summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-07-08 10:50:53 +0000
committerMoonchild <moonchild@palemoon.org>2020-07-08 10:50:53 +0000
commit786e344698c5a577ea82e2fa0d29faf2a2d851ea (patch)
treef089c4d296efc220266b0ac0133367747ab71e4f
parente378530bcaa63d46083879d746dec6b8c3a44d0b (diff)
downloadUXP-786e344698c5a577ea82e2fa0d29faf2a2d851ea.tar
UXP-786e344698c5a577ea82e2fa0d29faf2a2d851ea.tar.gz
UXP-786e344698c5a577ea82e2fa0d29faf2a2d851ea.tar.lz
UXP-786e344698c5a577ea82e2fa0d29faf2a2d851ea.tar.xz
UXP-786e344698c5a577ea82e2fa0d29faf2a2d851ea.zip
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
-rw-r--r--dom/script/ScriptElement.cpp4
-rw-r--r--dom/script/ScriptLoader.cpp3
-rw-r--r--dom/script/ScriptLoader.h3
-rw-r--r--dom/script/nsIScriptLoaderObserver.idl9
-rw-r--r--dom/xslt/xslt/txMozillaXMLOutput.cpp2
5 files changed, 12 insertions, 9 deletions
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<nsIParser> parser = do_QueryReferent(mCreatorParser);
if (parser) {
parser->PushDefinedInsertionPoint();
diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp
index a53098974..1426c30c9 100644
--- a/dom/script/ScriptLoader.cpp
+++ b/dom/script/ScriptLoader.cpp
@@ -2327,7 +2327,8 @@ ScriptLoader::OnStreamComplete(nsIIncrementalStreamLoader* aLoader,
MOZ_ASSERT(!modReq->IsTopLevel());
MOZ_ASSERT(!modReq->isInList());
modReq->Cancel();
- FireScriptAvailable(rv, request);
+ // A single error is fired for the top level module, so don't use
+ // FireScriptAvailable here.
} else if (mParserBlockingRequest == request) {
MOZ_ASSERT(!request->isInList());
mParserBlockingRequest = nullptr;
diff --git a/dom/script/ScriptLoader.h b/dom/script/ScriptLoader.h
index e6b75bf3b..b07dd4ec6 100644
--- a/dom/script/ScriptLoader.h
+++ b/dom/script/ScriptLoader.h
@@ -100,7 +100,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)
{
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/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)
{