Bug 1361369 - Allow async attribute on inline module scripts r=smaug
This commit is contained in:
@@ -190,12 +190,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 "".
|
||||
@@ -228,14 +236,14 @@ HTMLScriptElement::FreezeUriAsyncDefer()
|
||||
|
||||
// At this point mUri will be null for invalid URLs.
|
||||
mExternal = true;
|
||||
|
||||
bool async = Async();
|
||||
bool defer = Defer();
|
||||
|
||||
mDefer = !async && defer;
|
||||
mAsync = async;
|
||||
}
|
||||
|
||||
bool async = (mExternal || mIsModule) && Async();
|
||||
bool defer = mExternal && Defer();
|
||||
|
||||
mDefer = !async && defer;
|
||||
mAsync = async;
|
||||
|
||||
mFrozen = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user