Closed
Bug 788981
Opened 12 years ago
Closed 12 years ago
self.port.removeListener() in a content script isn't functional
Categories
(Add-on SDK Graveyard :: General, defect)
Add-on SDK Graveyard
General
Tracking
(Not tracked)
RESOLVED
FIXED
1.10
People
(Reporter: jwkbugzilla, Unassigned)
References
()
Details
Attachments
(1 file)
624 bytes,
patch
|
ochameau
:
review+
|
Details | Diff | Splinter Review |
It seems that self.port.removeListener() isn't working at all in content scripts, self.port.once() isn't working properly either for that reason. The bug in is this line api-utils/lib/content/content-worker.js: let index = listeners[name].indexOf(name); This should search the callback, not the event type: let index = listeners[name].indexOf(callback); With this change things work properly.
Reporter | ||
Updated•12 years ago
|
All tests seem to pass with this change applied.
Attachment #658964 -
Flags: review?(poirot.alex)
Comment 3•12 years ago
|
||
Comment on attachment 658964 [details] [diff] [review] s/name/callback/ Thanks for the patch :)
Attachment #658964 -
Flags: review?(poirot.alex) → review+
Comment 4•12 years ago
|
||
Commit pushed to master at https://github.com/mozilla/addon-sdk https://github.com/mozilla/addon-sdk/commit/2190a6471c9b65fd5d1c2b9d71b6ec9c89d7dfe3 Bug 788981: self.port.removeListener() in a content script isn't functional r=@ochameau
Comment 5•12 years ago
|
||
Wes, I don't think it would justify spinning another rc, but in case we do, it would be worth shipping that into 1.10.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.11
(In reply to Alexandre Poirot (:ochameau) from comment #5) > Wes, I don't think it would justify spinning another rc, but in case we do, > it would be worth shipping that into 1.10. I think Will was wanting to get some doc changes into 1.10, so if he gets those in before we need to make the final call for 1.10, I'll pull this in, too.
Comment 7•12 years ago
|
||
+1 for putting this in 1.10.
Comment 8•12 years ago
|
||
Commit pushed to stabilization at https://github.com/mozilla/addon-sdk https://github.com/mozilla/addon-sdk/commit/5703e32f2e1b4de7fd88b34473f6d0d9c13176ca Bug 788981: self.port.removeListener() in a content script isn't functional r=@ochameau (cherry picked from commit 2190a6471c9b65fd5d1c2b9d71b6ec9c89d7dfe3)
Target Milestone: 1.11 → 1.10
Comment 9•11 years ago
|
||
The fix is probably correct, but self.port.removeListener() is still not functional when a different listener is reassigned afterwards: In this case the old ("removed") listener is magically reproduced and executed. Created new bug 844433 for this to let this here sleep. Just wanted to mention it.
You need to log in
before you can comment on or make changes to this bug.
Description
•