Closed
Bug 856146
Opened 11 years ago
Closed 11 years ago
event/core/off should prevent in-progress emits from calling the removed handler.
Categories
(Add-on SDK Graveyard :: General, defect, P2)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: dcamp, Assigned: irakli)
Details
Attachments
(1 file)
In the dom: -- function handler2() { console.log("got here"); } document.body.addEventListener("click", function() { document.body.removeEventListener("click", handler2); }); document.body.addEventListener("click", handler2); -- Will produce no output. In addon-sdk: -- function secondHandler() { console.log("got here"); } on(target, "event", function() { off(target, "event", secondHandler); }); on(target, "event", secondHandler); -- Will print "got here". This will cause some annoyance when converting devtools code from our EventEmitter to EventTarget, as we rely on off() in destroy methods to prevent further access to the object (and occasionally destroy objects from event handlers - usually in tests).
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → rFobic
Assignee | ||
Comment 1•11 years ago
|
||
Pointer to Github pull-request
Assignee | ||
Updated•11 years ago
|
Attachment #731349 -
Flags: review?(poirot.alex)
Priority: -- → P2
Updated•11 years ago
|
Attachment #731349 -
Flags: review?(poirot.alex) → review+
Comment 2•11 years ago
|
||
Commit pushed to master at https://github.com/mozilla/addon-sdk https://github.com/mozilla/addon-sdk/commit/58aaa41444765afc5020638df04e91d0aecba8ce Merge pull request #909 from Gozala/bug/remove-listeners@856146 fix Bug 856146 - Ignore removed listeners during dispatch. r=@ochameau
Updated•11 years ago
|
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Comment 3•11 years ago
|
||
Commit pushed to integration at https://github.com/mozilla/addon-sdk https://github.com/mozilla/addon-sdk/commit/58aaa41444765afc5020638df04e91d0aecba8ce Merge pull request #909 from Gozala/bug/remove-listeners@856146
You need to log in
before you can comment on or make changes to this bug.
Description
•