Background page fails to load if background.service_worker and background.scripts are both present
Categories
(WebExtensions :: General, defect, P2)
Tracking
(firefox-esr115 verified, firefox118 wontfix, firefox119 wontfix, firefox120 wontfix, firefox121 fixed)
People
(Reporter: robwu, Assigned: robwu)
References
(Regression)
Details
(Keywords: dev-doc-complete, regression, Whiteboard: [wecg][addons-jira])
Attachments
(2 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-esr115+
|
Details | Review |
When manifest.json's background
declaration contains both service_worker
and an event page, the extension loads but the background page fails to start up.
The expected cross-browser behavior (as established in https://github.com/w3c/webextensions/issues/282) is to ignore scripts
if service_worker is supported, but to use scripts otherwise (WECG proposal / implemented by Safari). Chrome currently fails to load the extension, but will reduce it to a non-fatal warning in crbug.com/1418934.
We currently don't support service_worker
(bug 1573659). And as I explained in https://bugzilla.mozilla.org/show_bug.cgi?id=1775618#c1, there is already a bug that prevents the Service worker from loading if scripts
and service_worker
are both present. Fixing that was not a high priority because we haven't turned on support for service workers.
Today, I saw a report (https://github.com/w3c/webextensions/issues/282#issuecomment-1773034430) that stated that the background page fails to load if both are present. Upon investigation, it turns out that this is caused by a combination of bugs:
- bug 1831417: unrecognized properties still exist in unvalidated form.
- The logic that selects BackgroundWorker or BackgroundPage selects a non-functional service worker implementation because
manifest.background.service_worker
is present, at https://searchfox.org/mozilla-central/rev/9f6a9e601b2ab9ad1a3877691ea17c66c1fd8867/toolkit/components/extensions/parent/ext-backgroundPage.js#678-680
Updated•1 year ago
|
Comment 1•1 year ago
|
||
Set release status flags based on info from the regressing bug 1609920
Thanks for opening this! As far as I know having an unrecognised property under background
would not prevent the background page/scripts to load. Unless it's the service_worker
. Is it known when an extension with both scripts
and service_worker
started becoming unsupported?
Updated•1 year ago
|
Updated•1 year ago
|
Comment 3•1 year ago
|
||
Set release status flags based on info from the regressing bug 1609920
Assignee | ||
Comment 4•1 year ago
|
||
When a background page and service_worker are specified simultaneously,
load the background page instead of neither (i.e. the bug).
This patch only fixes the issue when
extensions.backgroundServiceWorker.enabled is false; When true, the
service worker is expected to load but doesn't due to
https://bugzilla.mozilla.org/show_bug.cgi?id=1775618#c1 . That requires
a different fix and is therefore saved for a follow-up.
Updated•1 year ago
|
Comment 6•1 year ago
|
||
bugherder |
Comment 8•1 year ago
|
||
The patch landed in nightly and beta is affected.
:robwu, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- If no, please set
status-firefox120
towontfix
.
For more information, please visit BugBot documentation.
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Release note available for review in "Background page load fail bug fix release note" #30097
Assignee | ||
Comment 10•10 months ago
|
||
When a background page and service_worker are specified simultaneously,
load the background page instead of neither (i.e. the bug).
This patch only fixes the issue when
extensions.backgroundServiceWorker.enabled is false; When true, the
service worker is expected to load but doesn't due to
https://bugzilla.mozilla.org/show_bug.cgi?id=1775618#c1 . That requires
a different fix and is therefore saved for a follow-up.
Original Revision: https://phabricator.services.mozilla.com/D192081
Updated•10 months ago
|
Updated•10 months ago
|
Updated•10 months ago
|
Updated•10 months ago
|
Comment 11•10 months ago
|
||
esr115 Uplift Approval Request
- User impact if declined: ESR115 users cannot install extensions that have been developed with cross-browser compatibility in mind. Since ESR115 is the last supported Firefox version on Windows 7/8, this could lower the number of available add-ons to them in the longer term.
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: Create a directory with manifest.json and background.js from https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/background#browser_support . Then try to load it at about:debugging and confirm that the test extension works as documented (a new tab opens)
- Risk associated with taking this patch: Low
- Explanation of risk level: Fixes very specific check, without side effects
- String changes made/needed: no
- Is Android affected?: yes
Updated•10 months ago
|
Updated•10 months ago
|
Updated•10 months ago
|
Comment 12•10 months ago
|
||
uplift |
Updated•10 months ago
|
Comment 13•10 months ago
|
||
Verified as Fixed. Tested on the latest ESR 115.11.0 (https://treeherder.mozilla.org/jobs?repo=mozilla-esr115&searchStr=build-signing%2Cshippable&fromchange=0b1b7b40dce62a5b81da7743f0d78dcf3ff3cead&selectedTaskRun=PvYBK5cXQsybruXrgiJpdQ.0) under Windows 10 x64 and Ubuntu 22.04 LTS.
Upon loading the test extension created as per the specifications mentioned in https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/background#browser_support, a new tab opens with the following URL - http://example.com/firstrun.html, confirming the fix.
Description
•