Closed Bug 1285899 Opened 9 years ago Closed 9 years ago

[e10s-multi] mozAddonManager events are broken for e10s-multi

Categories

(Toolkit :: Add-ons Manager, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Iteration:
51.1 - Aug 15
Tracking Status
firefox51 --- fixed

People

(Reporter: gkrizsanits, Assigned: aswan)

References

Details

(Whiteboard: [e10s-multi:M1] triaged)

Attachments

(1 file)

with multiple content processes something goes wrong with mozAddonManager events and I get errors like: INFO TEST-UNEXPECTED-FAIL | toolkit/mozapps/extensions/test/browser/browser_webapi_addon_listener.js | Uncaught exception - at chrome://mochitests/content/browser/toolkit/mozapps/extensions/test/browser/browser_webapi_addon_listener.js:14 - SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
Blocks: e10s-multi
Whiteboard: [e10s-multi:M?]
The logic here is overly simplistic: http://searchfox.org/mozilla-central/source/toolkit/mozapps/extensions/addonManager.js#230-253 It creates a single listener in the parent process to send events to a child process, but it falls apart with multiple child processes. It should be straightforward to fix...
Assignee: nobody → aswan
Whiteboard: [e10s-multi:M?] → [e10s-multi:M?] triaged
Whiteboard: [e10s-multi:M?] triaged → [e10s-multi:M1] triaged
No longer depends on: 1142013
Is this something you're actively working / will be working soon, or would you prefer me picking it up?
Flags: needinfo?(aswan)
(In reply to Gabor Krizsanits [:krizsa :gabor] from comment #2) > Is this something you're actively working / will be working soon, or would > you prefer me picking it up? It depends on how soon "soon" is. I've got some 50-related things to wrap up this week but was planning to pick this up early next week. If its more pressing than that, feel free to take it.
Flags: needinfo?(aswan)
Attachment #8777527 - Flags: review?(gkrizsanits)
https://reviewboard.mozilla.org/r/69080/#review66686 ::: toolkit/mozapps/extensions/addonManager.js:169 (Diff revision 1) > AddonManagerPrivate.backgroundUpdateTimerHandler(); > }, > > - addonListener: null, > + // Maps message manager instances for content processes to the associated > + // AddonListener instances. > + addonListeners: new Map(), Could you turn this into a WeakMap? I see no reason to hold onto the process message managers here. Also I think we should have an observer for message-manager-disconnect that calls removeAddonListener on the related listener to prevent messages to be sent after disconnect.
(In reply to Gabor Krizsanits [:krizsa :gabor] from comment #5) > Could you turn this into a WeakMap? I see no reason to hold onto the process > message managers here. This failed with the exception "cannot use the given object as a weak map key". The message manager itself doesn't need to be the key though if there is some sort of unique identifier I can easily access from the message manager?
Flags: needinfo?(gkrizsanits)
(In reply to Andrew Swan [:aswan] from comment #6) > (In reply to Gabor Krizsanits [:krizsa :gabor] from comment #5) > > Could you turn this into a WeakMap? I see no reason to hold onto the process > > message managers here. > > This failed with the exception "cannot use the given object as a weak map > key". The message manager itself doesn't need to be the key though if there > is some sort of unique identifier I can easily access from the message > manager? Sigh. Yeah, we don't actually have any DOM nodes for process message managers only for frame message managers. And even that is not that reliable since windows can just swap their fmm's... We could probably fix this but I don't think it's worth the time, the observer should be enough, let's go with the strong map. And sorry for wasting your time with this.
Flags: needinfo?(gkrizsanits)
No problem, I added cleanup of these listeners to the message-manager-disconnect and -closed handlers. That code doesn't have tests though, are there existing tests of cleanup in disconnect handlers that would be a good model or is that more trouble than its worth?
Comment on attachment 8777527 [details] Bug 1285899 Manager mozAddonManager AddonListeners per child https://reviewboard.mozilla.org/r/69080/#review67524 ::: toolkit/mozapps/extensions/addonManager.js:265 (Diff revision 2) > } > return undefined; > }, > > + childClosed(target) { > + AddonManager.webAPI.clearInstallsFrom(target); You also want to call removeAddonListener here, no? After the mm is closed no more receiveMessage will come in from that target... I would also do an addonListeners.has(target) check like in the receiveMessage code. For clearInstallsFrom that does not seem to be necessary since it does the check on the target internally.
Attachment #8777527 - Flags: review?(gkrizsanits) → review+
Comment on attachment 8777527 [details] Bug 1285899 Manager mozAddonManager AddonListeners per child https://reviewboard.mozilla.org/r/69080/#review67524 > You also want to call removeAddonListener here, no? After the mm is closed no more receiveMessage will come in from that target... > > I would also do an addonListeners.has(target) check like in the receiveMessage code. For clearInstallsFrom that does not seem to be necessary since it does the check on the target internally. yep, thanks for catching that.
Pushed by aswan@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bddf684f5b46 Manager mozAddonManager AddonListeners per child r=krizsa
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Iteration: --- → 51.1 - Aug 15
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: