Bug 1242505 - Part 1 - Handle more rejections in code exercised by browser-chrome tests. r=Mossop
MozReview-Commit-ID: JTMgC2XwzX2
--- a/browser/components/extensions/ExtensionPopups.jsm
+++ b/browser/components/extensions/ExtensionPopups.jsm
@@ -111,16 +111,18 @@ class BasePopup {
this.closePopup();
}
destroy() {
this.extension.forgetOnClose(this);
this.destroyed = true;
this.browserLoadedDeferred.reject(new Error("Popup destroyed"));
+ // Ignore unhandled rejections if the "attach" method is not called.
+ this.browserLoaded.catch(() => {});
BasePopup.instances.get(this.window).delete(this.extension);
return this.browserReady.then(() => {
if (this.browser) {
this.destroyBrowser(this.browser, true);
this.browser.remove();
}
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -1305,17 +1305,17 @@ var SessionStoreInternal = {
}
TelemetryStopwatch.start("FX_SESSION_RESTORE_STARTUP_ONLOAD_INITIAL_WINDOW_MS");
this.initializeWindow(aWindow, initialState);
TelemetryStopwatch.finish("FX_SESSION_RESTORE_STARTUP_ONLOAD_INITIAL_WINDOW_MS");
// Let everyone know we're done.
this._deferredInitialized.resolve();
}
- }, console.error);
+ }).catch(console.error);
},
/**
* On window close...
* - remove event listeners from tabs
* - save all window data
* @param aWindow
* Window reference
--- a/browser/extensions/shield-recipe-client/lib/PreferenceExperiments.jsm
+++ b/browser/extensions/shield-recipe-client/lib/PreferenceExperiments.jsm
@@ -250,17 +250,18 @@ this.PreferenceExperiments = {
`An observer for the preference experiment ${experimentName} is already active.`
);
}
const observerInfo = {
preferenceName,
observer(newValue) {
if (newValue !== preferenceValue) {
- PreferenceExperiments.stop(experimentName, false);
+ PreferenceExperiments.stop(experimentName, false)
+ .catch(Cu.reportError);
}
},
};
experimentObservers.set(experimentName, observerInfo);
Preferences.observe(preferenceName, observerInfo.observer);
},
/**
--- a/browser/modules/ContentCrashHandlers.jsm
+++ b/browser/modules/ContentCrashHandlers.jsm
@@ -378,17 +378,17 @@ this.TabCrashHandler = {
// with the empty string.
if (!includeURL) {
extraExtraKeyVals["URL"] = "";
}
CrashSubmit.submit(dumpID, {
recordSubmission: true,
extraExtraKeyVals,
- }).then(null, Cu.reportError);
+ }).catch(Cu.reportError);
this.prefs.setBoolPref("sendReport", true);
this.prefs.setBoolPref("includeURL", includeURL);
this.prefs.setBoolPref("emailMe", emailMe);
if (emailMe) {
this.prefs.setCharPref("email", email);
} else {
this.prefs.setCharPref("email", "");
@@ -876,17 +876,17 @@ this.UnsubmittedCrashHandler = {
* The array of reportIDs to submit.
*/
submitReports(reportIDs) {
for (let reportID of reportIDs) {
CrashSubmit.submit(reportID, {
extraExtraKeyVals: {
"SubmittedFromInfobar": true,
},
- });
+ }).catch(Cu.reportError);
}
},
};
this.PluginCrashReporter = {
/**
* Makes the PluginCrashReporter ready to hear about and
* submit crash reports.
@@ -990,17 +990,17 @@ this.PluginCrashReporter = {
let { pluginDumpID, browserDumpID } = this.crashReports.get(runID);
let submissionPromise = CrashSubmit.submit(pluginDumpID, {
recordSubmission: true,
extraExtraKeyVals: keyVals,
});
if (browserDumpID)
- CrashSubmit.submit(browserDumpID);
+ CrashSubmit.submit(browserDumpID).catch(Cu.reportError);
this.broadcastState(runID, "submitting");
submissionPromise.then(() => {
this.broadcastState(runID, "success");
}, () => {
this.broadcastState(runID, "failed");
});
--- a/devtools/server/actors/webextension-inspected-window.js
+++ b/devtools/server/actors/webextension-inspected-window.js
@@ -285,17 +285,17 @@ var WebExtensionInspectedWindowActor = p
});
this.customizedReload.start()
.then(() => {
delete this.customizedReload;
})
.catch(err => {
delete this.customizedReload;
- throw err;
+ console.error(err);
});
} catch (err) {
// Cancel the customized reload (if any) on exception during the
// reload setup.
if (this.customizedReload) {
this.customizedReload.stop(err);
}