Closed Bug 1272758 Opened 4 years ago Closed 3 years ago

addon.reload() leaks code running in the content process

Categories

(Toolkit :: Add-ons Manager, defect, P3)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1273251

People

(Reporter: kumar, Assigned: kumar)

References

(Blocks 1 open bug)

Details

(Whiteboard: triaged)

Attachments

(1 file)

Attached file content-script.zip
STR:
- create an add-on that has persistent code running in the content process (could be setInterval or a message listener, etc)
- install the add-on
- click the Reload button on about:debugging a bunch of times

Expected result:
- the content process should be shut down which should destroy anything running

Actual result:
- the Reload button does not shut down the content process so each reload piles on new code that will be running in the content process

I am attaching a simple web extension that uses setInterval to print a heartbeat in the content process. After a reload you should only ever see one heartbeat but you see multiple!

For testing, I was adding this with the 'install temporary add-on' button and I was opening a tab at mozilla.org (although any site should work)
Here is my theory of what's happening:

- addon.reload() calls installTemporaryAddon() and this starts by uninstalling the existing add-on, which calls shutdown https://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/internal/XPIProvider.jsm#3927
- immediately, installTemporaryAddon() installs the new add-on, which calls startup: https://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/internal/XPIProvider.jsm#3955
- the startup message for the new add-on arrives *before* the shutdown message which overrides the UUID in the ExtensionManager: https://dxr.mozilla.org/mozilla-central/source/toolkit/components/extensions/ExtensionContent.jsm#764
- when the shutdown message is received, it operates on the wrong UUID.

If that's truly what's happening, maybe the easiest thing is to somehow block the re-install until the shutdown message has been received.
Assignee: nobody → kumar.mcmillan
Priority: -- → P3
Whiteboard: triaged
This could also be related to bug 1273251
\o/ I just tried in Firefox 54 (today's Nightly) and it's fixed. It was probably a dupe of bug 1273251
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1273251
You need to log in before you can comment on or make changes to this bug.