Closed
Bug 1273221
Opened 8 years ago
Closed 7 years ago
DOM event listeners continue to run after the extension is disabled
Categories
(WebExtensions :: Untriaged, defect, P3)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: natalieg, Assigned: kmag)
References
Details
(Whiteboard: triaged)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:46.0) Gecko/20100101 Firefox/46.0 Build ID: 20160425115337 Steps to reproduce: In a WE content script, create a timestamp and a register a DOM event listener that logs the timestamp when the page is clicked: id = Date.now(); document.body.addEventListener('click', function (ev) {console.warn('Ouch! Stop that!', id)}); Actual results: (1) Install the extension. One click, one message, as expected. (2) 'Disable' the extension in the Add-ons Manager. The listener continues to run - one click, one message. (3) 'Enable' the extension in the Add-ons Manager. One click, two messages. One message has the original timestamp, the other has a new timestamp. The original listener continues to run, and a second listener was added on Enable. (4) 'Remove' the extension in the Add-ons Manager. Both listeners continue to run - one click, two messages. (5) 'Undo' the removal. One click, three messages; the third has a new timestamp. The content script runs every time the extension is enabled. DOM event listeners added by the content script aren't removed until the page is reloaded. Expected results: I expected the content script to run only when the page is loaded, not when the extension is enabled. That is what Chrome does; DOM event listeners continue to run after an extension is disabled, but aren't duplicated when it's enabled again. I prefer though that DOM event listeners be removed when the extension is disabled, and that the content script run when the extension is enabled.
Assignee | ||
Updated•8 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•8 years ago
|
Priority: -- → P3
Whiteboard: triaged
Port disconnection (Bug 1223425) could be used as a workaround to cleanup event listeners.
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → kmaglione+bmo
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Comment 3•7 years ago
|
||
Fixed by bug 1273251.
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•