Open Bug 1879517 Opened 8 months ago Updated 8 months ago

Cannot load service_worker from subdirectory in extension

Categories

(WebExtensions :: General, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: robwu, Unassigned)

References

(Blocks 1 open bug)

Details

Create directory with manifest.json (see below), a subdir directory with file sw.js (e.g. with just console.log("hello");) and run web-ext run -f nightly --pref=extensions.backgroundServiceWorker.enabled=true

{
  "name": "test",
  "version": "1",
  "manifest_version": 3,
  "background": { "service_worker": "subdir/sw.js" }
}

Expected:

  • Loads just fine (verified in Chrome)

Actual (Firefox Nightly 124):

  • Fails to load, with the following error:

Failed to register a ServiceWorker: The path of the provided scope ‘moz-extension://a0deb31f-b6d7-4902-bcab-11ace8ac1e5b/’ is not under the max scope allowed ‘/subdir/’. Adjust the scope, move the Service Worker script, or use the Service-Worker-Allowed HTTP header to allow the scope.

Severity: -- → S4
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.