Open Bug 1268148 Opened 8 years ago Updated 1 year ago

Addon compartments in child processes not grouped under add-ons category

Categories

(Toolkit :: about:memory, defect, P3)

defect

Tracking

()

UNCONFIRMED

People

(Reporter: bugzilla.mozilla.org, Unassigned, NeedInfo)

Details

(Whiteboard: [MemShrink:P3])

I'm seeing addon JSMs loaded through a framescript (i.e. loaded through addon main -> framescript -> JSM) properly categorized in the add-ons category in the parent process. The same JSM is just lumped under the top-level js-non-window category in the child process.
Nils, any idea why this might be happening, and how to fix it?
Flags: needinfo?(maierman)
Whiteboard: [MemShrink]
This is split out by the XPCJSRuntime ReportCompartmentStats function [1]. It will report the compartment under 'explicit/add-ons' if the following conditions are met:

- extras.location is not null (this is a URI)
- addonManager is not null
- extras.jsPathPrefix does not already start with 'add-ons'
- addonManager->MapURIToAddonID must not fail

So presumably one of these conditions is not met in the content process.

[1] https://dxr.mozilla.org/mozilla-central/rev/6adc822f5e27a55551faeb6c47a9bd8b0859a23b/js/xpconnect/src/XPCJSRuntime.cpp#2258-2275
Looks like the call to |addonManager->MapURIToAddonID| is failing. If I'm reading correctly the AddonManager is implemented in js, the jsm indicates it shouldn't be used from the child process [1].

[1] https://dxr.mozilla.org/mozilla-central/rev/6adc822f5e27a55551faeb6c47a9bd8b0859a23b/toolkit/mozapps/extensions/AddonManager.jsm#20
Thank you for looking at this.

> Looks like the call to |addonManager->MapURIToAddonID| is failing. If I'm
> reading correctly the AddonManager is implemented in js, the jsm indicates
> it shouldn't be used from the child process [1].

Ugh, so presumably we'd have to send a message to the parent process to get this info. That's no fun.
(In reply to Nicholas Nethercote [:njn] from comment #4)
> Thank you for looking at this.
> 
> > Looks like the call to |addonManager->MapURIToAddonID| is failing. If I'm
> > reading correctly the AddonManager is implemented in js, the jsm indicates
> > it shouldn't be used from the child process [1].
> 
> Ugh, so presumably we'd have to send a message to the parent process to get
> this info. That's no fun.

The other problem is it's called on every compartment that has a URI. If the call succeeds then we know it's an add-on compartment, so that would mean proxying a call for each compartment.
Whiteboard: [MemShrink] → [MemShrink:P3]
Flags: needinfo?(maierman)
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.