Bug 1881564 - Initialize module loader also for ServiceWorker to allow ChromeUtils.importESModule in DevTools ServiceWorker debugger global. r=yulia

Dynamic import is prevented by IsDynamicImportSupported, and now it now throws
TypeError instead of Error, and related wpt passes with it.

Differential Revision: https://phabricator.services.mozilla.com/D202494
This commit is contained in:
Tooru Fujisawa
2024-03-20 11:22:45 +00:00
parent 115b3c9068
commit e847933e44
7 changed files with 20 additions and 17 deletions

View File

@@ -251,6 +251,8 @@ class ModuleLoaderBase : public nsISupports {
JSContext* aCx, nsIURI* aURI, LoadedScript* aMaybeActiveScript,
JS::Handle<JSString*> aSpecifier, JS::Handle<JSObject*> aPromise) = 0;
virtual bool IsDynamicImportSupported() { return true; }
// Called when dynamic import started successfully.
virtual void OnDynamicImportStarted(ModuleLoadRequest* aRequest) {}