summaryrefslogtreecommitdiffstats
path: root/dom/html/HTMLScriptElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/html/HTMLScriptElement.cpp')
-rw-r--r--dom/html/HTMLScriptElement.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/dom/html/HTMLScriptElement.cpp b/dom/html/HTMLScriptElement.cpp
index ddeb925eb..6b0b4be59 100644
--- a/dom/html/HTMLScriptElement.cpp
+++ b/dom/html/HTMLScriptElement.cpp
@@ -279,12 +279,20 @@ HTMLScriptElement::GetScriptCharset(nsAString& charset)
}
void
-HTMLScriptElement::FreezeUriAsyncDefer()
+HTMLScriptElement::FreezeExecutionAttrs(nsIDocument* aOwnerDoc)
{
if (mFrozen) {
return;
}
+ MOZ_ASSERT(!mIsModule && !mAsync && !mDefer && !mExternal);
+
+ // Determine whether this is a classic script or a module script.
+ nsAutoString type;
+ GetScriptType(type);
+ mIsModule = aOwnerDoc->ModuleScriptsEnabled() &&
+ !type.IsEmpty() && type.LowerCaseEqualsASCII("module");
+
// variation of this code in nsSVGScriptElement - check if changes
// need to be transfered when modifying. Note that we don't use GetSrc here
// because it will return the base URL when the attr value is "".
@@ -299,14 +307,13 @@ HTMLScriptElement::FreezeUriAsyncDefer()
// At this point mUri will be null for invalid URLs.
mExternal = true;
-
- bool defer, async;
- GetAsync(&async);
- GetDefer(&defer);
-
- mDefer = !async && defer;
- mAsync = async;
}
+
+ bool defer, async;
+ GetAsync(&async);
+ mAsync = (mExternal || mIsModule) && async;
+ GetDefer(&defer);
+ mDefer = mExternal && !async && defer;
mFrozen = true;
}