From 2f145b6eda95c08a76711f0393e4d9ebe13a5f92 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 8 Jul 2020 10:50:53 +0000 Subject: Issue #618 - Fix error events fired when loading JS module dependencies fail When module dependencies fail, don't spam with errors for each import; only fire the error event once. Ref: BZ 1421259 --- dom/script/ScriptElement.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dom/script/ScriptElement.cpp') diff --git a/dom/script/ScriptElement.cpp b/dom/script/ScriptElement.cpp index 0cb17dcb0..9cb239c66 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 parser = do_QueryReferent(mCreatorParser); if (parser) { parser->PushDefinedInsertionPoint(); -- cgit v1.2.3 From 77e8ba7eaf3ca00f25d0507cf17de2f50741f335 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Tue, 25 Aug 2020 07:06:43 +0000 Subject: Issue #618 - Implement async attribute for inline module scripts. (uplift) This commit does several things: - Moves the pref check from ScriptLoader to ns[I]Document so it can be called on the document. - Changes the atrribute freezing function to a better name that takes the document as a parameter. - Sets the proper async/defer attributes on HTML script elements based on keywords and whether they are module scripts or not. --- dom/script/ScriptElement.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dom/script/ScriptElement.cpp') diff --git a/dom/script/ScriptElement.cpp b/dom/script/ScriptElement.cpp index 9cb239c66..eb20dbf32 100644 --- a/dom/script/ScriptElement.cpp +++ b/dom/script/ScriptElement.cpp @@ -128,11 +128,11 @@ ScriptElement::MaybeProcessScript() return false; } - FreezeUriAsyncDefer(); + nsIDocument* ownerDoc = cont->OwnerDoc(); + FreezeExecutionAttrs(ownerDoc); mAlreadyStarted = true; - nsIDocument* ownerDoc = cont->OwnerDoc(); nsCOMPtr parser = ((nsIScriptElement*) this)->GetCreatorParser(); if (parser) { nsCOMPtr sink = parser->GetContentSink(); -- cgit v1.2.3