Issue #1691 - Part 7d: Allow dynamic import in cases where there's no referencing script or module. Support dynamic import from classic scripts by creating ClassicScript objects and associating them with the compiled. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 This patch is incomplete, some code in ScriptLoader::EvaluateScript() could not be applied for missing dependencies. Part 7e will apply the missing dependencies and finish the patch.

(cherry picked from commit ce31a906e801b72f06385b0755710317ccf3658b)
This commit is contained in:
Brian Smith 2023-04-19 01:59:14 -05:00 committed by roytam1
commit d5d7bb5e47
6 changed files with 188 additions and 88 deletions

View file

@ -60,8 +60,8 @@ public:
// Create a module load request for dynamic module import.
static ModuleLoadRequest* CreateDynamicImport(
nsIURI* aURI, ModuleScript* aScript,
JS::Handle<JS::Value> aReferencingPrivate,
nsIURI* aURI, ScriptFetchOptions* aFetchOptions, nsIURI* aBaseURL,
ScriptLoader* aLoader, JS::Handle<JS::Value> aReferencingPrivate,
JS::Handle<JSString*> aSpecifier, JS::Handle<JSObject*> aPromise);
bool IsTopLevel() const override {
@ -90,9 +90,6 @@ public:
// Is this the top level request for a dynamic module import?
const bool mIsDynamicImport;
// The base URL used for resolving relative module imports.
nsCOMPtr<nsIURI> mBaseURL;
// Pointer to the script loader, used to trigger actions when the module load
// finishes.
RefPtr<ScriptLoader> mLoader;