Bug 1190679 (webext-oop)

[meta] Run WebExtensions out of process

NEW
Unassigned

Status

P2
major
4 years ago
14 days ago

People

(Reporter: billm, Unassigned)

Tracking

(Depends on: 12 bugs, Blocks: 3 bugs, {meta, perf})

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: triaged, [we-enterprise][qf:meta])

Besides setting the remote=true attribute on the browser elements used for extensions, we'll need to move the API-injected code to the other process (via content scripts or something). We'll also need platform support to ensure that all the <browser> elements for a given add-on run in the same process.
Priority: -- → P2
Bill, is this bug about running the background pages OOP or more than that?
There are a couple different kinds of pages that would need to run out of process:
- background page
- browserAction popup page
- any tabs that are showing moz-extension: URIs

We have to move them all together since they can get references to each other's windows.
Component: Extension Compatibility → WebExtensions
Product: Firefox → Toolkit
I'd like to work on the extensions; assigning this to myself. :)
Assignee: nobody → echen
I think this could be a lot of work, including some platform changes. Do you have a plan for this Edgar? Otherwise we should discuss the approach.
Flags: needinfo?(echen)
Summary: Run open extensions out of process → Run WebExtensions out of process
I believe this is a huge work. And I am still in study stage (trying to get whole picture from bug 1175770). Do you have any suggestion where we should start with? Thank you.
Flags: needinfo?(echen) → needinfo?(wmccloskey)
Sorry it took me a while to get to this.

The actual extension code will run in a content process. We'll do this using remote <browser> elements (and maybe remote moz-browser elements on b2g). The main process will load a process script into the extension process and the two processes will communicate using the process message manager.

We'll need some platform support to ensure that all these <browser> elements run in the same extension process. That could be an attribute on the <browser> DOM element. The <browser> elements that will need this attribute are for the background page, the browser action, and any page loaded with a moz-extension URI. For the latter, we'll need special handling in E10SUtils.jsm [1] on desktop to ensure that the page loads in the right process. I'm not sure how to handle that on b2g.

The ext-*.js scripts will have to be split into main process scripts and an extension process scripts. They'll communicate using the process message manager. Most API functions will probably just be forwarded to the main process, with their arguments sent using structured clone. However, there are some APIs that pass functions, so we'll have to do something special there.

The webRequest API will also need special handling. Right now it requires the request handlers to be synchronous, which won't be the case when the extension is OOP. I think we'll have to make it suspend the request until the extension makes a decision about whether to block.

I think the best way to get started here is to start using a non-remote browser element for the background page. Right now the code is loaded directly into a windowless docshell. If that works, then we can start moving some of the ext-*.js code to process scripts (as well as some of the related code in Extension.jsm, such as GlobalManager).

[1] http://mxr.mozilla.org/mozilla-central/source/browser/modules/E10SUtils.jsm#62
Flags: needinfo?(wmccloskey)
(In reply to Bill McCloskey (:billm) from comment #6)
> Sorry it took me a while to get to this.
> 
> The actual extension code will run in a content process. We'll do this using
> remote <browser> elements (and maybe remote moz-browser elements on b2g).
> The main process will load a process script into the extension process and
> the two processes will communicate using the process message manager.
> 
> We'll need some platform support to ensure that all these <browser> elements
> run in the same extension process. That could be an attribute on the
> <browser> DOM element. The <browser> elements that will need this attribute
> are for the background page, the browser action, and any page loaded with a
> moz-extension URI. For the latter, we'll need special handling in
> E10SUtils.jsm [1] on desktop to ensure that the page loads in the right
> process. I'm not sure how to handle that on b2g.

On b2g we had a need to run different apps in the same process (for Tarako) and we did that by adding a parentapp attribute on <iframe mozbrowser>. The ContentParent uses this attribute at http://mxr.mozilla.org/mozilla-central/source/dom/ipc/ContentParent.cpp#1264

> I think the best way to get started here is to start using a non-remote
> browser element for the background page. Right now the code is loaded
> directly into a windowless docshell. If that works, then we can start moving
> some of the ext-*.js code to process scripts (as well as some of the related
> code in Extension.jsm, such as GlobalManager).

Right, that's what I'm fixing in bug 1198970 as part of getting webRequest to work.

Updated

4 years ago
Blocks: 1214433
Severity: normal → major
Priority: P2 → P1
Unassigning myself as I am not able to work on this in short term.
Assignee: echen → nobody

Updated

3 years ago
Flags: blocking-webextensions+
Assignee: nobody → wmccloskey

Updated

3 years ago
Iteration: --- → 45.1 - Nov 16
OS: Unspecified → All
Hardware: Unspecified → All
Version: 34 Branch → unspecified

Updated

3 years ago
Iteration: 45.1 - Nov 16 → 45.2 - Nov 30
Target Milestone: --- → mozilla45

Updated

3 years ago
Whiteboard: triaged

Comment 9

3 years ago
After chatting with Bill, we decided to move this to post 48, but before we implement any APIs beyond Chromes implementation.
Flags: blocking-webextensions+ → blocking-webextensions-
Depends on: 1287209
Depends on: 1287210
Alias: webext-oop

Updated

3 years ago
Depends on: 1288276

Updated

3 years ago
Depends on: 1288279

Updated

3 years ago
Depends on: 1302702

Updated

3 years ago
Depends on: 1305216

Updated

3 years ago
Depends on: 1305217
Depends on: 1306110
Depends on: 1317101
Depends on: 1320395

Updated

2 years ago
Depends on: 1323845

Updated

2 years ago
webextensions: --- → +

Updated

2 years ago
Blocks: 1318174
Depends on: 1334557

Updated

2 years ago
Whiteboard: triaged → triaged, [we-enterprise]
Depends on: 1339144

Updated

2 years ago
Assignee: wmccloskey → kmaglione+bmo
Depends on: 1356317
Depends on: 1353060
Depends on: 1357486
Depends on: 1357487
Depends on: 1357490
Whiteboard: triaged, [we-enterprise] → triaged, [we-enterprise][qf:meta]
Depends on: 1362457
Depends on: 1355239
Depends on: 1361661
Depends on: 1365660

Updated

2 years ago
Blocks: 1363905
Whiteboard: triaged, [we-enterprise][qf:meta] → triaged, [we-enterprise][qf:meta][qf:p1]
Depends on: 1369559
Depends on: 1370131

Updated

2 years ago
Depends on: 1378459
Depends on: 1379046
Depends on: 1379508

Updated

2 years ago
Depends on: 1380156

Updated

2 years ago
Depends on: 1380290

Updated

2 years ago
Depends on: 1380597

Updated

2 years ago
Depends on: 1380646

Updated

2 years ago
Depends on: 1381023
Depends on: 1381086

Updated

2 years ago
No longer depends on: 1380646

Updated

2 years ago
No longer depends on: 1378459
Depends on: 1381097

Updated

2 years ago
Depends on: 1381212

Updated

2 years ago
Depends on: 1381337
Depends on: 1381321
Depends on: 1381344

Updated

2 years ago
Depends on: 1380294

Comment 10

2 years ago
Taking off webextensions+ and qf:p1. We've got out of process running on Windows which is the main quantum flow target. We'd like to get out of process working on OS X and Linux, but those will likely come after 57.

The bug for turning on out of process on windows was bug 1357486.
webextensions: + → ---
Whiteboard: triaged, [we-enterprise][qf:meta][qf:p1] → triaged, [we-enterprise][qf:meta]

Updated

2 years ago
Depends on: 1382228

Updated

2 years ago
Depends on: 1380109
No longer depends on: 1323845

Updated

2 years ago
No longer depends on: 1381212
Depends on: 1385403

Updated

2 years ago
Depends on: 1385548

Updated

2 years ago
Depends on: 1385736

Updated

2 years ago
Depends on: 1385880

Updated

2 years ago
Depends on: 1384078

Comment 11

2 years ago
I also had a problem with <select> drop down menu showing but not working in sidebar.

Tomislav suggested setting 'extensions.webextensions.remote' to false and after reloading the extension, the drop down menu worked fine in the sidebar.

I am using FF56.0b1

The default 'extensions.webextensions.remote' is true and users will not be expected to change it.

Updated

2 years ago
Depends on: 1389496

Updated

2 years ago
Blocks: 1389495

Updated

2 years ago
Depends on: 1390445

Updated

2 years ago
Depends on: 1392210

Updated

2 years ago
Depends on: 1393150

Updated

2 years ago
Depends on: 1394208

Updated

2 years ago
Blocks: 1394240
Depends on: 1394807

Updated

2 years ago
Depends on: 1397210

Updated

2 years ago
Priority: P1 → --

Updated

2 years ago
Iteration: 45.2 - Nov 30 → ---
Keywords: meta
Priority: -- → P2

Updated

2 years ago
Depends on: 1401288

Updated

2 years ago
Depends on: 1390276

Updated

2 years ago
Depends on: 1403965
Duplicate of this bug: 1406607

Updated

a year ago
Depends on: 1411285

Updated

a year ago
Depends on: 1415860
Depends on: 1419285

Updated

a year ago
Depends on: 1417043

Updated

a year ago
Depends on: 1418394

Updated

a year ago
Depends on: 1418655

Updated

a year ago
Depends on: 1423817

Updated

a year ago
Depends on: 1422187

Updated

a year ago
Depends on: 1433879

Updated

a year ago
Depends on: 1435959
No longer depends on: 1370131

Updated

a year ago
Depends on: 1408756

Updated

9 months ago
Product: Toolkit → WebExtensions
Assignee: kmaglione+bmo → nobody
Summary: Run WebExtensions out of process → [meta] Run WebExtensions out of process
You need to log in before you can comment on or make changes to this bug.