mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-02 13:27:33 +09:00
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
This commit is contained in:
parent
4413fcfdaa
commit
933fb54415
5 changed files with 12 additions and 9 deletions
|
|
@ -21,11 +21,11 @@ using namespace mozilla::dom;
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ScriptElement::ScriptAvailable(nsresult aResult,
|
ScriptElement::ScriptAvailable(nsresult aResult,
|
||||||
nsIScriptElement *aElement,
|
nsIScriptElement *aElement,
|
||||||
bool aIsInline,
|
bool aIsInlineClassicScript,
|
||||||
nsIURI *aURI,
|
nsIURI *aURI,
|
||||||
int32_t aLineNo)
|
int32_t aLineNo)
|
||||||
{
|
{
|
||||||
if (!aIsInline && NS_FAILED(aResult)) {
|
if (!aIsInlineClassicScript && NS_FAILED(aResult)) {
|
||||||
nsCOMPtr<nsIParser> parser = do_QueryReferent(mCreatorParser);
|
nsCOMPtr<nsIParser> parser = do_QueryReferent(mCreatorParser);
|
||||||
if (parser) {
|
if (parser) {
|
||||||
parser->PushDefinedInsertionPoint();
|
parser->PushDefinedInsertionPoint();
|
||||||
|
|
|
||||||
|
|
@ -2327,7 +2327,8 @@ ScriptLoader::OnStreamComplete(nsIIncrementalStreamLoader* aLoader,
|
||||||
MOZ_ASSERT(!modReq->IsTopLevel());
|
MOZ_ASSERT(!modReq->IsTopLevel());
|
||||||
MOZ_ASSERT(!modReq->isInList());
|
MOZ_ASSERT(!modReq->isInList());
|
||||||
modReq->Cancel();
|
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) {
|
} else if (mParserBlockingRequest == request) {
|
||||||
MOZ_ASSERT(!request->isInList());
|
MOZ_ASSERT(!request->isInList());
|
||||||
mParserBlockingRequest = nullptr;
|
mParserBlockingRequest = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,8 @@ public:
|
||||||
|
|
||||||
void FireScriptAvailable(nsresult aResult)
|
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)
|
void FireScriptEvaluated(nsresult aResult)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,16 @@ interface nsIScriptLoaderObserver : nsISupports {
|
||||||
* a script. If this is a failure code, script evaluation
|
* a script. If this is a failure code, script evaluation
|
||||||
* will not occur.
|
* will not occur.
|
||||||
* @param aElement The element being processed.
|
* @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
|
* @param aURI What is the URI of the script (the document URI if
|
||||||
* it is inline).
|
* it is inline).
|
||||||
* @param aLineNo At what line does the script appear (generally 1
|
* @param aLineNo At what line does the script appear (generally 1
|
||||||
* if it is a loaded script).
|
* if it is a loaded script).
|
||||||
*/
|
*/
|
||||||
void scriptAvailable(in nsresult aResult,
|
void scriptAvailable(in nsresult aResult,
|
||||||
in nsIScriptElement aElement,
|
in nsIScriptElement aElement,
|
||||||
in boolean aIsInline,
|
in boolean aIsInlineClassicScript,
|
||||||
in nsIURI aURI,
|
in nsIURI aURI,
|
||||||
in int32_t aLineNo);
|
in int32_t aLineNo);
|
||||||
|
|
||||||
|
|
@ -40,7 +41,7 @@ interface nsIScriptLoaderObserver : nsISupports {
|
||||||
* @param aElement The element being processed.
|
* @param aElement The element being processed.
|
||||||
* @param aIsInline Is this an inline script or externally loaded?
|
* @param aIsInline Is this an inline script or externally loaded?
|
||||||
*/
|
*/
|
||||||
void scriptEvaluated(in nsresult aResult,
|
void scriptEvaluated(in nsresult aResult,
|
||||||
in nsIScriptElement aElement,
|
in nsIScriptElement aElement,
|
||||||
in boolean aIsInline);
|
in boolean aIsInline);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -955,7 +955,7 @@ NS_IMPL_ISUPPORTS(txTransformNotifier,
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
txTransformNotifier::ScriptAvailable(nsresult aResult,
|
txTransformNotifier::ScriptAvailable(nsresult aResult,
|
||||||
nsIScriptElement *aElement,
|
nsIScriptElement *aElement,
|
||||||
bool aIsInline,
|
bool aIsInlineClassicScript,
|
||||||
nsIURI *aURI,
|
nsIURI *aURI,
|
||||||
int32_t aLineNo)
|
int32_t aLineNo)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue