Support execution world MAIN in `scripting.executeScript()`
Categories
(WebExtensions :: General, enhancement, P2)
Tracking
(Not tracked)
People
(Reporter: willdurand, Unassigned)
References
(Depends on 1 open bug, Blocks 2 open bugs)
Details
(Whiteboard: [mv3-m2][wecg])
Updated•2 years ago
|
Reporter | ||
Updated•2 years ago
|
Reporter | ||
Updated•2 years ago
|
Reporter | ||
Updated•2 years ago
|
Updated•2 years ago
|
Reporter | ||
Updated•2 years ago
|
Updated•1 year ago
|
Reporter | ||
Comment 1•1 year ago
|
||
Unassigned myself because this is not a high priority bug for now.
Comment 2•1 year ago
|
||
"ISOLATED" was supported in bug 1759932.
This bug is currently about supporting execution in the "MAIN" world (i.e. the web page).
Comment 3•11 months ago
|
||
When we commence work on this, we should also create new bugs or patches to introduce support for world
to scripting.registerContentScripts
and content_scripts
in manifest.json. Chromium implemented that in https://crbug.com/1330986
Comment 4•10 months ago
|
||
The userScripts API proposal at https://github.com/w3c/webextensions/pull/331 includes the "USER_SCRIPT" world, after my feedback to the initial proposal. That is out of scope for this bug, we will file new bugs to implement the USER_SCRIPT world and new APIs when we get there (and these would be part of the userScripts
namespace, not the scripting
namespace anyway).
When this bug is fixed, we have to adjust the BCD that I added in https://github.com/mdn/browser-compat-data/pull/18878
Comment 5•2 months ago
|
||
I have worked on the Adobe Flash Player emulator Ruffle. There are a few things we've had to do differently between Firefox and Chromium to make sure it works on both browsers, and this is the cause of one of them.
On Chromium browsers, we are able to use scripting.registerContentScripts with the MAIN execution world to run a script (https://github.com/ruffle-rs/ruffle/blob/feacbdc118c92ff30f686c1203c6f08ccd92833d/web/packages/core/src/plugin-polyfill.ts#L203) to add "Shockwave Flash" to navigator.plugins to fool Flash detection scripts. The faster the script is run, the more likely it is to run before any Flash detection scripts. On Firefox, we instead have to add a raw script tag with the compiled form of that script as its source to do the same thing, which isn't as fast so is more likely to run after the detection already fails and is also a bit more roundabout.
Comment 6•2 months ago
|
||
This is the code we use on chromium: https://github.com/ruffle-rs/ruffle/blob/feacbdc118c92ff30f686c1203c6f08ccd92833d/web/packages/extension/src/background.ts#L12-L30
Comment 7•2 months ago
|
||
On Firefox, we instead have to add a raw script tag with the compiled form of that script as its source to do the same thing
Hi Daniel, that shouldn't be necessary. See Sharing objects with page scripts.
Comment 8•29 days ago
|
||
(In reply to Gregory Pappas [:gregp] from comment #7)
On Firefox, we instead have to add a raw script tag with the compiled form of that script as its source to do the same thing
Hi Daniel, that shouldn't be necessary. See Sharing objects with page scripts.
That doesn't allow for running the script quickly enough that it can add "Shockwave Flash" to navigator.plugins before inline scripts on the page check for and don't see the presence of Shockwave Flash in navigator.plugins.
Description
•