Closed Bug 1498293 Opened 6 years ago Closed 6 years ago

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

Categories

(DevTools :: Debugger, enhancement)

enhancement
Not set
normal

Tracking

(firefox65 fixed)

RESOLVED FIXED
Firefox 65
Tracking Status
firefox65 --- fixed

People

(Reporter: nika, Assigned: rpl)

Details

Attachments

(1 file)

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().
ni? kmag as I'm not sure who to ask about this stuff :-)
Flags: needinfo?(kmaglione+bmo)
Moving ni? to rpl :-)
Flags: needinfo?(kmaglione+bmo) → needinfo?(lgreco)
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.
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.
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)
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
https://hg.mozilla.org/mozilla-central/rev/3c9736576736
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: