mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-01 12:57:31 +09:00
Issue #618 - Make document.currentScript null in modules.
Because the spec says so.
This commit is contained in:
parent
d7889e2d2a
commit
b7dbc3e795
1 changed files with 7 additions and 4 deletions
|
|
@ -534,7 +534,6 @@ ScriptLoader::CreateModuleScript(ModuleLoadRequest* aRequest)
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
{
|
{
|
||||||
// Update our current script.
|
// Update our current script.
|
||||||
AutoCurrentScriptUpdater scriptUpdater(this, aRequest->mElement);
|
|
||||||
Maybe<AutoCurrentScriptUpdater> masterScriptUpdater;
|
Maybe<AutoCurrentScriptUpdater> masterScriptUpdater;
|
||||||
nsCOMPtr<nsIDocument> master = mDocument->MasterDocument();
|
nsCOMPtr<nsIDocument> master = mDocument->MasterDocument();
|
||||||
if (master != mDocument) {
|
if (master != mDocument) {
|
||||||
|
|
@ -1456,7 +1455,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
|
||||||
return false;
|
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,
|
request = CreateLoadRequest(scriptKind, mDocument->GetDocumentURI(), aElement,
|
||||||
version, CORS_NONE,
|
version, CORS_NONE,
|
||||||
SRIMetadata(), // SRI doesn't apply
|
SRIMetadata(), // SRI doesn't apply
|
||||||
|
|
@ -1959,8 +1958,6 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
|
||||||
context->SetProcessingScriptTag(true);
|
context->SetProcessingScriptTag(true);
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
{
|
{
|
||||||
// Update our current script.
|
|
||||||
AutoCurrentScriptUpdater scriptUpdater(this, aRequest->mElement);
|
|
||||||
Maybe<AutoCurrentScriptUpdater> masterScriptUpdater;
|
Maybe<AutoCurrentScriptUpdater> masterScriptUpdater;
|
||||||
nsCOMPtr<nsIDocument> master = mDocument->MasterDocument();
|
nsCOMPtr<nsIDocument> master = mDocument->MasterDocument();
|
||||||
if (master != mDocument) {
|
if (master != mDocument) {
|
||||||
|
|
@ -1974,6 +1971,9 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aRequest->IsModuleRequest()) {
|
if (aRequest->IsModuleRequest()) {
|
||||||
|
// For modules, currentScript is set to null.
|
||||||
|
AutoCurrentScriptUpdater scriptUpdater(this, nullptr);
|
||||||
|
|
||||||
EnsureModuleResolveHook(cx);
|
EnsureModuleResolveHook(cx);
|
||||||
|
|
||||||
ModuleLoadRequest* request = aRequest->AsModuleRequest();
|
ModuleLoadRequest* request = aRequest->AsModuleRequest();
|
||||||
|
|
@ -1998,6 +1998,9 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
|
||||||
rv = NS_OK; // An error is reported by AutoEntryScript.
|
rv = NS_OK; // An error is reported by AutoEntryScript.
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Update our current script.
|
||||||
|
AutoCurrentScriptUpdater scriptUpdater(this, aRequest->mElement);
|
||||||
|
|
||||||
JS::CompileOptions options(cx);
|
JS::CompileOptions options(cx);
|
||||||
rv = FillCompileOptionsForRequest(aes, aRequest, global, &options);
|
rv = FillCompileOptionsForRequest(aes, aRequest, global, &options);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue