summaryrefslogtreecommitdiffstats
path: root/dom/script/ScriptLoader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/script/ScriptLoader.cpp')
-rw-r--r--dom/script/ScriptLoader.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp
index d994acc22..afda82da0 100644
--- a/dom/script/ScriptLoader.cpp
+++ b/dom/script/ScriptLoader.cpp
@@ -534,7 +534,6 @@ ScriptLoader::CreateModuleScript(ModuleLoadRequest* aRequest)
nsresult rv;
{
// Update our current script.
- AutoCurrentScriptUpdater scriptUpdater(this, aRequest->mElement);
Maybe<AutoCurrentScriptUpdater> masterScriptUpdater;
nsCOMPtr<nsIDocument> master = mDocument->MasterDocument();
if (master != mDocument) {
@@ -1456,7 +1455,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
return false;
}
- // Inline scripts ignore ther CORS mode and are always CORS_NONE.
+ // Inline scripts ignore their CORS mode and are always CORS_NONE.
request = CreateLoadRequest(scriptKind, mDocument->GetDocumentURI(), aElement,
version, CORS_NONE,
SRIMetadata(), // SRI doesn't apply
@@ -1959,8 +1958,6 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
context->SetProcessingScriptTag(true);
nsresult rv;
{
- // Update our current script.
- AutoCurrentScriptUpdater scriptUpdater(this, aRequest->mElement);
Maybe<AutoCurrentScriptUpdater> masterScriptUpdater;
nsCOMPtr<nsIDocument> master = mDocument->MasterDocument();
if (master != mDocument) {
@@ -1974,6 +1971,9 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
}
if (aRequest->IsModuleRequest()) {
+ // For modules, currentScript is set to null.
+ AutoCurrentScriptUpdater scriptUpdater(this, nullptr);
+
EnsureModuleResolveHook(cx);
ModuleLoadRequest* request = aRequest->AsModuleRequest();
@@ -1998,6 +1998,9 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
rv = NS_OK; // An error is reported by AutoEntryScript.
}
} else {
+ // Update our current script.
+ AutoCurrentScriptUpdater scriptUpdater(this, aRequest->mElement);
+
JS::CompileOptions options(cx);
rv = FillCompileOptionsForRequest(aes, aRequest, global, &options);