userScripts in MV2 sandbox does not have a fix for the structuredClone regression
Categories
(WebExtensions :: General, defect, P1)
Tracking
(firefox148 unaffected, firefox149 fixed, firefox150 fixed)
| Tracking | Status | |
|---|---|---|
| firefox148 | --- | unaffected |
| firefox149 | --- | fixed |
| firefox150 | --- | fixed |
People
(Reporter: robwu, Assigned: rpl)
References
(Blocks 1 open bug)
Details
(Whiteboard: [addons-jira])
Attachments
(2 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
bug 2017797 fixed the regression for structuredClone in content scripts and the sandbox of user scripts registered through the MV3 userScripts API.
But the fix was not applied to the sandbox of userScripts API from MV2.
For completeness and future reference, here is an overview of Cu.Sandbox instances in extensions that interact with content:
- content script sandbox: https://searchfox.org/firefox-main/rev/0894e095dfb46b6dac785365432791a54861fe09/toolkit/components/extensions/ExtensionContent.sys.mjs#1045,1070
- created when a page loads and
content_scriptsis used (the order does not matter) - the most common sandbox, most extensions interacting with content use this.
- created when a page loads and
- MV2 userScripts sandbox: https://searchfox.org/firefox-main/rev/0894e095dfb46b6dac785365432791a54861fe09/toolkit/components/extensions/ExtensionContent.sys.mjs#954
- created when a page loads, after
api_scriptsis defined in a manifest withmanifest_version: 2anduserScripts.register()is called.
- created when a page loads, after
- MV3 userScripts sandbox: https://searchfox.org/firefox-main/rev/0894e095dfb46b6dac785365432791a54861fe09/toolkit/components/extensions/ExtensionUserScriptsContent.sys.mjs#264
- created when a page loads, after the "userScripts" permission is granted to an extension with
manifest_version: 3anduserScripts.register()is called.
- created when a page loads, after the "userScripts" permission is granted to an extension with
Examples of unit tests that trigger the creation of such sandboxes and verify the execution within can be seen in the patch to bug 1912587 at https://phabricator.services.mozilla.com/D219142
test_Document_parseHTML_and_parseHTMLUnsafetests content scriptstest_Document_parseHTML_in_mv2_userscript_sandboxtests MV2 user script sandbox.test_Document_parseHTML_in_mv3_userscript_sandboxtests MV3 user script sandbox.
| Reporter | ||
Comment 1•1 month ago
|
||
The original regression was introduced in Firefox 149 by bug 2013389, setting status flags accordingly.
| Reporter | ||
Comment 2•1 month ago
|
||
P1 because we want to get the fix in the same release as the other fix (uplift to beta).
The number of extensions using the MV2 user scripts API is relatively low (especially in comparison to content scripts), but nevertheless for sanity the behaviors should be identical.
| Reporter | ||
Updated•1 month ago
|
Updated•1 month ago
|
| Assignee | ||
Comment 3•1 month ago
|
||
Comment 6•1 month ago
|
||
The patch landed in nightly and beta is affected.
:rpl, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- See https://wiki.mozilla.org/Release_Management/Requesting_an_Uplift for documentation on how to request an uplift.
- If no, please set
status-firefox149towontfix.
For more information, please visit BugBot documentation.
| Reporter | ||
Comment 7•1 month ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D287444
Updated•1 month ago
|
Comment 8•1 month ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined/Reason for urgency: Fixes regression from bug 2013389 and bug 2017797 affecting extensions using MV2 userScripts API. Not fixing can break user scripts run through the MV2 userScripts extension API that rely on
structuredClone. - Code covered by automated testing?: no
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: Fix is obvious and restores the original behavior of version 148 (before the regression was introduced). This only affects users of the MV2 userScripts extension API.
- String changes made/needed?: No
- Is Android affected?: yes
| Assignee | ||
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Description
•