summaryrefslogtreecommitdiffstats
path: root/dom/script
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-08-23 14:08:32 +0000
committerMoonchild <moonchild@palemoon.org>2020-08-30 09:39:55 +0000
commitaefb293793a4278d53d39e346aaa1178975aada1 (patch)
tree7cf9240e7fc22ba5b923cf016bb9acdc49ff9e06 /dom/script
parentc5833155583739be9335a036a4d72bcdc1ad19c4 (diff)
downloadUXP-aefb293793a4278d53d39e346aaa1178975aada1.tar
UXP-aefb293793a4278d53d39e346aaa1178975aada1.tar.gz
UXP-aefb293793a4278d53d39e346aaa1178975aada1.tar.lz
UXP-aefb293793a4278d53d39e346aaa1178975aada1.tar.xz
UXP-aefb293793a4278d53d39e346aaa1178975aada1.zip
Issue #618 - Make document.currentScript null in modules.
Because the spec says so.
Diffstat (limited to 'dom/script')
-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);