summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dom/base/nsDocument.cpp13
-rw-r--r--dom/base/nsIDocument.h2
-rw-r--r--dom/html/HTMLScriptElement.cpp23
-rw-r--r--dom/html/HTMLScriptElement.h2
-rw-r--r--dom/script/ModuleLoadRequest.cpp45
-rw-r--r--dom/script/ModuleLoadRequest.h33
-rw-r--r--dom/script/ModuleScript.cpp43
-rw-r--r--dom/script/ModuleScript.h12
-rw-r--r--dom/script/ScriptElement.cpp8
-rw-r--r--dom/script/ScriptLoader.cpp695
-rw-r--r--dom/script/ScriptLoader.h93
-rw-r--r--dom/script/nsIScriptElement.h29
-rw-r--r--dom/script/nsIScriptLoaderObserver.idl9
-rw-r--r--dom/svg/SVGScriptElement.cpp2
-rw-r--r--dom/svg/SVGScriptElement.h2
-rw-r--r--dom/xslt/xslt/txMozillaXMLOutput.cpp2
-rw-r--r--js/public/Class.h2
-rw-r--r--js/src/builtin/Module.js300
-rw-r--r--js/src/builtin/ModuleObject.cpp121
-rw-r--r--js/src/builtin/ModuleObject.h33
-rw-r--r--js/src/builtin/SelfHostingDefines.h24
-rw-r--r--js/src/builtin/TestingFunctions.cpp8
-rw-r--r--js/src/jit-test/tests/modules/bug-1284486.js12
-rw-r--r--js/src/jit-test/tests/modules/bug-1420420-2.js19
-rw-r--r--js/src/jit-test/tests/modules/bug-1420420-3.js9
-rw-r--r--js/src/jit-test/tests/modules/bug-1420420-4.js16
-rw-r--r--js/src/jit-test/tests/modules/bug-1420420.js19
-rw-r--r--js/src/js.msg1
-rw-r--r--js/src/jsapi.cpp32
-rw-r--r--js/src/jsapi.h21
-rw-r--r--js/src/shell/js.cpp33
-rw-r--r--js/src/vm/EnvironmentObject.cpp2
-rw-r--r--js/src/vm/GlobalObject.h14
-rw-r--r--js/src/vm/Runtime.cpp6
-rw-r--r--js/src/vm/Runtime.h3
-rw-r--r--js/src/vm/SelfHosting.cpp28
-rw-r--r--parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/AttributeName.java955
-rw-r--r--parser/html/nsHtml5AtomList.h1
-rw-r--r--parser/html/nsHtml5AttributeName.cpp484
-rw-r--r--parser/html/nsHtml5AttributeName.h1
-rw-r--r--parser/html/nsHtml5SpeculativeLoad.cpp23
-rw-r--r--parser/html/nsHtml5SpeculativeLoad.h28
-rw-r--r--parser/html/nsHtml5TreeBuilderCppSupplement.h20
-rw-r--r--parser/html/nsHtml5TreeOpExecutor.cpp8
-rw-r--r--parser/html/nsHtml5TreeOpExecutor.h5
-rw-r--r--parser/html/nsHtml5TreeOperation.cpp2
46 files changed, 1783 insertions, 1460 deletions
diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp
index dc4b23f2c..76490e6b4 100644
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -12446,3 +12446,16 @@ nsIDocument::GetSelection(ErrorResult& aRv)
return nsGlobalWindow::Cast(window)->GetSelection(aRv);
}
+
+bool
+nsIDocument::ModuleScriptsEnabled()
+{
+ static bool sEnabledForContent = false;
+ static bool sCachedPref = false;
+ if (!sCachedPref) {
+ sCachedPref = true;
+ Preferences::AddBoolVarCache(&sEnabledForContent, "dom.moduleScripts.enabled", false);
+ }
+
+ return nsContentUtils::IsChromeDoc(this) || sEnabledForContent;
+} \ No newline at end of file
diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h
index 33aac3a3d..21cd0aaf7 100644
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -2851,6 +2851,8 @@ public:
return mIsWebComponentsEnabled;
}
+ bool ModuleScriptsEnabled();
+
protected:
bool GetUseCounter(mozilla::UseCounter aUseCounter)
{
diff --git a/dom/html/HTMLScriptElement.cpp b/dom/html/HTMLScriptElement.cpp
index 5b727280f..f1463d6aa 100644
--- a/dom/html/HTMLScriptElement.cpp
+++ b/dom/html/HTMLScriptElement.cpp
@@ -280,12 +280,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 "".
@@ -300,14 +308,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;
}
diff --git a/dom/html/HTMLScriptElement.h b/dom/html/HTMLScriptElement.h
index 6edeb9832..198df1ed0 100644
--- a/dom/html/HTMLScriptElement.h
+++ b/dom/html/HTMLScriptElement.h
@@ -41,7 +41,7 @@ public:
virtual bool GetScriptType(nsAString& type) override;
virtual void GetScriptText(nsAString& text) override;
virtual void GetScriptCharset(nsAString& charset) override;
- virtual void FreezeUriAsyncDefer() override;
+ virtual void FreezeExecutionAttrs(nsIDocument* aOwnerDoc) override;
virtual CORSMode GetCORSMode() const override;
// nsIContent
diff --git a/dom/script/ModuleLoadRequest.cpp b/dom/script/ModuleLoadRequest.cpp
index d62214304..743f30fb9 100644
--- a/dom/script/ModuleLoadRequest.cpp
+++ b/dom/script/ModuleLoadRequest.cpp
@@ -17,26 +17,54 @@ NS_INTERFACE_MAP_END_INHERITING(ScriptLoadRequest)
NS_IMPL_CYCLE_COLLECTION_INHERITED(ModuleLoadRequest, ScriptLoadRequest,
mBaseURL,
mLoader,
- mParent,
mModuleScript,
mImports)
NS_IMPL_ADDREF_INHERITED(ModuleLoadRequest, ScriptLoadRequest)
NS_IMPL_RELEASE_INHERITED(ModuleLoadRequest, ScriptLoadRequest)
-ModuleLoadRequest::ModuleLoadRequest(nsIScriptElement* aElement,
+ModuleLoadRequest::ModuleLoadRequest(nsIURI* aURI,
+ nsIScriptElement* aElement,
uint32_t aVersion,
CORSMode aCORSMode,
const SRIMetadata &aIntegrity,
+ nsIURI* aReferrer,
+ mozilla::net::ReferrerPolicy aReferrerPolicy,
ScriptLoader* aLoader)
: ScriptLoadRequest(ScriptKind::Module,
+ aURI,
aElement,
aVersion,
aCORSMode,
- aIntegrity),
+ aIntegrity,
+ aReferrer,
+ aReferrerPolicy),
mIsTopLevel(true),
- mLoader(aLoader)
-{}
+ mLoader(aLoader),
+ mVisitedSet(new VisitedURLSet())
+{
+ mVisitedSet->PutEntry(aURI);
+}
+
+ModuleLoadRequest::ModuleLoadRequest(nsIURI* aURI,
+ ModuleLoadRequest* aParent)
+ : ScriptLoadRequest(ScriptKind::Module,
+ aURI,
+ aParent->mElement,
+ aParent->mJSVersion,
+ aParent->mCORSMode,
+ SRIMetadata(),
+ aParent->mURI,
+ aParent->mReferrerPolicy),
+ mIsTopLevel(false),
+ mLoader(aParent->mLoader),
+ mVisitedSet(aParent->mVisitedSet)
+{
+ MOZ_ASSERT(mVisitedSet->Contains(aURI));
+
+ mIsInline = false;
+ mScriptMode = aParent->mScriptMode;
+}
void ModuleLoadRequest::Cancel()
{
@@ -83,7 +111,7 @@ ModuleLoadRequest::ModuleLoaded()
// been loaded.
mModuleScript = mLoader->GetFetchedModule(mURI);
- if (!mModuleScript || mModuleScript->IsErrored()) {
+ if (!mModuleScript || mModuleScript->HasParseError()) {
ModuleErrored();
return;
}
@@ -95,7 +123,7 @@ void
ModuleLoadRequest::ModuleErrored()
{
mLoader->CheckModuleDependenciesLoaded(this);
- MOZ_ASSERT(!mModuleScript || mModuleScript->IsErrored());
+ MOZ_ASSERT(!mModuleScript || mModuleScript->HasParseError());
CancelImports();
SetReady();
@@ -132,8 +160,7 @@ ModuleLoadRequest::LoadFinished()
{
mLoader->ProcessLoadedModuleTree(this);
mLoader = nullptr;
- mParent = nullptr;
}
} // dom namespace
-} // mozilla namespace \ No newline at end of file
+} // mozilla namespace
diff --git a/dom/script/ModuleLoadRequest.h b/dom/script/ModuleLoadRequest.h
index 7b06dd2cf..eefb7dad5 100644
--- a/dom/script/ModuleLoadRequest.h
+++ b/dom/script/ModuleLoadRequest.h
@@ -8,6 +8,7 @@
#define mozilla_dom_ModuleLoadRequest_h
#include "mozilla/dom/ScriptLoader.h"
+#include "nsURIHashKey.h"
#include "mozilla/MozPromise.h"
namespace mozilla {
@@ -16,6 +17,16 @@ namespace dom {
class ModuleScript;
class ScriptLoader;
+// A reference counted set of URLs we have visited in the process of loading a
+// module graph.
+class VisitedURLSet : public nsTHashtable<nsURIHashKey>
+{
+ NS_INLINE_DECL_REFCOUNTING(VisitedURLSet)
+
+private:
+ ~VisitedURLSet() = default;
+};
+
// A load request for a module, created for every top level module script and
// every module import. Load request can share a ModuleScript if there are
// multiple imports of the same module.
@@ -31,12 +42,20 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ModuleLoadRequest, ScriptLoadRequest)
- ModuleLoadRequest(nsIScriptElement* aElement,
+ // Create a top-level module load request.
+ ModuleLoadRequest(nsIURI* aURI,
+ nsIScriptElement* aElement,
uint32_t aVersion,
CORSMode aCORSMode,
const SRIMetadata& aIntegrity,
+ nsIURI* aReferrer,
+ mozilla::net::ReferrerPolicy,
ScriptLoader* aLoader);
+ // Create a module load request for an imported module.
+ ModuleLoadRequest(nsIURI* aURI,
+ ModuleLoadRequest* aParent);
+
bool IsTopLevel() const {
return mIsTopLevel;
}
@@ -55,7 +74,7 @@ private:
public:
// Is this a request for a top level module script or an import?
- bool mIsTopLevel;
+ const bool mIsTopLevel;
// The base URL used for resolving relative module imports.
nsCOMPtr<nsIURI> mBaseURL;
@@ -64,10 +83,6 @@ public:
// finishes.
RefPtr<ScriptLoader> mLoader;
- // The importing module, or nullptr for top level module scripts. Used to
- // implement the ancestor list checked when fetching module dependencies.
- RefPtr<ModuleLoadRequest> mParent;
-
// Set to a module script object after a successful load or nullptr on
// failure.
RefPtr<ModuleScript> mModuleScript;
@@ -79,9 +94,13 @@ public:
// Array of imported modules.
nsTArray<RefPtr<ModuleLoadRequest>> mImports;
+
+ // Set of module URLs visited while fetching the module graph this request is
+ // part of.
+ RefPtr<VisitedURLSet> mVisitedSet;
};
} // dom namespace
} // mozilla namespace
-#endif // mozilla_dom_ModuleLoadRequest_h \ No newline at end of file
+#endif // mozilla_dom_ModuleLoadRequest_h
diff --git a/dom/script/ModuleScript.cpp b/dom/script/ModuleScript.cpp
index 28b97a3cb..1bf9d0b0f 100644
--- a/dom/script/ModuleScript.cpp
+++ b/dom/script/ModuleScript.cpp
@@ -26,7 +26,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ModuleScript)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mLoader)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mBaseURL)
tmp->UnlinkModuleRecord();
- tmp->mError.setUndefined();
+ tmp->mParseError.setUndefined();
+ tmp->mErrorToRethrow.setUndefined();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(ModuleScript)
@@ -35,7 +36,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(ModuleScript)
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mModuleRecord)
- NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mError)
+ NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mParseError)
+ NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mErrorToRethrow)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(ModuleScript)
@@ -48,7 +50,8 @@ ModuleScript::ModuleScript(ScriptLoader *aLoader, nsIURI* aBaseURL)
MOZ_ASSERT(mLoader);
MOZ_ASSERT(mBaseURL);
MOZ_ASSERT(!mModuleRecord);
- MOZ_ASSERT(mError.isUndefined());
+ MOZ_ASSERT(!HasParseError());
+ MOZ_ASSERT(!HasErrorToRethrow());
}
void
@@ -74,7 +77,8 @@ void
ModuleScript::SetModuleRecord(JS::Handle<JSObject*> aModuleRecord)
{
MOZ_ASSERT(!mModuleRecord);
- MOZ_ASSERT(mError.isUndefined());
+ MOZ_ASSERT(!HasParseError());
+ MOZ_ASSERT(!HasErrorToRethrow());
mModuleRecord = aModuleRecord;
@@ -85,37 +89,24 @@ ModuleScript::SetModuleRecord(JS::Handle<JSObject*> aModuleRecord)
}
void
-ModuleScript::SetPreInstantiationError(const JS::Value& aError)
+ModuleScript::SetParseError(const JS::Value& aError)
{
MOZ_ASSERT(!aError.isUndefined());
+ MOZ_ASSERT(!HasParseError());
+ MOZ_ASSERT(!HasErrorToRethrow());
UnlinkModuleRecord();
- mError = aError;
-
+ mParseError = aError;
HoldJSObjects(this);
}
-bool
-ModuleScript::IsErrored() const
-{
- if (!mModuleRecord) {
- MOZ_ASSERT(!mError.isUndefined());
- return true;
- }
-
- return JS::IsModuleErrored(mModuleRecord);
-}
-
-JS::Value
-ModuleScript::Error() const
+void
+ModuleScript::SetErrorToRethrow(const JS::Value& aError)
{
- MOZ_ASSERT(IsErrored());
-
- if (!mModuleRecord) {
- return mError;
- }
+ MOZ_ASSERT(!aError.isUndefined());
+ MOZ_ASSERT(!HasErrorToRethrow());
- return JS::GetModuleError(mModuleRecord);
+ mErrorToRethrow = aError;
}
} // dom namespace
diff --git a/dom/script/ModuleScript.h b/dom/script/ModuleScript.h
index 571359859..f765aa0fa 100644
--- a/dom/script/ModuleScript.h
+++ b/dom/script/ModuleScript.h
@@ -23,7 +23,8 @@ class ModuleScript final : public nsISupports
RefPtr<ScriptLoader> mLoader;
nsCOMPtr<nsIURI> mBaseURL;
JS::Heap<JSObject*> mModuleRecord;
- JS::Heap<JS::Value> mError;
+ JS::Heap<JS::Value> mParseError;
+ JS::Heap<JS::Value> mErrorToRethrow;
~ModuleScript();
@@ -35,14 +36,17 @@ public:
nsIURI* aBaseURL);
void SetModuleRecord(JS::Handle<JSObject*> aModuleRecord);
- void SetPreInstantiationError(const JS::Value& aError);
+ void SetParseError(const JS::Value& aError);
+ void SetErrorToRethrow(const JS::Value& aError);
ScriptLoader* Loader() const { return mLoader; }
JSObject* ModuleRecord() const { return mModuleRecord; }
nsIURI* BaseURL() const { return mBaseURL; }
- bool IsErrored() const;
- JS::Value Error() const;
+ JS::Value ParseError() const { return mParseError; }
+ JS::Value ErrorToRethrow() const { return mErrorToRethrow; }
+ bool HasParseError() const { return !mParseError.isUndefined(); }
+ bool HasErrorToRethrow() const { return !mErrorToRethrow.isUndefined(); }
void UnlinkModuleRecord();
};
diff --git a/dom/script/ScriptElement.cpp b/dom/script/ScriptElement.cpp
index 0cb17dcb0..eb20dbf32 100644
--- a/dom/script/ScriptElement.cpp
+++ b/dom/script/ScriptElement.cpp
@@ -21,11 +21,11 @@ using namespace mozilla::dom;
NS_IMETHODIMP
ScriptElement::ScriptAvailable(nsresult aResult,
nsIScriptElement *aElement,
- bool aIsInline,
+ bool aIsInlineClassicScript,
nsIURI *aURI,
int32_t aLineNo)
{
- if (!aIsInline && NS_FAILED(aResult)) {
+ if (!aIsInlineClassicScript && NS_FAILED(aResult)) {
nsCOMPtr<nsIParser> parser = do_QueryReferent(mCreatorParser);
if (parser) {
parser->PushDefinedInsertionPoint();
@@ -128,11 +128,11 @@ ScriptElement::MaybeProcessScript()
return false;
}
- FreezeUriAsyncDefer();
+ nsIDocument* ownerDoc = cont->OwnerDoc();
+ FreezeExecutionAttrs(ownerDoc);
mAlreadyStarted = true;
- nsIDocument* ownerDoc = cont->OwnerDoc();
nsCOMPtr<nsIParser> parser = ((nsIScriptElement*) this)->GetCreatorParser();
if (parser) {
nsCOMPtr<nsIContentSink> sink = parser->GetContentSink();
diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp
index a53098974..0052c72fe 100644
--- a/dom/script/ScriptLoader.cpp
+++ b/dom/script/ScriptLoader.cpp
@@ -140,6 +140,18 @@ ScriptLoadRequest::AsModuleRequest()
return static_cast<ModuleLoadRequest*>(this);
}
+void
+ScriptLoadRequest::SetScriptMode(bool aDeferAttr, bool aAsyncAttr)
+{
+ if (aAsyncAttr) {
+ mScriptMode = ScriptMode::eAsync;
+ } else if (aDeferAttr || IsModuleRequest()) {
+ mScriptMode = ScriptMode::eDeferred;
+ } else {
+ mScriptMode = ScriptMode::eBlocking;
+ }
+}
+
//////////////////////////////////////////////////////////////
// ScriptLoadRequestList
@@ -299,8 +311,12 @@ ScriptLoader::~ScriptLoader()
// <script for=... event=...> element.
static bool
-IsScriptEventHandler(nsIContent* aScriptElement)
+IsScriptEventHandler(ScriptKind kind, nsIContent* aScriptElement)
{
+ if (kind != ScriptKind::Classic) {
+ return false;
+ }
+
if (!aScriptElement->IsHTMLElement()) {
return false;
}
@@ -375,25 +391,12 @@ ScriptLoader::CheckContentPolicy(nsIDocument* aDocument,
}
bool
-ScriptLoader::ModuleScriptsEnabled()
-{
- static bool sEnabledForContent = false;
- static bool sCachedPref = false;
- if (!sCachedPref) {
- sCachedPref = true;
- Preferences::AddBoolVarCache(&sEnabledForContent, "dom.moduleScripts.enabled", false);
- }
-
- return nsContentUtils::IsChromeDoc(mDocument) || sEnabledForContent;
-}
-
-bool
-ScriptLoader::ModuleMapContainsModule(ModuleLoadRequest *aRequest) const
+ScriptLoader::ModuleMapContainsURL(nsIURI* aURL) const
{
// Returns whether we have fetched, or are currently fetching, a module script
- // for the request's URL.
- return mFetchingModules.Contains(aRequest->mURI) ||
- mFetchedModules.Contains(aRequest->mURI);
+ // for a URL.
+ return mFetchingModules.Contains(aURL) ||
+ mFetchedModules.Contains(aURL);
}
bool
@@ -410,7 +413,7 @@ ScriptLoader::SetModuleFetchStarted(ModuleLoadRequest *aRequest)
// Update the module map to indicate that a module is currently being fetched.
MOZ_ASSERT(aRequest->IsLoading());
- MOZ_ASSERT(!ModuleMapContainsModule(aRequest));
+ MOZ_ASSERT(!ModuleMapContainsURL(aRequest->mURI));
mFetchingModules.Put(aRequest->mURI, nullptr);
}
@@ -443,21 +446,21 @@ ScriptLoader::SetModuleFetchFinishedAndResumeWaitingRequests(ModuleLoadRequest *
}
RefPtr<GenericPromise>
-ScriptLoader::WaitForModuleFetch(ModuleLoadRequest *aRequest)
+ScriptLoader::WaitForModuleFetch(nsIURI* aURL)
{
- MOZ_ASSERT(ModuleMapContainsModule(aRequest));
+ MOZ_ASSERT(ModuleMapContainsURL(aURL));
RefPtr<GenericPromise::Private> promise;
- if (mFetchingModules.Get(aRequest->mURI, getter_AddRefs(promise))) {
+ if (mFetchingModules.Get(aURL, getter_AddRefs(promise))) {
if (!promise) {
promise = new GenericPromise::Private(__func__);
- mFetchingModules.Put(aRequest->mURI, promise);
+ mFetchingModules.Put(aURL, promise);
}
return promise;
}
RefPtr<ModuleScript> ms;
- MOZ_ALWAYS_TRUE(mFetchedModules.Get(aRequest->mURI, getter_AddRefs(ms)));
+ MOZ_ALWAYS_TRUE(mFetchedModules.Get(aURL, getter_AddRefs(ms)));
if (!ms) {
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
}
@@ -482,8 +485,6 @@ ScriptLoader::ProcessFetchedModuleSource(ModuleLoadRequest* aRequest)
nsresult rv = CreateModuleScript(aRequest);
MOZ_ASSERT(NS_FAILED(rv) == !aRequest->mModuleScript);
- SetModuleFetchFinishedAndResumeWaitingRequests(aRequest, rv);
-
free(aRequest->mScriptTextBuf);
aRequest->mScriptTextBuf = nullptr;
aRequest->mScriptTextLength = 0;
@@ -493,7 +494,11 @@ ScriptLoader::ProcessFetchedModuleSource(ModuleLoadRequest* aRequest)
return rv;
}
- if (!aRequest->mModuleScript->IsErrored()) {
+ if (!aRequest->mIsInline) {
+ SetModuleFetchFinishedAndResumeWaitingRequests(aRequest, rv);
+ }
+
+ if (!aRequest->mModuleScript->HasParseError()) {
StartFetchingModuleDependencies(aRequest);
}
@@ -501,7 +506,7 @@ ScriptLoader::ProcessFetchedModuleSource(ModuleLoadRequest* aRequest)
}
static nsresult
-ResolveRequestedModules(ModuleLoadRequest* aRequest, nsCOMArray<nsIURI>& aUrls);
+ResolveRequestedModules(ModuleLoadRequest* aRequest, nsCOMArray<nsIURI>* aUrlsOut);
nsresult
ScriptLoader::CreateModuleScript(ModuleLoadRequest* aRequest)
@@ -528,7 +533,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) {
@@ -568,7 +572,7 @@ ScriptLoader::CreateModuleScript(ModuleLoadRequest* aRequest)
return NS_ERROR_FAILURE;
}
- moduleScript->SetPreInstantiationError(error);
+ moduleScript->SetParseError(error);
aRequest->ModuleErrored();
return NS_OK;
}
@@ -577,11 +581,8 @@ ScriptLoader::CreateModuleScript(ModuleLoadRequest* aRequest)
// Validate requested modules and treat failure to resolve module specifiers
// the same as a parse error.
- nsCOMArray<nsIURI> urls;
- rv = ResolveRequestedModules(aRequest, urls);
+ rv = ResolveRequestedModules(aRequest, nullptr);
if (NS_FAILED(rv)) {
- // ResolveRequestedModules sets pre-instanitation error on failure.
- MOZ_ASSERT(moduleScript->IsErrored());
aRequest->ModuleErrored();
return NS_OK;
}
@@ -627,7 +628,7 @@ HandleResolveFailure(JSContext* aCx, ModuleScript* aScript,
return NS_ERROR_OUT_OF_MEMORY;
}
- aScript->SetPreInstantiationError(error);
+ aScript->SetParseError(error);
return NS_OK;
}
@@ -667,33 +668,7 @@ ResolveModuleSpecifier(ModuleScript* aScript,
}
static nsresult
-RequestedModuleIsInAncestorList(ModuleLoadRequest* aRequest, nsIURI* aURL, bool* aResult)
-{
- const size_t ImportDepthLimit = 100;
-
- *aResult = false;
- size_t depth = 0;
- while (aRequest) {
- if (depth++ == ImportDepthLimit) {
- return NS_ERROR_FAILURE;
- }
-
- bool equal;
- nsresult rv = aURL->Equals(aRequest->mURI, &equal);
- NS_ENSURE_SUCCESS(rv, rv);
- if (equal) {
- *aResult = true;
- return NS_OK;
- }
-
- aRequest = aRequest->mParent;
- }
-
- return NS_OK;
-}
-
-static nsresult
-ResolveRequestedModules(ModuleLoadRequest* aRequest, nsCOMArray<nsIURI> &aUrls)
+ResolveRequestedModules(ModuleLoadRequest* aRequest, nsCOMArray<nsIURI>* aUrlsOut)
{
ModuleScript* ms = aRequest->mModuleScript;
@@ -723,7 +698,6 @@ ResolveRequestedModules(ModuleLoadRequest* aRequest, nsCOMArray<nsIURI> &aUrls)
}
// Let url be the result of resolving a module specifier given module script and requested.
- ModuleScript* ms = aRequest->mModuleScript;
nsCOMPtr<nsIURI> uri = ResolveModuleSpecifier(ms, specifier);
if (!uri) {
nsresult rv = HandleResolveFailure(cx, ms, specifier);
@@ -731,11 +705,8 @@ ResolveRequestedModules(ModuleLoadRequest* aRequest, nsCOMArray<nsIURI> &aUrls)
return NS_ERROR_FAILURE;
}
- bool isAncestor;
- nsresult rv = RequestedModuleIsInAncestorList(aRequest, uri, &isAncestor);
- NS_ENSURE_SUCCESS(rv, rv);
- if (!isAncestor) {
- aUrls.AppendElement(uri.forget());
+ if (aUrlsOut) {
+ aUrlsOut->AppendElement(uri.forget());
}
}
@@ -746,20 +717,36 @@ void
ScriptLoader::StartFetchingModuleDependencies(ModuleLoadRequest* aRequest)
{
MOZ_ASSERT(aRequest->mModuleScript);
- MOZ_ASSERT(!aRequest->mModuleScript->IsErrored());
+ MOZ_ASSERT(!aRequest->mModuleScript->HasParseError());
MOZ_ASSERT(!aRequest->IsReadyToRun());
+ auto visitedSet = aRequest->mVisitedSet;
+ MOZ_ASSERT(visitedSet->Contains(aRequest->mURI));
+
aRequest->mProgress = ModuleLoadRequest::Progress::FetchingImports;
nsCOMArray<nsIURI> urls;
- nsresult rv = ResolveRequestedModules(aRequest, urls);
+ nsresult rv = ResolveRequestedModules(aRequest, &urls);
if (NS_FAILED(rv)) {
aRequest->ModuleErrored();
return;
}
- if (urls.Length() == 0) {
- // There are no descendents to load so this request is ready.
+ // Remove already visited URLs from the list. Put unvisited URLs into the
+ // visited set.
+ int32_t i = 0;
+ while (i < urls.Count()) {
+ nsIURI* url = urls[i];
+ if (visitedSet->Contains(url)) {
+ urls.RemoveObjectAt(i);
+ } else {
+ visitedSet->PutEntry(url);
+ i++;
+ }
+ }
+
+ if (urls.Count() == 0) {
+ // There are no descendants to load so this request is ready.
aRequest->DependenciesLoaded();
return;
}
@@ -782,20 +769,14 @@ ScriptLoader::StartFetchingModuleDependencies(ModuleLoadRequest* aRequest)
}
RefPtr<GenericPromise>
-ScriptLoader::StartFetchingModuleAndDependencies(ModuleLoadRequest* aRequest,
+ScriptLoader::StartFetchingModuleAndDependencies(ModuleLoadRequest* aParent,
nsIURI* aURI)
{
MOZ_ASSERT(aURI);
- RefPtr<ModuleLoadRequest> childRequest =
- new ModuleLoadRequest(aRequest->mElement, aRequest->mJSVersion,
- aRequest->mCORSMode, aRequest->mIntegrity, this);
+ RefPtr<ModuleLoadRequest> childRequest = new ModuleLoadRequest(aURI, aParent);
- childRequest->mIsTopLevel = false;
- childRequest->mURI = aURI;
- childRequest->mIsInline = false;
- childRequest->mReferrerPolicy = aRequest->mReferrerPolicy;
- childRequest->mParent = aRequest;
+ aParent->mImports.AppendElement(childRequest);
RefPtr<GenericPromise> ready = childRequest->mReady.Ensure(__func__);
@@ -806,29 +787,24 @@ ScriptLoader::StartFetchingModuleAndDependencies(ModuleLoadRequest* aRequest,
return ready;
}
- aRequest->mImports.AppendElement(childRequest);
return ready;
}
// 8.1.3.8.1 HostResolveImportedModule(referencingModule, specifier)
-bool
-HostResolveImportedModule(JSContext* aCx, unsigned argc, JS::Value* vp)
+JSObject*
+HostResolveImportedModule(JSContext* aCx, JS::Handle<JSObject*> aModule,
+ JS::Handle<JSString*> aSpecifier)
{
- MOZ_ASSERT(argc == 2);
- JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
- JS::Rooted<JSObject*> module(aCx, &args[0].toObject());
- JS::Rooted<JSString*> specifier(aCx, args[1].toString());
-
// Let referencing module script be referencingModule.[[HostDefined]].
- JS::Value value = JS::GetModuleHostDefinedField(module);
+ JS::Value value = JS::GetModuleHostDefinedField(aModule);
auto script = static_cast<ModuleScript*>(value.toPrivate());
- MOZ_ASSERT(script->ModuleRecord() == module);
+ MOZ_ASSERT(script->ModuleRecord() == aModule);
// Let url be the result of resolving a module specifier given referencing
// module script and specifier.
nsAutoJSString string;
- if (!string.init(aCx, specifier)) {
- return false;
+ if (!string.init(aCx, aSpecifier)) {
+ return nullptr;
}
nsCOMPtr<nsIURI> uri = ResolveModuleSpecifier(script, string);
@@ -843,62 +819,79 @@ HostResolveImportedModule(JSContext* aCx, unsigned argc, JS::Value* vp)
ModuleScript* ms = script->Loader()->GetFetchedModule(uri);
MOZ_ASSERT(ms, "Resolved module not found in module map");
- MOZ_ASSERT(!ms->IsErrored());
+ MOZ_ASSERT(!ms->HasParseError());
+ MOZ_ASSERT(ms->ModuleRecord());
- *vp = JS::ObjectValue(*ms->ModuleRecord());
- return true;
+ return ms->ModuleRecord();
}
-static nsresult
+static void
EnsureModuleResolveHook(JSContext* aCx)
{
- if (JS::GetModuleResolveHook(aCx)) {
- return NS_OK;
- }
-
- JS::Rooted<JSFunction*> func(aCx);
- func = JS_NewFunction(aCx, HostResolveImportedModule, 2, 0,
- "HostResolveImportedModule");
- if (!func) {
- return NS_ERROR_FAILURE;
+ JSRuntime* rt = JS_GetRuntime(aCx);
+ if (JS::GetModuleResolveHook(rt)) {
+ return;
}
- JS::SetModuleResolveHook(aCx, func);
- return NS_OK;
+ JS::SetModuleResolveHook(rt, HostResolveImportedModule);
}
void
ScriptLoader::CheckModuleDependenciesLoaded(ModuleLoadRequest* aRequest)
{
RefPtr<ModuleScript> moduleScript = aRequest->mModuleScript;
- if (moduleScript && !moduleScript->IsErrored()) {
- for (auto childRequest : aRequest->mImports) {
- ModuleScript* childScript = childRequest->mModuleScript;
- if (!childScript) {
- // Load error
- aRequest->mModuleScript = nullptr;
- return;
- } else if (childScript->IsErrored()) {
- // Script error
- moduleScript->SetPreInstantiationError(childScript->Error());
- return;
- }
+ if (!moduleScript || moduleScript->HasParseError()) {
+ return;
+ }
+
+ for (auto childRequest : aRequest->mImports) {
+ ModuleScript* childScript = childRequest->mModuleScript;
+ if (!childScript) {
+ aRequest->mModuleScript = nullptr;
+ // Load error on script load request; bail.
+ return;
}
}
}
+class ScriptRequestProcessor : public Runnable
+{
+private:
+ RefPtr<ScriptLoader> mLoader;
+ RefPtr<ScriptLoadRequest> mRequest;
+public:
+ ScriptRequestProcessor(ScriptLoader* aLoader,
+ ScriptLoadRequest* aRequest)
+ : mLoader(aLoader)
+ , mRequest(aRequest)
+ {}
+ NS_IMETHOD Run() override
+ {
+ return mLoader->ProcessRequest(mRequest);
+ }
+};
+
void
ScriptLoader::ProcessLoadedModuleTree(ModuleLoadRequest* aRequest)
{
if (aRequest->IsTopLevel()) {
ModuleScript* moduleScript = aRequest->mModuleScript;
- if (moduleScript && !moduleScript->IsErrored()) {
+ if (moduleScript && !moduleScript->HasErrorToRethrow()) {
if (!InstantiateModuleTree(aRequest)) {
aRequest->mModuleScript = nullptr;
}
}
- MaybeMoveToLoadedList(aRequest);
- ProcessPendingRequests();
+
+ if (aRequest->mIsInline &&
+ aRequest->mElement->GetParserCreated() == NOT_FROM_PARSER)
+ {
+ MOZ_ASSERT(!aRequest->isInList());
+ nsContentUtils::AddScriptRunner(
+ new ScriptRequestProcessor(this, aRequest));
+ } else {
+ MaybeMoveToLoadedList(aRequest);
+ ProcessPendingRequests();
+ }
}
if (aRequest->mWasCompiledOMT) {
@@ -906,6 +899,28 @@ ScriptLoader::ProcessLoadedModuleTree(ModuleLoadRequest* aRequest)
}
}
+JS::Value
+ScriptLoader::FindFirstParseError(ModuleLoadRequest* aRequest)
+{
+ MOZ_ASSERT(aRequest);
+
+ ModuleScript* moduleScript = aRequest->mModuleScript;
+ MOZ_ASSERT(moduleScript);
+
+ if (moduleScript->HasParseError()) {
+ return moduleScript->ParseError();
+ }
+
+ for (ModuleLoadRequest* childRequest : aRequest->mImports) {
+ JS::Value error = FindFirstParseError(childRequest);
+ if (!error.isUndefined()) {
+ return error;
+ }
+ }
+
+ return JS::UndefinedValue();
+}
+
bool
ScriptLoader::InstantiateModuleTree(ModuleLoadRequest* aRequest)
{
@@ -916,6 +931,14 @@ ScriptLoader::InstantiateModuleTree(ModuleLoadRequest* aRequest)
ModuleScript* moduleScript = aRequest->mModuleScript;
MOZ_ASSERT(moduleScript);
+
+ JS::Value parseError = FindFirstParseError(aRequest);
+ if (!parseError.isUndefined()) {
+ // Parse error found in the requested script
+ moduleScript->SetErrorToRethrow(parseError);
+ return true;
+ }
+
MOZ_ASSERT(moduleScript->ModuleRecord());
nsAutoMicroTask mt;
@@ -924,8 +947,7 @@ ScriptLoader::InstantiateModuleTree(ModuleLoadRequest* aRequest)
return false;
}
- nsresult rv = EnsureModuleResolveHook(jsapi.cx());
- NS_ENSURE_SUCCESS(rv, false);
+ EnsureModuleResolveHook(jsapi.cx());
JS::Rooted<JSObject*> module(jsapi.cx(), moduleScript->ModuleRecord());
bool ok = NS_SUCCEEDED(nsJSUtils::ModuleInstantiate(jsapi.cx(), module));
@@ -937,7 +959,7 @@ ScriptLoader::InstantiateModuleTree(ModuleLoadRequest* aRequest)
return false;
}
MOZ_ASSERT(!exception.isUndefined());
- // Ignore the exception. It will be recorded in the module record.
+ moduleScript->SetErrorToRethrow(exception);
}
return true;
@@ -959,8 +981,8 @@ ScriptLoader::StartLoad(ScriptLoadRequest *aRequest, const nsAString &aType,
// Check whether the module has been fetched or is currently being fetched,
// and if so wait for it.
ModuleLoadRequest* request = aRequest->AsModuleRequest();
- if (ModuleMapContainsModule(request)) {
- WaitForModuleFetch(request)
+ if (ModuleMapContainsURL(request->mURI)) {
+ WaitForModuleFetch(request->mURI)
->Then(AbstractThread::GetCurrent(), __func__, request,
&ModuleLoadRequest::ModuleLoaded,
&ModuleLoadRequest::LoadFailed);
@@ -1026,16 +1048,14 @@ ScriptLoader::StartLoad(ScriptLoadRequest *aRequest, const nsAString &aType,
NS_ENSURE_SUCCESS(rv, rv);
- nsIScriptElement *script = aRequest->mElement;
nsCOMPtr<nsIClassOfService> cos(do_QueryInterface(channel));
if (cos) {
- if (aScriptFromHead &&
- !(script && (script->GetScriptAsync() || script->GetScriptDeferred()))) {
+ if (aScriptFromHead && aRequest->IsBlockingScript()) {
// synchronous head scripts block lading of most other non js/css
// content such as images
cos->AddClassFlags(nsIClassOfService::Leader);
- } else if (!(script && script->GetScriptDeferred())) {
+ } else if (!aRequest->IsDeferredScript()) {
// other scripts are neither blocked nor prioritized unless marked deferred
cos->AddClassFlags(nsIClassOfService::Unblocked);
}
@@ -1047,7 +1067,7 @@ ScriptLoader::StartLoad(ScriptLoadRequest *aRequest, const nsAString &aType,
httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
NS_LITERAL_CSTRING("*/*"),
false);
- httpChannel->SetReferrerWithPolicy(mDocument->GetDocumentURI(),
+ httpChannel->SetReferrerWithPolicy(aRequest->mReferrer,
aRequest->mReferrerPolicy);
nsCOMPtr<nsIHttpChannelInternal> internalChannel(do_QueryInterface(httpChannel));
@@ -1095,23 +1115,6 @@ ScriptLoader::PreloadURIComparator::Equals(const PreloadInfo &aPi,
same;
}
-class ScriptRequestProcessor : public Runnable
-{
-private:
- RefPtr<ScriptLoader> mLoader;
- RefPtr<ScriptLoadRequest> mRequest;
-public:
- ScriptRequestProcessor(ScriptLoader* aLoader,
- ScriptLoadRequest* aRequest)
- : mLoader(aLoader)
- , mRequest(aRequest)
- {}
- NS_IMETHOD Run() override
- {
- return mLoader->ProcessRequest(mRequest);
- }
-};
-
static inline bool
ParseTypeAttribute(const nsAString& aType, JSVersion* aVersion)
{
@@ -1176,17 +1179,24 @@ CSPAllowsInlineScript(nsIScriptElement *aElement, nsIDocument *aDocument)
ScriptLoadRequest*
ScriptLoader::CreateLoadRequest(ScriptKind aKind,
+ nsIURI* aURI,
nsIScriptElement* aElement,
uint32_t aVersion, CORSMode aCORSMode,
- const SRIMetadata &aIntegrity)
+ const SRIMetadata& aIntegrity,
+ mozilla::net::ReferrerPolicy aReferrerPolicy)
{
+ nsIURI* referrer = mDocument->GetDocumentURI();
+
if (aKind == ScriptKind::Classic) {
- return new ScriptLoadRequest(aKind, aElement, aVersion, aCORSMode,
- aIntegrity);
+ return new ScriptLoadRequest(aKind, aURI, aElement,
+ aVersion, aCORSMode,
+ aIntegrity,
+ referrer, aReferrerPolicy);
}
MOZ_ASSERT(aKind == ScriptKind::Module);
- return new ModuleLoadRequest(aElement, aVersion, aCORSMode, aIntegrity, this);
+ return new ModuleLoadRequest(aURI, aElement, aVersion, aCORSMode,
+ aIntegrity, referrer, aReferrerPolicy, this);
}
bool
@@ -1204,35 +1214,36 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
nsCOMPtr<nsIContent> scriptContent = do_QueryInterface(aElement);
+ nsAutoString type;
+ bool hasType = aElement->GetScriptType(type);
+
+ ScriptKind scriptKind = aElement->GetScriptIsModule() ?
+ ScriptKind::Module :
+ ScriptKind::Classic;
+
// Step 13. Check that the script is not an eventhandler
- if (IsScriptEventHandler(scriptContent)) {
+ if (IsScriptEventHandler(scriptKind, scriptContent)) {
return false;
}
JSVersion version = JSVERSION_DEFAULT;
- // Check the type attribute to determine language and version.
- // If type exists, it trumps the deprecated 'language='
- nsAutoString type;
- bool hasType = aElement->GetScriptType(type);
-
- ScriptKind scriptKind = ScriptKind::Classic;
- if (!type.IsEmpty()) {
- if (ModuleScriptsEnabled() && type.LowerCaseEqualsASCII("module")) {
- scriptKind = ScriptKind::Module;
- } else {
+ // For classic scripts, check the type attribute to determine language and
+ // version. If type exists, it trumps the deprecated 'language='
+ if (scriptKind == ScriptKind::Classic) {
+ if (!type.IsEmpty()) {
NS_ENSURE_TRUE(ParseTypeAttribute(type, &version), false);
- }
- } else if (!hasType) {
- // no 'type=' element
- // "language" is a deprecated attribute of HTML, so we check it only for
- // HTML script elements.
- if (scriptContent->IsHTMLElement()) {
- nsAutoString language;
- scriptContent->GetAttr(kNameSpaceID_None, nsGkAtoms::language, language);
- if (!language.IsEmpty()) {
- if (!nsContentUtils::IsJavaScriptLanguage(language)) {
- return false;
+ } else if (!hasType) {
+ // no 'type=' element
+ // "language" is a deprecated attribute of HTML, so we check it only for
+ // HTML script elements.
+ if (scriptContent->IsHTMLElement()) {
+ nsAutoString language;
+ scriptContent->GetAttr(kNameSpaceID_None, nsGkAtoms::language, language);
+ if (!language.IsEmpty()) {
+ if (!nsContentUtils::IsJavaScriptLanguage(language)) {
+ return false;
+ }
}
}
}
@@ -1242,7 +1253,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
// the nomodule attribute will be ignored".
// "The nomodule attribute must not be specified on module scripts (and will
// be ignored if it is)."
- if (ModuleScriptsEnabled() &&
+ if (mDocument->ModuleScriptsEnabled() &&
scriptKind == ScriptKind::Classic &&
scriptContent->IsHTMLElement() &&
scriptContent->HasAttr(kNameSpaceID_None, nsGkAtoms::nomodule)) {
@@ -1252,6 +1263,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
// Step 15. and later in the HTML5 spec
nsresult rv = NS_OK;
RefPtr<ScriptLoadRequest> request;
+ mozilla::net::ReferrerPolicy ourRefPolicy = mDocument->GetReferrerPolicy();
if (aElement->GetScriptExternal()) {
// external script
nsCOMPtr<nsIURI> scriptURI = aElement->GetScriptURI();
@@ -1264,7 +1276,6 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
}
// Double-check that the preload matches what we're asked to load now.
- mozilla::net::ReferrerPolicy ourRefPolicy = mDocument->GetReferrerPolicy();
CORSMode ourCORSMode = aElement->GetCORSMode();
nsTArray<PreloadInfo>::index_type i =
mPreloads.IndexOf(scriptURI.get(), 0, PreloadURIComparator());
@@ -1297,8 +1308,15 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
}
}
- if (!request) {
- // no usable preload
+ if (request) {
+ // Use a preload request.
+
+ // It's possible these attributes changed since we started the preload, so
+ // update them here.
+ request->SetScriptMode(aElement->GetScriptDeferred(),
+ aElement->GetScriptAsync());
+ } else {
+ // No usable preload found.
SRIMetadata sriMetadata;
{
@@ -1318,13 +1336,14 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
}
}
- request = CreateLoadRequest(scriptKind, aElement, version, ourCORSMode,
- sriMetadata);
- request->mURI = scriptURI;
+ request = CreateLoadRequest(scriptKind, scriptURI, aElement,
+ version, ourCORSMode, sriMetadata,
+ ourRefPolicy);
request->mIsInline = false;
- request->mReferrerPolicy = ourRefPolicy;
+ request->SetScriptMode(aElement->GetScriptDeferred(),
+ aElement->GetScriptAsync());
- // set aScriptFromHead to false so we don't treat non preloaded scripts as
+ // Set aScriptFromHead to false so we don't treat non-preloaded scripts as
// blockers for full page load. See bug 792438.
rv = StartLoad(request, type, false);
if (NS_FAILED(rv)) {
@@ -1342,18 +1361,15 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
request->mJSVersion = version;
- if (aElement->GetScriptAsync()) {
- request->mIsAsync = true;
+ if (request->IsAsyncScript()) {
+ AddAsyncRequest(request);
if (request->IsReadyToRun()) {
- mLoadedAsyncRequests.AppendElement(request);
// The script is available already. Run it ASAP when the event
// loop gets a chance to spin.
// KVKV TODO: Instead of processing immediately, try off-thread-parsing
// it and only schedule a pending ProcessRequest if that fails.
ProcessPendingRequestsAsync();
- } else {
- mLoadingAsyncRequests.AppendElement(request);
}
return false;
}
@@ -1372,7 +1388,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
}
// we now have a parser-inserted request that may or may not be still
// loading
- if (aElement->GetScriptDeferred() || request->IsModuleRequest()) {
+ if (request->IsDeferredScript()) {
// We don't want to run this yet.
// If we come here, the script is a parser-created script and it has
// the defer attribute but not the async attribute. Since a
@@ -1440,31 +1456,36 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
return false;
}
- // Inline scripts ignore ther CORS mode and are always CORS_NONE
- request = CreateLoadRequest(scriptKind, aElement, version, CORS_NONE,
- SRIMetadata()); // SRI doesn't apply
+ // 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
+ ourRefPolicy);
request->mJSVersion = version;
request->mIsInline = true;
- request->mURI = mDocument->GetDocumentURI();
request->mLineNo = aElement->GetScriptLineNumber();
+ // Only the 'async' attribute is heeded on an inline module script and
+ // inline classic scripts ignore both these attributes.
+ MOZ_ASSERT(!aElement->GetScriptDeferred());
+ MOZ_ASSERT_IF(!request->IsModuleRequest(), !aElement->GetScriptAsync());
+ request->SetScriptMode(false, aElement->GetScriptAsync());
+
if (request->IsModuleRequest()) {
ModuleLoadRequest* modReq = request->AsModuleRequest();
modReq->mBaseURL = mDocument->GetDocBaseURI();
- rv = CreateModuleScript(modReq);
- MOZ_ASSERT(NS_FAILED(rv) == !modReq->mModuleScript);
- if (NS_FAILED(rv)) {
- modReq->LoadFailed();
- return false;
- }
+
if (aElement->GetScriptAsync()) {
- mLoadingAsyncRequests.AppendElement(request);
+ AddAsyncRequest(modReq);
} else {
- AddDeferRequest(request);
+ AddDeferRequest(modReq);
}
- if (!modReq->mModuleScript->IsErrored()) {
- StartFetchingModuleDependencies(modReq);
+
+ nsresult rv = ProcessFetchedModuleSource(modReq);
+ if (NS_FAILED(rv)) {
+ HandleLoadError(modReq, rv);
}
+
return false;
}
request->mProgress = ScriptLoadRequest::Progress::Ready;
@@ -1943,8 +1964,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) {
@@ -1958,17 +1977,19 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
}
if (aRequest->IsModuleRequest()) {
- rv = EnsureModuleResolveHook(cx);
- NS_ENSURE_SUCCESS(rv, rv);
+ // For modules, currentScript is set to null.
+ AutoCurrentScriptUpdater scriptUpdater(this, nullptr);
+
+ EnsureModuleResolveHook(cx);
ModuleLoadRequest* request = aRequest->AsModuleRequest();
MOZ_ASSERT(request->mModuleScript);
MOZ_ASSERT(!request->mOffThreadToken);
ModuleScript* moduleScript = request->mModuleScript;
- if (moduleScript->IsErrored()) {
- // Module has an error status
- JS::Rooted<JS::Value> error(cx, moduleScript->Error());
+ if (moduleScript->HasErrorToRethrow()) {
+ // Module has an error status to be rethrown
+ JS::Rooted<JS::Value> error(cx, moduleScript->ErrorToRethrow());
JS_SetPendingException(cx, error);
return NS_OK; // An error is reported by AutoEntryScript.
}
@@ -1983,6 +2004,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);
@@ -2236,19 +2260,41 @@ ScriptLoader::OnStreamComplete(nsIIncrementalStreamLoader* aLoader,
nsresult aChannelStatus,
nsresult aSRIStatus,
mozilla::Vector<char16_t> &aString,
- mozilla::dom::SRICheckDataVerifier* aSRIDataVerifier)
+ SRICheckDataVerifier* aSRIDataVerifier)
{
ScriptLoadRequest* request = static_cast<ScriptLoadRequest*>(aContext);
NS_ASSERTION(request, "null request in stream complete handler");
NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
+ nsresult rv = VerifySRI(request, aLoader, aSRIStatus, aSRIDataVerifier);
+
+ if (NS_SUCCEEDED(rv)) {
+ rv = PrepareLoadedRequest(request, aLoader, aChannelStatus, aString);
+ }
+
+ if (NS_FAILED(rv)) {
+ HandleLoadError(request, rv);
+ }
+
+ // Process our request and/or any pending ones
+ ProcessPendingRequests();
+
+ return NS_OK;
+}
+
+nsresult
+ScriptLoader::VerifySRI(ScriptLoadRequest* aRequest,
+ nsIIncrementalStreamLoader* aLoader,
+ nsresult aSRIStatus,
+ SRICheckDataVerifier* aSRIDataVerifier) const
+{
nsCOMPtr<nsIRequest> channelRequest;
aLoader->GetRequest(getter_AddRefs(channelRequest));
nsCOMPtr<nsIChannel> channel;
channel = do_QueryInterface(channelRequest);
nsresult rv = NS_OK;
- if (!request->mIntegrity.IsEmpty() &&
+ if (!aRequest->mIntegrity.IsEmpty() &&
NS_SUCCEEDED((rv = aSRIStatus))) {
MOZ_ASSERT(aSRIDataVerifier);
MOZ_ASSERT(mReporter);
@@ -2257,7 +2303,7 @@ ScriptLoader::OnStreamComplete(nsIIncrementalStreamLoader* aLoader,
if (mDocument && mDocument->GetDocumentURI()) {
mDocument->GetDocumentURI()->GetAsciiSpec(sourceUri);
}
- rv = aSRIDataVerifier->Verify(request->mIntegrity, channel, sourceUri,
+ rv = aSRIDataVerifier->Verify(aRequest->mIntegrity, channel, sourceUri,
mReporter);
mReporter->FlushConsoleReports(mDocument);
if (NS_FAILED(rv)) {
@@ -2273,7 +2319,7 @@ ScriptLoader::OnStreamComplete(nsIIncrementalStreamLoader* aLoader,
loadInfo->LoadingPrincipal()->GetCsp(getter_AddRefs(csp));
nsAutoCString violationURISpec;
mDocument->GetDocumentURI()->GetAsciiSpec(violationURISpec);
- uint32_t lineNo = request->mElement ? request->mElement->GetScriptLineNumber() : 0;
+ uint32_t lineNo = aRequest->mElement ? aRequest->mElement->GetScriptLineNumber() : 0;
csp->LogViolationDetails(
nsIContentSecurityPolicy::VIOLATION_TYPE_REQUIRE_SRI_FOR_SCRIPT,
NS_ConvertUTF8toUTF16(violationURISpec),
@@ -2281,78 +2327,79 @@ ScriptLoader::OnStreamComplete(nsIIncrementalStreamLoader* aLoader,
rv = NS_ERROR_SRI_CORRUPT;
}
}
+
+ return rv;
+}
- if (NS_SUCCEEDED(rv)) {
- rv = PrepareLoadedRequest(request, aLoader, aChannelStatus, aString);
+void
+ScriptLoader::HandleLoadError(ScriptLoadRequest *aRequest, nsresult aResult) {
+ /*
+ * Handle script not loading error because source was a tracking URL.
+ * We make a note of this script node by including it in a dedicated
+ * array of blocked tracking nodes under its parent document.
+ */
+ if (aResult == NS_ERROR_TRACKING_URI) {
+ nsCOMPtr<nsIContent> cont = do_QueryInterface(aRequest->mElement);
+ mDocument->AddBlockedTrackingNode(cont);
}
- if (NS_FAILED(rv)) {
- /*
- * Handle script not loading error because source was a tracking URL.
- * We make a note of this script node by including it in a dedicated
- * array of blocked tracking nodes under its parent document.
- */
- if (rv == NS_ERROR_TRACKING_URI) {
- nsCOMPtr<nsIContent> cont = do_QueryInterface(request->mElement);
- mDocument->AddBlockedTrackingNode(cont);
- }
-
- if (request->mIsDefer) {
- MOZ_ASSERT_IF(request->IsModuleRequest(),
- request->AsModuleRequest()->IsTopLevel());
- if (request->isInList()) {
- RefPtr<ScriptLoadRequest> req = mDeferRequests.Steal(request);
- FireScriptAvailable(rv, req);
- }
- } else if (request->mIsAsync) {
- MOZ_ASSERT_IF(request->IsModuleRequest(),
- request->AsModuleRequest()->IsTopLevel());
- if (request->isInList()) {
- RefPtr<ScriptLoadRequest> req = mLoadingAsyncRequests.Steal(request);
- FireScriptAvailable(rv, req);
- }
- } else if (request->mIsNonAsyncScriptInserted) {
- if (request->isInList()) {
- RefPtr<ScriptLoadRequest> req =
- mNonAsyncExternalScriptInsertedRequests.Steal(request);
- FireScriptAvailable(rv, req);
- }
- } else if (request->mIsXSLT) {
- if (request->isInList()) {
- RefPtr<ScriptLoadRequest> req = mXSLTRequests.Steal(request);
- FireScriptAvailable(rv, req);
- }
- } else if (request->IsModuleRequest()) {
- ModuleLoadRequest* modReq = request->AsModuleRequest();
- MOZ_ASSERT(!modReq->IsTopLevel());
- MOZ_ASSERT(!modReq->isInList());
- modReq->Cancel();
- FireScriptAvailable(rv, request);
- } else if (mParserBlockingRequest == request) {
- MOZ_ASSERT(!request->isInList());
- mParserBlockingRequest = nullptr;
- UnblockParser(request);
-
- // Ensure that we treat request->mElement as our current parser-inserted
- // script while firing onerror on it.
- MOZ_ASSERT(request->mElement->GetParserCreated());
- nsCOMPtr<nsIScriptElement> oldParserInsertedScript =
- mCurrentParserInsertedScript;
- mCurrentParserInsertedScript = request->mElement;
- FireScriptAvailable(rv, request);
- ContinueParserAsync(request);
- mCurrentParserInsertedScript = oldParserInsertedScript;
- } else {
- mPreloads.RemoveElement(request, PreloadRequestComparator());
- }
+ if (aRequest->IsModuleRequest() && !aRequest->mIsInline) {
+ auto request = aRequest->AsModuleRequest();
+ SetModuleFetchFinishedAndResumeWaitingRequests(request, aResult);
}
- // Process our request and/or any pending ones
- ProcessPendingRequests();
+ if (aRequest->mInDeferList) {
+ MOZ_ASSERT_IF(aRequest->IsModuleRequest(),
+ aRequest->AsModuleRequest()->IsTopLevel());
+ if (aRequest->isInList()) {
+ RefPtr<ScriptLoadRequest> req = mDeferRequests.Steal(aRequest);
+ FireScriptAvailable(aResult, req);
+ }
+ } else if (aRequest->mInAsyncList) {
+ MOZ_ASSERT_IF(aRequest->IsModuleRequest(),
+ aRequest->AsModuleRequest()->IsTopLevel());
+ if (aRequest->isInList()) {
+ RefPtr<ScriptLoadRequest> req = mLoadingAsyncRequests.Steal(aRequest);
+ FireScriptAvailable(aResult, req);
+ }
+ } else if (aRequest->mIsNonAsyncScriptInserted) {
+ if (aRequest->isInList()) {
+ RefPtr<ScriptLoadRequest> req =
+ mNonAsyncExternalScriptInsertedRequests.Steal(aRequest);
+ FireScriptAvailable(aResult, req);
+ }
+ } else if (aRequest->mIsXSLT) {
+ if (aRequest->isInList()) {
+ RefPtr<ScriptLoadRequest> req = mXSLTRequests.Steal(aRequest);
+ FireScriptAvailable(aResult, req);
+ }
+ } else if (aRequest->IsModuleRequest()) {
+ ModuleLoadRequest* modReq = aRequest->AsModuleRequest();
+ MOZ_ASSERT(!modReq->IsTopLevel());
+ MOZ_ASSERT(!modReq->isInList());
+ modReq->Cancel();
+ // A single error is fired for the top level module, so don't use
+ // FireScriptAvailable here.
+ } else if (mParserBlockingRequest == aRequest) {
+ MOZ_ASSERT(!aRequest->isInList());
+ mParserBlockingRequest = nullptr;
+ UnblockParser(aRequest);
- return NS_OK;
+ // Ensure that we treat request->mElement as our current parser-inserted
+ // script while firing onerror on it.
+ MOZ_ASSERT(aRequest->mElement->GetParserCreated());
+ nsCOMPtr<nsIScriptElement> oldParserInsertedScript =
+ mCurrentParserInsertedScript;
+ mCurrentParserInsertedScript = aRequest->mElement;
+ FireScriptAvailable(aResult, aRequest);
+ ContinueParserAsync(aRequest);
+ mCurrentParserInsertedScript = oldParserInsertedScript;
+ } else {
+ mPreloads.RemoveElement(aRequest, PreloadRequestComparator());
+ }
}
+
void
ScriptLoader::UnblockParser(ScriptLoadRequest* aParserBlockingRequest)
{
@@ -2377,23 +2424,6 @@ ScriptLoader::NumberOfProcessors()
return mNumberOfProcessors;
}
-void
-ScriptLoader::MaybeMoveToLoadedList(ScriptLoadRequest* aRequest)
-{
- MOZ_ASSERT(aRequest->IsReadyToRun());
-
- // If it's async, move it to the loaded list. aRequest->mIsAsync really
- // _should_ be in a list, but the consequences if it's not are bad enough we
- // want to avoid trying to move it if it's not.
- if (aRequest->mIsAsync) {
- MOZ_ASSERT(aRequest->isInList());
- if (aRequest->isInList()) {
- RefPtr<ScriptLoadRequest> req = mLoadingAsyncRequests.Steal(aRequest);
- mLoadedAsyncRequests.AppendElement(req);
- }
- }
-}
-
nsresult
ScriptLoader::PrepareLoadedRequest(ScriptLoadRequest* aRequest,
nsIIncrementalStreamLoader* aLoader,
@@ -2440,10 +2470,10 @@ ScriptLoader::PrepareLoadedRequest(ScriptLoadRequest* aRequest,
}
nsCOMPtr<nsIChannel> channel = do_QueryInterface(req);
- // If this load was subject to a CORS check; don't flag it with a
- // separate origin principal, so that it will treat our document's
- // principal as the origin principal
- if (aRequest->mCORSMode == CORS_NONE) {
+ // If this load was subject to a CORS check, don't flag it with a separate
+ // origin principal, so that it will treat our document's principal as the
+ // origin principal. Module loads always use CORS.
+ if (!aRequest->IsModuleRequest() && aRequest->mCORSMode == CORS_NONE) {
rv = nsContentUtils::GetSecurityManager()->
GetChannelResultPrincipal(channel, getter_AddRefs(aRequest->mOriginPrincipal));
NS_ENSURE_SUCCESS(rv, rv);
@@ -2546,11 +2576,15 @@ ScriptLoader::ParsingComplete(bool aTerminated)
}
void
-ScriptLoader::PreloadURI(nsIURI *aURI, const nsAString &aCharset,
+ScriptLoader::PreloadURI(nsIURI *aURI,
+ const nsAString &aCharset,
const nsAString &aType,
const nsAString &aCrossOrigin,
const nsAString& aIntegrity,
bool aScriptFromHead,
+ bool aAsync,
+ bool aDefer,
+ bool aNoModule,
const mozilla::net::ReferrerPolicy aReferrerPolicy)
{
NS_ENSURE_TRUE_VOID(mDocument);
@@ -2559,9 +2593,16 @@ ScriptLoader::PreloadURI(nsIURI *aURI, const nsAString &aCharset,
return;
}
- // TODO: Preload module scripts.
- if (ModuleScriptsEnabled() && aType.LowerCaseEqualsASCII("module")) {
- return;
+ if (mDocument->ModuleScriptsEnabled()) {
+ // Don't load nomodule scripts.
+ if (aNoModule) {
+ return;
+ }
+
+ // TODO: Preload module scripts.
+ if (aType.LowerCaseEqualsASCII("module")) {
+ return;
+ }
}
SRIMetadata sriMetadata;
@@ -2577,11 +2618,11 @@ ScriptLoader::PreloadURI(nsIURI *aURI, const nsAString &aCharset,
}
RefPtr<ScriptLoadRequest> request =
- CreateLoadRequest(ScriptKind::Classic, nullptr, 0,
- Element::StringToCORSMode(aCrossOrigin), sriMetadata);
- request->mURI = aURI;
+ CreateLoadRequest(ScriptKind::Classic, aURI, nullptr, 0,
+ Element::StringToCORSMode(aCrossOrigin), sriMetadata,
+ aReferrerPolicy);
request->mIsInline = false;
- request->mReferrerPolicy = aReferrerPolicy;
+ request->SetScriptMode(aDefer, aAsync);
nsresult rv = StartLoad(request, aType, aScriptFromHead);
if (NS_FAILED(rv)) {
@@ -2596,7 +2637,10 @@ ScriptLoader::PreloadURI(nsIURI *aURI, const nsAString &aCharset,
void
ScriptLoader::AddDeferRequest(ScriptLoadRequest* aRequest)
{
- aRequest->mIsDefer = true;
+ MOZ_ASSERT(aRequest->IsDeferredScript());
+ MOZ_ASSERT(!aRequest->mInDeferList && !aRequest->mInAsyncList);
+
+ aRequest->mInDeferList = true;
mDeferRequests.AppendElement(aRequest);
if (mDeferEnabled && aRequest == mDeferRequests.getFirst() &&
mDocument && !mBlockingDOMContentLoaded) {
@@ -2606,6 +2650,37 @@ ScriptLoader::AddDeferRequest(ScriptLoadRequest* aRequest)
}
}
+void
+ScriptLoader::AddAsyncRequest(ScriptLoadRequest* aRequest)
+{
+ MOZ_ASSERT(aRequest->IsAsyncScript());
+ MOZ_ASSERT(!aRequest->mInDeferList && !aRequest->mInAsyncList);
+
+ aRequest->mInAsyncList = true;
+ if (aRequest->IsReadyToRun()) {
+ mLoadedAsyncRequests.AppendElement(aRequest);
+ } else {
+ mLoadingAsyncRequests.AppendElement(aRequest);
+ }
+}
+
+void
+ScriptLoader::MaybeMoveToLoadedList(ScriptLoadRequest* aRequest)
+{
+ MOZ_ASSERT(aRequest->IsReadyToRun());
+
+ // If it's async, move it to the loaded list. aRequest->mInAsyncList really
+ // _should_ be in a list, but the consequences if it's not are bad enough we
+ // want to avoid trying to move it if it's not.
+ if (aRequest->mInAsyncList) {
+ MOZ_ASSERT(aRequest->isInList());
+ if (aRequest->isInList()) {
+ RefPtr<ScriptLoadRequest> req = mLoadingAsyncRequests.Steal(aRequest);
+ mLoadedAsyncRequests.AppendElement(req);
+ }
+ }
+}
+
bool
ScriptLoader::MaybeRemovedDeferRequests()
{
diff --git a/dom/script/ScriptLoader.h b/dom/script/ScriptLoader.h
index e6b75bf3b..20e76970f 100644
--- a/dom/script/ScriptLoader.h
+++ b/dom/script/ScriptLoader.h
@@ -62,17 +62,21 @@ protected:
public:
ScriptLoadRequest(ScriptKind aKind,
+ nsIURI* aURI,
nsIScriptElement* aElement,
uint32_t aVersion,
mozilla::CORSMode aCORSMode,
- const mozilla::dom::SRIMetadata &aIntegrity)
+ const SRIMetadata& aIntegrity,
+ nsIURI* aReferrer,
+ mozilla::net::ReferrerPolicy aReferrerPolicy)
: mKind(aKind),
mElement(aElement),
mProgress(Progress::Loading),
+ mScriptMode(ScriptMode::eBlocking),
mIsInline(true),
mHasSourceMapURL(false),
- mIsDefer(false),
- mIsAsync(false),
+ mInDeferList(false),
+ mInAsyncList(false),
mIsNonAsyncScriptInserted(false),
mIsXSLT(false),
mIsCanceled(false),
@@ -81,10 +85,12 @@ public:
mScriptTextBuf(nullptr),
mScriptTextLength(0),
mJSVersion(aVersion),
+ mURI(aURI),
mLineNo(1),
mCORSMode(aCORSMode),
mIntegrity(aIntegrity),
- mReferrerPolicy(mozilla::net::RP_Default)
+ mReferrer(aReferrer),
+ mReferrerPolicy(aReferrerPolicy)
{
}
@@ -100,7 +106,8 @@ public:
void FireScriptAvailable(nsresult aResult)
{
- mElement->ScriptAvailable(aResult, mElement, mIsInline, mURI, mLineNo);
+ bool isInlineClassicScript = mIsInline && !IsModuleRequest();
+ mElement->ScriptAvailable(aResult, mElement, isInlineClassicScript, mURI, mLineNo);
}
void FireScriptEvaluated(nsresult aResult)
{
@@ -143,6 +150,29 @@ public:
(IsReadyToRun() && mWasCompiledOMT);
}
+ enum class ScriptMode : uint8_t {
+ eBlocking,
+ eDeferred,
+ eAsync
+ };
+
+ void SetScriptMode(bool aDeferAttr, bool aAsyncAttr);
+
+ bool IsBlockingScript() const
+ {
+ return mScriptMode == ScriptMode::eBlocking;
+ }
+
+ bool IsDeferredScript() const
+ {
+ return mScriptMode == ScriptMode::eDeferred;
+ }
+
+ bool IsAsyncScript() const
+ {
+ return mScriptMode == ScriptMode::eAsync;
+ }
+
void MaybeCancelOffThreadScript();
using super::getNext;
@@ -151,10 +181,11 @@ public:
const ScriptKind mKind;
nsCOMPtr<nsIScriptElement> mElement;
Progress mProgress; // Are we still waiting for a load to complete?
+ ScriptMode mScriptMode; // Whether this script is blocking, deferred or async.
bool mIsInline; // Is the script inline or loaded?
bool mHasSourceMapURL; // Does the HTTP header have a source map url?
- bool mIsDefer; // True if we live in mDeferRequests.
- bool mIsAsync; // True if we live in mLoadingAsyncRequests or mLoadedAsyncRequests.
+ bool mInDeferList; // True if we live in mDeferRequests.
+ bool mInAsyncList; // True if we live in mLoadingAsyncRequests or mLoadedAsyncRequests.
bool mIsNonAsyncScriptInserted; // True if we live in mNonAsyncExternalScriptInsertedRequests
bool mIsXSLT; // True if we live in mXSLTRequests.
bool mIsCanceled; // True if we have been explicitly canceled.
@@ -164,13 +195,14 @@ public:
char16_t* mScriptTextBuf; // Holds script text for non-inline scripts. Don't
size_t mScriptTextLength; // use nsString so we can give ownership to jsapi.
uint32_t mJSVersion;
- nsCOMPtr<nsIURI> mURI;
+ const nsCOMPtr<nsIURI> mURI;
nsCOMPtr<nsIPrincipal> mOriginPrincipal;
nsAutoCString mURL; // Keep the URI's filename alive during off thread parsing.
int32_t mLineNo;
const mozilla::CORSMode mCORSMode;
- const mozilla::dom::SRIMetadata mIntegrity;
- mozilla::net::ReferrerPolicy mReferrerPolicy;
+ const SRIMetadata mIntegrity;
+ const nsCOMPtr<nsIURI> mReferrer;
+ const mozilla::net::ReferrerPolicy mReferrerPolicy;
};
class ScriptLoadRequestList : private mozilla::LinkedList<ScriptLoadRequest>
@@ -447,11 +479,15 @@ public:
* @param aIntegrity The expect hash url, if avail, of the request
* @param aScriptFromHead Whether or not the script was a child of head
*/
- virtual void PreloadURI(nsIURI *aURI, const nsAString &aCharset,
+ virtual void PreloadURI(nsIURI *aURI,
+ const nsAString &aCharset,
const nsAString &aType,
const nsAString &aCrossOrigin,
const nsAString& aIntegrity,
bool aScriptFromHead,
+ bool aAsync,
+ bool aDefer,
+ bool aNoModule,
const mozilla::net::ReferrerPolicy aReferrerPolicy);
/**
@@ -467,12 +503,13 @@ public:
private:
virtual ~ScriptLoader();
- ScriptLoadRequest* CreateLoadRequest(
- ScriptKind aKind,
- nsIScriptElement* aElement,
- uint32_t aVersion,
- mozilla::CORSMode aCORSMode,
- const mozilla::dom::SRIMetadata &aIntegrity);
+ ScriptLoadRequest* CreateLoadRequest(ScriptKind aKind,
+ nsIURI* aURI,
+ nsIScriptElement* aElement,
+ uint32_t aVersion,
+ mozilla::CORSMode aCORSMode,
+ const SRIMetadata& aIntegrity,
+ mozilla::net::ReferrerPolicy aReferrerPolicy);
/**
* Unblocks the creator parser of the parser-blocking scripts.
@@ -500,6 +537,8 @@ private:
nsresult StartLoad(ScriptLoadRequest *aRequest, const nsAString &aType,
bool aScriptFromHead);
+ void HandleLoadError(ScriptLoadRequest *aRequest, nsresult aResult);
+
/**
* Process any pending requests asynchronously (i.e. off an event) if there
* are any. Note that this is a no-op if there aren't any currently pending
@@ -534,6 +573,11 @@ private:
return mEnabled && !mBlockerCount;
}
+ nsresult VerifySRI(ScriptLoadRequest *aRequest,
+ nsIIncrementalStreamLoader* aLoader,
+ nsresult aSRIStatus,
+ SRICheckDataVerifier* aSRIDataVerifier) const;
+
nsresult AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest);
nsresult ProcessRequest(ScriptLoadRequest* aRequest);
nsresult CompileOffThreadOrProcessRequest(ScriptLoadRequest* aRequest);
@@ -556,6 +600,7 @@ private:
mozilla::Vector<char16_t> &aString);
void AddDeferRequest(ScriptLoadRequest* aRequest);
+ void AddAsyncRequest(ScriptLoadRequest* aRequest);
bool MaybeRemovedDeferRequests();
void MaybeMoveToLoadedList(ScriptLoadRequest* aRequest);
@@ -563,30 +608,30 @@ private:
JS::SourceBufferHolder GetScriptSource(ScriptLoadRequest* aRequest,
nsAutoString& inlineData);
- bool ModuleScriptsEnabled();
-
void SetModuleFetchStarted(ModuleLoadRequest *aRequest);
void SetModuleFetchFinishedAndResumeWaitingRequests(ModuleLoadRequest *aRequest,
nsresult aResult);
bool IsFetchingModule(ModuleLoadRequest *aRequest) const;
- bool ModuleMapContainsModule(ModuleLoadRequest *aRequest) const;
- RefPtr<mozilla::GenericPromise> WaitForModuleFetch(ModuleLoadRequest *aRequest);
+ bool ModuleMapContainsURL(nsIURI* aURL) const;
+ RefPtr<mozilla::GenericPromise> WaitForModuleFetch(nsIURI* aURL);
ModuleScript* GetFetchedModule(nsIURI* aURL) const;
- friend bool
- HostResolveImportedModule(JSContext* aCx, unsigned argc, JS::Value* vp);
+ friend JSObject*
+ HostResolveImportedModule(JSContext* aCx, JS::Handle<JSObject*> aModule,
+ JS::Handle<JSString*> aSpecifier);
nsresult CreateModuleScript(ModuleLoadRequest* aRequest);
nsresult ProcessFetchedModuleSource(ModuleLoadRequest* aRequest);
void CheckModuleDependenciesLoaded(ModuleLoadRequest* aRequest);
void ProcessLoadedModuleTree(ModuleLoadRequest* aRequest);
+ JS::Value FindFirstParseError(ModuleLoadRequest* aRequest);
bool InstantiateModuleTree(ModuleLoadRequest* aRequest);
void StartFetchingModuleDependencies(ModuleLoadRequest* aRequest);
RefPtr<mozilla::GenericPromise>
- StartFetchingModuleAndDependencies(ModuleLoadRequest* aRequest, nsIURI* aURI);
+ StartFetchingModuleAndDependencies(ModuleLoadRequest* aParent, nsIURI* aURI);
nsIDocument* mDocument; // [WEAK]
nsCOMArray<nsIScriptLoaderObserver> mObservers;
diff --git a/dom/script/nsIScriptElement.h b/dom/script/nsIScriptElement.h
index 470d51c94..e3e1bc49a 100644
--- a/dom/script/nsIScriptElement.h
+++ b/dom/script/nsIScriptElement.h
@@ -13,6 +13,7 @@
#include "nsIScriptLoaderObserver.h"
#include "nsWeakPtr.h"
#include "nsIParser.h"
+#include "nsIDocument.h"
#include "nsContentCreatorFunctions.h"
#include "nsIDOMHTMLScriptElement.h"
#include "mozilla/CORSMode.h"
@@ -37,6 +38,7 @@ public:
mForceAsync(aFromParser == mozilla::dom::NOT_FROM_PARSER ||
aFromParser == mozilla::dom::FROM_PARSER_FRAGMENT),
mFrozen(false),
+ mIsModule(false),
mDefer(false),
mAsync(false),
mExternal(false),
@@ -73,11 +75,25 @@ public:
virtual void GetScriptCharset(nsAString& charset) = 0;
/**
- * Freezes the return values of GetScriptDeferred(), GetScriptAsync() and
- * GetScriptURI() so that subsequent modifications to the attributes don't
- * change execution behavior.
+ * Freezes the return values of the following methods so that subsequent
+ * modifications to the attributes don't change execution behavior:
+ * - GetScriptIsModule()
+ * - GetScriptDeferred()
+ * - GetScriptAsync()
+ * - GetScriptURI()
+ * - GetScriptExternal()
*/
- virtual void FreezeUriAsyncDefer() = 0;
+ virtual void FreezeExecutionAttrs(nsIDocument* aOwnerDoc) = 0;
+
+ /**
+ * Is the script a module script?
+ * Currently only supported by HTML scripts.
+ */
+ bool GetScriptIsModule()
+ {
+ NS_PRECONDITION(mFrozen, "Execution attributes not yet frozen: Not ready for this call!");
+ return mIsModule;
+ }
/**
* Is the script deferred. Currently only supported by HTML scripts.
@@ -293,6 +309,11 @@ protected:
bool mFrozen;
/**
+ * The effective moduleness.
+ */
+ bool mIsModule;
+
+ /**
* The effective deferredness.
*/
bool mDefer;
diff --git a/dom/script/nsIScriptLoaderObserver.idl b/dom/script/nsIScriptLoaderObserver.idl
index ed7196525..880738360 100644
--- a/dom/script/nsIScriptLoaderObserver.idl
+++ b/dom/script/nsIScriptLoaderObserver.idl
@@ -20,15 +20,16 @@ interface nsIScriptLoaderObserver : nsISupports {
* a script. If this is a failure code, script evaluation
* will not occur.
* @param aElement The element being processed.
- * @param aIsInline Is this an inline script or externally loaded?
+ * @param aIsInline Is this an inline classic script (as opposed to an
+ * externally loaded classic script or module script)?
* @param aURI What is the URI of the script (the document URI if
* it is inline).
* @param aLineNo At what line does the script appear (generally 1
* if it is a loaded script).
*/
- void scriptAvailable(in nsresult aResult,
+ void scriptAvailable(in nsresult aResult,
in nsIScriptElement aElement,
- in boolean aIsInline,
+ in boolean aIsInlineClassicScript,
in nsIURI aURI,
in int32_t aLineNo);
@@ -40,7 +41,7 @@ interface nsIScriptLoaderObserver : nsISupports {
* @param aElement The element being processed.
* @param aIsInline Is this an inline script or externally loaded?
*/
- void scriptEvaluated(in nsresult aResult,
+ void scriptEvaluated(in nsresult aResult,
in nsIScriptElement aElement,
in boolean aIsInline);
diff --git a/dom/svg/SVGScriptElement.cpp b/dom/svg/SVGScriptElement.cpp
index 7adce2f46..9a4afb13a 100644
--- a/dom/svg/SVGScriptElement.cpp
+++ b/dom/svg/SVGScriptElement.cpp
@@ -137,7 +137,7 @@ SVGScriptElement::GetScriptCharset(nsAString& charset)
}
void
-SVGScriptElement::FreezeUriAsyncDefer()
+SVGScriptElement::FreezeExecutionAttrs(nsIDocument* aOwnerDoc)
{
if (mFrozen) {
return;
diff --git a/dom/svg/SVGScriptElement.h b/dom/svg/SVGScriptElement.h
index 79a3de70d..8ee94bf02 100644
--- a/dom/svg/SVGScriptElement.h
+++ b/dom/svg/SVGScriptElement.h
@@ -44,7 +44,7 @@ public:
virtual bool GetScriptType(nsAString& type) override;
virtual void GetScriptText(nsAString& text) override;
virtual void GetScriptCharset(nsAString& charset) override;
- virtual void FreezeUriAsyncDefer() override;
+ virtual void FreezeExecutionAttrs(nsIDocument* aOwnerDoc) override;
virtual CORSMode GetCORSMode() const override;
// ScriptElement
diff --git a/dom/xslt/xslt/txMozillaXMLOutput.cpp b/dom/xslt/xslt/txMozillaXMLOutput.cpp
index 704d8ac11..21b3c228f 100644
--- a/dom/xslt/xslt/txMozillaXMLOutput.cpp
+++ b/dom/xslt/xslt/txMozillaXMLOutput.cpp
@@ -955,7 +955,7 @@ NS_IMPL_ISUPPORTS(txTransformNotifier,
NS_IMETHODIMP
txTransformNotifier::ScriptAvailable(nsresult aResult,
nsIScriptElement *aElement,
- bool aIsInline,
+ bool aIsInlineClassicScript,
nsIURI *aURI,
int32_t aLineNo)
{
diff --git a/js/public/Class.h b/js/public/Class.h
index 3d73bce44..f4fa9ccaf 100644
--- a/js/public/Class.h
+++ b/js/public/Class.h
@@ -779,7 +779,7 @@ struct JSClass {
// application.
#define JSCLASS_GLOBAL_APPLICATION_SLOTS 5
#define JSCLASS_GLOBAL_SLOT_COUNT \
- (JSCLASS_GLOBAL_APPLICATION_SLOTS + JSProto_LIMIT * 2 + 46)
+ (JSCLASS_GLOBAL_APPLICATION_SLOTS + JSProto_LIMIT * 2 + 45)
#define JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(n) \
(JSCLASS_IS_GLOBAL | JSCLASS_HAS_RESERVED_SLOTS(JSCLASS_GLOBAL_SLOT_COUNT + (n)))
#define JSCLASS_GLOBAL_FLAGS \
diff --git a/js/src/builtin/Module.js b/js/src/builtin/Module.js
index 64d62d216..355303d44 100644
--- a/js/src/builtin/Module.js
+++ b/js/src/builtin/Module.js
@@ -67,10 +67,16 @@ function ModuleGetExportedNames(exportStarSet = [])
function ModuleSetStatus(module, newStatus)
{
- assert(newStatus >= MODULE_STATUS_ERRORED && newStatus <= MODULE_STATUS_EVALUATED,
+ assert(newStatus >= MODULE_STATUS_UNINSTANTIATED &&
+ newStatus <= MODULE_STATUS_EVALUATED_ERROR,
"Bad new module status in ModuleSetStatus");
- if (newStatus !== MODULE_STATUS_ERRORED)
- assert(newStatus > module.status, "New module status inconsistent with current status");
+
+ // Note that under OOM conditions we can fail the module instantiation
+ // process even after modules have been marked as instantiated.
+ assert((module.status <= MODULE_STATUS_INSTANTIATED &&
+ newStatus === MODULE_STATUS_UNINSTANTIATED) ||
+ newStatus > module.status,
+ "New module status inconsistent with current status");
UnsafeSetReservedSlot(module, MODULE_OBJECT_STATUS_SLOT, newStatus);
}
@@ -80,20 +86,15 @@ function ModuleSetStatus(module, newStatus)
// Returns an object describing the location of the resolved export or
// indicating a failure.
//
-// On success this returns: { resolved: true, module, bindingName }
-//
-// There are three failure cases:
+// On success this returns a resolved binding record: { module, bindingName }
//
-// - The resolution failure can be blamed on a particular module.
-// Returns: { resolved: false, module, ambiguous: false }
+// There are two failure cases:
//
-// - No culprit can be determined and the resolution failure was due to star
-// export ambiguity.
-// Returns: { resolved: false, module: null, ambiguous: true }
+// - If no definition was found or the request is found to be circular, *null*
+// is returned.
//
-// - No culprit can be determined and the resolution failure was not due to
-// star export ambiguity.
-// Returns: { resolved: false, module: null, ambiguous: false }
+// - If the request is found to be ambiguous, the string `"ambiguous"` is
+// returned.
//
function ModuleResolveExport(exportName, resolveSet = [])
{
@@ -106,53 +107,47 @@ function ModuleResolveExport(exportName, resolveSet = [])
let module = this;
// Step 2
- assert(module.status !== MODULE_STATUS_ERRORED, "Bad module status in ResolveExport");
-
- // Step 3
for (let i = 0; i < resolveSet.length; i++) {
let r = resolveSet[i];
if (r.module === module && r.exportName === exportName) {
// This is a circular import request.
- return {resolved: false, module: null, ambiguous: false};
+ return null;
}
}
- // Step 4
+ // Step 3
_DefineDataProperty(resolveSet, resolveSet.length, {module: module, exportName: exportName});
- // Step 5
+ // Step 4
let localExportEntries = module.localExportEntries;
for (let i = 0; i < localExportEntries.length; i++) {
let e = localExportEntries[i];
if (exportName === e.exportName)
- return {resolved: true, module, bindingName: e.localName};
+ return {module, bindingName: e.localName};
}
- // Step 6
+ // Step 5
let indirectExportEntries = module.indirectExportEntries;
for (let i = 0; i < indirectExportEntries.length; i++) {
let e = indirectExportEntries[i];
if (exportName === e.exportName) {
let importedModule = CallModuleResolveHook(module, e.moduleRequest,
MODULE_STATUS_UNINSTANTIATED);
- let resolution = callFunction(importedModule.resolveExport, importedModule, e.importName,
- resolveSet);
- if (!resolution.resolved && !resolution.module)
- resolution.module = module;
- return resolution;
+ return callFunction(importedModule.resolveExport, importedModule, e.importName,
+ resolveSet);
}
}
- // Step 7
+ // Step 6
if (exportName === "default") {
// A default export cannot be provided by an export *.
- return {resolved: false, module: null, ambiguous: false};
+ return null;
}
- // Step 8
+ // Step 7
let starResolution = null;
- // Step 9
+ // Step 8
let starExportEntries = module.starExportEntries;
for (let i = 0; i < starExportEntries.length; i++) {
let e = starExportEntries[i];
@@ -160,27 +155,31 @@ function ModuleResolveExport(exportName, resolveSet = [])
MODULE_STATUS_UNINSTANTIATED);
let resolution = callFunction(importedModule.resolveExport, importedModule, exportName,
resolveSet);
- if (!resolution.resolved && (resolution.module || resolution.ambiguous))
+ if (resolution === "ambiguous")
return resolution;
- if (resolution.resolved) {
+ if (resolution !== null) {
if (starResolution === null) {
starResolution = resolution;
} else {
if (resolution.module !== starResolution.module ||
resolution.bindingName !== starResolution.bindingName)
{
- return {resolved: false, module: null, ambiguous: true};
+ return "ambiguous";
}
}
}
}
- // Step 10
- if (starResolution !== null)
- return starResolution;
+ // Step 9
+ return starResolution;
+}
- return {resolved: false, module: null, ambiguous: false};
+function IsResolvedBinding(resolution)
+{
+ assert(resolution === "ambiguous" || typeof resolution === "object",
+ "Bad module resolution result");
+ return typeof resolution === "object" && resolution !== null;
}
// 15.2.1.18 GetModuleNamespace(module)
@@ -189,12 +188,12 @@ function GetModuleNamespace(module)
// Step 1
assert(IsModule(module), "GetModuleNamespace called with non-module");
- // Step 2
+ // Steps 2-3
assert(module.status !== MODULE_STATUS_UNINSTANTIATED &&
- module.status !== MODULE_STATUS_ERRORED,
+ module.status !== MODULE_STATUS_EVALUATED_ERROR,
"Bad module status in GetModuleNamespace");
- // Step 3
+ // Step 4
let namespace = module.namespace;
if (typeof namespace === "undefined") {
@@ -203,7 +202,7 @@ function GetModuleNamespace(module)
for (let i = 0; i < exportedNames.length; i++) {
let name = exportedNames[i];
let resolution = callFunction(module.resolveExport, module, name);
- if (resolution.resolved)
+ if (IsResolvedBinding(resolution))
_DefineDataProperty(unambiguousNames, unambiguousNames.length, name);
}
namespace = ModuleNamespaceCreate(module, unambiguousNames);
@@ -225,7 +224,7 @@ function ModuleNamespaceCreate(module, exports)
for (let i = 0; i < exports.length; i++) {
let name = exports[i];
let binding = callFunction(module.resolveExport, module, name);
- assert(binding.resolved, "Failed to resolve binding");
+ assert(IsResolvedBinding(binding), "Failed to resolve binding");
AddModuleNamespaceBinding(ns, name, binding.module, binding.bindingName);
}
@@ -236,31 +235,16 @@ function GetModuleEnvironment(module)
{
assert(IsModule(module), "Non-module passed to GetModuleEnvironment");
- // Check for a previous failed attempt to instantiate this module. This can
- // only happen due to a bug in the module loader.
- if (module.status === MODULE_STATUS_ERRORED)
- ThrowInternalError(JSMSG_MODULE_INSTANTIATE_FAILED, module.status);
+ assert(module.status >= MODULE_STATUS_INSTANTIATING,
+ "Attempt to access module environement before instantation");
let env = UnsafeGetReservedSlot(module, MODULE_OBJECT_ENVIRONMENT_SLOT);
- assert(env === undefined || IsModuleEnvironment(env),
+ assert(IsModuleEnvironment(env),
"Module environment slot contains unexpected value");
return env;
}
-function RecordModuleError(module, error)
-{
- // Set the module's status to 'errored' to indicate a failed module
- // instantiation and record the exception. The environment slot is also
- // reset to 'undefined'.
-
- assert(IsObject(module) && IsModule(module), "Non-module passed to RecordModuleError");
-
- ModuleSetStatus(module, MODULE_STATUS_ERRORED);
- UnsafeSetReservedSlot(module, MODULE_OBJECT_ERROR_SLOT, error);
- UnsafeSetReservedSlot(module, MODULE_OBJECT_ENVIRONMENT_SLOT, undefined);
-}
-
function CountArrayValues(array, value)
{
let count = 0;
@@ -280,6 +264,16 @@ function ArrayContains(array, value)
return false;
}
+function HandleModuleInstantiationFailure(module)
+{
+ // Reset the module to the "uninstantiated" state. Don't reset the
+ // environment slot as the environment object will be required by any
+ // possible future instantiation attempt.
+ ModuleSetStatus(module, MODULE_STATUS_UNINSTANTIATED);
+ UnsafeSetReservedSlot(module, MODULE_OBJECT_DFS_INDEX_SLOT, undefined);
+ UnsafeSetReservedSlot(module, MODULE_OBJECT_DFS_ANCESTOR_INDEX_SLOT, undefined);
+}
+
// 15.2.1.16.4 ModuleInstantiate()
function ModuleInstantiate()
{
@@ -301,38 +295,30 @@ function ModuleInstantiate()
// Steps 4-5
try {
- InnerModuleDeclarationInstantiation(module, stack, 0);
+ InnerModuleInstantiation(module, stack, 0);
} catch (error) {
for (let i = 0; i < stack.length; i++) {
let m = stack[i];
- assert(m.status === MODULE_STATUS_INSTANTIATING ||
- m.status === MODULE_STATUS_ERRORED,
- "Bad module status after failed instantiation");
-
- RecordModuleError(m, error);
+ assert(m.status === MODULE_STATUS_INSTANTIATING,
+ "Expected instantiating status during failed instantiation");
+ HandleModuleInstantiationFailure(m);
}
- if (stack.length === 0 &&
- typeof(UnsafeGetReservedSlot(module, MODULE_OBJECT_ERROR_SLOT)) === "undefined")
- {
- // This can happen due to OOM when appending to the stack.
- assert(error === "out of memory",
- "Stack must contain module unless we hit OOM");
- RecordModuleError(module, error);
- }
+ // Handle OOM when appending to the stack or over-recursion errors.
+ if (stack.length === 0)
+ HandleModuleInstantiationFailure(module);
- assert(module.status === MODULE_STATUS_ERRORED,
- "Bad module status after failed instantiation");
- assert(SameValue(UnsafeGetReservedSlot(module, MODULE_OBJECT_ERROR_SLOT), error),
- "Module has different error set after failed instantiation");
+ assert(module.status === MODULE_STATUS_UNINSTANTIATED,
+ "Expected uninstantiated status after failed instantiation");
throw error;
}
// Step 6
- assert(module.status == MODULE_STATUS_INSTANTIATED ||
- module.status == MODULE_STATUS_EVALUATED,
+ assert(module.status === MODULE_STATUS_INSTANTIATED ||
+ module.status === MODULE_STATUS_EVALUATED ||
+ module.status === MODULE_STATUS_EVALUATED_ERROR,
"Bad module status after successful instantiation");
// Step 7
@@ -344,8 +330,8 @@ function ModuleInstantiate()
}
_SetCanonicalName(ModuleInstantiate, "ModuleInstantiate");
-// 15.2.1.16.4.1 InnerModuleDeclarationInstantiation(module, stack, index)
-function InnerModuleDeclarationInstantiation(module, stack, index)
+// 15.2.1.16.4.1 InnerModuleInstantiation(module, stack, index)
+function InnerModuleInstantiation(module, stack, index)
{
// Step 1
// TODO: Support module records other than source text module records.
@@ -353,42 +339,40 @@ function InnerModuleDeclarationInstantiation(module, stack, index)
// Step 2
if (module.status === MODULE_STATUS_INSTANTIATING ||
module.status === MODULE_STATUS_INSTANTIATED ||
- module.status === MODULE_STATUS_EVALUATED)
+ module.status === MODULE_STATUS_EVALUATED ||
+ module.status === MODULE_STATUS_EVALUATED_ERROR)
{
return index;
}
// Step 3
- if (module.status === MODULE_STATUS_ERRORED)
- throw module.error;
-
- // Step 4
assert(module.status === MODULE_STATUS_UNINSTANTIATED,
"Bad module status in ModuleDeclarationInstantiation");
- // Steps 5
+ // Step 4
ModuleSetStatus(module, MODULE_STATUS_INSTANTIATING);
- // Step 6-8
+ // Steps 5-7
UnsafeSetReservedSlot(module, MODULE_OBJECT_DFS_INDEX_SLOT, index);
UnsafeSetReservedSlot(module, MODULE_OBJECT_DFS_ANCESTOR_INDEX_SLOT, index);
index++;
- // Step 9
+ // Step 8
_DefineDataProperty(stack, stack.length, module);
- // Step 10
+ // Step 9
let requestedModules = module.requestedModules;
for (let i = 0; i < requestedModules.length; i++) {
let required = requestedModules[i];
- let requiredModule = CallModuleResolveHook(module, required, MODULE_STATUS_ERRORED);
+ let requiredModule = CallModuleResolveHook(module, required, MODULE_STATUS_UNINSTANTIATED);
- index = InnerModuleDeclarationInstantiation(requiredModule, stack, index);
+ index = InnerModuleInstantiation(requiredModule, stack, index);
assert(requiredModule.status === MODULE_STATUS_INSTANTIATING ||
requiredModule.status === MODULE_STATUS_INSTANTIATED ||
- requiredModule.status === MODULE_STATUS_EVALUATED,
- "Bad required module status after InnerModuleDeclarationInstantiation");
+ requiredModule.status === MODULE_STATUS_EVALUATED ||
+ requiredModule.status === MODULE_STATUS_EVALUATED_ERROR,
+ "Bad required module status after InnerModuleInstantiation");
assert((requiredModule.status === MODULE_STATUS_INSTANTIATING) ===
ArrayContains(stack, requiredModule),
@@ -404,16 +388,16 @@ function InnerModuleDeclarationInstantiation(module, stack, index)
}
}
- // Step 11
+ // Step 10
ModuleDeclarationEnvironmentSetup(module);
- // Steps 12-13
+ // Steps 11-12
assert(CountArrayValues(stack, module) === 1,
"Current module should appear exactly once in the stack");
assert(module.dfsAncestorIndex <= module.dfsIndex,
"Bad DFS ancestor index");
- // Step 14
+ // Step 13
if (module.dfsAncestorIndex === module.dfsIndex) {
let requiredModule;
do {
@@ -434,16 +418,14 @@ function ModuleDeclarationEnvironmentSetup(module)
for (let i = 0; i < indirectExportEntries.length; i++) {
let e = indirectExportEntries[i];
let resolution = callFunction(module.resolveExport, module, e.exportName);
- assert(resolution.resolved || resolution.module,
- "Unexpected failure to resolve export in ModuleDeclarationEnvironmentSetup");
- if (!resolution.resolved) {
- return ResolutionError(resolution, "indirectExport", e.exportName,
- e.lineNumber, e.columnNumber)
+ if (!IsResolvedBinding(resolution)) {
+ ThrowResolutionError(module, resolution, "indirectExport", e.exportName,
+ e.lineNumber, e.columnNumber);
}
}
// Steps 5-6
- CreateModuleEnvironment(module);
+ // Note that we have already created the environment by this point.
let env = GetModuleEnvironment(module);
// Step 8
@@ -458,12 +440,9 @@ function ModuleDeclarationEnvironmentSetup(module)
} else {
let resolution = callFunction(importedModule.resolveExport, importedModule,
imp.importName);
- if (!resolution.resolved && !resolution.module)
- resolution.module = module;
-
- if (!resolution.resolved) {
- return ResolutionError(resolution, "import", imp.importName,
- imp.lineNumber, imp.columnNumber);
+ if (!IsResolvedBinding(resolution)) {
+ ThrowResolutionError(module, resolution, "import", imp.importName,
+ imp.lineNumber, imp.columnNumber);
}
CreateImportBinding(env, imp.localName, resolution.module, resolution.bindingName);
@@ -473,38 +452,58 @@ function ModuleDeclarationEnvironmentSetup(module)
InstantiateModuleFunctionDeclarations(module);
}
-// 15.2.1.16.4.3 ResolutionError(module)
-function ResolutionError(resolution, kind, name, line, column)
+function ThrowResolutionError(module, resolution, kind, name, line, column)
{
- let module = resolution.module;
- assert(module !== null,
- "Null module passed to ResolutionError");
-
- assert(module.status === MODULE_STATUS_UNINSTANTIATED ||
- module.status === MODULE_STATUS_INSTANTIATING,
- "Unexpected module status in ResolutionError");
+ assert(module.status === MODULE_STATUS_INSTANTIATING,
+ "Unexpected module status in ThrowResolutionError");
assert(kind === "import" || kind === "indirectExport",
- "Unexpected kind in ResolutionError");
+ "Unexpected kind in ThrowResolutionError");
assert(line > 0,
"Line number should be present for all imports and indirect exports");
+ let ambiguous = resolution === "ambiguous";
+
let errorNumber;
- if (kind === "import") {
- errorNumber = resolution.ambiguous ? JSMSG_AMBIGUOUS_IMPORT
- : JSMSG_MISSING_IMPORT;
- } else {
- errorNumber = resolution.ambiguous ? JSMSG_AMBIGUOUS_INDIRECT_EXPORT
- : JSMSG_MISSING_INDIRECT_EXPORT;
- }
+ if (kind === "import")
+ errorNumber = ambiguous ? JSMSG_AMBIGUOUS_IMPORT : JSMSG_MISSING_IMPORT;
+ else
+ errorNumber = ambiguous ? JSMSG_AMBIGUOUS_INDIRECT_EXPORT : JSMSG_MISSING_INDIRECT_EXPORT;
let message = GetErrorMessage(errorNumber) + ": " + name;
let error = CreateModuleSyntaxError(module, line, column, message);
- RecordModuleError(module, error);
throw error;
}
+function GetModuleEvaluationError(module)
+{
+ assert(IsObject(module) && IsModule(module),
+ "Non-module passed to GetModuleEvaluationError");
+ assert(module.status === MODULE_STATUS_EVALUATED_ERROR,
+ "Bad module status in GetModuleEvaluationError");
+ return UnsafeGetReservedSlot(module, MODULE_OBJECT_EVALUATION_ERROR_SLOT);
+}
+
+function RecordModuleEvaluationError(module, error)
+{
+ // Set the module's EvaluationError slot to indicate a failed module
+ // evaluation.
+
+ assert(IsObject(module) && IsModule(module),
+ "Non-module passed to RecordModuleEvaluationError");
+
+ if (module.status === MODULE_STATUS_EVALUATED_ERROR) {
+ // It would be nice to assert that |error| is the same as the one we
+ // previously recorded, but that's not always true in the case of out of
+ // memory and over-recursion errors.
+ return;
+ }
+
+ ModuleSetStatus(module, MODULE_STATUS_EVALUATED_ERROR);
+ UnsafeSetReservedSlot(module, MODULE_OBJECT_EVALUATION_ERROR_SLOT, error);
+}
+
// 15.2.1.16.5 ModuleEvaluate()
function ModuleEvaluate()
{
@@ -515,9 +514,9 @@ function ModuleEvaluate()
let module = this;
// Step 2
- if (module.status !== MODULE_STATUS_ERRORED &&
- module.status !== MODULE_STATUS_INSTANTIATED &&
- module.status !== MODULE_STATUS_EVALUATED)
+ if (module.status !== MODULE_STATUS_INSTANTIATED &&
+ module.status !== MODULE_STATUS_EVALUATED &&
+ module.status !== MODULE_STATUS_EVALUATED_ERROR)
{
ThrowInternalError(JSMSG_BAD_MODULE_STATUS);
}
@@ -535,27 +534,20 @@ function ModuleEvaluate()
assert(m.status === MODULE_STATUS_EVALUATING,
"Bad module status after failed evaluation");
- RecordModuleError(m, error);
+ RecordModuleEvaluationError(m, error);
}
- if (stack.length === 0 &&
- typeof(UnsafeGetReservedSlot(module, MODULE_OBJECT_ERROR_SLOT)) === "undefined")
- {
- // This can happen due to OOM when appending to the stack.
- assert(error === "out of memory",
- "Stack must contain module unless we hit OOM");
- RecordModuleError(module, error);
- }
+ // Handle OOM when appending to the stack or over-recursion errors.
+ if (stack.length === 0)
+ RecordModuleEvaluationError(module, error);
- assert(module.status === MODULE_STATUS_ERRORED,
+ assert(module.status === MODULE_STATUS_EVALUATED_ERROR,
"Bad module status after failed evaluation");
- assert(SameValue(UnsafeGetReservedSlot(module, MODULE_OBJECT_ERROR_SLOT), error),
- "Module has different error set after failed evaluation");
throw error;
}
- assert(module.status == MODULE_STATUS_EVALUATED,
+ assert(module.status === MODULE_STATUS_EVALUATED,
"Bad module status after successful evaluation");
assert(stack.length === 0,
"Stack should be empty after successful evaluation");
@@ -571,19 +563,19 @@ function InnerModuleEvaluation(module, stack, index)
// TODO: Support module records other than source text module records.
// Step 2
- if (module.status === MODULE_STATUS_EVALUATING ||
- module.status === MODULE_STATUS_EVALUATED)
- {
+ if (module.status === MODULE_STATUS_EVALUATED_ERROR)
+ throw GetModuleEvaluationError(module);
+
+ if (module.status === MODULE_STATUS_EVALUATED)
return index;
- }
// Step 3
- if (module.status === MODULE_STATUS_ERRORED)
- throw module.error;
+ if (module.status === MODULE_STATUS_EVALUATING)
+ return index;
// Step 4
assert(module.status === MODULE_STATUS_INSTANTIATED,
- "Bad module status in ModuleEvaluation");
+ "Bad module status in InnerModuleEvaluation");
// Step 5
ModuleSetStatus(module, MODULE_STATUS_EVALUATING);
@@ -605,8 +597,8 @@ function InnerModuleEvaluation(module, stack, index)
index = InnerModuleEvaluation(requiredModule, stack, index);
- assert(requiredModule.status == MODULE_STATUS_EVALUATING ||
- requiredModule.status == MODULE_STATUS_EVALUATED,
+ assert(requiredModule.status === MODULE_STATUS_EVALUATING ||
+ requiredModule.status === MODULE_STATUS_EVALUATED,
"Bad module status after InnerModuleEvaluation");
assert((requiredModule.status === MODULE_STATUS_EVALUATING) ===
diff --git a/js/src/builtin/ModuleObject.cpp b/js/src/builtin/ModuleObject.cpp
index 30e7120c0..728929e8c 100644
--- a/js/src/builtin/ModuleObject.cpp
+++ b/js/src/builtin/ModuleObject.cpp
@@ -18,10 +18,10 @@
using namespace js;
using namespace js::frontend;
-static_assert(MODULE_STATUS_ERRORED < MODULE_STATUS_UNINSTANTIATED &&
- MODULE_STATUS_UNINSTANTIATED < MODULE_STATUS_INSTANTIATING &&
+static_assert(MODULE_STATUS_UNINSTANTIATED < MODULE_STATUS_INSTANTIATING &&
MODULE_STATUS_INSTANTIATING < MODULE_STATUS_INSTANTIATED &&
- MODULE_STATUS_INSTANTIATED < MODULE_STATUS_EVALUATED,
+ MODULE_STATUS_INSTANTIATED < MODULE_STATUS_EVALUATED &&
+ MODULE_STATUS_EVALUATED < MODULE_STATUS_EVALUATED_ERROR,
"Module statuses are ordered incorrectly");
template<typename T, Value ValueGetter(const T* obj)>
@@ -248,21 +248,13 @@ IndirectBindingMap::Binding::Binding(ModuleEnvironmentObject* environment, Shape
: environment(environment), shape(shape)
{}
-IndirectBindingMap::IndirectBindingMap(Zone* zone)
- : map_(ZoneAllocPolicy(zone))
-{
-}
-
-bool
-IndirectBindingMap::init()
-{
- return map_.init();
-}
-
void
IndirectBindingMap::trace(JSTracer* trc)
{
- for (Map::Enum e(map_); !e.empty(); e.popFront()) {
+ if (!map_)
+ return;
+
+ for (Map::Enum e(*map_); !e.empty(); e.popFront()) {
Binding& b = e.front().value();
TraceEdge(trc, &b.environment, "module bindings environment");
TraceEdge(trc, &b.shape, "module bindings shape");
@@ -273,12 +265,25 @@ IndirectBindingMap::trace(JSTracer* trc)
}
bool
-IndirectBindingMap::putNew(JSContext* cx, HandleId name,
- HandleModuleEnvironmentObject environment, HandleId localName)
-{
+IndirectBindingMap::put(JSContext* cx, HandleId name,
+ HandleModuleEnvironmentObject environment, HandleId localName)
+{
+ // This object might have been allocated on the background parsing thread in
+ // different zone to the final module. Lazily allocate the map so we don't
+ // have to switch its zone when merging compartments.
+ if (!map_) {
+ MOZ_ASSERT(!cx->zone()->usedByExclusiveThread);
+ map_.emplace(cx->zone());
+ if (!map_->init()) {
+ map_.reset();
+ ReportOutOfMemory(cx);
+ return false;
+ }
+ }
+
RootedShape shape(cx, environment->lookup(cx, localName));
MOZ_ASSERT(shape);
- if (!map_.putNew(name, Binding(environment, shape))) {
+ if (!map_->put(name, Binding(environment, shape))) {
ReportOutOfMemory(cx);
return false;
}
@@ -289,7 +294,10 @@ IndirectBindingMap::putNew(JSContext* cx, HandleId name,
bool
IndirectBindingMap::lookup(jsid name, ModuleEnvironmentObject** envOut, Shape** shapeOut) const
{
- auto ptr = map_.lookup(name);
+ if (!map_)
+ return false;
+
+ auto ptr = map_->lookup(name);
if (!ptr)
return false;
@@ -359,7 +367,7 @@ ModuleNamespaceObject::addBinding(JSContext* cx, HandleAtom exportedName,
RootedModuleEnvironmentObject environment(cx, &targetModule->initialEnvironment());
RootedId exportedNameId(cx, AtomToId(exportedName));
RootedId localNameId(cx, AtomToId(localName));
- return bindings->putNew(cx, exportedNameId, environment, localNameId);
+ return bindings->put(cx, exportedNameId, environment, localNameId);
}
const char ModuleNamespaceObject::ProxyHandler::family = 0;
@@ -625,10 +633,9 @@ ModuleObject::create(ExclusiveContext* cx)
RootedModuleObject self(cx, &obj->as<ModuleObject>());
Zone* zone = cx->zone();
- IndirectBindingMap* bindings = zone->new_<IndirectBindingMap>(zone);
- if (!bindings || !bindings->init()) {
+ IndirectBindingMap* bindings = zone->new_<IndirectBindingMap>();
+ if (!bindings) {
ReportOutOfMemory(cx);
- js_delete<IndirectBindingMap>(bindings);
return nullptr;
}
@@ -657,14 +664,24 @@ ModuleObject::finalize(js::FreeOp* fop, JSObject* obj)
fop->delete_(funDecls);
}
+ModuleEnvironmentObject&
+ModuleObject::initialEnvironment() const
+{
+ Value value = getReservedSlot(EnvironmentSlot);
+ return value.toObject().as<ModuleEnvironmentObject>();
+}
+
ModuleEnvironmentObject*
ModuleObject::environment() const
{
- Value value = getReservedSlot(EnvironmentSlot);
- if (value.isUndefined())
+ MOZ_ASSERT(!hadEvaluationError());
+
+ // According to the spec the environment record is created during
+ // instantiation, but we create it earlier than that.
+ if (status() < MODULE_STATUS_INSTANTIATED)
return nullptr;
- return &value.toObject().as<ModuleEnvironmentObject>();
+ return &initialEnvironment();
}
bool
@@ -723,13 +740,13 @@ void
ModuleObject::init(HandleScript script)
{
initReservedSlot(ScriptSlot, PrivateValue(script));
- initReservedSlot(StatusSlot, Int32Value(MODULE_STATUS_ERRORED));
+ initReservedSlot(StatusSlot, Int32Value(MODULE_STATUS_UNINSTANTIATED));
}
void
ModuleObject::setInitialEnvironment(HandleModuleEnvironmentObject initialEnvironment)
{
- initReservedSlot(InitialEnvironmentSlot, ObjectValue(*initialEnvironment));
+ initReservedSlot(EnvironmentSlot, ObjectValue(*initialEnvironment));
}
void
@@ -827,7 +844,8 @@ ModuleObject::script() const
static inline void
AssertValidModuleStatus(ModuleStatus status)
{
- MOZ_ASSERT(status >= MODULE_STATUS_ERRORED && status <= MODULE_STATUS_EVALUATED);
+ MOZ_ASSERT(status >= MODULE_STATUS_UNINSTANTIATED &&
+ status <= MODULE_STATUS_EVALUATED_ERROR);
}
ModuleStatus
@@ -838,11 +856,17 @@ ModuleObject::status() const
return status;
}
+bool
+ModuleObject::hadEvaluationError() const
+{
+ return status() == MODULE_STATUS_EVALUATED_ERROR;
+}
+
Value
-ModuleObject::error() const
+ModuleObject::evaluationError() const
{
- MOZ_ASSERT(status() == MODULE_STATUS_ERRORED);
- return getReservedSlot(ErrorSlot);
+ MOZ_ASSERT(hadEvaluationError());
+ return getReservedSlot(EvaluationErrorSlot);
}
Value
@@ -857,12 +881,6 @@ ModuleObject::setHostDefinedField(const JS::Value& value)
setReservedSlot(HostDefinedSlot, value);
}
-ModuleEnvironmentObject&
-ModuleObject::initialEnvironment() const
-{
- return getReservedSlot(InitialEnvironmentSlot).toObject().as<ModuleEnvironmentObject>();
-}
-
Scope*
ModuleObject::enclosingScope() const
{
@@ -888,16 +906,6 @@ ModuleObject::trace(JSTracer* trc, JSObject* obj)
funDecls->trace(trc);
}
-void
-ModuleObject::createEnvironment()
-{
- // The environment has already been created, we just neet to set it in the
- // right slot.
- MOZ_ASSERT(!getReservedSlot(InitialEnvironmentSlot).isUndefined());
- MOZ_ASSERT(getReservedSlot(EnvironmentSlot).isUndefined());
- setReservedSlot(EnvironmentSlot, getReservedSlot(InitialEnvironmentSlot));
-}
-
bool
ModuleObject::noteFunctionDeclaration(ExclusiveContext* cx, HandleAtom name, HandleFunction fun)
{
@@ -913,7 +921,10 @@ ModuleObject::noteFunctionDeclaration(ExclusiveContext* cx, HandleAtom name, Han
/* static */ bool
ModuleObject::instantiateFunctionDeclarations(JSContext* cx, HandleModuleObject self)
{
+#ifdef DEBUG
+ MOZ_ASSERT(self->status() == MODULE_STATUS_INSTANTIATING);
MOZ_ASSERT(IsFrozen(cx, self));
+#endif
FunctionDeclarationVector* funDecls = self->functionDeclarations();
if (!funDecls) {
@@ -944,7 +955,10 @@ ModuleObject::instantiateFunctionDeclarations(JSContext* cx, HandleModuleObject
/* static */ bool
ModuleObject::execute(JSContext* cx, HandleModuleObject self, MutableHandleValue rval)
{
+#ifdef DEBUG
+ MOZ_ASSERT(self->status() == MODULE_STATUS_EVALUATING);
MOZ_ASSERT(IsFrozen(cx, self));
+#endif
RootedScript script(cx, self->script());
RootedModuleEnvironmentObject scope(cx, self->environment());
@@ -967,10 +981,9 @@ ModuleObject::createNamespace(JSContext* cx, HandleModuleObject self, HandleObje
return nullptr;
Zone* zone = cx->zone();
- IndirectBindingMap* bindings = zone->new_<IndirectBindingMap>(zone);
- if (!bindings || !bindings->init()) {
+ IndirectBindingMap* bindings = zone->new_<IndirectBindingMap>();
+ if (!bindings) {
ReportOutOfMemory(cx);
- js_delete<IndirectBindingMap>(bindings);
return nullptr;
}
@@ -1005,7 +1018,7 @@ ModuleObject::Evaluate(JSContext* cx, HandleModuleObject self)
DEFINE_GETTER_FUNCTIONS(ModuleObject, namespace_, NamespaceSlot)
DEFINE_GETTER_FUNCTIONS(ModuleObject, status, StatusSlot)
-DEFINE_GETTER_FUNCTIONS(ModuleObject, error, ErrorSlot)
+DEFINE_GETTER_FUNCTIONS(ModuleObject, evaluationError, EvaluationErrorSlot)
DEFINE_GETTER_FUNCTIONS(ModuleObject, requestedModules, RequestedModulesSlot)
DEFINE_GETTER_FUNCTIONS(ModuleObject, importEntries, ImportEntriesSlot)
DEFINE_GETTER_FUNCTIONS(ModuleObject, localExportEntries, LocalExportEntriesSlot)
@@ -1020,7 +1033,7 @@ GlobalObject::initModuleProto(JSContext* cx, Handle<GlobalObject*> global)
static const JSPropertySpec protoAccessors[] = {
JS_PSG("namespace", ModuleObject_namespace_Getter, 0),
JS_PSG("status", ModuleObject_statusGetter, 0),
- JS_PSG("error", ModuleObject_errorGetter, 0),
+ JS_PSG("evaluationError", ModuleObject_evaluationErrorGetter, 0),
JS_PSG("requestedModules", ModuleObject_requestedModulesGetter, 0),
JS_PSG("importEntries", ModuleObject_importEntriesGetter, 0),
JS_PSG("localExportEntries", ModuleObject_localExportEntriesGetter, 0),
diff --git a/js/src/builtin/ModuleObject.h b/js/src/builtin/ModuleObject.h
index be0315215..5e4e7f342 100644
--- a/js/src/builtin/ModuleObject.h
+++ b/js/src/builtin/ModuleObject.h
@@ -7,6 +7,8 @@
#ifndef builtin_ModuleObject_h
#define builtin_ModuleObject_h
+#include "mozilla/Maybe.h"
+
#include "jsapi.h"
#include "jsatom.h"
@@ -102,27 +104,27 @@ typedef Handle<ExportEntryObject*> HandleExportEntryObject;
class IndirectBindingMap
{
public:
- explicit IndirectBindingMap(Zone* zone);
- bool init();
-
void trace(JSTracer* trc);
- bool putNew(JSContext* cx, HandleId name,
- HandleModuleEnvironmentObject environment, HandleId localName);
+ bool put(JSContext* cx, HandleId name,
+ HandleModuleEnvironmentObject environment, HandleId localName);
size_t count() const {
- return map_.count();
+ return map_ ? map_->count() : 0;
}
bool has(jsid name) const {
- return map_.has(name);
+ return map_ ? map_->has(name) : false;
}
bool lookup(jsid name, ModuleEnvironmentObject** envOut, Shape** shapeOut) const;
template <typename Func>
void forEachExportedName(Func func) const {
- for (auto r = map_.all(); !r.empty(); r.popFront())
+ if (!map_)
+ return;
+
+ for (auto r = map_->all(); !r.empty(); r.popFront())
func(r.front().key());
}
@@ -136,7 +138,7 @@ class IndirectBindingMap
typedef HashMap<jsid, Binding, DefaultHasher<jsid>, ZoneAllocPolicy> Map;
- Map map_;
+ mozilla::Maybe<Map> map_;
};
class ModuleNamespaceObject : public ProxyObject
@@ -214,11 +216,10 @@ class ModuleObject : public NativeObject
enum
{
ScriptSlot = 0,
- InitialEnvironmentSlot,
EnvironmentSlot,
NamespaceSlot,
StatusSlot,
- ErrorSlot,
+ EvaluationErrorSlot,
HostDefinedSlot,
RequestedModulesSlot,
ImportEntriesSlot,
@@ -238,8 +239,8 @@ class ModuleObject : public NativeObject
"EnvironmentSlot must match self-hosting define");
static_assert(StatusSlot == MODULE_OBJECT_STATUS_SLOT,
"StatusSlot must match self-hosting define");
- static_assert(ErrorSlot == MODULE_OBJECT_ERROR_SLOT,
- "ErrorSlot must match self-hosting define");
+ static_assert(EvaluationErrorSlot == MODULE_OBJECT_EVALUATION_ERROR_SLOT,
+ "EvaluationErrorSlot must match self-hosting define");
static_assert(DFSIndexSlot == MODULE_OBJECT_DFS_INDEX_SLOT,
"DFSIndexSlot must match self-hosting define");
static_assert(DFSAncestorIndexSlot == MODULE_OBJECT_DFS_ANCESTOR_INDEX_SLOT,
@@ -269,7 +270,8 @@ class ModuleObject : public NativeObject
ModuleEnvironmentObject* environment() const;
ModuleNamespaceObject* namespace_();
ModuleStatus status() const;
- Value error() const;
+ bool hadEvaluationError() const;
+ Value evaluationError() const;
Value hostDefinedField() const;
ArrayObject& requestedModules() const;
ArrayObject& importEntries() const;
@@ -285,9 +287,6 @@ class ModuleObject : public NativeObject
void setHostDefinedField(const JS::Value& value);
- // For intrinsic_CreateModuleEnvironment.
- void createEnvironment();
-
// For BytecodeEmitter.
bool noteFunctionDeclaration(ExclusiveContext* cx, HandleAtom name, HandleFunction fun);
diff --git a/js/src/builtin/SelfHostingDefines.h b/js/src/builtin/SelfHostingDefines.h
index a06c2aa62..a3ba36804 100644
--- a/js/src/builtin/SelfHostingDefines.h
+++ b/js/src/builtin/SelfHostingDefines.h
@@ -97,17 +97,17 @@
#define REGEXP_STRING_ITERATOR_FLAGS_SLOT 2
#define REGEXP_STRING_ITERATOR_DONE_SLOT 3
-#define MODULE_OBJECT_ENVIRONMENT_SLOT 2
-#define MODULE_OBJECT_STATUS_SLOT 4
-#define MODULE_OBJECT_ERROR_SLOT 5
-#define MODULE_OBJECT_DFS_INDEX_SLOT 16
-#define MODULE_OBJECT_DFS_ANCESTOR_INDEX_SLOT 17
-
-#define MODULE_STATUS_ERRORED 0
-#define MODULE_STATUS_UNINSTANTIATED 1
-#define MODULE_STATUS_INSTANTIATING 2
-#define MODULE_STATUS_INSTANTIATED 3
-#define MODULE_STATUS_EVALUATING 4
-#define MODULE_STATUS_EVALUATED 5
+#define MODULE_OBJECT_ENVIRONMENT_SLOT 1
+#define MODULE_OBJECT_STATUS_SLOT 3
+#define MODULE_OBJECT_EVALUATION_ERROR_SLOT 4
+#define MODULE_OBJECT_DFS_INDEX_SLOT 15
+#define MODULE_OBJECT_DFS_ANCESTOR_INDEX_SLOT 16
+
+#define MODULE_STATUS_UNINSTANTIATED 0
+#define MODULE_STATUS_INSTANTIATING 1
+#define MODULE_STATUS_INSTANTIATED 2
+#define MODULE_STATUS_EVALUATING 3
+#define MODULE_STATUS_EVALUATED 4
+#define MODULE_STATUS_EVALUATED_ERROR 5
#endif
diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp
index 025620766..f589b8076 100644
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -3566,8 +3566,6 @@ GetModuleEnvironment(JSContext* cx, HandleValue moduleValue)
// before they have been instantiated.
RootedModuleEnvironmentObject env(cx, &module->initialEnvironment());
MOZ_ASSERT(env);
- MOZ_ASSERT_IF(module->environment(), module->environment() == env);
-
return env;
}
@@ -3585,6 +3583,9 @@ GetModuleEnvironmentNames(JSContext* cx, unsigned argc, Value* vp)
return false;
}
+//- if (module->status() == MODULE_STATUS_ERRORED) {
+//+ if (module->hadEvaluationError()) {
+
RootedModuleEnvironmentObject env(cx, GetModuleEnvironment(cx, args[0]));
Rooted<IdVector> ids(cx, IdVector(cx));
if (!JS_Enumerate(cx, env, &ids))
@@ -3622,6 +3623,9 @@ GetModuleEnvironmentValue(JSContext* cx, unsigned argc, Value* vp)
return false;
}
+//- if (module->status() == MODULE_STATUS_ERRORED) {
+//+ if (module->hadEvaluationError()) {
+
RootedModuleEnvironmentObject env(cx, GetModuleEnvironment(cx, args[0]));
RootedString name(cx, args[1].toString());
RootedId id(cx);
diff --git a/js/src/jit-test/tests/modules/bug-1284486.js b/js/src/jit-test/tests/modules/bug-1284486.js
index 08286393a..6fbd67d9d 100644
--- a/js/src/jit-test/tests/modules/bug-1284486.js
+++ b/js/src/jit-test/tests/modules/bug-1284486.js
@@ -1,9 +1,8 @@
-// This tests that attempting to perform ModuleDeclarationInstantation a second
-// time after a failure re-throws the same error.
+// This tests that module instantiation can succeed when executed a second
+// time after a failure.
//
// The first attempt fails becuase module 'a' is not available. The second
-// attempt fails because of the previous failure (it would otherwise succeed as
-// 'a' is now available).
+// attempt succeeds as 'a' is now available.
load(libdir + "dummyModuleResolveHook.js");
@@ -25,12 +24,9 @@ let a = moduleRepo['a'] = parseModule("export var a = 1; export var b = 2;");
let d = moduleRepo['d'] = parseModule("import { a } from 'c'; a;");
threw = false;
-let e2;
try {
d.declarationInstantiation();
} catch (exc) {
threw = true;
- e2 = exc;
}
-assertEq(threw, true);
-assertEq(e1, e2);
+assertEq(threw, false);
diff --git a/js/src/jit-test/tests/modules/bug-1420420-2.js b/js/src/jit-test/tests/modules/bug-1420420-2.js
new file mode 100644
index 000000000..0511e8126
--- /dev/null
+++ b/js/src/jit-test/tests/modules/bug-1420420-2.js
@@ -0,0 +1,19 @@
+// Test re-instantiation module after failure.
+
+load(libdir + "asserts.js");
+load(libdir + "dummyModuleResolveHook.js");
+
+moduleRepo["good"] = parseModule(`export let x`);
+
+moduleRepo["y1"] = parseModule(`export let y`);
+moduleRepo["y2"] = parseModule(`export let y`);
+moduleRepo["bad"] = parseModule(`export* from "y1"; export* from "y2";`);
+
+moduleRepo["a"] = parseModule(`import* as ns from "good"; import {y} from "bad";`);
+
+let b = moduleRepo["b"] = parseModule(`import "a";`);
+let c = moduleRepo["c"] = parseModule(`import "a";`);
+
+assertThrowsInstanceOf(() => b.declarationInstantiation(), SyntaxError);
+assertThrowsInstanceOf(() => c.declarationInstantiation(), SyntaxError);
+
diff --git a/js/src/jit-test/tests/modules/bug-1420420-3.js b/js/src/jit-test/tests/modules/bug-1420420-3.js
new file mode 100644
index 000000000..236c023b9
--- /dev/null
+++ b/js/src/jit-test/tests/modules/bug-1420420-3.js
@@ -0,0 +1,9 @@
+if (!('stackTest' in this))
+ quit();
+
+let a = parseModule(`throw new Error`);
+a.declarationInstantiation();
+stackTest(function() {
+ a.evaluation();
+});
+
diff --git a/js/src/jit-test/tests/modules/bug-1420420-4.js b/js/src/jit-test/tests/modules/bug-1420420-4.js
new file mode 100644
index 000000000..721c770bc
--- /dev/null
+++ b/js/src/jit-test/tests/modules/bug-1420420-4.js
@@ -0,0 +1,16 @@
+load(libdir + "asserts.js");
+load(libdir + "dummyModuleResolveHook.js");
+
+moduleRepo["a"] = parseModule(`throw undefined`);
+
+let b = moduleRepo["b"] = parseModule(`import "a";`);
+let c = moduleRepo["c"] = parseModule(`import "a";`);
+
+b.declarationInstantiation();
+c.declarationInstantiation();
+
+let count = 0;
+try { b.evaluation() } catch (e) { count++; }
+try { c.evaluation() } catch (e) { count++; }
+assertEq(count, 2);
+
diff --git a/js/src/jit-test/tests/modules/bug-1420420.js b/js/src/jit-test/tests/modules/bug-1420420.js
new file mode 100644
index 000000000..cd1101c76
--- /dev/null
+++ b/js/src/jit-test/tests/modules/bug-1420420.js
@@ -0,0 +1,19 @@
+// Test re-instantiation module after failure.
+
+load(libdir + "asserts.js");
+load(libdir + "dummyModuleResolveHook.js");
+
+moduleRepo["good"] = parseModule(`export let x`);
+
+moduleRepo["y1"] = parseModule(`export let y`);
+moduleRepo["y2"] = parseModule(`export let y`);
+moduleRepo["bad"] = parseModule(`export* from "y1"; export* from "y2";`);
+
+moduleRepo["a"] = parseModule(`import {x} from "good"; import {y} from "bad";`);
+
+let b = moduleRepo["b"] = parseModule(`import "a";`);
+let c = moduleRepo["c"] = parseModule(`import "a";`);
+
+assertThrowsInstanceOf(() => b.declarationInstantiation(), SyntaxError);
+assertThrowsInstanceOf(() => c.declarationInstantiation(), SyntaxError);
+
diff --git a/js/src/js.msg b/js/src/js.msg
index 9c508ebbd..587481864 100644
--- a/js/src/js.msg
+++ b/js/src/js.msg
@@ -579,7 +579,6 @@ MSG_DEF(JSMSG_MISSING_IMPORT, 0, JSEXN_SYNTAXERR, "import not found")
MSG_DEF(JSMSG_AMBIGUOUS_IMPORT, 0, JSEXN_SYNTAXERR, "ambiguous import")
MSG_DEF(JSMSG_MISSING_NAMESPACE_EXPORT, 0, JSEXN_SYNTAXERR, "export not found for namespace")
MSG_DEF(JSMSG_MISSING_EXPORT, 1, JSEXN_SYNTAXERR, "local binding for export '{0}' not found")
-MSG_DEF(JSMSG_MODULE_INSTANTIATE_FAILED, 0, JSEXN_INTERNALERR, "attempt to re-instantiate module after failure")
MSG_DEF(JSMSG_BAD_MODULE_STATUS, 0, JSEXN_INTERNALERR, "module record has unexpected status")
// Promise
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp
index cf5880e03..69a3ba2ac 100644
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -483,6 +483,11 @@ JS_DestroyContext(JSContext* cx)
DestroyContext(cx);
}
+JS_PUBLIC_API(JSRuntime*)
+JS_GetRuntime(JSContext* cx) {
+ return cx->runtime();
+}
+
static JS_CurrentEmbedderTimeFunction currentEmbedderTimeFunction;
JS_PUBLIC_API(void)
@@ -4662,21 +4667,16 @@ JS::Evaluate(JSContext* cx, const ReadOnlyCompileOptions& optionsArg,
return ::Evaluate(cx, optionsArg, filename, rval);
}
-JS_PUBLIC_API(JSFunction*)
-JS::GetModuleResolveHook(JSContext* cx)
+JS_PUBLIC_API(JS::ModuleResolveHook)
+JS::GetModuleResolveHook(JSRuntime* rt)
{
- AssertHeapIsIdle(cx);
- CHECK_REQUEST(cx);
- return cx->global()->moduleResolveHook();
+ return rt->moduleResolveHook;
}
JS_PUBLIC_API(void)
-JS::SetModuleResolveHook(JSContext* cx, HandleFunction func)
+JS::SetModuleResolveHook(JSRuntime* rt, JS::ModuleResolveHook func)
{
- AssertHeapIsIdle(cx);
- CHECK_REQUEST(cx);
- assertSameCompartment(cx, func);
- cx->global()->setModuleResolveHook(func);
+ rt->moduleResolveHook = func;
}
JS_PUBLIC_API(bool)
@@ -4739,18 +4739,6 @@ JS::GetModuleScript(JSContext* cx, JS::HandleObject moduleArg)
return moduleArg->as<ModuleObject>().script();
}
-JS_PUBLIC_API(bool)
-JS::IsModuleErrored(JSObject* moduleArg)
-{
- return moduleArg->as<ModuleObject>().status() == MODULE_STATUS_ERRORED;
-}
-
-JS_PUBLIC_API(JS::Value)
-JS::GetModuleError(JSObject* moduleArg)
-{
- return moduleArg->as<ModuleObject>().error();
-}
-
JS_PUBLIC_API(JSObject*)
JS_New(JSContext* cx, HandleObject ctor, const JS::HandleValueArray& inputArgs)
{
diff --git a/js/src/jsapi.h b/js/src/jsapi.h
index 9c3bf8151..5cdfd958e 100644
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -995,6 +995,9 @@ JS_NewContext(uint32_t maxbytes,
extern JS_PUBLIC_API(void)
JS_DestroyContext(JSContext* cx);
+extern JS_PUBLIC_API(JSRuntime*)
+JS_GetRuntime(JSContext* cx);
+
typedef double (*JS_CurrentEmbedderTimeFunction)();
/**
@@ -4322,17 +4325,19 @@ extern JS_PUBLIC_API(bool)
Evaluate(JSContext* cx, const ReadOnlyCompileOptions& options,
const char* filename, JS::MutableHandleValue rval);
+using ModuleResolveHook = JSObject* (*)(JSContext*, HandleObject, HandleString);
+
/**
- * Get the HostResolveImportedModule hook for a global.
+ * Get the HostResolveImportedModule hook for the runtime.
*/
-extern JS_PUBLIC_API(JSFunction*)
-GetModuleResolveHook(JSContext* cx);
+extern JS_PUBLIC_API(ModuleResolveHook)
+GetModuleResolveHook(JSRuntime* rt);
/**
- * Set the HostResolveImportedModule hook for a global to the given function.
+ * Set the HostResolveImportedModule hook for the runtime to the given function.
*/
extern JS_PUBLIC_API(void)
-SetModuleResolveHook(JSContext* cx, JS::HandleFunction func);
+SetModuleResolveHook(JSRuntime* rt, ModuleResolveHook func);
/**
* Parse the given source buffer as a module in the scope of the current global
@@ -4395,12 +4400,6 @@ GetRequestedModules(JSContext* cx, JS::HandleObject moduleRecord);
extern JS_PUBLIC_API(JSScript*)
GetModuleScript(JSContext* cx, JS::HandleObject moduleRecord);
-extern JS_PUBLIC_API(bool)
-IsModuleErrored(JSObject* moduleRecord);
-
-extern JS_PUBLIC_API(JS::Value)
-GetModuleError(JSObject* moduleRecord);
-
} /* namespace JS */
extern JS_PUBLIC_API(bool)
diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp
index 8cd821b31..bbf35459f 100644
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -274,6 +274,7 @@ struct ShellContext
JS::PersistentRooted<JobQueue> jobQueue;
ExclusiveData<ShellAsyncTasks> asyncTasks;
bool drainingJobQueue;
+ JS::PersistentRootedFunction moduleResolveHook;
/*
* Watchdog thread state.
@@ -439,7 +440,8 @@ ShellContext::ShellContext(JSContext* cx)
exitCode(0),
quitting(false),
readLineBufPos(0),
- spsProfilingStackSize(0)
+ spsProfilingStackSize(0),
+ moduleResolveHook(cx)
{}
static ShellContext*
@@ -4030,13 +4032,34 @@ SetModuleResolveHook(JSContext* cx, unsigned argc, Value* vp)
return false;
}
- RootedFunction hook(cx, &args[0].toObject().as<JSFunction>());
- Rooted<GlobalObject*> global(cx, cx->global());
- global->setModuleResolveHook(hook);
+ ShellContext* sc = GetShellContext(cx);
+ sc->moduleResolveHook = &args[0].toObject().as<JSFunction>();
+
args.rval().setUndefined();
return true;
}
+static JSObject*
+CallModuleResolveHook(JSContext* cx, HandleObject module, HandleString specifier)
+{
+ ShellContext* sc = GetShellContext(cx);
+
+ JS::AutoValueArray<2> args(cx);
+ args[0].setObject(*module);
+ args[1].setString(specifier);
+
+ RootedValue result(cx);
+ if (!JS_CallFunction(cx, nullptr, sc->moduleResolveHook, args, &result))
+ return nullptr;
+
+ if (!result.isObject() || !result.toObject().is<ModuleObject>()) {
+ JS_ReportErrorASCII(cx, "Module resolve hook did not return Module object");
+ return nullptr;
+ }
+
+ return &result.toObject();
+}
+
static bool
GetModuleLoadPath(JSContext* cx, unsigned argc, Value* vp)
{
@@ -7962,6 +7985,8 @@ main(int argc, char** argv, char** envp)
js::SetPreserveWrapperCallback(cx, DummyPreserveWrapperCallback);
+ JS::SetModuleResolveHook(cx->runtime(), CallModuleResolveHook);
+
result = Shell(cx, &op, envp);
#ifdef DEBUG
diff --git a/js/src/vm/EnvironmentObject.cpp b/js/src/vm/EnvironmentObject.cpp
index 7834940f1..871ae3f19 100644
--- a/js/src/vm/EnvironmentObject.cpp
+++ b/js/src/vm/EnvironmentObject.cpp
@@ -491,7 +491,7 @@ ModuleEnvironmentObject::createImportBinding(JSContext* cx, HandleAtom importNam
RootedId importNameId(cx, AtomToId(importName));
RootedId localNameId(cx, AtomToId(localName));
RootedModuleEnvironmentObject env(cx, &module->initialEnvironment());
- if (!importBindings().putNew(cx, importNameId, env, localNameId)) {
+ if (!importBindings().put(cx, importNameId, env, localNameId)) {
ReportOutOfMemory(cx);
return false;
}
diff --git a/js/src/vm/GlobalObject.h b/js/src/vm/GlobalObject.h
index 720f63e69..a9f07d495 100644
--- a/js/src/vm/GlobalObject.h
+++ b/js/src/vm/GlobalObject.h
@@ -119,7 +119,6 @@ class GlobalObject : public NativeObject
DEBUGGERS,
INTRINSICS,
FOR_OF_PIC_CHAIN,
- MODULE_RESOLVE_HOOK,
WINDOW_PROXY,
GLOBAL_THIS_RESOLVED,
@@ -879,19 +878,6 @@ class GlobalObject : public NativeObject
setReservedSlot(WINDOW_PROXY, ObjectValue(*windowProxy));
}
- void setModuleResolveHook(HandleFunction hook) {
- MOZ_ASSERT(hook);
- setSlot(MODULE_RESOLVE_HOOK, ObjectValue(*hook));
- }
-
- JSFunction* moduleResolveHook() {
- Value value = getSlotRef(MODULE_RESOLVE_HOOK);
- if (value.isUndefined())
- return nullptr;
-
- return &value.toObject().as<JSFunction>();
- }
-
// Returns either this global's star-generator function prototype, or null
// if that object was never created. Dodgy; for use only in also-dodgy
// GlobalHelperThreadState::mergeParseTaskCompartment().
diff --git a/js/src/vm/Runtime.cpp b/js/src/vm/Runtime.cpp
index 284a4f3d7..5e0246b85 100644
--- a/js/src/vm/Runtime.cpp
+++ b/js/src/vm/Runtime.cpp
@@ -241,8 +241,10 @@ JSRuntime::JSRuntime(JSRuntime* parentRuntime)
lastAnimationTime(0),
performanceMonitoring(thisFromCtor()),
ionLazyLinkListSize_(0),
- stackFormat_(parentRuntime ? js::StackFormat::Default
- : js::StackFormat::SpiderMonkey)
+ stackFormat_(parentRuntime ?
+ js::StackFormat::Default :
+ js::StackFormat::SpiderMonkey),
+ moduleResolveHook()
{
setGCStoreBufferPtr(&gc.storeBuffer);
diff --git a/js/src/vm/Runtime.h b/js/src/vm/Runtime.h
index e60371e38..247a2dc9d 100644
--- a/js/src/vm/Runtime.h
+++ b/js/src/vm/Runtime.h
@@ -1294,6 +1294,9 @@ struct JSRuntime : public JS::shadow::Runtime,
// For inherited heap state accessors.
friend class js::gc::AutoTraceSession;
friend class JS::AutoEnterCycleCollection;
+
+ // The implementation-defined abstract operation HostResolveImportedModule.
+ JS::ModuleResolveHook moduleResolveHook;
};
namespace js {
diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp
index 0dfeffc36..f324a0a67 100644
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -2026,36 +2026,26 @@ intrinsic_HostResolveImportedModule(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
MOZ_ASSERT(args.length() == 2);
- MOZ_ASSERT(args[0].toObject().is<ModuleObject>());
- MOZ_ASSERT(args[1].isString());
+ RootedModuleObject module(cx, &args[0].toObject().as<ModuleObject>());
+ RootedString specifier(cx, args[1].toString());
- RootedFunction moduleResolveHook(cx, cx->global()->moduleResolveHook());
+ JS::ModuleResolveHook moduleResolveHook = cx->runtime()->moduleResolveHook;
if (!moduleResolveHook) {
JS_ReportErrorASCII(cx, "Module resolve hook not set");
return false;
}
- RootedValue result(cx);
- if (!JS_CallFunction(cx, nullptr, moduleResolveHook, args, &result))
+ RootedObject result(cx);
+ result = moduleResolveHook(cx, module, specifier);
+ if (!result)
return false;
- if (!result.isObject() || !result.toObject().is<ModuleObject>()) {
+ if (!result->is<ModuleObject>()) {
JS_ReportErrorASCII(cx, "Module resolve hook did not return Module object");
return false;
}
- args.rval().set(result);
- return true;
-}
-
-static bool
-intrinsic_CreateModuleEnvironment(JSContext* cx, unsigned argc, Value* vp)
-{
- CallArgs args = CallArgsFromVp(argc, vp);
- MOZ_ASSERT(args.length() == 1);
- RootedModuleObject module(cx, &args[0].toObject().as<ModuleObject>());
- module->createEnvironment();
- args.rval().setUndefined();
+ args.rval().setObject(*result);
return true;
}
@@ -2087,7 +2077,6 @@ intrinsic_CreateNamespaceBinding(JSContext* cx, unsigned argc, Value* vp)
// the slot directly.
RootedShape shape(cx, environment->lookup(cx, name));
MOZ_ASSERT(shape);
- MOZ_ASSERT(environment->getSlot(shape->slot()).isMagic(JS_UNINITIALIZED_LEXICAL));
environment->setSlot(shape->slot(), args[2]);
args.rval().setUndefined();
return true;
@@ -2659,7 +2648,6 @@ static const JSFunctionSpec intrinsic_functions[] = {
CallNonGenericSelfhostedMethod<Is<ModuleObject>>, 2, 0),
JS_FN("HostResolveImportedModule", intrinsic_HostResolveImportedModule, 2, 0),
JS_FN("IsModuleEnvironment", intrinsic_IsInstanceOfBuiltin<ModuleEnvironmentObject>, 1, 0),
- JS_FN("CreateModuleEnvironment", intrinsic_CreateModuleEnvironment, 1, 0),
JS_FN("CreateImportBinding", intrinsic_CreateImportBinding, 4, 0),
JS_FN("CreateNamespaceBinding", intrinsic_CreateNamespaceBinding, 3, 0),
JS_FN("InstantiateModuleFunctionDeclarations",
diff --git a/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/AttributeName.java b/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/AttributeName.java
index aaf0b7b91..28ada917a 100644
--- a/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/AttributeName.java
+++ b/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/AttributeName.java
@@ -1161,6 +1161,7 @@ public final class AttributeName
public static final AttributeName LQUOTE = new AttributeName(ALL_NO_NS, SAME_LOCAL("lquote"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
public static final AttributeName PANOSE_1 = new AttributeName(ALL_NO_NS, SAME_LOCAL("panose-1"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
public static final AttributeName NUMOCTAVES = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("numoctaves", "numOctaves"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName NOMODULE = new AttributeName(ALL_NO_NS, SAME_LOCAL("nomodule"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
public static final AttributeName ONLOAD = new AttributeName(ALL_NO_NS, SAME_LOCAL("onload"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
public static final AttributeName ONBOUNCE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbounce"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
public static final AttributeName ONCONTROLSELECT = new AttributeName(ALL_NO_NS, SAME_LOCAL("oncontrolselect"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
@@ -1362,31 +1363,31 @@ public final class AttributeName
public static final AttributeName VERYVERYTHINMATHSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("veryverythinmathspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
public static final AttributeName VERYVERYTHICKMATHSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("veryverythickmathspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
private final static @NoLength AttributeName[] ATTRIBUTE_NAMES = {
- STEMH,
- REPEATCOUNT,
+ STEMV,
+ REPEAT_START,
NOWRAP,
SRCDOC,
- ADDITIVE,
+ BEGIN,
ONFORMCHANGE,
KEYTIMES,
ARIA_SORT,
- OBJECT,
- IMAGE_RENDERING,
- MARKER_START,
- XLINK_ARCROLE,
+ ONSELECT,
+ LANGUAGE,
+ MARKERWIDTH,
+ XMLNS_XLINK,
CLIP,
LOWSRC,
COLUMNWIDTH,
XML_SPACE,
VSPACE,
- EDGEMODE,
- ONBEFOREUPDATE,
- UNDERLINE_THICKNESS,
- HIGH,
- RADIUS,
- ROWLINES,
- ONEND,
- ENCODING,
+ EDGE,
+ ONDEACTIVATE,
+ X_HEIGHT,
+ LIGHTING_COLOR,
+ SCRIPTLEVEL,
+ SCALE,
+ ONINPUT,
+ EXPONENT,
ONFORMINPUT,
SHAPE_RENDERING,
ONDRAGLEAVE,
@@ -1398,20 +1399,20 @@ public final class AttributeName
HSPACE,
SPECULAREXPONENT,
BASELINE,
- LINEBREAK,
- ONBEGIN,
- ONKEYDOWN,
- STRETCHY,
- SURFACESCALE,
- NARGS,
- NOSHADE,
- LIMITINGCONEANGLE,
- VALIGN,
- DECLARE,
- FRAMEBORDER,
- IN,
- STANDBY,
- AUTOCOMPLETE,
+ LABEL,
+ ONHELP,
+ ONRESIZE,
+ SCHEME,
+ XREF,
+ ORIGIN,
+ ONCHANGE,
+ MEDIUMMATHSPACE,
+ VISIBILITY,
+ FILL_RULE,
+ FRAME,
+ ICON,
+ THINMATHSPACE,
+ AUTOFOCUS,
ONLOAD,
ONMOVESTART,
STROKE_DASHOFFSET,
@@ -1434,36 +1435,36 @@ public final class AttributeName
CALCMODE,
ID,
ACCENT_HEIGHT,
- CITE,
- INDEX,
- NAME,
- ONRESET,
- ORIENTATION,
- ONKEYPRESS,
- REFERRERPOLICY,
- SELECTED,
- SIZE,
- HREFLANG,
- ALIGNMENTSCOPE,
- LONGDESC,
- TARGETX,
- METHOD,
- ALTIMG,
- DEFINITIONURL,
- ONFILTERCHANGE,
- STRIKETHROUGH_POSITION,
- MARKER_MID,
- MASKCONTENTUNITS,
- MAXLENGTH,
- TITLE,
- FORM,
- USEMAP,
- KERNELUNITLENGTH,
- POINTSATX,
- WHEN,
- XLINK_SHOW,
- COLOR_RENDERING,
- IDEOGRAPHIC,
+ DEFER,
+ IRRELEVANT,
+ NORESIZE,
+ ONCELLCHANGE,
+ ONBEFORECOPY,
+ ONKEYUP,
+ RULES,
+ SPEED,
+ TYPE,
+ ONAFTERPRINT,
+ DRAGGABLE,
+ LENGTHADJUST,
+ TARGETY,
+ MATHVARIANT,
+ ACTIONTYPE,
+ HORIZ_ADV_X,
+ ONFINISH,
+ STRIKETHROUGH_THICKNESS,
+ MARKERHEIGHT,
+ AMPLITUDE,
+ ONCLICK,
+ V_ALPHABETIC,
+ PROMPT,
+ ZOOMANDPAN,
+ ONUNLOAD,
+ POINTSATY,
+ XLINK_HREF,
+ XLINK_ACTUATE,
+ COLOR_INTERPOLATION,
+ LQUOTE,
ONMOUSEWHEEL,
ONCONTEXTMENU,
ONMOUSEMOVE,
@@ -1507,66 +1508,66 @@ public final class AttributeName
HEADERS,
WORD_SPACING,
BEVELLED,
- CODETYPE,
- DATETIME,
- FACE,
- INTERCEPT,
- LINETHICKNESS,
- ONBEFOREUNLOAD,
- ORDER,
- ONREADYSTATECHANGE,
- ONBEFOREPRINT,
- ONSELECTSTART,
- ONBEFOREACTIVATE,
- ONBEFOREEDITFOCUS,
- REPEAT,
- REPEAT_MIN,
- REPEAT_TEMPLATE,
- SIZES,
- SPREADMETHOD,
- UNSELECTABLE,
- DIFFUSECONSTANT,
- ONAFTERUPDATE,
- ALIGN,
- HEIGHT,
- LANG,
- MARGINHEIGHT,
- PING,
- ALPHABETIC,
- MATHEMATICAL,
- MATHCOLOR,
- PATHLENGTH,
- ACTION,
- DOMINANT_BASELINE,
- HORIZ_ORIGIN_X,
- MEDIA,
- OPTIMUM,
- SCRIPTSIZEMULTIPLIER,
- SCRIPTMINSIZE,
- BACKGROUND,
- MARKER_END,
- MASKUNITS,
- CELLSPACING,
- FILL,
- ONBLUR,
- STYLE,
- AZIMUTH,
- FRAMESPACING,
- PRIMITIVEUNITS,
- SEAMLESS,
- ASYNC,
- KERNELMATRIX,
- OPEN,
- POINTER_EVENTS,
- POINTSATZ,
- TRANSFORM,
- XLINK_TITLE,
- XMLNS,
- AUTOPLAY,
- BGCOLOR,
- COLOR,
- FLOOD_COLOR,
- PANOSE_1,
+ CODEBASE,
+ DIRECTION,
+ HIDEFOCUS,
+ INTEGRITY,
+ MODE,
+ ONREPEAT,
+ OTHER,
+ ONMESSAGE,
+ ORIENT,
+ ONBEFOREPASTE,
+ ONBEFORDEACTIVATE,
+ ONBEFORECUT,
+ REPEAT_MAX,
+ ROLE,
+ REPEATDUR,
+ SUPERSCRIPTSHIFT,
+ SELECTION,
+ UNDERLINE_POSITION,
+ HREF,
+ PROFILE,
+ ALIGNMENT_BASELINE,
+ HANGING,
+ LARGEOP,
+ MARGINWIDTH,
+ TARGET,
+ ARCHIVE,
+ MATHBACKGROUND,
+ MATHSIZE,
+ PATH,
+ ACTIVE,
+ DIVISOR,
+ HORIZ_ORIGIN_Y,
+ MANIFEST,
+ RADIOGROUP,
+ STRING,
+ TABINDEX,
+ LINK,
+ MASK,
+ MARKERUNITS,
+ CELLPADDING,
+ FILL_OPACITY,
+ REPLACE,
+ TABLEVALUES,
+ FORMAT,
+ FROM,
+ SYMMETRIC,
+ SUMMARY,
+ ALINK,
+ KERNING,
+ ONINVALID,
+ POINTS,
+ SPAN,
+ VLINK,
+ XLINK_ROLE,
+ XLINK_TYPE,
+ AUTOSUBMIT,
+ COLOR_PROFILE,
+ COLOR_INTERPOLATION_FILTERS,
+ FLOOD_OPACITY,
+ NUMOCTAVES,
ONCONTROLSELECT,
ONMOUSEENTER,
ONROWEXIT,
@@ -1654,125 +1655,125 @@ public final class AttributeName
ASCENT,
BASELINE_SHIFT,
CODE,
- CODEBASE,
- DEFER,
- DIRECTION,
- EDGE,
- HIDEFOCUS,
- IRRELEVANT,
- INTEGRITY,
- LABEL,
- MODE,
- NORESIZE,
- ONREPEAT,
- ONSELECT,
- OTHER,
- ONCELLCHANGE,
- ONMESSAGE,
- ONHELP,
- ORIENT,
- ONBEFORECOPY,
- ONBEFOREPASTE,
- ONDEACTIVATE,
- ONBEFORDEACTIVATE,
- ONKEYUP,
- ONBEFORECUT,
- ONRESIZE,
- REPEAT_MAX,
- RULES,
- ROLE,
- REPEAT_START,
- REPEATDUR,
- SPEED,
- SUPERSCRIPTSHIFT,
- SCHEME,
- SELECTION,
- TYPE,
- UNDERLINE_POSITION,
- X_HEIGHT,
- HREF,
- ONAFTERPRINT,
- PROFILE,
- XREF,
- ALIGNMENT_BASELINE,
- DRAGGABLE,
- HANGING,
- LANGUAGE,
- LARGEOP,
- LENGTHADJUST,
- MARGINWIDTH,
- ORIGIN,
- TARGET,
- TARGETY,
- ARCHIVE,
- LIGHTING_COLOR,
- MATHBACKGROUND,
- MATHVARIANT,
- MATHSIZE,
- ONCHANGE,
- PATH,
- ACTIONTYPE,
- ACTIVE,
- BEGIN,
- DIVISOR,
- HORIZ_ADV_X,
- HORIZ_ORIGIN_Y,
- MEDIUMMATHSPACE,
- MANIFEST,
- ONFINISH,
- RADIOGROUP,
- SCRIPTLEVEL,
- STRING,
- STRIKETHROUGH_THICKNESS,
- TABINDEX,
- VISIBILITY,
- LINK,
- MARKERHEIGHT,
- MASK,
- MARKERWIDTH,
- MARKERUNITS,
- AMPLITUDE,
- CELLPADDING,
- FILL_RULE,
- FILL_OPACITY,
- ONCLICK,
- REPLACE,
- SCALE,
- TABLEVALUES,
- V_ALPHABETIC,
- FORMAT,
- FRAME,
- FROM,
- PROMPT,
- SYMMETRIC,
- STEMV,
- SUMMARY,
- ZOOMANDPAN,
- ALINK,
- ICON,
- KERNING,
- ONUNLOAD,
- ONINVALID,
- ONINPUT,
- POINTS,
- POINTSATY,
- SPAN,
- THINMATHSPACE,
- VLINK,
- XLINK_HREF,
- XLINK_ROLE,
- XMLNS_XLINK,
- XLINK_TYPE,
- XLINK_ACTUATE,
- AUTOSUBMIT,
- AUTOFOCUS,
- COLOR_PROFILE,
- COLOR_INTERPOLATION,
- COLOR_INTERPOLATION_FILTERS,
- EXPONENT,
- FLOOD_OPACITY,
- LQUOTE,
- NUMOCTAVES,
+ CITE,
+ DATETIME,
+ EDGEMODE,
+ FACE,
+ INDEX,
+ INTERCEPT,
+ LINEBREAK,
+ LINETHICKNESS,
+ NAME,
+ ONBEFOREUNLOAD,
+ OBJECT,
+ ORDER,
+ ONRESET,
+ ONREADYSTATECHANGE,
+ ONBEGIN,
+ ONBEFOREPRINT,
+ ORIENTATION,
+ ONSELECTSTART,
+ ONBEFOREUPDATE,
+ ONBEFOREACTIVATE,
+ ONKEYPRESS,
+ ONBEFOREEDITFOCUS,
+ ONKEYDOWN,
+ REPEAT,
+ REFERRERPOLICY,
+ REPEAT_MIN,
+ REPEATCOUNT,
+ REPEAT_TEMPLATE,
+ SELECTED,
+ SIZES,
+ STRETCHY,
+ SPREADMETHOD,
+ SIZE,
+ UNSELECTABLE,
+ UNDERLINE_THICKNESS,
+ DIFFUSECONSTANT,
+ HREFLANG,
+ ONAFTERUPDATE,
+ SURFACESCALE,
+ ALIGN,
+ ALIGNMENTSCOPE,
+ HEIGHT,
+ IMAGE_RENDERING,
+ LANG,
+ LONGDESC,
+ MARGINHEIGHT,
+ NARGS,
+ PING,
+ TARGETX,
+ ALPHABETIC,
+ HIGH,
+ MATHEMATICAL,
+ METHOD,
+ MATHCOLOR,
+ NOSHADE,
+ PATHLENGTH,
+ ALTIMG,
+ ACTION,
+ ADDITIVE,
+ DOMINANT_BASELINE,
+ DEFINITIONURL,
+ HORIZ_ORIGIN_X,
+ LIMITINGCONEANGLE,
+ MEDIA,
+ ONFILTERCHANGE,
+ OPTIMUM,
+ RADIUS,
+ SCRIPTSIZEMULTIPLIER,
+ STRIKETHROUGH_POSITION,
+ SCRIPTMINSIZE,
+ VALIGN,
+ BACKGROUND,
+ MARKER_MID,
+ MARKER_END,
+ MARKER_START,
+ MASKUNITS,
+ MASKCONTENTUNITS,
+ CELLSPACING,
+ DECLARE,
+ FILL,
+ MAXLENGTH,
+ ONBLUR,
+ ROWLINES,
+ STYLE,
+ TITLE,
+ AZIMUTH,
+ FRAMEBORDER,
+ FRAMESPACING,
+ FORM,
+ PRIMITIVEUNITS,
+ STEMH,
+ SEAMLESS,
+ USEMAP,
+ ASYNC,
+ IN,
+ KERNELMATRIX,
+ KERNELUNITLENGTH,
+ OPEN,
+ ONEND,
+ POINTER_EVENTS,
+ POINTSATX,
+ POINTSATZ,
+ STANDBY,
+ TRANSFORM,
+ WHEN,
+ XLINK_TITLE,
+ XLINK_ARCROLE,
+ XMLNS,
+ XLINK_SHOW,
+ AUTOPLAY,
+ AUTOCOMPLETE,
+ BGCOLOR,
+ COLOR_RENDERING,
+ COLOR,
+ ENCODING,
+ FLOOD_COLOR,
+ IDEOGRAPHIC,
+ PANOSE_1,
+ NOMODULE,
ONBOUNCE,
ONROWSINSERTED,
ONROWENTER,
@@ -1946,33 +1947,34 @@ public final class AttributeName
BASEFREQUENCY,
BASEPROFILE,
BASE,
+ CODETYPE,
};
private final static int[] ATTRIBUTE_HASHES = {
- 1891069765,
- 1756360955,
+ 1891098437,
+ 1756426572,
1972151670,
1740096054,
- 1814656840,
+ 1814986837,
1922419228,
2004199576,
1680411449,
- 1754606246,
- 1785174319,
- 1854466380,
- 1910441773,
+ 1754612424,
+ 1786622296,
+ 1854474395,
+ 1910487243,
1932959284,
1988132214,
2017010843,
1037879561,
1691145478,
- 1749350104,
- 1754860110,
- 1758018291,
- 1801312388,
- 1823580230,
- 1873656984,
- 1905754853,
- 1917295176,
+ 1749399124,
+ 1754860396,
+ 1759379608,
+ 1803561214,
+ 1823829083,
+ 1874261045,
+ 1905902311,
+ 1917327080,
1922679531,
1941409583,
1972996699,
@@ -1984,20 +1986,20 @@ public final class AttributeName
1683805446,
1723336432,
1747939528,
- 1752985897,
- 1754698327,
- 1754927689,
- 1756804936,
- 1773606972,
- 1787699221,
- 1804405895,
- 1820262641,
- 1825437894,
- 1866496199,
- 1884142379,
- 1900544002,
- 1907701479,
- 1915295948,
+ 1753049109,
+ 1754751622,
+ 1754958648,
+ 1756836998,
+ 1776114564,
+ 1788254870,
+ 1804978712,
+ 1820637455,
+ 1825677514,
+ 1867448617,
+ 1884246821,
+ 1902640276,
+ 1908195085,
+ 1915341049,
1922319046,
1922630475,
1924517489,
@@ -2020,36 +2022,36 @@ public final class AttributeName
1714745560,
1732771842,
1747348637,
- 1748566068,
- 1751507685,
- 1754214628,
- 1754645079,
- 1754798923,
- 1754872618,
- 1756190926,
- 1756704824,
- 1757053236,
- 1767875272,
- 1781007934,
- 1786821704,
- 1791068279,
- 1804054854,
- 1814517574,
- 1816178925,
- 1821755934,
- 1824005974,
- 1854285018,
- 1854497008,
- 1871251689,
- 1874788501,
- 1884343396,
- 1891937366,
- 1903759600,
- 1906419001,
- 1909819252,
- 1910527802,
- 1916247343,
- 1919297291,
+ 1748869205,
+ 1751649130,
+ 1754434872,
+ 1754647068,
+ 1754835516,
+ 1754899031,
+ 1756219733,
+ 1756710661,
+ 1757421892,
+ 1771569964,
+ 1782518297,
+ 1786851500,
+ 1791070327,
+ 1804069019,
+ 1814558026,
+ 1817175115,
+ 1821958888,
+ 1824081655,
+ 1854302364,
+ 1864698185,
+ 1872034503,
+ 1875753052,
+ 1889569526,
+ 1894552650,
+ 1905541832,
+ 1906421049,
+ 1910328970,
+ 1910572893,
+ 1916278099,
+ 1921061206,
1922400908,
1922566877,
1922665179,
@@ -2093,66 +2095,66 @@ public final class AttributeName
1734404167,
1742183484,
1747792072,
- 1748503880,
- 1748971848,
- 1749856356,
- 1751679545,
- 1753297133,
- 1754546894,
- 1754643237,
- 1754647074,
- 1754792749,
- 1754858317,
- 1754860400,
- 1754905345,
- 1756147974,
- 1756265690,
- 1756428495,
- 1756737685,
- 1756874572,
- 1757874716,
- 1765800271,
- 1771637325,
- 1780879045,
- 1784574102,
- 1786740932,
- 1787193500,
- 1788842244,
- 1797666394,
- 1803839644,
- 1804081401,
- 1805715690,
- 1814560070,
- 1816104145,
- 1817175198,
- 1820727381,
- 1822002839,
- 1823841492,
- 1824159037,
- 1848600826,
- 1854366938,
- 1854497001,
- 1865910331,
- 1867462756,
- 1872343590,
- 1874270021,
- 1881750231,
- 1884267068,
- 1889633006,
- 1891182792,
- 1898415413,
- 1903612236,
- 1905628916,
- 1906408542,
- 1906423097,
- 1908462185,
- 1910441627,
- 1910503637,
- 1915025672,
- 1915757815,
- 1916286197,
- 1917857531,
- 1921880376,
+ 1748552744,
+ 1749027145,
+ 1751232761,
+ 1751755561,
+ 1753550036,
+ 1754579720,
+ 1754644293,
+ 1754647353,
+ 1754794646,
+ 1754860061,
+ 1754860401,
+ 1754907227,
+ 1756155098,
+ 1756302628,
+ 1756471625,
+ 1756762256,
+ 1756889417,
+ 1757942610,
+ 1767725700,
+ 1772032615,
+ 1780975314,
+ 1784643703,
+ 1786775671,
+ 1787365531,
+ 1790814502,
+ 1797886599,
+ 1804036350,
+ 1804235064,
+ 1805715716,
+ 1814656326,
+ 1816144023,
+ 1817177246,
+ 1820928104,
+ 1823574314,
+ 1823975206,
+ 1824377064,
+ 1853862084,
+ 1854464212,
+ 1854497003,
+ 1865910347,
+ 1867620412,
+ 1873590471,
+ 1874698443,
+ 1884079398,
+ 1884295780,
+ 1890996553,
+ 1891186903,
+ 1898428101,
+ 1903659239,
+ 1905672729,
+ 1906408598,
+ 1907660596,
+ 1909438149,
+ 1910441770,
+ 1910507338,
+ 1915146282,
+ 1916210285,
+ 1916337499,
+ 1917953597,
+ 1921894426,
1922384591,
1922413292,
1922482777,
@@ -2240,125 +2242,125 @@ public final class AttributeName
1747455030,
1747839118,
1748306996,
- 1748552744,
- 1748869205,
- 1749027145,
- 1749399124,
- 1751232761,
- 1751649130,
- 1751755561,
- 1753049109,
- 1753550036,
- 1754434872,
- 1754579720,
- 1754612424,
- 1754644293,
- 1754647068,
- 1754647353,
- 1754751622,
- 1754794646,
- 1754835516,
- 1754860061,
- 1754860396,
- 1754860401,
- 1754899031,
- 1754907227,
- 1754958648,
- 1756155098,
- 1756219733,
- 1756302628,
- 1756426572,
- 1756471625,
- 1756710661,
- 1756762256,
- 1756836998,
- 1756889417,
- 1757421892,
- 1757942610,
- 1759379608,
- 1767725700,
- 1771569964,
- 1772032615,
- 1776114564,
- 1780975314,
- 1782518297,
- 1784643703,
- 1786622296,
- 1786775671,
- 1786851500,
- 1787365531,
- 1788254870,
- 1790814502,
- 1791070327,
- 1797886599,
- 1803561214,
- 1804036350,
- 1804069019,
- 1804235064,
- 1804978712,
- 1805715716,
- 1814558026,
- 1814656326,
- 1814986837,
- 1816144023,
- 1817175115,
- 1817177246,
- 1820637455,
- 1820928104,
- 1821958888,
- 1823574314,
- 1823829083,
- 1823975206,
- 1824081655,
- 1824377064,
- 1825677514,
- 1853862084,
- 1854302364,
- 1854464212,
- 1854474395,
- 1854497003,
- 1864698185,
- 1865910347,
- 1867448617,
- 1867620412,
- 1872034503,
- 1873590471,
- 1874261045,
- 1874698443,
- 1875753052,
- 1884079398,
- 1884246821,
- 1884295780,
- 1889569526,
- 1890996553,
- 1891098437,
- 1891186903,
- 1894552650,
- 1898428101,
- 1902640276,
- 1903659239,
- 1905541832,
- 1905672729,
- 1905902311,
- 1906408598,
- 1906421049,
- 1907660596,
- 1908195085,
- 1909438149,
- 1910328970,
- 1910441770,
- 1910487243,
- 1910507338,
- 1910572893,
- 1915146282,
- 1915341049,
- 1916210285,
- 1916278099,
- 1916337499,
- 1917327080,
- 1917953597,
- 1921061206,
- 1921894426,
+ 1748566068,
+ 1748971848,
+ 1749350104,
+ 1749856356,
+ 1751507685,
+ 1751679545,
+ 1752985897,
+ 1753297133,
+ 1754214628,
+ 1754546894,
+ 1754606246,
+ 1754643237,
+ 1754645079,
+ 1754647074,
+ 1754698327,
+ 1754792749,
+ 1754798923,
+ 1754858317,
+ 1754860110,
+ 1754860400,
+ 1754872618,
+ 1754905345,
+ 1754927689,
+ 1756147974,
+ 1756190926,
+ 1756265690,
+ 1756360955,
+ 1756428495,
+ 1756704824,
+ 1756737685,
+ 1756804936,
+ 1756874572,
+ 1757053236,
+ 1757874716,
+ 1758018291,
+ 1765800271,
+ 1767875272,
+ 1771637325,
+ 1773606972,
+ 1780879045,
+ 1781007934,
+ 1784574102,
+ 1785174319,
+ 1786740932,
+ 1786821704,
+ 1787193500,
+ 1787699221,
+ 1788842244,
+ 1791068279,
+ 1797666394,
+ 1801312388,
+ 1803839644,
+ 1804054854,
+ 1804081401,
+ 1804405895,
+ 1805715690,
+ 1814517574,
+ 1814560070,
+ 1814656840,
+ 1816104145,
+ 1816178925,
+ 1817175198,
+ 1820262641,
+ 1820727381,
+ 1821755934,
+ 1822002839,
+ 1823580230,
+ 1823841492,
+ 1824005974,
+ 1824159037,
+ 1825437894,
+ 1848600826,
+ 1854285018,
+ 1854366938,
+ 1854466380,
+ 1854497001,
+ 1854497008,
+ 1865910331,
+ 1866496199,
+ 1867462756,
+ 1871251689,
+ 1872343590,
+ 1873656984,
+ 1874270021,
+ 1874788501,
+ 1881750231,
+ 1884142379,
+ 1884267068,
+ 1884343396,
+ 1889633006,
+ 1891069765,
+ 1891182792,
+ 1891937366,
+ 1898415413,
+ 1900544002,
+ 1903612236,
+ 1903759600,
+ 1905628916,
+ 1905754853,
+ 1906408542,
+ 1906419001,
+ 1906423097,
+ 1907701479,
+ 1908462185,
+ 1909819252,
+ 1910441627,
+ 1910441773,
+ 1910503637,
+ 1910527802,
+ 1915025672,
+ 1915295948,
+ 1915757815,
+ 1916247343,
+ 1916286197,
+ 1917295176,
+ 1917857531,
+ 1919297291,
+ 1921880376,
+ 1921977416,
1922354008,
1922384686,
1922413290,
@@ -2532,5 +2534,6 @@ public final class AttributeName
1747800157,
1747906667,
1748021284,
+ 1748503880,
};
}
diff --git a/parser/html/nsHtml5AtomList.h b/parser/html/nsHtml5AtomList.h
index 6c8874dde..bd53b5a42 100644
--- a/parser/html/nsHtml5AtomList.h
+++ b/parser/html/nsHtml5AtomList.h
@@ -446,6 +446,7 @@ HTML5_ATOM(lquote, "lquote")
HTML5_ATOM(panose_1, "panose-1")
HTML5_ATOM(numoctaves, "numoctaves")
HTML5_ATOM(numOctaves, "numOctaves")
+HTML5_ATOM(nomodule, "nomodule")
HTML5_ATOM(onload, "onload")
HTML5_ATOM(onbounce, "onbounce")
HTML5_ATOM(oncontrolselect, "oncontrolselect")
diff --git a/parser/html/nsHtml5AttributeName.cpp b/parser/html/nsHtml5AttributeName.cpp
index 2b1ffd507..6bb9a8a16 100644
--- a/parser/html/nsHtml5AttributeName.cpp
+++ b/parser/html/nsHtml5AttributeName.cpp
@@ -546,6 +546,7 @@ nsHtml5AttributeName* nsHtml5AttributeName::ATTR_IDEOGRAPHIC = nullptr;
nsHtml5AttributeName* nsHtml5AttributeName::ATTR_LQUOTE = nullptr;
nsHtml5AttributeName* nsHtml5AttributeName::ATTR_PANOSE_1 = nullptr;
nsHtml5AttributeName* nsHtml5AttributeName::ATTR_NUMOCTAVES = nullptr;
+nsHtml5AttributeName* nsHtml5AttributeName::ATTR_NOMODULE = nullptr;
nsHtml5AttributeName* nsHtml5AttributeName::ATTR_ONLOAD = nullptr;
nsHtml5AttributeName* nsHtml5AttributeName::ATTR_ONBOUNCE = nullptr;
nsHtml5AttributeName* nsHtml5AttributeName::ATTR_ONCONTROLSELECT = nullptr;
@@ -747,7 +748,7 @@ nsHtml5AttributeName* nsHtml5AttributeName::ATTR_VERYTHICKMATHSPACE = nullptr;
nsHtml5AttributeName* nsHtml5AttributeName::ATTR_VERYVERYTHINMATHSPACE = nullptr;
nsHtml5AttributeName* nsHtml5AttributeName::ATTR_VERYVERYTHICKMATHSPACE = nullptr;
nsHtml5AttributeName** nsHtml5AttributeName::ATTRIBUTE_NAMES = 0;
-static int32_t const ATTRIBUTE_HASHES_DATA[] = { 1891069765, 1756360955, 1972151670, 1740096054, 1814656840, 1922419228, 2004199576, 1680411449, 1754606246, 1785174319, 1854466380, 1910441773, 1932959284, 1988132214, 2017010843, 1037879561, 1691145478, 1749350104, 1754860110, 1758018291, 1801312388, 1823580230, 1873656984, 1905754853, 1917295176, 1922679531, 1941409583, 1972996699, 2000162011, 2009059485, 2065170434, 71303169, 1680185931, 1683805446, 1723336432, 1747939528, 1752985897, 1754698327, 1754927689, 1756804936, 1773606972, 1787699221, 1804405895, 1820262641, 1825437894, 1866496199, 1884142379, 1900544002, 1907701479, 1915295948, 1922319046, 1922630475, 1924517489, 1934970504, 1965349396, 1972904522, 1983347764, 1991392548, 2001669450, 2007019632, 2010452700, 2024763702, 2082471938, 57205395, 885522434, 1680165436, 1680311085, 1681694748, 1687751191, 1714745560, 1732771842, 1747348637, 1748566068, 1751507685, 1754214628, 1754645079, 1754798923, 1754872618, 1756190926, 1756704824, 1757053236, 1767875272, 1781007934, 1786821704, 1791068279, 1804054854, 1814517574, 1816178925, 1821755934, 1824005974, 1854285018, 1854497008, 1871251689, 1874788501, 1884343396, 1891937366, 1903759600, 1906419001, 1909819252, 1910527802, 1916247343, 1919297291, 1922400908, 1922566877, 1922665179, 1924206934, 1924629705, 1933369607, 1937777860, 1941454586, 1966439670, 1972744954, 1972922984, 1982640164, 1983461061, 1990062797, 1999273799, 2001578182, 2001814704, 2005925890, 2008084807, 2009079867, 2016711994, 2023146024, 2026975253, 2073034754, 2093791505, 53006051, 60345635, 876085250, 901775362, 1680140893, 1680165613, 1680230940, 1680345685, 1680446153, 1681940503, 1686731997, 1689324870, 1697174123, 1721189160, 1724189239, 1734404167, 1742183484, 1747792072, 1748503880, 1748971848, 1749856356, 1751679545, 1753297133, 1754546894, 1754643237, 1754647074, 1754792749, 1754858317, 1754860400, 1754905345, 1756147974, 1756265690, 1756428495, 1756737685, 1756874572, 1757874716, 1765800271, 1771637325, 1780879045, 1784574102, 1786740932, 1787193500, 1788842244, 1797666394, 1803839644, 1804081401, 1805715690, 1814560070, 1816104145, 1817175198, 1820727381, 1822002839, 1823841492, 1824159037, 1848600826, 1854366938, 1854497001, 1865910331, 1867462756, 1872343590, 1874270021, 1881750231, 1884267068, 1889633006, 1891182792, 1898415413, 1903612236, 1905628916, 1906408542, 1906423097, 1908462185, 1910441627, 1910503637, 1915025672, 1915757815, 1916286197, 1917857531, 1921880376, 1922384591, 1922413292, 1922482777, 1922599757, 1922665052, 1922677495, 1922699851, 1924453467, 1924583073, 1924773438, 1933123337, 1934917290, 1935597338, 1941253366, 1941438085, 1942026440, 1965561677, 1966454567, 1972656710, 1972863609, 1972908839, 1972963917, 1975062341, 1983266615, 1983416119, 1987410233, 1988788535, 1991021879, 1991643278, 2000125224, 2001210183, 2001634459, 2001710299, 2001898808, 2004957380, 2006516551, 2007064812, 2008408414, 2009061533, 2009231684, 2010716309, 2016810187, 2019887833, 2024616088, 2026741958, 2060302634, 2066743298, 2081423362, 2089811970, 2093791509, 52488851, 55077603, 59825747, 64487425, 72351745, 883425282, 894959618, 911736834, 1038141480, 1680159328, 1680165487, 1680181850, 1680198381, 1680251485, 1680323325, 1680347981, 1680433915, 1680511804, 1681844247, 1682440540, 1685882101, 1687503600, 1689048326, 1689839946, 1692408896, 1704262346, 1715466295, 1721347639, 1723340621, 1724238365, 1733919469, 1739583824, 1740130375, 1747299630, 1747455030, 1747839118, 1748306996, 1748552744, 1748869205, 1749027145, 1749399124, 1751232761, 1751649130, 1751755561, 1753049109, 1753550036, 1754434872, 1754579720, 1754612424, 1754644293, 1754647068, 1754647353, 1754751622, 1754794646, 1754835516, 1754860061, 1754860396, 1754860401, 1754899031, 1754907227, 1754958648, 1756155098, 1756219733, 1756302628, 1756426572, 1756471625, 1756710661, 1756762256, 1756836998, 1756889417, 1757421892, 1757942610, 1759379608, 1767725700, 1771569964, 1772032615, 1776114564, 1780975314, 1782518297, 1784643703, 1786622296, 1786775671, 1786851500, 1787365531, 1788254870, 1790814502, 1791070327, 1797886599, 1803561214, 1804036350, 1804069019, 1804235064, 1804978712, 1805715716, 1814558026, 1814656326, 1814986837, 1816144023, 1817175115, 1817177246, 1820637455, 1820928104, 1821958888, 1823574314, 1823829083, 1823975206, 1824081655, 1824377064, 1825677514, 1853862084, 1854302364, 1854464212, 1854474395, 1854497003, 1864698185, 1865910347, 1867448617, 1867620412, 1872034503, 1873590471, 1874261045, 1874698443, 1875753052, 1884079398, 1884246821, 1884295780, 1889569526, 1890996553, 1891098437, 1891186903, 1894552650, 1898428101, 1902640276, 1903659239, 1905541832, 1905672729, 1905902311, 1906408598, 1906421049, 1907660596, 1908195085, 1909438149, 1910328970, 1910441770, 1910487243, 1910507338, 1910572893, 1915146282, 1915341049, 1916210285, 1916278099, 1916337499, 1917327080, 1917953597, 1921061206, 1921894426, 1922354008, 1922384686, 1922413290, 1922413307, 1922470745, 1922531929, 1922567078, 1922607670, 1922632396, 1922665174, 1922671417, 1922679386, 1922679610, 1923088386, 1924443742, 1924462384, 1924570799, 1924585254, 1924738716, 1932870919, 1932986153, 1933145837, 1933508940, 1934917372, 1935099626, 1937336473, 1939976792, 1941286708, 1941435445, 1941440197, 1941550652, 1943317364, 1965512429, 1966384692, 1966442279, 1971855414, 1972196486, 1972744939, 1972750880, 1972904518, 1972904785, 1972909592, 1972962123, 1972980466, 1974849131, 1982254612, 1983157559, 1983290011, 1983398182, 1983432389, 1984430082, 1987422362, 1988784439, 1989522022, 1990107683, 1991220282, 1991625270, 1993343287, 2000096287, 2000160071, 2000752725, 2001527900, 2001634458, 2001669449, 2001710298, 2001732764, 2001826027, 2001898809, 2004846654, 2005342360, 2006459190, 2006824246, 2007021895, 2007064819, 2008401563, 2009041198, 2009061450, 2009071951, 2009141482, 2009434924, 2010542150, 2015950026, 2016787611, 2016910397, 2018908874, 2023011418, 2023342821, 2024647008, 2024794274, 2026893641, 2034765641, 2060474743, 2065694722, 2066762276, 2075005220, 2081947650, 2083520514, 2091784484, 2093791506, 2093791510, 50917059, 52489043, 53537523, 56685811, 57210387, 59830867, 60817409, 68157441, 71827457, 808872090, 878182402, 884998146, 892862466, 900202498, 902299650, 928514050, 1038063816, 1680095865, 1680159327, 1680165421, 1680165437, 1680165533, 1680165692, 1680181996, 1680198203, 1680229115, 1680231247, 1680282148, 1680315086, 1680343801, 1680345965, 1680368221, 1680413393, 1680437801, 1680452349, 1681174213, 1681733672, 1681879063, 1681969220, 1682587945, 1684319541, 1685902598, 1687164232, 1687620127, 1687751377, 1689130184, 1689788441, 1691091102, 1691293817, 1692933184, 1699185409, 1704526375, 1714763319, 1716303957, 1721305962, 1723309623, 1723336528, 1723645710, 1724197420, 1731048742, 1733874289, 1734182982, 1739561208, 1739927860, 1740119884, 1741535501, 1747295467, 1747309881, 1747446838, 1747479606, 1747800157, 1747906667, 1748021284 };
+static int32_t const ATTRIBUTE_HASHES_DATA[] = { 1891098437, 1756426572, 1972151670, 1740096054, 1814986837, 1922419228, 2004199576, 1680411449, 1754612424, 1786622296, 1854474395, 1910487243, 1932959284, 1988132214, 2017010843, 1037879561, 1691145478, 1749399124, 1754860396, 1759379608, 1803561214, 1823829083, 1874261045, 1905902311, 1917327080, 1922679531, 1941409583, 1972996699, 2000162011, 2009059485, 2065170434, 71303169, 1680185931, 1683805446, 1723336432, 1747939528, 1753049109, 1754751622, 1754958648, 1756836998, 1776114564, 1788254870, 1804978712, 1820637455, 1825677514, 1867448617, 1884246821, 1902640276, 1908195085, 1915341049, 1922319046, 1922630475, 1924517489, 1934970504, 1965349396, 1972904522, 1983347764, 1991392548, 2001669450, 2007019632, 2010452700, 2024763702, 2082471938, 57205395, 885522434, 1680165436, 1680311085, 1681694748, 1687751191, 1714745560, 1732771842, 1747348637, 1748869205, 1751649130, 1754434872, 1754647068, 1754835516, 1754899031, 1756219733, 1756710661, 1757421892, 1771569964, 1782518297, 1786851500, 1791070327, 1804069019, 1814558026, 1817175115, 1821958888, 1824081655, 1854302364, 1864698185, 1872034503, 1875753052, 1889569526, 1894552650, 1905541832, 1906421049, 1910328970, 1910572893, 1916278099, 1921061206, 1922400908, 1922566877, 1922665179, 1924206934, 1924629705, 1933369607, 1937777860, 1941454586, 1966439670, 1972744954, 1972922984, 1982640164, 1983461061, 1990062797, 1999273799, 2001578182, 2001814704, 2005925890, 2008084807, 2009079867, 2016711994, 2023146024, 2026975253, 2073034754, 2093791505, 53006051, 60345635, 876085250, 901775362, 1680140893, 1680165613, 1680230940, 1680345685, 1680446153, 1681940503, 1686731997, 1689324870, 1697174123, 1721189160, 1724189239, 1734404167, 1742183484, 1747792072, 1748552744, 1749027145, 1751232761, 1751755561, 1753550036, 1754579720, 1754644293, 1754647353, 1754794646, 1754860061, 1754860401, 1754907227, 1756155098, 1756302628, 1756471625, 1756762256, 1756889417, 1757942610, 1767725700, 1772032615, 1780975314, 1784643703, 1786775671, 1787365531, 1790814502, 1797886599, 1804036350, 1804235064, 1805715716, 1814656326, 1816144023, 1817177246, 1820928104, 1823574314, 1823975206, 1824377064, 1853862084, 1854464212, 1854497003, 1865910347, 1867620412, 1873590471, 1874698443, 1884079398, 1884295780, 1890996553, 1891186903, 1898428101, 1903659239, 1905672729, 1906408598, 1907660596, 1909438149, 1910441770, 1910507338, 1915146282, 1916210285, 1916337499, 1917953597, 1921894426, 1922384591, 1922413292, 1922482777, 1922599757, 1922665052, 1922677495, 1922699851, 1924453467, 1924583073, 1924773438, 1933123337, 1934917290, 1935597338, 1941253366, 1941438085, 1942026440, 1965561677, 1966454567, 1972656710, 1972863609, 1972908839, 1972963917, 1975062341, 1983266615, 1983416119, 1987410233, 1988788535, 1991021879, 1991643278, 2000125224, 2001210183, 2001634459, 2001710299, 2001898808, 2004957380, 2006516551, 2007064812, 2008408414, 2009061533, 2009231684, 2010716309, 2016810187, 2019887833, 2024616088, 2026741958, 2060302634, 2066743298, 2081423362, 2089811970, 2093791509, 52488851, 55077603, 59825747, 64487425, 72351745, 883425282, 894959618, 911736834, 1038141480, 1680159328, 1680165487, 1680181850, 1680198381, 1680251485, 1680323325, 1680347981, 1680433915, 1680511804, 1681844247, 1682440540, 1685882101, 1687503600, 1689048326, 1689839946, 1692408896, 1704262346, 1715466295, 1721347639, 1723340621, 1724238365, 1733919469, 1739583824, 1740130375, 1747299630, 1747455030, 1747839118, 1748306996, 1748566068, 1748971848, 1749350104, 1749856356, 1751507685, 1751679545, 1752985897, 1753297133, 1754214628, 1754546894, 1754606246, 1754643237, 1754645079, 1754647074, 1754698327, 1754792749, 1754798923, 1754858317, 1754860110, 1754860400, 1754872618, 1754905345, 1754927689, 1756147974, 1756190926, 1756265690, 1756360955, 1756428495, 1756704824, 1756737685, 1756804936, 1756874572, 1757053236, 1757874716, 1758018291, 1765800271, 1767875272, 1771637325, 1773606972, 1780879045, 1781007934, 1784574102, 1785174319, 1786740932, 1786821704, 1787193500, 1787699221, 1788842244, 1791068279, 1797666394, 1801312388, 1803839644, 1804054854, 1804081401, 1804405895, 1805715690, 1814517574, 1814560070, 1814656840, 1816104145, 1816178925, 1817175198, 1820262641, 1820727381, 1821755934, 1822002839, 1823580230, 1823841492, 1824005974, 1824159037, 1825437894, 1848600826, 1854285018, 1854366938, 1854466380, 1854497001, 1854497008, 1865910331, 1866496199, 1867462756, 1871251689, 1872343590, 1873656984, 1874270021, 1874788501, 1881750231, 1884142379, 1884267068, 1884343396, 1889633006, 1891069765, 1891182792, 1891937366, 1898415413, 1900544002, 1903612236, 1903759600, 1905628916, 1905754853, 1906408542, 1906419001, 1906423097, 1907701479, 1908462185, 1909819252, 1910441627, 1910441773, 1910503637, 1910527802, 1915025672, 1915295948, 1915757815, 1916247343, 1916286197, 1917295176, 1917857531, 1919297291, 1921880376, 1921977416, 1922354008, 1922384686, 1922413290, 1922413307, 1922470745, 1922531929, 1922567078, 1922607670, 1922632396, 1922665174, 1922671417, 1922679386, 1922679610, 1923088386, 1924443742, 1924462384, 1924570799, 1924585254, 1924738716, 1932870919, 1932986153, 1933145837, 1933508940, 1934917372, 1935099626, 1937336473, 1939976792, 1941286708, 1941435445, 1941440197, 1941550652, 1943317364, 1965512429, 1966384692, 1966442279, 1971855414, 1972196486, 1972744939, 1972750880, 1972904518, 1972904785, 1972909592, 1972962123, 1972980466, 1974849131, 1982254612, 1983157559, 1983290011, 1983398182, 1983432389, 1984430082, 1987422362, 1988784439, 1989522022, 1990107683, 1991220282, 1991625270, 1993343287, 2000096287, 2000160071, 2000752725, 2001527900, 2001634458, 2001669449, 2001710298, 2001732764, 2001826027, 2001898809, 2004846654, 2005342360, 2006459190, 2006824246, 2007021895, 2007064819, 2008401563, 2009041198, 2009061450, 2009071951, 2009141482, 2009434924, 2010542150, 2015950026, 2016787611, 2016910397, 2018908874, 2023011418, 2023342821, 2024647008, 2024794274, 2026893641, 2034765641, 2060474743, 2065694722, 2066762276, 2075005220, 2081947650, 2083520514, 2091784484, 2093791506, 2093791510, 50917059, 52489043, 53537523, 56685811, 57210387, 59830867, 60817409, 68157441, 71827457, 808872090, 878182402, 884998146, 892862466, 900202498, 902299650, 928514050, 1038063816, 1680095865, 1680159327, 1680165421, 1680165437, 1680165533, 1680165692, 1680181996, 1680198203, 1680229115, 1680231247, 1680282148, 1680315086, 1680343801, 1680345965, 1680368221, 1680413393, 1680437801, 1680452349, 1681174213, 1681733672, 1681879063, 1681969220, 1682587945, 1684319541, 1685902598, 1687164232, 1687620127, 1687751377, 1689130184, 1689788441, 1691091102, 1691293817, 1692933184, 1699185409, 1704526375, 1714763319, 1716303957, 1721305962, 1723309623, 1723336528, 1723645710, 1724197420, 1731048742, 1733874289, 1734182982, 1739561208, 1739927860, 1740119884, 1741535501, 1747295467, 1747309881, 1747446838, 1747479606, 1747800157, 1747906667, 1748021284, 1748503880 };
staticJArray<int32_t,int32_t> nsHtml5AttributeName::ATTRIBUTE_HASHES = { ATTRIBUTE_HASHES_DATA, MOZ_ARRAY_LENGTH(ATTRIBUTE_HASHES_DATA) };
void
nsHtml5AttributeName::initializeStatics()
@@ -1168,6 +1169,7 @@ nsHtml5AttributeName::initializeStatics()
ATTR_LQUOTE = new nsHtml5AttributeName(ALL_NO_NS, SAME_LOCAL(nsHtml5Atoms::lquote), ALL_NO_PREFIX);
ATTR_PANOSE_1 = new nsHtml5AttributeName(ALL_NO_NS, SAME_LOCAL(nsHtml5Atoms::panose_1), ALL_NO_PREFIX);
ATTR_NUMOCTAVES = new nsHtml5AttributeName(ALL_NO_NS, SVG_DIFFERENT(nsHtml5Atoms::numoctaves, nsHtml5Atoms::numOctaves), ALL_NO_PREFIX);
+ ATTR_NOMODULE = new nsHtml5AttributeName(ALL_NO_NS, SAME_LOCAL(nsHtml5Atoms::nomodule), ALL_NO_PREFIX);
ATTR_ONLOAD = new nsHtml5AttributeName(ALL_NO_NS, SAME_LOCAL(nsHtml5Atoms::onload), ALL_NO_PREFIX);
ATTR_ONBOUNCE = new nsHtml5AttributeName(ALL_NO_NS, SAME_LOCAL(nsHtml5Atoms::onbounce), ALL_NO_PREFIX);
ATTR_ONCONTROLSELECT = new nsHtml5AttributeName(ALL_NO_NS, SAME_LOCAL(nsHtml5Atoms::oncontrolselect), ALL_NO_PREFIX);
@@ -1368,32 +1370,32 @@ nsHtml5AttributeName::initializeStatics()
ATTR_VERYTHICKMATHSPACE = new nsHtml5AttributeName(ALL_NO_NS, SAME_LOCAL(nsHtml5Atoms::verythickmathspace), ALL_NO_PREFIX);
ATTR_VERYVERYTHINMATHSPACE = new nsHtml5AttributeName(ALL_NO_NS, SAME_LOCAL(nsHtml5Atoms::veryverythinmathspace), ALL_NO_PREFIX);
ATTR_VERYVERYTHICKMATHSPACE = new nsHtml5AttributeName(ALL_NO_NS, SAME_LOCAL(nsHtml5Atoms::veryverythickmathspace), ALL_NO_PREFIX);
- ATTRIBUTE_NAMES = new nsHtml5AttributeName*[584];
- ATTRIBUTE_NAMES[0] = ATTR_STEMH;
- ATTRIBUTE_NAMES[1] = ATTR_REPEATCOUNT;
+ ATTRIBUTE_NAMES = new nsHtml5AttributeName*[585];
+ ATTRIBUTE_NAMES[0] = ATTR_STEMV;
+ ATTRIBUTE_NAMES[1] = ATTR_REPEAT_START;
ATTRIBUTE_NAMES[2] = ATTR_NOWRAP;
ATTRIBUTE_NAMES[3] = ATTR_SRCDOC;
- ATTRIBUTE_NAMES[4] = ATTR_ADDITIVE;
+ ATTRIBUTE_NAMES[4] = ATTR_BEGIN;
ATTRIBUTE_NAMES[5] = ATTR_ONFORMCHANGE;
ATTRIBUTE_NAMES[6] = ATTR_KEYTIMES;
ATTRIBUTE_NAMES[7] = ATTR_ARIA_SORT;
- ATTRIBUTE_NAMES[8] = ATTR_OBJECT;
- ATTRIBUTE_NAMES[9] = ATTR_IMAGE_RENDERING;
- ATTRIBUTE_NAMES[10] = ATTR_MARKER_START;
- ATTRIBUTE_NAMES[11] = ATTR_XLINK_ARCROLE;
+ ATTRIBUTE_NAMES[8] = ATTR_ONSELECT;
+ ATTRIBUTE_NAMES[9] = ATTR_LANGUAGE;
+ ATTRIBUTE_NAMES[10] = ATTR_MARKERWIDTH;
+ ATTRIBUTE_NAMES[11] = ATTR_XMLNS_XLINK;
ATTRIBUTE_NAMES[12] = ATTR_CLIP;
ATTRIBUTE_NAMES[13] = ATTR_LOWSRC;
ATTRIBUTE_NAMES[14] = ATTR_COLUMNWIDTH;
ATTRIBUTE_NAMES[15] = ATTR_XML_SPACE;
ATTRIBUTE_NAMES[16] = ATTR_VSPACE;
- ATTRIBUTE_NAMES[17] = ATTR_EDGEMODE;
- ATTRIBUTE_NAMES[18] = ATTR_ONBEFOREUPDATE;
- ATTRIBUTE_NAMES[19] = ATTR_UNDERLINE_THICKNESS;
- ATTRIBUTE_NAMES[20] = ATTR_HIGH;
- ATTRIBUTE_NAMES[21] = ATTR_RADIUS;
- ATTRIBUTE_NAMES[22] = ATTR_ROWLINES;
- ATTRIBUTE_NAMES[23] = ATTR_ONEND;
- ATTRIBUTE_NAMES[24] = ATTR_ENCODING;
+ ATTRIBUTE_NAMES[17] = ATTR_EDGE;
+ ATTRIBUTE_NAMES[18] = ATTR_ONDEACTIVATE;
+ ATTRIBUTE_NAMES[19] = ATTR_X_HEIGHT;
+ ATTRIBUTE_NAMES[20] = ATTR_LIGHTING_COLOR;
+ ATTRIBUTE_NAMES[21] = ATTR_SCRIPTLEVEL;
+ ATTRIBUTE_NAMES[22] = ATTR_SCALE;
+ ATTRIBUTE_NAMES[23] = ATTR_ONINPUT;
+ ATTRIBUTE_NAMES[24] = ATTR_EXPONENT;
ATTRIBUTE_NAMES[25] = ATTR_ONFORMINPUT;
ATTRIBUTE_NAMES[26] = ATTR_SHAPE_RENDERING;
ATTRIBUTE_NAMES[27] = ATTR_ONDRAGLEAVE;
@@ -1405,20 +1407,20 @@ nsHtml5AttributeName::initializeStatics()
ATTRIBUTE_NAMES[33] = ATTR_HSPACE;
ATTRIBUTE_NAMES[34] = ATTR_SPECULAREXPONENT;
ATTRIBUTE_NAMES[35] = ATTR_BASELINE;
- ATTRIBUTE_NAMES[36] = ATTR_LINEBREAK;
- ATTRIBUTE_NAMES[37] = ATTR_ONBEGIN;
- ATTRIBUTE_NAMES[38] = ATTR_ONKEYDOWN;
- ATTRIBUTE_NAMES[39] = ATTR_STRETCHY;
- ATTRIBUTE_NAMES[40] = ATTR_SURFACESCALE;
- ATTRIBUTE_NAMES[41] = ATTR_NARGS;
- ATTRIBUTE_NAMES[42] = ATTR_NOSHADE;
- ATTRIBUTE_NAMES[43] = ATTR_LIMITINGCONEANGLE;
- ATTRIBUTE_NAMES[44] = ATTR_VALIGN;
- ATTRIBUTE_NAMES[45] = ATTR_DECLARE;
- ATTRIBUTE_NAMES[46] = ATTR_FRAMEBORDER;
- ATTRIBUTE_NAMES[47] = ATTR_IN;
- ATTRIBUTE_NAMES[48] = ATTR_STANDBY;
- ATTRIBUTE_NAMES[49] = ATTR_AUTOCOMPLETE;
+ ATTRIBUTE_NAMES[36] = ATTR_LABEL;
+ ATTRIBUTE_NAMES[37] = ATTR_ONHELP;
+ ATTRIBUTE_NAMES[38] = ATTR_ONRESIZE;
+ ATTRIBUTE_NAMES[39] = ATTR_SCHEME;
+ ATTRIBUTE_NAMES[40] = ATTR_XREF;
+ ATTRIBUTE_NAMES[41] = ATTR_ORIGIN;
+ ATTRIBUTE_NAMES[42] = ATTR_ONCHANGE;
+ ATTRIBUTE_NAMES[43] = ATTR_MEDIUMMATHSPACE;
+ ATTRIBUTE_NAMES[44] = ATTR_VISIBILITY;
+ ATTRIBUTE_NAMES[45] = ATTR_FILL_RULE;
+ ATTRIBUTE_NAMES[46] = ATTR_FRAME;
+ ATTRIBUTE_NAMES[47] = ATTR_ICON;
+ ATTRIBUTE_NAMES[48] = ATTR_THINMATHSPACE;
+ ATTRIBUTE_NAMES[49] = ATTR_AUTOFOCUS;
ATTRIBUTE_NAMES[50] = ATTR_ONLOAD;
ATTRIBUTE_NAMES[51] = ATTR_ONMOVESTART;
ATTRIBUTE_NAMES[52] = ATTR_STROKE_DASHOFFSET;
@@ -1441,36 +1443,36 @@ nsHtml5AttributeName::initializeStatics()
ATTRIBUTE_NAMES[69] = ATTR_CALCMODE;
ATTRIBUTE_NAMES[70] = ATTR_ID;
ATTRIBUTE_NAMES[71] = ATTR_ACCENT_HEIGHT;
- ATTRIBUTE_NAMES[72] = ATTR_CITE;
- ATTRIBUTE_NAMES[73] = ATTR_INDEX;
- ATTRIBUTE_NAMES[74] = ATTR_NAME;
- ATTRIBUTE_NAMES[75] = ATTR_ONRESET;
- ATTRIBUTE_NAMES[76] = ATTR_ORIENTATION;
- ATTRIBUTE_NAMES[77] = ATTR_ONKEYPRESS;
- ATTRIBUTE_NAMES[78] = ATTR_REFERRERPOLICY;
- ATTRIBUTE_NAMES[79] = ATTR_SELECTED;
- ATTRIBUTE_NAMES[80] = ATTR_SIZE;
- ATTRIBUTE_NAMES[81] = ATTR_HREFLANG;
- ATTRIBUTE_NAMES[82] = ATTR_ALIGNMENTSCOPE;
- ATTRIBUTE_NAMES[83] = ATTR_LONGDESC;
- ATTRIBUTE_NAMES[84] = ATTR_TARGETX;
- ATTRIBUTE_NAMES[85] = ATTR_METHOD;
- ATTRIBUTE_NAMES[86] = ATTR_ALTIMG;
- ATTRIBUTE_NAMES[87] = ATTR_DEFINITIONURL;
- ATTRIBUTE_NAMES[88] = ATTR_ONFILTERCHANGE;
- ATTRIBUTE_NAMES[89] = ATTR_STRIKETHROUGH_POSITION;
- ATTRIBUTE_NAMES[90] = ATTR_MARKER_MID;
- ATTRIBUTE_NAMES[91] = ATTR_MASKCONTENTUNITS;
- ATTRIBUTE_NAMES[92] = ATTR_MAXLENGTH;
- ATTRIBUTE_NAMES[93] = ATTR_TITLE;
- ATTRIBUTE_NAMES[94] = ATTR_FORM;
- ATTRIBUTE_NAMES[95] = ATTR_USEMAP;
- ATTRIBUTE_NAMES[96] = ATTR_KERNELUNITLENGTH;
- ATTRIBUTE_NAMES[97] = ATTR_POINTSATX;
- ATTRIBUTE_NAMES[98] = ATTR_WHEN;
- ATTRIBUTE_NAMES[99] = ATTR_XLINK_SHOW;
- ATTRIBUTE_NAMES[100] = ATTR_COLOR_RENDERING;
- ATTRIBUTE_NAMES[101] = ATTR_IDEOGRAPHIC;
+ ATTRIBUTE_NAMES[72] = ATTR_DEFER;
+ ATTRIBUTE_NAMES[73] = ATTR_IRRELEVANT;
+ ATTRIBUTE_NAMES[74] = ATTR_NORESIZE;
+ ATTRIBUTE_NAMES[75] = ATTR_ONCELLCHANGE;
+ ATTRIBUTE_NAMES[76] = ATTR_ONBEFORECOPY;
+ ATTRIBUTE_NAMES[77] = ATTR_ONKEYUP;
+ ATTRIBUTE_NAMES[78] = ATTR_RULES;
+ ATTRIBUTE_NAMES[79] = ATTR_SPEED;
+ ATTRIBUTE_NAMES[80] = ATTR_TYPE;
+ ATTRIBUTE_NAMES[81] = ATTR_ONAFTERPRINT;
+ ATTRIBUTE_NAMES[82] = ATTR_DRAGGABLE;
+ ATTRIBUTE_NAMES[83] = ATTR_LENGTHADJUST;
+ ATTRIBUTE_NAMES[84] = ATTR_TARGETY;
+ ATTRIBUTE_NAMES[85] = ATTR_MATHVARIANT;
+ ATTRIBUTE_NAMES[86] = ATTR_ACTIONTYPE;
+ ATTRIBUTE_NAMES[87] = ATTR_HORIZ_ADV_X;
+ ATTRIBUTE_NAMES[88] = ATTR_ONFINISH;
+ ATTRIBUTE_NAMES[89] = ATTR_STRIKETHROUGH_THICKNESS;
+ ATTRIBUTE_NAMES[90] = ATTR_MARKERHEIGHT;
+ ATTRIBUTE_NAMES[91] = ATTR_AMPLITUDE;
+ ATTRIBUTE_NAMES[92] = ATTR_ONCLICK;
+ ATTRIBUTE_NAMES[93] = ATTR_V_ALPHABETIC;
+ ATTRIBUTE_NAMES[94] = ATTR_PROMPT;
+ ATTRIBUTE_NAMES[95] = ATTR_ZOOMANDPAN;
+ ATTRIBUTE_NAMES[96] = ATTR_ONUNLOAD;
+ ATTRIBUTE_NAMES[97] = ATTR_POINTSATY;
+ ATTRIBUTE_NAMES[98] = ATTR_XLINK_HREF;
+ ATTRIBUTE_NAMES[99] = ATTR_XLINK_ACTUATE;
+ ATTRIBUTE_NAMES[100] = ATTR_COLOR_INTERPOLATION;
+ ATTRIBUTE_NAMES[101] = ATTR_LQUOTE;
ATTRIBUTE_NAMES[102] = ATTR_ONMOUSEWHEEL;
ATTRIBUTE_NAMES[103] = ATTR_ONCONTEXTMENU;
ATTRIBUTE_NAMES[104] = ATTR_ONMOUSEMOVE;
@@ -1514,66 +1516,66 @@ nsHtml5AttributeName::initializeStatics()
ATTRIBUTE_NAMES[142] = ATTR_HEADERS;
ATTRIBUTE_NAMES[143] = ATTR_WORD_SPACING;
ATTRIBUTE_NAMES[144] = ATTR_BEVELLED;
- ATTRIBUTE_NAMES[145] = ATTR_CODETYPE;
- ATTRIBUTE_NAMES[146] = ATTR_DATETIME;
- ATTRIBUTE_NAMES[147] = ATTR_FACE;
- ATTRIBUTE_NAMES[148] = ATTR_INTERCEPT;
- ATTRIBUTE_NAMES[149] = ATTR_LINETHICKNESS;
- ATTRIBUTE_NAMES[150] = ATTR_ONBEFOREUNLOAD;
- ATTRIBUTE_NAMES[151] = ATTR_ORDER;
- ATTRIBUTE_NAMES[152] = ATTR_ONREADYSTATECHANGE;
- ATTRIBUTE_NAMES[153] = ATTR_ONBEFOREPRINT;
- ATTRIBUTE_NAMES[154] = ATTR_ONSELECTSTART;
- ATTRIBUTE_NAMES[155] = ATTR_ONBEFOREACTIVATE;
- ATTRIBUTE_NAMES[156] = ATTR_ONBEFOREEDITFOCUS;
- ATTRIBUTE_NAMES[157] = ATTR_REPEAT;
- ATTRIBUTE_NAMES[158] = ATTR_REPEAT_MIN;
- ATTRIBUTE_NAMES[159] = ATTR_REPEAT_TEMPLATE;
- ATTRIBUTE_NAMES[160] = ATTR_SIZES;
- ATTRIBUTE_NAMES[161] = ATTR_SPREADMETHOD;
- ATTRIBUTE_NAMES[162] = ATTR_UNSELECTABLE;
- ATTRIBUTE_NAMES[163] = ATTR_DIFFUSECONSTANT;
- ATTRIBUTE_NAMES[164] = ATTR_ONAFTERUPDATE;
- ATTRIBUTE_NAMES[165] = ATTR_ALIGN;
- ATTRIBUTE_NAMES[166] = ATTR_HEIGHT;
- ATTRIBUTE_NAMES[167] = ATTR_LANG;
- ATTRIBUTE_NAMES[168] = ATTR_MARGINHEIGHT;
- ATTRIBUTE_NAMES[169] = ATTR_PING;
- ATTRIBUTE_NAMES[170] = ATTR_ALPHABETIC;
- ATTRIBUTE_NAMES[171] = ATTR_MATHEMATICAL;
- ATTRIBUTE_NAMES[172] = ATTR_MATHCOLOR;
- ATTRIBUTE_NAMES[173] = ATTR_PATHLENGTH;
- ATTRIBUTE_NAMES[174] = ATTR_ACTION;
- ATTRIBUTE_NAMES[175] = ATTR_DOMINANT_BASELINE;
- ATTRIBUTE_NAMES[176] = ATTR_HORIZ_ORIGIN_X;
- ATTRIBUTE_NAMES[177] = ATTR_MEDIA;
- ATTRIBUTE_NAMES[178] = ATTR_OPTIMUM;
- ATTRIBUTE_NAMES[179] = ATTR_SCRIPTSIZEMULTIPLIER;
- ATTRIBUTE_NAMES[180] = ATTR_SCRIPTMINSIZE;
- ATTRIBUTE_NAMES[181] = ATTR_BACKGROUND;
- ATTRIBUTE_NAMES[182] = ATTR_MARKER_END;
- ATTRIBUTE_NAMES[183] = ATTR_MASKUNITS;
- ATTRIBUTE_NAMES[184] = ATTR_CELLSPACING;
- ATTRIBUTE_NAMES[185] = ATTR_FILL;
- ATTRIBUTE_NAMES[186] = ATTR_ONBLUR;
- ATTRIBUTE_NAMES[187] = ATTR_STYLE;
- ATTRIBUTE_NAMES[188] = ATTR_AZIMUTH;
- ATTRIBUTE_NAMES[189] = ATTR_FRAMESPACING;
- ATTRIBUTE_NAMES[190] = ATTR_PRIMITIVEUNITS;
- ATTRIBUTE_NAMES[191] = ATTR_SEAMLESS;
- ATTRIBUTE_NAMES[192] = ATTR_ASYNC;
- ATTRIBUTE_NAMES[193] = ATTR_KERNELMATRIX;
- ATTRIBUTE_NAMES[194] = ATTR_OPEN;
- ATTRIBUTE_NAMES[195] = ATTR_POINTER_EVENTS;
- ATTRIBUTE_NAMES[196] = ATTR_POINTSATZ;
- ATTRIBUTE_NAMES[197] = ATTR_TRANSFORM;
- ATTRIBUTE_NAMES[198] = ATTR_XLINK_TITLE;
- ATTRIBUTE_NAMES[199] = ATTR_XMLNS;
- ATTRIBUTE_NAMES[200] = ATTR_AUTOPLAY;
- ATTRIBUTE_NAMES[201] = ATTR_BGCOLOR;
- ATTRIBUTE_NAMES[202] = ATTR_COLOR;
- ATTRIBUTE_NAMES[203] = ATTR_FLOOD_COLOR;
- ATTRIBUTE_NAMES[204] = ATTR_PANOSE_1;
+ ATTRIBUTE_NAMES[145] = ATTR_CODEBASE;
+ ATTRIBUTE_NAMES[146] = ATTR_DIRECTION;
+ ATTRIBUTE_NAMES[147] = ATTR_HIDEFOCUS;
+ ATTRIBUTE_NAMES[148] = ATTR_INTEGRITY;
+ ATTRIBUTE_NAMES[149] = ATTR_MODE;
+ ATTRIBUTE_NAMES[150] = ATTR_ONREPEAT;
+ ATTRIBUTE_NAMES[151] = ATTR_OTHER;
+ ATTRIBUTE_NAMES[152] = ATTR_ONMESSAGE;
+ ATTRIBUTE_NAMES[153] = ATTR_ORIENT;
+ ATTRIBUTE_NAMES[154] = ATTR_ONBEFOREPASTE;
+ ATTRIBUTE_NAMES[155] = ATTR_ONBEFORDEACTIVATE;
+ ATTRIBUTE_NAMES[156] = ATTR_ONBEFORECUT;
+ ATTRIBUTE_NAMES[157] = ATTR_REPEAT_MAX;
+ ATTRIBUTE_NAMES[158] = ATTR_ROLE;
+ ATTRIBUTE_NAMES[159] = ATTR_REPEATDUR;
+ ATTRIBUTE_NAMES[160] = ATTR_SUPERSCRIPTSHIFT;
+ ATTRIBUTE_NAMES[161] = ATTR_SELECTION;
+ ATTRIBUTE_NAMES[162] = ATTR_UNDERLINE_POSITION;
+ ATTRIBUTE_NAMES[163] = ATTR_HREF;
+ ATTRIBUTE_NAMES[164] = ATTR_PROFILE;
+ ATTRIBUTE_NAMES[165] = ATTR_ALIGNMENT_BASELINE;
+ ATTRIBUTE_NAMES[166] = ATTR_HANGING;
+ ATTRIBUTE_NAMES[167] = ATTR_LARGEOP;
+ ATTRIBUTE_NAMES[168] = ATTR_MARGINWIDTH;
+ ATTRIBUTE_NAMES[169] = ATTR_TARGET;
+ ATTRIBUTE_NAMES[170] = ATTR_ARCHIVE;
+ ATTRIBUTE_NAMES[171] = ATTR_MATHBACKGROUND;
+ ATTRIBUTE_NAMES[172] = ATTR_MATHSIZE;
+ ATTRIBUTE_NAMES[173] = ATTR_PATH;
+ ATTRIBUTE_NAMES[174] = ATTR_ACTIVE;
+ ATTRIBUTE_NAMES[175] = ATTR_DIVISOR;
+ ATTRIBUTE_NAMES[176] = ATTR_HORIZ_ORIGIN_Y;
+ ATTRIBUTE_NAMES[177] = ATTR_MANIFEST;
+ ATTRIBUTE_NAMES[178] = ATTR_RADIOGROUP;
+ ATTRIBUTE_NAMES[179] = ATTR_STRING;
+ ATTRIBUTE_NAMES[180] = ATTR_TABINDEX;
+ ATTRIBUTE_NAMES[181] = ATTR_LINK;
+ ATTRIBUTE_NAMES[182] = ATTR_MASK;
+ ATTRIBUTE_NAMES[183] = ATTR_MARKERUNITS;
+ ATTRIBUTE_NAMES[184] = ATTR_CELLPADDING;
+ ATTRIBUTE_NAMES[185] = ATTR_FILL_OPACITY;
+ ATTRIBUTE_NAMES[186] = ATTR_REPLACE;
+ ATTRIBUTE_NAMES[187] = ATTR_TABLEVALUES;
+ ATTRIBUTE_NAMES[188] = ATTR_FORMAT;
+ ATTRIBUTE_NAMES[189] = ATTR_FROM;
+ ATTRIBUTE_NAMES[190] = ATTR_SYMMETRIC;
+ ATTRIBUTE_NAMES[191] = ATTR_SUMMARY;
+ ATTRIBUTE_NAMES[192] = ATTR_ALINK;
+ ATTRIBUTE_NAMES[193] = ATTR_KERNING;
+ ATTRIBUTE_NAMES[194] = ATTR_ONINVALID;
+ ATTRIBUTE_NAMES[195] = ATTR_POINTS;
+ ATTRIBUTE_NAMES[196] = ATTR_SPAN;
+ ATTRIBUTE_NAMES[197] = ATTR_VLINK;
+ ATTRIBUTE_NAMES[198] = ATTR_XLINK_ROLE;
+ ATTRIBUTE_NAMES[199] = ATTR_XLINK_TYPE;
+ ATTRIBUTE_NAMES[200] = ATTR_AUTOSUBMIT;
+ ATTRIBUTE_NAMES[201] = ATTR_COLOR_PROFILE;
+ ATTRIBUTE_NAMES[202] = ATTR_COLOR_INTERPOLATION_FILTERS;
+ ATTRIBUTE_NAMES[203] = ATTR_FLOOD_OPACITY;
+ ATTRIBUTE_NAMES[204] = ATTR_NUMOCTAVES;
ATTRIBUTE_NAMES[205] = ATTR_ONCONTROLSELECT;
ATTRIBUTE_NAMES[206] = ATTR_ONMOUSEENTER;
ATTRIBUTE_NAMES[207] = ATTR_ONROWEXIT;
@@ -1661,125 +1663,125 @@ nsHtml5AttributeName::initializeStatics()
ATTRIBUTE_NAMES[289] = ATTR_ASCENT;
ATTRIBUTE_NAMES[290] = ATTR_BASELINE_SHIFT;
ATTRIBUTE_NAMES[291] = ATTR_CODE;
- ATTRIBUTE_NAMES[292] = ATTR_CODEBASE;
- ATTRIBUTE_NAMES[293] = ATTR_DEFER;
- ATTRIBUTE_NAMES[294] = ATTR_DIRECTION;
- ATTRIBUTE_NAMES[295] = ATTR_EDGE;
- ATTRIBUTE_NAMES[296] = ATTR_HIDEFOCUS;
- ATTRIBUTE_NAMES[297] = ATTR_IRRELEVANT;
- ATTRIBUTE_NAMES[298] = ATTR_INTEGRITY;
- ATTRIBUTE_NAMES[299] = ATTR_LABEL;
- ATTRIBUTE_NAMES[300] = ATTR_MODE;
- ATTRIBUTE_NAMES[301] = ATTR_NORESIZE;
- ATTRIBUTE_NAMES[302] = ATTR_ONREPEAT;
- ATTRIBUTE_NAMES[303] = ATTR_ONSELECT;
- ATTRIBUTE_NAMES[304] = ATTR_OTHER;
- ATTRIBUTE_NAMES[305] = ATTR_ONCELLCHANGE;
- ATTRIBUTE_NAMES[306] = ATTR_ONMESSAGE;
- ATTRIBUTE_NAMES[307] = ATTR_ONHELP;
- ATTRIBUTE_NAMES[308] = ATTR_ORIENT;
- ATTRIBUTE_NAMES[309] = ATTR_ONBEFORECOPY;
- ATTRIBUTE_NAMES[310] = ATTR_ONBEFOREPASTE;
- ATTRIBUTE_NAMES[311] = ATTR_ONDEACTIVATE;
- ATTRIBUTE_NAMES[312] = ATTR_ONBEFORDEACTIVATE;
- ATTRIBUTE_NAMES[313] = ATTR_ONKEYUP;
- ATTRIBUTE_NAMES[314] = ATTR_ONBEFORECUT;
- ATTRIBUTE_NAMES[315] = ATTR_ONRESIZE;
- ATTRIBUTE_NAMES[316] = ATTR_REPEAT_MAX;
- ATTRIBUTE_NAMES[317] = ATTR_RULES;
- ATTRIBUTE_NAMES[318] = ATTR_ROLE;
- ATTRIBUTE_NAMES[319] = ATTR_REPEAT_START;
- ATTRIBUTE_NAMES[320] = ATTR_REPEATDUR;
- ATTRIBUTE_NAMES[321] = ATTR_SPEED;
- ATTRIBUTE_NAMES[322] = ATTR_SUPERSCRIPTSHIFT;
- ATTRIBUTE_NAMES[323] = ATTR_SCHEME;
- ATTRIBUTE_NAMES[324] = ATTR_SELECTION;
- ATTRIBUTE_NAMES[325] = ATTR_TYPE;
- ATTRIBUTE_NAMES[326] = ATTR_UNDERLINE_POSITION;
- ATTRIBUTE_NAMES[327] = ATTR_X_HEIGHT;
- ATTRIBUTE_NAMES[328] = ATTR_HREF;
- ATTRIBUTE_NAMES[329] = ATTR_ONAFTERPRINT;
- ATTRIBUTE_NAMES[330] = ATTR_PROFILE;
- ATTRIBUTE_NAMES[331] = ATTR_XREF;
- ATTRIBUTE_NAMES[332] = ATTR_ALIGNMENT_BASELINE;
- ATTRIBUTE_NAMES[333] = ATTR_DRAGGABLE;
- ATTRIBUTE_NAMES[334] = ATTR_HANGING;
- ATTRIBUTE_NAMES[335] = ATTR_LANGUAGE;
- ATTRIBUTE_NAMES[336] = ATTR_LARGEOP;
- ATTRIBUTE_NAMES[337] = ATTR_LENGTHADJUST;
- ATTRIBUTE_NAMES[338] = ATTR_MARGINWIDTH;
- ATTRIBUTE_NAMES[339] = ATTR_ORIGIN;
- ATTRIBUTE_NAMES[340] = ATTR_TARGET;
- ATTRIBUTE_NAMES[341] = ATTR_TARGETY;
- ATTRIBUTE_NAMES[342] = ATTR_ARCHIVE;
- ATTRIBUTE_NAMES[343] = ATTR_LIGHTING_COLOR;
- ATTRIBUTE_NAMES[344] = ATTR_MATHBACKGROUND;
- ATTRIBUTE_NAMES[345] = ATTR_MATHVARIANT;
- ATTRIBUTE_NAMES[346] = ATTR_MATHSIZE;
- ATTRIBUTE_NAMES[347] = ATTR_ONCHANGE;
- ATTRIBUTE_NAMES[348] = ATTR_PATH;
- ATTRIBUTE_NAMES[349] = ATTR_ACTIONTYPE;
- ATTRIBUTE_NAMES[350] = ATTR_ACTIVE;
- ATTRIBUTE_NAMES[351] = ATTR_BEGIN;
- ATTRIBUTE_NAMES[352] = ATTR_DIVISOR;
- ATTRIBUTE_NAMES[353] = ATTR_HORIZ_ADV_X;
- ATTRIBUTE_NAMES[354] = ATTR_HORIZ_ORIGIN_Y;
- ATTRIBUTE_NAMES[355] = ATTR_MEDIUMMATHSPACE;
- ATTRIBUTE_NAMES[356] = ATTR_MANIFEST;
- ATTRIBUTE_NAMES[357] = ATTR_ONFINISH;
- ATTRIBUTE_NAMES[358] = ATTR_RADIOGROUP;
- ATTRIBUTE_NAMES[359] = ATTR_SCRIPTLEVEL;
- ATTRIBUTE_NAMES[360] = ATTR_STRING;
- ATTRIBUTE_NAMES[361] = ATTR_STRIKETHROUGH_THICKNESS;
- ATTRIBUTE_NAMES[362] = ATTR_TABINDEX;
- ATTRIBUTE_NAMES[363] = ATTR_VISIBILITY;
- ATTRIBUTE_NAMES[364] = ATTR_LINK;
- ATTRIBUTE_NAMES[365] = ATTR_MARKERHEIGHT;
- ATTRIBUTE_NAMES[366] = ATTR_MASK;
- ATTRIBUTE_NAMES[367] = ATTR_MARKERWIDTH;
- ATTRIBUTE_NAMES[368] = ATTR_MARKERUNITS;
- ATTRIBUTE_NAMES[369] = ATTR_AMPLITUDE;
- ATTRIBUTE_NAMES[370] = ATTR_CELLPADDING;
- ATTRIBUTE_NAMES[371] = ATTR_FILL_RULE;
- ATTRIBUTE_NAMES[372] = ATTR_FILL_OPACITY;
- ATTRIBUTE_NAMES[373] = ATTR_ONCLICK;
- ATTRIBUTE_NAMES[374] = ATTR_REPLACE;
- ATTRIBUTE_NAMES[375] = ATTR_SCALE;
- ATTRIBUTE_NAMES[376] = ATTR_TABLEVALUES;
- ATTRIBUTE_NAMES[377] = ATTR_V_ALPHABETIC;
- ATTRIBUTE_NAMES[378] = ATTR_FORMAT;
- ATTRIBUTE_NAMES[379] = ATTR_FRAME;
- ATTRIBUTE_NAMES[380] = ATTR_FROM;
- ATTRIBUTE_NAMES[381] = ATTR_PROMPT;
- ATTRIBUTE_NAMES[382] = ATTR_SYMMETRIC;
- ATTRIBUTE_NAMES[383] = ATTR_STEMV;
- ATTRIBUTE_NAMES[384] = ATTR_SUMMARY;
- ATTRIBUTE_NAMES[385] = ATTR_ZOOMANDPAN;
- ATTRIBUTE_NAMES[386] = ATTR_ALINK;
- ATTRIBUTE_NAMES[387] = ATTR_ICON;
- ATTRIBUTE_NAMES[388] = ATTR_KERNING;
- ATTRIBUTE_NAMES[389] = ATTR_ONUNLOAD;
- ATTRIBUTE_NAMES[390] = ATTR_ONINVALID;
- ATTRIBUTE_NAMES[391] = ATTR_ONINPUT;
- ATTRIBUTE_NAMES[392] = ATTR_POINTS;
- ATTRIBUTE_NAMES[393] = ATTR_POINTSATY;
- ATTRIBUTE_NAMES[394] = ATTR_SPAN;
- ATTRIBUTE_NAMES[395] = ATTR_THINMATHSPACE;
- ATTRIBUTE_NAMES[396] = ATTR_VLINK;
- ATTRIBUTE_NAMES[397] = ATTR_XLINK_HREF;
- ATTRIBUTE_NAMES[398] = ATTR_XLINK_ROLE;
- ATTRIBUTE_NAMES[399] = ATTR_XMLNS_XLINK;
- ATTRIBUTE_NAMES[400] = ATTR_XLINK_TYPE;
- ATTRIBUTE_NAMES[401] = ATTR_XLINK_ACTUATE;
- ATTRIBUTE_NAMES[402] = ATTR_AUTOSUBMIT;
- ATTRIBUTE_NAMES[403] = ATTR_AUTOFOCUS;
- ATTRIBUTE_NAMES[404] = ATTR_COLOR_PROFILE;
- ATTRIBUTE_NAMES[405] = ATTR_COLOR_INTERPOLATION;
- ATTRIBUTE_NAMES[406] = ATTR_COLOR_INTERPOLATION_FILTERS;
- ATTRIBUTE_NAMES[407] = ATTR_EXPONENT;
- ATTRIBUTE_NAMES[408] = ATTR_FLOOD_OPACITY;
- ATTRIBUTE_NAMES[409] = ATTR_LQUOTE;
- ATTRIBUTE_NAMES[410] = ATTR_NUMOCTAVES;
+ ATTRIBUTE_NAMES[292] = ATTR_CITE;
+ ATTRIBUTE_NAMES[293] = ATTR_DATETIME;
+ ATTRIBUTE_NAMES[294] = ATTR_EDGEMODE;
+ ATTRIBUTE_NAMES[295] = ATTR_FACE;
+ ATTRIBUTE_NAMES[296] = ATTR_INDEX;
+ ATTRIBUTE_NAMES[297] = ATTR_INTERCEPT;
+ ATTRIBUTE_NAMES[298] = ATTR_LINEBREAK;
+ ATTRIBUTE_NAMES[299] = ATTR_LINETHICKNESS;
+ ATTRIBUTE_NAMES[300] = ATTR_NAME;
+ ATTRIBUTE_NAMES[301] = ATTR_ONBEFOREUNLOAD;
+ ATTRIBUTE_NAMES[302] = ATTR_OBJECT;
+ ATTRIBUTE_NAMES[303] = ATTR_ORDER;
+ ATTRIBUTE_NAMES[304] = ATTR_ONRESET;
+ ATTRIBUTE_NAMES[305] = ATTR_ONREADYSTATECHANGE;
+ ATTRIBUTE_NAMES[306] = ATTR_ONBEGIN;
+ ATTRIBUTE_NAMES[307] = ATTR_ONBEFOREPRINT;
+ ATTRIBUTE_NAMES[308] = ATTR_ORIENTATION;
+ ATTRIBUTE_NAMES[309] = ATTR_ONSELECTSTART;
+ ATTRIBUTE_NAMES[310] = ATTR_ONBEFOREUPDATE;
+ ATTRIBUTE_NAMES[311] = ATTR_ONBEFOREACTIVATE;
+ ATTRIBUTE_NAMES[312] = ATTR_ONKEYPRESS;
+ ATTRIBUTE_NAMES[313] = ATTR_ONBEFOREEDITFOCUS;
+ ATTRIBUTE_NAMES[314] = ATTR_ONKEYDOWN;
+ ATTRIBUTE_NAMES[315] = ATTR_REPEAT;
+ ATTRIBUTE_NAMES[316] = ATTR_REFERRERPOLICY;
+ ATTRIBUTE_NAMES[317] = ATTR_REPEAT_MIN;
+ ATTRIBUTE_NAMES[318] = ATTR_REPEATCOUNT;
+ ATTRIBUTE_NAMES[319] = ATTR_REPEAT_TEMPLATE;
+ ATTRIBUTE_NAMES[320] = ATTR_SELECTED;
+ ATTRIBUTE_NAMES[321] = ATTR_SIZES;
+ ATTRIBUTE_NAMES[322] = ATTR_STRETCHY;
+ ATTRIBUTE_NAMES[323] = ATTR_SPREADMETHOD;
+ ATTRIBUTE_NAMES[324] = ATTR_SIZE;
+ ATTRIBUTE_NAMES[325] = ATTR_UNSELECTABLE;
+ ATTRIBUTE_NAMES[326] = ATTR_UNDERLINE_THICKNESS;
+ ATTRIBUTE_NAMES[327] = ATTR_DIFFUSECONSTANT;
+ ATTRIBUTE_NAMES[328] = ATTR_HREFLANG;
+ ATTRIBUTE_NAMES[329] = ATTR_ONAFTERUPDATE;
+ ATTRIBUTE_NAMES[330] = ATTR_SURFACESCALE;
+ ATTRIBUTE_NAMES[331] = ATTR_ALIGN;
+ ATTRIBUTE_NAMES[332] = ATTR_ALIGNMENTSCOPE;
+ ATTRIBUTE_NAMES[333] = ATTR_HEIGHT;
+ ATTRIBUTE_NAMES[334] = ATTR_IMAGE_RENDERING;
+ ATTRIBUTE_NAMES[335] = ATTR_LANG;
+ ATTRIBUTE_NAMES[336] = ATTR_LONGDESC;
+ ATTRIBUTE_NAMES[337] = ATTR_MARGINHEIGHT;
+ ATTRIBUTE_NAMES[338] = ATTR_NARGS;
+ ATTRIBUTE_NAMES[339] = ATTR_PING;
+ ATTRIBUTE_NAMES[340] = ATTR_TARGETX;
+ ATTRIBUTE_NAMES[341] = ATTR_ALPHABETIC;
+ ATTRIBUTE_NAMES[342] = ATTR_HIGH;
+ ATTRIBUTE_NAMES[343] = ATTR_MATHEMATICAL;
+ ATTRIBUTE_NAMES[344] = ATTR_METHOD;
+ ATTRIBUTE_NAMES[345] = ATTR_MATHCOLOR;
+ ATTRIBUTE_NAMES[346] = ATTR_NOSHADE;
+ ATTRIBUTE_NAMES[347] = ATTR_PATHLENGTH;
+ ATTRIBUTE_NAMES[348] = ATTR_ALTIMG;
+ ATTRIBUTE_NAMES[349] = ATTR_ACTION;
+ ATTRIBUTE_NAMES[350] = ATTR_ADDITIVE;
+ ATTRIBUTE_NAMES[351] = ATTR_DOMINANT_BASELINE;
+ ATTRIBUTE_NAMES[352] = ATTR_DEFINITIONURL;
+ ATTRIBUTE_NAMES[353] = ATTR_HORIZ_ORIGIN_X;
+ ATTRIBUTE_NAMES[354] = ATTR_LIMITINGCONEANGLE;
+ ATTRIBUTE_NAMES[355] = ATTR_MEDIA;
+ ATTRIBUTE_NAMES[356] = ATTR_ONFILTERCHANGE;
+ ATTRIBUTE_NAMES[357] = ATTR_OPTIMUM;
+ ATTRIBUTE_NAMES[358] = ATTR_RADIUS;
+ ATTRIBUTE_NAMES[359] = ATTR_SCRIPTSIZEMULTIPLIER;
+ ATTRIBUTE_NAMES[360] = ATTR_STRIKETHROUGH_POSITION;
+ ATTRIBUTE_NAMES[361] = ATTR_SCRIPTMINSIZE;
+ ATTRIBUTE_NAMES[362] = ATTR_VALIGN;
+ ATTRIBUTE_NAMES[363] = ATTR_BACKGROUND;
+ ATTRIBUTE_NAMES[364] = ATTR_MARKER_MID;
+ ATTRIBUTE_NAMES[365] = ATTR_MARKER_END;
+ ATTRIBUTE_NAMES[366] = ATTR_MARKER_START;
+ ATTRIBUTE_NAMES[367] = ATTR_MASKUNITS;
+ ATTRIBUTE_NAMES[368] = ATTR_MASKCONTENTUNITS;
+ ATTRIBUTE_NAMES[369] = ATTR_CELLSPACING;
+ ATTRIBUTE_NAMES[370] = ATTR_DECLARE;
+ ATTRIBUTE_NAMES[371] = ATTR_FILL;
+ ATTRIBUTE_NAMES[372] = ATTR_MAXLENGTH;
+ ATTRIBUTE_NAMES[373] = ATTR_ONBLUR;
+ ATTRIBUTE_NAMES[374] = ATTR_ROWLINES;
+ ATTRIBUTE_NAMES[375] = ATTR_STYLE;
+ ATTRIBUTE_NAMES[376] = ATTR_TITLE;
+ ATTRIBUTE_NAMES[377] = ATTR_AZIMUTH;
+ ATTRIBUTE_NAMES[378] = ATTR_FRAMEBORDER;
+ ATTRIBUTE_NAMES[379] = ATTR_FRAMESPACING;
+ ATTRIBUTE_NAMES[380] = ATTR_FORM;
+ ATTRIBUTE_NAMES[381] = ATTR_PRIMITIVEUNITS;
+ ATTRIBUTE_NAMES[382] = ATTR_STEMH;
+ ATTRIBUTE_NAMES[383] = ATTR_SEAMLESS;
+ ATTRIBUTE_NAMES[384] = ATTR_USEMAP;
+ ATTRIBUTE_NAMES[385] = ATTR_ASYNC;
+ ATTRIBUTE_NAMES[386] = ATTR_IN;
+ ATTRIBUTE_NAMES[387] = ATTR_KERNELMATRIX;
+ ATTRIBUTE_NAMES[388] = ATTR_KERNELUNITLENGTH;
+ ATTRIBUTE_NAMES[389] = ATTR_OPEN;
+ ATTRIBUTE_NAMES[390] = ATTR_ONEND;
+ ATTRIBUTE_NAMES[391] = ATTR_POINTER_EVENTS;
+ ATTRIBUTE_NAMES[392] = ATTR_POINTSATX;
+ ATTRIBUTE_NAMES[393] = ATTR_POINTSATZ;
+ ATTRIBUTE_NAMES[394] = ATTR_STANDBY;
+ ATTRIBUTE_NAMES[395] = ATTR_TRANSFORM;
+ ATTRIBUTE_NAMES[396] = ATTR_WHEN;
+ ATTRIBUTE_NAMES[397] = ATTR_XLINK_TITLE;
+ ATTRIBUTE_NAMES[398] = ATTR_XLINK_ARCROLE;
+ ATTRIBUTE_NAMES[399] = ATTR_XMLNS;
+ ATTRIBUTE_NAMES[400] = ATTR_XLINK_SHOW;
+ ATTRIBUTE_NAMES[401] = ATTR_AUTOPLAY;
+ ATTRIBUTE_NAMES[402] = ATTR_AUTOCOMPLETE;
+ ATTRIBUTE_NAMES[403] = ATTR_BGCOLOR;
+ ATTRIBUTE_NAMES[404] = ATTR_COLOR_RENDERING;
+ ATTRIBUTE_NAMES[405] = ATTR_COLOR;
+ ATTRIBUTE_NAMES[406] = ATTR_ENCODING;
+ ATTRIBUTE_NAMES[407] = ATTR_FLOOD_COLOR;
+ ATTRIBUTE_NAMES[408] = ATTR_IDEOGRAPHIC;
+ ATTRIBUTE_NAMES[409] = ATTR_PANOSE_1;
+ ATTRIBUTE_NAMES[410] = ATTR_NOMODULE;
ATTRIBUTE_NAMES[411] = ATTR_ONBOUNCE;
ATTRIBUTE_NAMES[412] = ATTR_ONROWSINSERTED;
ATTRIBUTE_NAMES[413] = ATTR_ONROWENTER;
@@ -1953,6 +1955,7 @@ nsHtml5AttributeName::initializeStatics()
ATTRIBUTE_NAMES[581] = ATTR_BASEFREQUENCY;
ATTRIBUTE_NAMES[582] = ATTR_BASEPROFILE;
ATTRIBUTE_NAMES[583] = ATTR_BASE;
+ ATTRIBUTE_NAMES[584] = ATTR_CODETYPE;
}
void
@@ -2350,6 +2353,7 @@ nsHtml5AttributeName::releaseStatics()
delete ATTR_LQUOTE;
delete ATTR_PANOSE_1;
delete ATTR_NUMOCTAVES;
+ delete ATTR_NOMODULE;
delete ATTR_ONLOAD;
delete ATTR_ONBOUNCE;
delete ATTR_ONCONTROLSELECT;
diff --git a/parser/html/nsHtml5AttributeName.h b/parser/html/nsHtml5AttributeName.h
index d44ea6667..8bb706408 100644
--- a/parser/html/nsHtml5AttributeName.h
+++ b/parser/html/nsHtml5AttributeName.h
@@ -563,6 +563,7 @@ class nsHtml5AttributeName
static nsHtml5AttributeName* ATTR_LQUOTE;
static nsHtml5AttributeName* ATTR_PANOSE_1;
static nsHtml5AttributeName* ATTR_NUMOCTAVES;
+ static nsHtml5AttributeName* ATTR_NOMODULE;
static nsHtml5AttributeName* ATTR_ONLOAD;
static nsHtml5AttributeName* ATTR_ONBOUNCE;
static nsHtml5AttributeName* ATTR_ONCONTROLSELECT;
diff --git a/parser/html/nsHtml5SpeculativeLoad.cpp b/parser/html/nsHtml5SpeculativeLoad.cpp
index 8ffc4d063..35c11b739 100644
--- a/parser/html/nsHtml5SpeculativeLoad.cpp
+++ b/parser/html/nsHtml5SpeculativeLoad.cpp
@@ -6,9 +6,12 @@
#include "nsHtml5TreeOpExecutor.h"
nsHtml5SpeculativeLoad::nsHtml5SpeculativeLoad()
+ :
#ifdef DEBUG
- : mOpCode(eSpeculativeLoadUninitialized)
+ mOpCode(eSpeculativeLoadUninitialized),
#endif
+ mIsAsync(false),
+ mIsDefer(false)
{
MOZ_COUNT_CTOR(nsHtml5SpeculativeLoad);
}
@@ -48,16 +51,28 @@ nsHtml5SpeculativeLoad::Perform(nsHtml5TreeOpExecutor* aExecutor)
break;
case eSpeculativeLoadScript:
aExecutor->PreloadScript(mUrl, mCharset, mTypeOrCharsetSourceOrDocumentMode,
- mCrossOrigin, mIntegrity, false);
+ mCrossOrigin, mIntegrity, false,
+ mIsAsync, mIsDefer, false);
break;
case eSpeculativeLoadScriptFromHead:
aExecutor->PreloadScript(mUrl, mCharset, mTypeOrCharsetSourceOrDocumentMode,
- mCrossOrigin, mIntegrity, true);
+ mCrossOrigin, mIntegrity, true,
+ mIsAsync, mIsDefer, false);
+ break;
+ case eSpeculativeLoadNoModuleScript:
+ aExecutor->PreloadScript(mUrl, mCharset, mTypeOrCharsetSourceOrDocumentMode,
+ mCrossOrigin, mIntegrity, false,
+ mIsAsync, mIsDefer, true);
+ break;
+ case eSpeculativeLoadNoModuleScriptFromHead:
+ aExecutor->PreloadScript(mUrl, mCharset, mTypeOrCharsetSourceOrDocumentMode,
+ mCrossOrigin, mIntegrity, true,
+ mIsAsync, mIsDefer, true);
break;
case eSpeculativeLoadStyle:
aExecutor->PreloadStyle(mUrl, mCharset, mCrossOrigin, mIntegrity);
break;
- case eSpeculativeLoadManifest:
+ case eSpeculativeLoadManifest:
aExecutor->ProcessOfflineManifest(mUrl);
break;
case eSpeculativeLoadSetDocumentCharset: {
diff --git a/parser/html/nsHtml5SpeculativeLoad.h b/parser/html/nsHtml5SpeculativeLoad.h
index 6f1365bcf..1f4a61741 100644
--- a/parser/html/nsHtml5SpeculativeLoad.h
+++ b/parser/html/nsHtml5SpeculativeLoad.h
@@ -10,7 +10,8 @@
class nsHtml5TreeOpExecutor;
-enum eHtml5SpeculativeLoad {
+enum eHtml5SpeculativeLoad
+{
#ifdef DEBUG
eSpeculativeLoadUninitialized,
#endif
@@ -23,6 +24,8 @@ enum eHtml5SpeculativeLoad {
eSpeculativeLoadPictureSource,
eSpeculativeLoadScript,
eSpeculativeLoadScriptFromHead,
+ eSpeculativeLoadNoModuleScript,
+ eSpeculativeLoadNoModuleScriptFromHead,
eSpeculativeLoadStyle,
eSpeculativeLoadManifest,
eSpeculativeLoadSetDocumentCharset,
@@ -128,17 +131,27 @@ class nsHtml5SpeculativeLoad {
nsHtml5String aType,
nsHtml5String aCrossOrigin,
nsHtml5String aIntegrity,
- bool aParserInHead)
+ bool aParserInHead,
+ bool aAsync,
+ bool aDefer,
+ bool aNoModule)
{
NS_PRECONDITION(mOpCode == eSpeculativeLoadUninitialized,
"Trying to reinitialize a speculative load!");
- mOpCode = aParserInHead ?
- eSpeculativeLoadScriptFromHead : eSpeculativeLoadScript;
+ if (aNoModule) {
+ mOpCode = aParserInHead ? eSpeculativeLoadNoModuleScriptFromHead
+ : eSpeculativeLoadNoModuleScript;
+ } else {
+ mOpCode = aParserInHead ? eSpeculativeLoadScriptFromHead
+ : eSpeculativeLoadScript;
+ }
aUrl.ToString(mUrl);
aCharset.ToString(mCharset);
aType.ToString(mTypeOrCharsetSourceOrDocumentMode);
aCrossOrigin.ToString(mCrossOrigin);
aIntegrity.ToString(mIntegrity);
+ mIsAsync = aAsync;
+ mIsDefer = aDefer;
}
inline void InitStyle(nsHtml5String aUrl,
@@ -221,6 +234,13 @@ class nsHtml5SpeculativeLoad {
private:
eHtml5SpeculativeLoad mOpCode;
+
+ /**
+ * Whether the refering element has async and/or defer attributes.
+ */
+ bool mIsAsync;
+ bool mIsDefer;
+
nsString mUrl;
nsString mReferrerPolicy;
nsString mMetaCSP;
diff --git a/parser/html/nsHtml5TreeBuilderCppSupplement.h b/parser/html/nsHtml5TreeBuilderCppSupplement.h
index 62df6d002..f09cc1853 100644
--- a/parser/html/nsHtml5TreeBuilderCppSupplement.h
+++ b/parser/html/nsHtml5TreeBuilderCppSupplement.h
@@ -185,16 +185,23 @@ nsHtml5TreeBuilder::createElement(int32_t aNamespace,
aAttributes->getValue(nsHtml5AttributeName::ATTR_CROSSORIGIN);
nsHtml5String integrity =
aAttributes->getValue(nsHtml5AttributeName::ATTR_INTEGRITY);
+ bool async =
+ aAttributes->contains(nsHtml5AttributeName::ATTR_ASYNC);
+ bool defer =
+ aAttributes->contains(nsHtml5AttributeName::ATTR_DEFER);
+ bool noModule =
+ aAttributes->contains(nsHtml5AttributeName::ATTR_NOMODULE);
mSpeculativeLoadQueue.AppendElement()->InitScript(
url,
charset,
type,
crossOrigin,
integrity,
- mode == nsHtml5TreeBuilder::IN_HEAD);
- mCurrentHtmlScriptIsAsyncOrDefer =
- aAttributes->contains(nsHtml5AttributeName::ATTR_ASYNC) ||
- aAttributes->contains(nsHtml5AttributeName::ATTR_DEFER);
+ mode == nsHtml5TreeBuilder::IN_HEAD,
+ async,
+ defer,
+ noModule);
+ mCurrentHtmlScriptIsAsyncOrDefer = async || defer;
}
} else if (nsHtml5Atoms::link == aName) {
nsHtml5String rel =
@@ -297,7 +304,10 @@ nsHtml5TreeBuilder::createElement(int32_t aNamespace,
type,
crossOrigin,
integrity,
- mode == nsHtml5TreeBuilder::IN_HEAD);
+ mode == nsHtml5TreeBuilder::IN_HEAD,
+ false /* async */,
+ false /* defer */,
+ false /* noModule */);
}
} else if (nsHtml5Atoms::style == aName) {
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
diff --git a/parser/html/nsHtml5TreeOpExecutor.cpp b/parser/html/nsHtml5TreeOpExecutor.cpp
index 3ed634d0c..cd5c68913 100644
--- a/parser/html/nsHtml5TreeOpExecutor.cpp
+++ b/parser/html/nsHtml5TreeOpExecutor.cpp
@@ -921,14 +921,18 @@ nsHtml5TreeOpExecutor::PreloadScript(const nsAString& aURL,
const nsAString& aType,
const nsAString& aCrossOrigin,
const nsAString& aIntegrity,
- bool aScriptFromHead)
+ bool aScriptFromHead,
+ bool aAsync,
+ bool aDefer,
+ bool aNoModule)
{
nsCOMPtr<nsIURI> uri = ConvertIfNotPreloadedYet(aURL);
if (!uri) {
return;
}
mDocument->ScriptLoader()->PreloadURI(uri, aCharset, aType, aCrossOrigin,
- aIntegrity, aScriptFromHead,
+ aIntegrity, aScriptFromHead, aAsync,
+ aDefer, aNoModule,
mSpeculationReferrerPolicy);
}
diff --git a/parser/html/nsHtml5TreeOpExecutor.h b/parser/html/nsHtml5TreeOpExecutor.h
index c4b6a4594..878f359c5 100644
--- a/parser/html/nsHtml5TreeOpExecutor.h
+++ b/parser/html/nsHtml5TreeOpExecutor.h
@@ -249,7 +249,10 @@ class nsHtml5TreeOpExecutor final : public nsHtml5DocumentBuilder,
const nsAString& aType,
const nsAString& aCrossOrigin,
const nsAString& aIntegrity,
- bool aScriptFromHead);
+ bool aScriptFromHead,
+ bool aAsync,
+ bool aDefer,
+ bool aNoModule);
void PreloadStyle(const nsAString& aURL, const nsAString& aCharset,
const nsAString& aCrossOrigin,
diff --git a/parser/html/nsHtml5TreeOperation.cpp b/parser/html/nsHtml5TreeOperation.cpp
index 46907d3a4..6444b9674 100644
--- a/parser/html/nsHtml5TreeOperation.cpp
+++ b/parser/html/nsHtml5TreeOperation.cpp
@@ -1076,7 +1076,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(node);
NS_ASSERTION(sele, "Node didn't QI to script.");
sele->SetScriptLineNumber(mFour.integer);
- sele->FreezeUriAsyncDefer();
+ sele->FreezeExecutionAttrs(node->OwnerDoc());
return NS_OK;
}
case eTreeOpSvgLoad: {