Support ChromeUtils.importESModule(..., {global: "current"}) in service worker
Categories
(Core :: XPConnect, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox126 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(1 file)
Currently ServiceWorker doesn't have module loader, which results in ChromeUtils.importESModule(..., {global: "current"})
not available there for DevTools debugger code (bug 1789981)
// Set up the module loader, if it has not been initialzied yet.
if (!aWorkerPrivate->IsServiceWorker()) {
self->InitModuleLoader();
}
The reason for not initializing is bug 1694377 and https://github.com/whatwg/html/pull/6395 where dynamic import should be prevented for ServiceWorker.
Then, there's also bug 1360870 which is to support modules in service worker.
So, initializing module loader itself is fine, as long as dynamic import is kept unavailable.
We could add some hook or flag to prevent dynamic import, and then just initialize module loader (maybe lazily), so that ChromeUtils.importESModule(..., {global: "current"})
can access it.
Assignee | ||
Comment 1•2 years ago
|
||
Dynamic import is still disabled for service worker by WorkerModuleLoader::CreateDynamicImport.
Comment 3•2 years ago
|
||
Backed out for causing wpt failures in serviceworker.any.serviceworker.html
- Backout link
- Push with failures
- Failure Log
- Failure line: PROCESS-CRASH | application crashed [@ RefPtr<mozilla::dom::StrongWorkerRef>::get] | /html/semantics/scripting-1/the-script-element/module/dynamic-import/microtasks/serviceworker.any.serviceworker.html
Assignee | ||
Updated•2 years ago
|
Comment 5•2 years ago
|
||
bugherder |
Description
•