Ensure the webextension fallback window has a TabChild actor in content.

RESOLVED FIXED in Firefox 65

Status

enhancement
RESOLVED FIXED
7 months ago
6 months ago

People

(Reporter: Nika, Assigned: rpl)

Tracking

unspecified
Firefox 65

Firefox Tracking Flags

(firefox65 fixed)

Details

Attachments

(1 attachment)

Currently, the fallback window for webextensions is created using createWindowlessBrowser (https://searchfox.org/mozilla-central/rev/65f9687eb192f8317b4e02b0b791932eff6237cc/devtools/server/actors/targets/webextension.js#163-166). This window doesn't have a corresponding TabChild, as it does not correspond to a xul:browser element in the parent process.

This means that the PWindowGlobal actor cannot be created for all windows unconditionally, due to this window existing. 

I would like to prohibit standalone windows in content processes in the future, so that we can rely on having a TabChild actor if XRE_IsContentProcess().
Reporter

Comment 1

7 months ago
ni? kmag as I'm not sure who to ask about this stuff :-)
Flags: needinfo?(kmaglione+bmo)
Reporter

Comment 2

7 months ago
Moving ni? to rpl :-)
Flags: needinfo?(kmaglione+bmo) → needinfo?(lgreco)
Assignee

Comment 3

7 months ago
This patch remove the usage of `Services.appShell.createWindowlessBrowser` from the
webextension target actor (that runs in a child process when the extension is in oop-mode).

As a fallback window (needed when an extension doesn't have an extension page yet, e.g. while
the extension is being reloaded, or when the extension doesn't have a background page), the actor
is going to search for the window related to the XUL browser element created to connect into
the extension process.

If the extension runs in the child process (e.g. as it currently happens on all platforms supported
by Firefox Desktop), the TabParent/TabChild's tabId is used to identify the fallback window.

On the contrary, when the extension runs in the parent process (e.g. as it currently happens on
Firefox for Android), the XUL browser's ownerGlobal innerWindowID is used to identify the
fallback window.
Assignee

Comment 4

7 months ago
I've just attached an initial draft patch as attachment 9016704 [details], and pushed it to try to double-check if this draft breaks any of the existing tests.
Assignee

Comment 5

7 months ago
Patch updated to include a fix needed on the single test that was failing with the changes applied (browser_addons_debug_webextension_nobg.js) and added :ochameau as the blocking reviewer on the phabricator revision.

Related push to try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=1429ddb811228d9f19d3a832248e59205e807d9e
Assignee: nobody → lgreco
Status: NEW → ASSIGNED
Flags: needinfo?(lgreco)

Comment 6

6 months ago
Pushed by luca.greco@alcacoop.it:
https://hg.mozilla.org/integration/autoland/rev/3c9736576736
Ensure the webextension fallback window has a TabChild actor in content. r=ochameau

Comment 7

6 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/3c9736576736
Status: ASSIGNED → RESOLVED
Last Resolved: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
You need to log in before you can comment on or make changes to this bug.