Bug 1811796 - Automatically replace Cu.reportError with console.error (most of toolkit). r=mossop,credential-management-reviewers,dimi

Depends on D167518

Differential Revision: https://phabricator.services.mozilla.com/D167519
This commit is contained in:
Mark Banner
2023-01-23 18:09:03 +00:00
parent ff6bee72c2
commit 24d67b71d0
118 changed files with 329 additions and 344 deletions

View File

@@ -210,7 +210,8 @@ module.exports = {
files: [ files: [
"dom/push/test/mockpushserviceparent.js", "dom/push/test/mockpushserviceparent.js",
"browser/components/extensions/**", "browser/components/extensions/**",
"toolkit/**", "toolkit/components/extensions/**",
"toolkit/mozapps/extensions/**",
], ],
rules: { rules: {
"mozilla/no-cu-reportError": "off", "mozilla/no-cu-reportError": "off",

View File

@@ -84,7 +84,7 @@ class AutoCompleteChild extends JSWindowActorChild {
try { try {
listener.popupStateChanged(messageName, data, this.contentWindow); listener.popupStateChanged(messageName, data, this.contentWindow);
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
} }
} }

View File

@@ -488,7 +488,7 @@ class AutoCompleteParent extends JSWindowActorParent {
try { try {
listener(window); listener(window);
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
} }
} }

View File

@@ -93,7 +93,7 @@ class PrintingChild extends JSWindowActorChild {
try { try {
article = await lazy.ReaderMode.parseDocument(contentWindow.document); article = await lazy.ReaderMode.parseDocument(contentWindow.document);
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
await new Promise(resolve => { await new Promise(resolve => {

View File

@@ -109,7 +109,7 @@ class RemotePageChild extends JSWindowActorChild {
try { try {
listener(clonedMessage); listener(clonedMessage);
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
} }
} }

View File

@@ -56,7 +56,7 @@ class UAWidgetsChild extends JSWindowActorChild {
this.unwrap(aElement.openOrClosedShadowRoot) != this.unwrap(aElement.openOrClosedShadowRoot) !=
this.unwrap(widget.shadowRoot) this.unwrap(widget.shadowRoot)
) { ) {
Cu.reportError( console.error(
"Getting a UAWidgetSetupOrChange event without the ShadowRoot. " + "Getting a UAWidgetSetupOrChange event without the ShadowRoot. " +
"Torn down already?" "Torn down already?"
); );
@@ -65,7 +65,7 @@ class UAWidgetsChild extends JSWindowActorChild {
try { try {
widget.onchange(); widget.onchange();
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
} }
} }
@@ -109,7 +109,7 @@ class UAWidgetsChild extends JSWindowActorChild {
} }
if (!uri || !widgetName) { if (!uri || !widgetName) {
Cu.reportError( console.error(
"Getting a UAWidgetSetupOrChange event on undefined element." "Getting a UAWidgetSetupOrChange event on undefined element."
); );
return; return;
@@ -117,7 +117,7 @@ class UAWidgetsChild extends JSWindowActorChild {
let shadowRoot = aElement.openOrClosedShadowRoot; let shadowRoot = aElement.openOrClosedShadowRoot;
if (!shadowRoot) { if (!shadowRoot) {
Cu.reportError( console.error(
"Getting a UAWidgetSetupOrChange event without the Shadow Root. " + "Getting a UAWidgetSetupOrChange event without the Shadow Root. " +
"Torn down already?" "Torn down already?"
); );
@@ -143,13 +143,13 @@ class UAWidgetsChild extends JSWindowActorChild {
widget = widget.wrappedJSObject; widget = widget.wrappedJSObject;
} }
if (this.unwrap(widget.shadowRoot) != this.unwrap(shadowRoot)) { if (this.unwrap(widget.shadowRoot) != this.unwrap(shadowRoot)) {
Cu.reportError("Widgets should expose their shadow root."); console.error("Widgets should expose their shadow root.");
} }
this.widgets.set(aElement, { widget, widgetName }); this.widgets.set(aElement, { widget, widgetName });
try { try {
widget.onsetup(); widget.onsetup();
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
} }
@@ -162,7 +162,7 @@ class UAWidgetsChild extends JSWindowActorChild {
try { try {
widget.teardown(); widget.teardown();
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
} }
this.widgets.delete(aElement); this.widgets.delete(aElement);
@@ -228,7 +228,7 @@ class UAWidgetsChild extends JSWindowActorChild {
try { try {
widget.onPrefChange(prefKey, newValue); widget.onPrefChange(prefKey, newValue);
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
} }
} }

View File

@@ -65,7 +65,7 @@ export class WebChannelChild extends JSWindowActorChild {
whitelisted => principal.originNoSuffix == whitelisted.originNoSuffix whitelisted => principal.originNoSuffix == whitelisted.originNoSuffix
); );
if (!objectsAllowed) { if (!objectsAllowed) {
Cu.reportError( console.error(
"WebChannelMessageToChrome sent with an object from a non-whitelisted principal" "WebChannelMessageToChrome sent with an object from a non-whitelisted principal"
); );
return; return;
@@ -82,7 +82,7 @@ export class WebChannelChild extends JSWindowActorChild {
principal, principal,
}); });
} else { } else {
Cu.reportError("WebChannel message failed. No message detail."); console.error("WebChannel message failed. No message detail.");
} }
} }
@@ -99,7 +99,7 @@ export class WebChannelChild extends JSWindowActorChild {
eventTarget = ContentDOMReference.resolve(eventTarget); eventTarget = ContentDOMReference.resolve(eventTarget);
} }
if (!eventTarget) { if (!eventTarget) {
Cu.reportError("WebChannel message failed. No target."); console.error("WebChannel message failed. No target.");
return; return;
} }
@@ -123,10 +123,10 @@ export class WebChannelChild extends JSWindowActorChild {
}) })
); );
} else { } else {
Cu.reportError("WebChannel message failed. Principal mismatch."); console.error("WebChannel message failed. Principal mismatch.");
} }
} else { } else {
Cu.reportError("WebChannel message failed. No message data."); console.error("WebChannel message failed. No message data.");
} }
} }
} }

View File

@@ -22,7 +22,7 @@ export class WebChannelParent extends JSWindowActorParent {
try { try {
data = JSON.parse(data); data = JSON.parse(data);
} catch (e) { } catch (e) {
Cu.reportError("Failed to parse WebChannel data as a JSON object"); console.error("Failed to parse WebChannel data as a JSON object");
return; return;
} }
} }
@@ -52,7 +52,7 @@ export class WebChannelParent extends JSWindowActorParent {
} }
} }
} else { } else {
Cu.reportError("WebChannel channel id missing"); console.error("WebChannel channel id missing");
} }
} }
@@ -85,8 +85,8 @@ export class WebChannelParent extends JSWindowActorParent {
principal, principal,
}); });
} else { } else {
Cu.reportError("Failed to send a WebChannel error. Target invalid."); console.error("Failed to send a WebChannel error. Target invalid.");
} }
Cu.reportError(id.toString() + " error message. " + errorMsg); console.error(id.toString() + " error message. ", errorMsg);
} }
} }

View File

@@ -45,7 +45,7 @@ nsDefaultCLH.prototype = {
} }
dump(out + "\n"); dump(out + "\n");
Cu.reportError(out); console.error(out);
} }
var printDirList; var printDirList;
@@ -65,7 +65,7 @@ nsDefaultCLH.prototype = {
} }
dump(out + "\n"); dump(out + "\n");
Cu.reportError(out); console.error(out);
} }
if (cmdLine.handleFlag("silent", false)) { if (cmdLine.handleFlag("silent", false)) {

View File

@@ -65,7 +65,7 @@ async function fetchData() {
!(e instanceof Components.Exception) || !(e instanceof Components.Exception) ||
e.result != Cr.NS_ERROR_NOT_AVAILABLE e.result != Cr.NS_ERROR_NOT_AVAILABLE
) { ) {
Cu.reportError(e); console.error(e);
} }
} }
@@ -231,7 +231,7 @@ async function onBlock(event) {
event.target.setAttribute("data-l10n-id", blockButtonL10nId); event.target.setAttribute("data-l10n-id", blockButtonL10nId);
updatedBlocklist = true; updatedBlocklist = true;
} catch (ex) { } catch (ex) {
Cu.reportError("Failed to update the blocklist file - " + ex.result); console.error("Failed to update the blocklist file - ", ex.result);
} finally { } finally {
processingBlockRequest = false; processingBlockRequest = false;
} }
@@ -582,7 +582,7 @@ async function collectCrashInfo() {
try { try {
return BigInt(maybeBigInt); return BigInt(maybeBigInt);
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
return NaN; return NaN;
}; };
@@ -626,7 +626,7 @@ async function onLoad() {
e.target.disabled = true; e.target.disabled = true;
const data = await fetchData(); const data = await fetchData();
await copyDataToClipboard(data || []).catch(Cu.reportError); await copyDataToClipboard(data || []).catch(console.error);
e.target.disabled = false; e.target.disabled = false;
}); });
@@ -665,7 +665,7 @@ async function onLoad() {
// we show the reload button to call visualizeData again. // we show the reload button to call visualizeData again.
button.hidden = false; button.hidden = false;
}) })
.catch(Cu.reportError); .catch(console.error);
const data = await fetchData(); const data = await fetchData();
// Used for testing purposes // Used for testing purposes
@@ -688,5 +688,5 @@ try {
} catch (ex) { } catch (ex) {
// Do nothing if we fail to create a singleton instance, // Do nothing if we fail to create a singleton instance,
// showing the default no-module message. // showing the default no-module message.
Cu.reportError(ex); console.error(ex);
} }

View File

@@ -66,5 +66,5 @@ try {
} catch (ex) { } catch (ex) {
// Do nothing if we fail to create a singleton instance, // Do nothing if we fail to create a singleton instance,
// showing the default no-module message. // showing the default no-module message.
Cu.reportError(ex); console.error(ex);
} }

View File

@@ -40,7 +40,7 @@ class Feature {
observe(subject, topic, data) { observe(subject, topic, data) {
if (topic != "nsPref:changed" || data != this.prefName) { if (topic != "nsPref:changed" || data != this.prefName) {
Cu.reportError(`Unexpected event ${topic} with ${data}`); console.error(`Unexpected event ${topic} with ${data}`);
return; return;
} }

View File

@@ -290,7 +290,7 @@ TrackingDBService.prototype = {
} }
}); });
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
// If milestone CFR messaging is not enabled we don't need to update the milestone pref or send the event. // If milestone CFR messaging is not enabled we don't need to update the milestone pref or send the event.

View File

@@ -130,7 +130,7 @@ class URLQueryStrippingListService {
break; break;
default: default:
Cu.reportError(`Unexpected pref name ${pref}`); console.error(`Unexpected pref name ${pref}`);
return; return;
} }
@@ -224,7 +224,7 @@ class URLQueryStrippingListService {
this._onPrefUpdate(data, prefValue); this._onPrefUpdate(data, prefValue);
break; break;
default: default:
Cu.reportError(`Unexpected event ${topic}`); console.error(`Unexpected event ${topic}`);
} }
} }

View File

@@ -872,7 +872,7 @@ const StorageAccessCleaner = {
try { try {
Services.perms.removePermission(perm); Services.perms.removePermission(perm);
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
}); });
}, },
@@ -1174,7 +1174,7 @@ const ClientAuthRememberCleaner = {
originSuffix originSuffix
); );
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
} }
@@ -1572,7 +1572,7 @@ ClearDataService.prototype = Object.freeze({
// This is mainly needed for GeckoView that doesn't start QMS on startup // This is mainly needed for GeckoView that doesn't start QMS on startup
// time. // time.
if (!Services.qms) { if (!Services.qms) {
Cu.reportError("Failed initializiation of QuotaManagerService."); console.error("Failed initializiation of QuotaManagerService.");
} }
}, },
@@ -1733,7 +1733,7 @@ ClearDataService.prototype = Object.freeze({
return Promise.all( return Promise.all(
c.cleaners.map(cleaner => { c.cleaners.map(cleaner => {
return aHelper(cleaner).catch(e => { return aHelper(cleaner).catch(e => {
Cu.reportError(e); console.error(e);
resultFlags |= c.flag; resultFlags |= c.flag;
}); });
}) })

View File

@@ -112,7 +112,7 @@ export class PrincipalsCollector {
resolve(principalsMap); resolve(principalsMap);
}; };
}).catch(ex => { }).catch(ex => {
Cu.reportError("QuotaManagerService promise failed: " + ex); console.error("QuotaManagerService promise failed: ", ex);
return []; return [];
}); });

View File

@@ -914,10 +914,10 @@ ContentPrefService2.prototype = {
try { try {
callbacks.onError(e); callbacks.onError(e);
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
} else { } else {
Cu.reportError(e); console.error(e);
} }
} }
@@ -926,7 +926,7 @@ ContentPrefService2.prototype = {
try { try {
callbacks.onRow(row); callbacks.onRow(row);
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
} }
} }
@@ -940,7 +940,7 @@ ContentPrefService2.prototype = {
rows && !!rows.length rows && !!rows.length
); );
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
}, },
@@ -1034,7 +1034,7 @@ ContentPrefService2.prototype = {
try { try {
observer.onContentPrefRemoved(aGroup, aName, aIsPrivate); observer.onContentPrefRemoved(aGroup, aName, aIsPrivate);
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
} }
}, },
@@ -1052,7 +1052,7 @@ ContentPrefService2.prototype = {
try { try {
observer.onContentPrefSet(aGroup, aName, aValue, aIsPrivate); observer.onContentPrefSet(aGroup, aName, aValue, aIsPrivate);
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
} }
}, },
@@ -1184,7 +1184,7 @@ ContentPrefService2.prototype = {
try { try {
await this._failover(conn, path); await this._failover(conn, path);
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
throw e; throw e;
} }
return this._getConnection(++aAttemptNum); return this._getConnection(++aAttemptNum);
@@ -1207,14 +1207,14 @@ ContentPrefService2.prototype = {
return null; return null;
} }
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
return resetAndRetry(e); return resetAndRetry(e);
} }
try { try {
await this._dbMaybeInit(conn); await this._dbMaybeInit(conn);
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
return resetAndRetry(e); return resetAndRetry(e);
} }

View File

@@ -43,7 +43,7 @@ function safeCallback(callbackObj, methodName, args) {
try { try {
callbackObj[methodName].apply(callbackObj, args); callbackObj[methodName].apply(callbackObj, args);
} catch (err) { } catch (err) {
Cu.reportError(err); console.error(err);
} }
} }

View File

@@ -205,7 +205,7 @@ _ContextualIdentityService.prototype = {
loadError(error) { loadError(error) {
if (error != null && error.name != "NotFoundError") { if (error != null && error.name != "NotFoundError") {
// Let's report the error. // Let's report the error.
Cu.reportError(error); console.error(error);
} }
// If synchronous loading happened in the meantime, exit now. // If synchronous loading happened in the meantime, exit now.

View File

@@ -132,9 +132,9 @@ class CookieBannerParent extends JSWindowActorParent {
// is disabled. We will fallback to global pref setting if any errors // is disabled. We will fallback to global pref setting if any errors
// occur. // occur.
if (e.result == Cr.NS_ERROR_NOT_AVAILABLE) { if (e.result == Cr.NS_ERROR_NOT_AVAILABLE) {
Cu.reportError("The cookie banner handling service is not available"); console.error("The cookie banner handling service is not available");
} else { } else {
Cu.reportError("Fail on getting domain pref:" + e); console.error("Fail on getting domain pref:", e);
} }
} }
} }

View File

@@ -83,7 +83,7 @@ function parseAndRemoveField(obj, field) {
try { try {
value = JSON.parse(obj[field]); value = JSON.parse(obj[field]);
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
delete obj[field]; delete obj[field];
@@ -344,10 +344,10 @@ CrashManager.prototype = Object.freeze({
break; break;
default: default:
Cu.reportError( console.error(
"Unhandled crash event file return code. Please " + "Unhandled crash event file return code. Please " +
"file a bug: " + "file a bug: ",
result result
); );
} }
} catch (ex) { } catch (ex) {
@@ -360,7 +360,7 @@ CrashManager.prototype = Object.freeze({
// //
// If we get here, report the error and delete the source file // If we get here, report the error and delete the source file
// so we don't see it again. // so we don't see it again.
Cu.reportError( console.error(
"Exception when processing crash event file: " + "Exception when processing crash event file: " +
lazy.Log.exceptionStr(ex) lazy.Log.exceptionStr(ex)
); );
@@ -450,10 +450,10 @@ CrashManager.prototype = Object.freeze({
addCrash(processType, crashType, id, date, metadata) { addCrash(processType, crashType, id, date, metadata) {
let promise = (async () => { let promise = (async () => {
if (!this.isValidProcessType(processType)) { if (!this.isValidProcessType(processType)) {
Cu.reportError( console.error(
"Unhandled process type. Please file a bug: '" + "Unhandled process type. Please file a bug: '",
processType + processType,
"'. Ignore in the context of " + "'. Ignore in the context of " +
"test_crash_manager.js:test_addCrashWrong()." "test_crash_manager.js:test_addCrashWrong()."
); );
return; return;
@@ -645,7 +645,7 @@ CrashManager.prototype = Object.freeze({
return entries; return entries;
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
return []; return [];
} }
})(); })();

View File

@@ -31,7 +31,7 @@ async function maybeRunMinidumpAnalyzer(minidumpPath, allThreads) {
} }
await runMinidumpAnalyzer(minidumpPath, allThreads).catch(e => await runMinidumpAnalyzer(minidumpPath, allThreads).catch(e =>
Cu.reportError(e) console.error(e)
); );
} }
@@ -123,7 +123,7 @@ function computeMinidumpHash(minidumpPath) {
return hash; return hash;
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
return null; return null;
} }
})(); })();
@@ -146,7 +146,7 @@ function processExtraFile(extraPath) {
return JSON.parse(decoder.decode(extraData)); return JSON.parse(decoder.decode(extraData));
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
return {}; return {};
} }
})(); })();

View File

@@ -108,7 +108,7 @@ var CrashMonitorInternal = {
} catch (ex) { } catch (ex) {
// Ignore file not found errors, but report all others. // Ignore file not found errors, but report all others.
if (ex.name !== "NotFoundError") { if (ex.name !== "NotFoundError") {
Cu.reportError( console.error(
`Error while loading crash monitor data: ${ex.message}` `Error while loading crash monitor data: ${ex.message}`
); );
} }
@@ -117,7 +117,7 @@ var CrashMonitorInternal = {
// If `notifications` isn't an object, then the monitor data isn't valid. // If `notifications` isn't an object, then the monitor data isn't valid.
if (Object(notifications) !== notifications) { if (Object(notifications) !== notifications) {
Cu.reportError( console.error(
"Error while parsing crash monitor data: invalid monitor data" "Error while parsing crash monitor data: invalid monitor data"
); );
return null; return null;

View File

@@ -596,7 +596,7 @@ Download.prototype = {
this._deferSucceeded.resolve(); this._deferSucceeded.resolve();
if (this.launchWhenSucceeded) { if (this.launchWhenSucceeded) {
this.launch().catch(Cu.reportError); this.launch().catch(console.error);
// Always schedule files to be deleted at the end of the private browsing // Always schedule files to be deleted at the end of the private browsing
// mode, regardless of the value of the pref. // mode, regardless of the value of the pref.
@@ -1072,7 +1072,7 @@ Download.prototype = {
this._notifyChange(); this._notifyChange();
} }
})().catch(Cu.reportError); })().catch(console.error);
}, },
/** /**
@@ -2053,7 +2053,7 @@ DownloadSaver.prototype = {
addToHistory() { addToHistory() {
if (AppConstants.MOZ_PLACES) { if (AppConstants.MOZ_PLACES) {
lazy.DownloadHistory.addDownloadToHistory(this.download).catch( lazy.DownloadHistory.addDownloadToHistory(this.download).catch(
Cu.reportError console.error
); );
} }
}, },

View File

@@ -573,7 +573,7 @@ var DownloadHistoryList = function(publicList, place) {
this._slotForDownload = new WeakMap(); this._slotForDownload = new WeakMap();
// Start the asynchronous queries to retrieve history and session downloads. // Start the asynchronous queries to retrieve history and session downloads.
publicList.addView(this).catch(Cu.reportError); publicList.addView(this).catch(console.error);
let query = {}, let query = {},
options = {}; options = {};
lazy.PlacesUtils.history.queryStringToQuery(place, query, options); lazy.PlacesUtils.history.queryStringToQuery(place, query, options);

View File

@@ -1017,7 +1017,7 @@ var DownloadObserver = {
}; };
// We register the view asynchronously. // We register the view asynchronously.
aList.addView(downloadsView).catch(Cu.reportError); aList.addView(downloadsView).catch(console.error);
}, },
/** /**
@@ -1105,8 +1105,8 @@ var DownloadObserver = {
// We can remove the downloads and finalize them in parallel. // We can remove the downloads and finalize them in parallel.
for (let download of downloads) { for (let download of downloads) {
list.remove(download).catch(Cu.reportError); list.remove(download).catch(console.error);
download.finalize(true).catch(Cu.reportError); download.finalize(true).catch(console.error);
} }
})(); })();
// Handle test mode // Handle test mode

View File

@@ -119,7 +119,7 @@ DownloadLegacyTransfer.prototype = {
} }
}); });
}) })
.catch(Cu.reportError); .catch(console.error);
} else if ( } else if (
aStateFlags & Ci.nsIWebProgressListener.STATE_STOP && aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK
@@ -137,7 +137,7 @@ DownloadLegacyTransfer.prototype = {
} }
download.saver.onTransferFinished(aStatus); download.saver.onTransferFinished(aStatus);
}) })
.catch(Cu.reportError); .catch(console.error);
// Release the reference to the component executing the download. // Release the reference to the component executing the download.
this._cancelable = null; this._cancelable = null;
@@ -183,7 +183,7 @@ DownloadLegacyTransfer.prototype = {
.then(download => { .then(download => {
download.saver.onTransferFinished(aStatus); download.saver.onTransferFinished(aStatus);
}) })
.catch(Cu.reportError); .catch(console.error);
} }
}, },
@@ -236,7 +236,7 @@ DownloadLegacyTransfer.prototype = {
this._delayedMaxTotalProgress this._delayedMaxTotalProgress
); );
}) })
.catch(Cu.reportError); .catch(console.error);
}, },
_hasDelayedProgress: false, _hasDelayedProgress: false,
_delayedCurTotalProgress: 0, _delayedCurTotalProgress: 0,
@@ -447,7 +447,7 @@ DownloadLegacyTransfer.prototype = {
aDownload._notifyChange(); aDownload._notifyChange();
} }
}) })
.catch(Cu.reportError); .catch(console.error);
}, },
setSha256Hash(hash) { setSha256Hash(hash) {

View File

@@ -357,10 +357,10 @@ DownloadList.prototype = {
// don't need to wait for the procedure to be complete before // don't need to wait for the procedure to be complete before
// processing the other downloads in the list. // processing the other downloads in the list.
let removePartialData = !sameFileIsDownloading; let removePartialData = !sameFileIsDownloading;
download.finalize(removePartialData).catch(Cu.reportError); download.finalize(removePartialData).catch(console.error);
} }
} }
})().catch(Cu.reportError); })().catch(console.error);
}, },
}; };
@@ -380,8 +380,8 @@ export var DownloadCombinedList = function(aPublicList, aPrivateList) {
DownloadList.call(this); DownloadList.call(this);
this._publicList = aPublicList; this._publicList = aPublicList;
this._privateList = aPrivateList; this._privateList = aPrivateList;
aPublicList.addView(this).catch(Cu.reportError); aPublicList.addView(this).catch(console.error);
aPrivateList.addView(this).catch(Cu.reportError); aPrivateList.addView(this).catch(console.error);
}; };
DownloadCombinedList.prototype = { DownloadCombinedList.prototype = {

View File

@@ -903,7 +903,7 @@ function registerInterruptibleHandler(aPath, aFirstPartFn, aSecondPartFn) {
aResponse.finish(); aResponse.finish();
info("Interruptible request finished."); info("Interruptible request finished.");
}) })
.catch(Cu.reportError); .catch(console.error);
}); });
} }

View File

@@ -268,7 +268,7 @@ class FeatureGateImplementation {
try { try {
observer[method](...args); observer[method](...args);
} catch (err) { } catch (err) {
Cu.reportError(err); console.error(err);
} }
} }
} }
@@ -292,7 +292,7 @@ class FeatureGateImplementation {
} }
} }
} else { } else {
Cu.reportError( console.error(
new Error(`Unexpected event observed: ${aSubject}, ${aTopic}, ${aData}`) new Error(`Unexpected event observed: ${aSubject}, ${aTopic}, ${aData}`)
); );
} }

View File

@@ -39,7 +39,7 @@ module.exports = {
"max-nested-callbacks": ["error", 4], "max-nested-callbacks": ["error", 4],
// Disallow using the console API. // Disallow using the console API.
"no-console": "error", "no-console": ["error", { allow: ["error"] }],
// Disallow fallthrough of case statements, except if there is a comment. // Disallow fallthrough of case statements, except if there is a comment.
"no-fallthrough": "error", "no-fallthrough": "error",

View File

@@ -401,7 +401,7 @@ class FormAutofillParent extends JSWindowActorParent {
); );
} }
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
} }
} }

View File

@@ -81,7 +81,7 @@ const SpecialMessageActions = {
install install
); );
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
}, },

View File

@@ -134,7 +134,7 @@ class TargetingContext {
const logUndesiredEvent = (event, key, prop) => { const logUndesiredEvent = (event, key, prop) => {
const value = key ? `${key}.${prop}` : prop; const value = key ? `${key}.${prop}` : prop;
this._sendUndesiredEvent({ event, value }); this._sendUndesiredEvent({ event, value });
Cu.reportError(`${event}: ${value}`); console.error(`${event}: ${value}`);
}; };
return new Proxy(context, { return new Proxy(context, {
@@ -157,7 +157,7 @@ class TargetingContext {
} catch (error) { } catch (error) {
logUndesiredEvent(ERROR_TYPES.ATTRIBUTE_ERROR, key, prop); logUndesiredEvent(ERROR_TYPES.ATTRIBUTE_ERROR, key, prop);
reject(error); reject(error);
Cu.reportError(error); console.error(error);
} finally { } finally {
lazy.clearTimeout(timeout); lazy.clearTimeout(timeout);
} }

View File

@@ -271,7 +271,7 @@ NarrateControls.prototype = {
this.narrator this.narrator
.start(options) .start(options)
.catch(err => { .catch(err => {
Cu.reportError(`Narrate failed: ${err}.`); console.error(`Narrate failed: ${err}.`);
}) })
.then(() => { .then(() => {
this._updateSpeechControls(false); this._updateSpeechControls(false);

View File

@@ -46,7 +46,7 @@ function parseJSON(value) {
try { try {
return JSON.parse(value); return JSON.parse(value);
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
} }
return null; return null;
@@ -112,7 +112,7 @@ const ExperimentAPI = {
experimentData = this._store.getExperimentForFeature(featureId); experimentData = this._store.getExperimentForFeature(featureId);
} }
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
if (experimentData) { if (experimentData) {
return { return {
@@ -151,7 +151,7 @@ const ExperimentAPI = {
} }
} }
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
if (experimentData) { if (experimentData) {
return { return {
@@ -194,7 +194,7 @@ const ExperimentAPI = {
experiment = this._store.getExperimentForFeature(featureId); experiment = this._store.getExperimentForFeature(featureId);
} }
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
if (!experiment) { if (!experiment) {
@@ -276,7 +276,7 @@ const ExperimentAPI = {
} catch (e) { } catch (e) {
// If an error occurs in .get(), an empty list is returned and the destructuring // If an error occurs in .get(), an empty list is returned and the destructuring
// assignment will throw. // assignment will throw.
Cu.reportError(e); console.error(e);
recipe = undefined; recipe = undefined;
} }
@@ -319,7 +319,7 @@ const ExperimentAPI = {
} }
); );
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
Glean.nimbusEvents.exposure.record({ Glean.nimbusEvents.exposure.record({
experiment: experimentSlug, experiment: experimentSlug,
@@ -346,7 +346,7 @@ class _ExperimentFeature {
this.prefGetters = {}; this.prefGetters = {};
this.manifest = manifest || lazy.FeatureManifest[featureId]; this.manifest = manifest || lazy.FeatureManifest[featureId];
if (!this.manifest) { if (!this.manifest) {
Cu.reportError( console.error(
`No manifest entry for ${featureId}. Please add one to toolkit/components/nimbus/FeatureManifest.js` `No manifest entry for ${featureId}. Please add one to toolkit/components/nimbus/FeatureManifest.js`
); );
} }

View File

@@ -207,7 +207,7 @@ class _ExperimentManager {
} }
this.unenroll(slug, reason); this.unenroll(slug, reason);
} catch (err) { } catch (err) {
Cu.reportError(err); console.error(err);
} }
} }
} }

View File

@@ -49,7 +49,7 @@ XPCOMUtils.defineLazyGetter(lazy, "syncDataStore", () => {
try { try {
branch.setStringPref(pref, JSON.stringify(value)); branch.setStringPref(pref, JSON.stringify(value));
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
}, },
_trySetTypedPrefValue(pref, value) { _trySetTypedPrefValue(pref, value) {
@@ -302,7 +302,7 @@ class ExperimentStore extends SharedDataMap {
try { try {
data = Object.values(this._data || {}); data = Object.values(this._data || {});
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
return data; return data;

View File

@@ -190,7 +190,7 @@ class _RemoteSettingsExperimentLoader {
result = await targetingContext.evalWithDefault(jexlString); result = await targetingContext.evalWithDefault(jexlString);
} catch (e) { } catch (e) {
lazy.log.debug("Targeting failed because of an error", e); lazy.log.debug("Targeting failed because of an error", e);
Cu.reportError(e); console.error(e);
} }
return result; return result;
} }
@@ -254,7 +254,7 @@ class _RemoteSettingsExperimentLoader {
} catch (e) { } catch (e) {
lazy.log.debug("Error getting recipes from remote settings."); lazy.log.debug("Error getting recipes from remote settings.");
loadingError = true; loadingError = true;
Cu.reportError(e); console.error(e);
} }
let recipeValidator; let recipeValidator;
@@ -292,7 +292,7 @@ class _RemoteSettingsExperimentLoader {
if (validationEnabled) { if (validationEnabled) {
let validation = recipeValidator.validate(r); let validation = recipeValidator.validate(r);
if (!validation.valid) { if (!validation.valid) {
Cu.reportError( console.error(
`Could not validate experiment recipe ${r.id}: ${JSON.stringify( `Could not validate experiment recipe ${r.id}: ${JSON.stringify(
validation.errors, validation.errors,
undefined, undefined,
@@ -409,7 +409,7 @@ class _RemoteSettingsExperimentLoader {
emptyListFallback: false, emptyListFallback: false,
}); });
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
throw new Error("Error getting recipes from remote settings."); throw new Error("Error getting recipes from remote settings.");
} }
@@ -488,9 +488,7 @@ class _RemoteSettingsExperimentLoader {
for (const feature of features) { for (const feature of features) {
const { featureId, value } = feature; const { featureId, value } = feature;
if (!lazy.NimbusFeatures[featureId]) { if (!lazy.NimbusFeatures[featureId]) {
Cu.reportError( console.error(`Experiment ${id} has unknown featureId: ${featureId}`);
`Experiment ${id} has unknown featureId: ${featureId}`
);
invalidFeatureIds.add(featureId); invalidFeatureIds.add(featureId);
continue; continue;
@@ -525,7 +523,7 @@ class _RemoteSettingsExperimentLoader {
const result = validator.validate(value); const result = validator.validate(value);
if (!result.valid) { if (!result.valid) {
Cu.reportError( console.error(
`Experiment ${id} branch ${branchIdx} feature ${featureId} does not validate: ${JSON.stringify( `Experiment ${id} branch ${branchIdx} feature ${featureId} does not validate: ${JSON.stringify(
result.errors, result.errors,
undefined, undefined,
@@ -573,7 +571,7 @@ class _RemoteSettingsExperimentLoader {
default: default:
// NB: Experimenter doesn't outright reject invalid types either. // NB: Experimenter doesn't outright reject invalid types either.
Cu.reportError( console.error(
`Feature ID ${featureId} has variable ${varName} with invalid FML type: ${prop.type}` `Feature ID ${featureId} has variable ${varName} with invalid FML type: ${prop.type}`
); );
break; break;

View File

@@ -42,13 +42,13 @@ class SharedDataMap extends EventEmitter {
const profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile).path; const profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile).path;
path = PathUtils.join(profileDir, `${sharedDataKey}.json`); path = PathUtils.join(profileDir, `${sharedDataKey}.json`);
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
} }
try { try {
store = new lazy.JSONFile({ path }); store = new lazy.JSONFile({ path });
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
return store; return store;
}); });
@@ -66,7 +66,7 @@ class SharedDataMap extends EventEmitter {
this._syncToChildren({ flush: true }); this._syncToChildren({ flush: true });
this._checkIfReady(); this._checkIfReady();
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
} }
} }

View File

@@ -234,7 +234,7 @@ var Normandy = {
targetPrefType !== Services.prefs.PREF_INVALID && targetPrefType !== Services.prefs.PREF_INVALID &&
targetPrefType !== sourcePrefType targetPrefType !== sourcePrefType
) { ) {
Cu.reportError( console.error(
new Error( new Error(
`Error setting startup pref ${prefName}; pref type does not match.` `Error setting startup pref ${prefName}; pref type does not match.`
) )
@@ -274,7 +274,7 @@ var Normandy = {
originalValues[prefName] = null; originalValues[prefName] = null;
} else { } else {
// Unexpected error, report it and move on // Unexpected error, report it and move on
Cu.reportError(e); console.error(e);
continue; continue;
} }
} }
@@ -301,7 +301,7 @@ var Normandy = {
} }
default: { default: {
// This should never happen. // This should never happen.
Cu.reportError( console.error(
new Error( new Error(
`Error getting startup pref ${prefName}; unexpected value type ${sourcePrefType}.` `Error getting startup pref ${prefName}; unexpected value type ${sourcePrefType}.`
) )

View File

@@ -89,14 +89,12 @@ class BaseAction {
break; break;
} }
default: { default: {
Cu.reportError( console.error(new Error("BaseAction.fail() called at unexpected time"));
new Error("BaseAction.fail() called at unexpected time")
);
} }
} }
this.state = BaseAction.STATE_FAILED; this.state = BaseAction.STATE_FAILED;
this.lastError = err; this.lastError = err;
Cu.reportError(err); console.error(err);
} }
// Gets the name of the action. Does not necessarily match the // Gets the name of the action. Does not necessarily match the
@@ -170,7 +168,7 @@ class BaseAction {
try { try {
recipe.arguments = this.validateArguments(recipe.arguments); recipe.arguments = this.validateArguments(recipe.arguments);
} catch (error) { } catch (error) {
Cu.reportError(error); console.error(error);
uptakeResult = Uptake.RECIPE_EXECUTION_ERROR; uptakeResult = Uptake.RECIPE_EXECUTION_ERROR;
suitability = BaseAction.suitability.ARGUMENTS_INVALID; suitability = BaseAction.suitability.ARGUMENTS_INVALID;
} }
@@ -179,7 +177,7 @@ class BaseAction {
try { try {
await this._processRecipe(recipe, suitability); await this._processRecipe(recipe, suitability);
} catch (err) { } catch (err) {
Cu.reportError(err); console.error(err);
uptakeResult = Uptake.RECIPE_EXECUTION_ERROR; uptakeResult = Uptake.RECIPE_EXECUTION_ERROR;
} }
Uptake.reportRecipe(recipe, uptakeResult); Uptake.reportRecipe(recipe, uptakeResult);
@@ -249,7 +247,7 @@ class BaseAction {
} }
this.lastError = err; this.lastError = err;
Cu.reportError(err); console.error(err);
} }
break; break;
} }

View File

@@ -229,7 +229,7 @@ class BranchedAddonStudyAction extends BaseStudyAction {
try { try {
await this.unenroll(study.recipeId, "recipe-not-seen"); await this.unenroll(study.recipeId, "recipe-not-seen");
} catch (err) { } catch (err) {
Cu.reportError(err); console.error(err);
} }
} }
} }

View File

@@ -114,7 +114,7 @@ class PreferenceRolloutAction extends BaseAction {
break; break;
} }
default: { default: {
Cu.reportError( console.error(
new Error( new Error(
`Updated pref rollout in unexpected state: ${existingRollout.state}` `Updated pref rollout in unexpected state: ${existingRollout.state}`
) )

View File

@@ -486,7 +486,7 @@ var AddonStudies = {
try { try {
await cb(reason); await cb(reason);
} catch (err) { } catch (err) {
Cu.reportError(err); console.error(err);
} }
} }

View File

@@ -33,7 +33,7 @@ class CleanupManagerClass {
try { try {
await handler(); await handler();
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
} }
})(); })();

View File

@@ -74,7 +74,7 @@ var ShieldPreferences = {
const allPromises = studyPromises const allPromises = studyPromises
.concat(experimentPromises) .concat(experimentPromises)
.map(p => p && p.catch(err => Cu.reportError(err))); .map(p => p && p.catch(err => console.error(err)));
await Promise.all(allPromises); await Promise.all(allPromises);
} }
break; break;

View File

@@ -59,7 +59,7 @@ async function getRelayTokenAsync() {
try { try {
return await lazy.fxAccounts.getOAuthToken({ scope: config.scope }); return await lazy.fxAccounts.getOAuthToken({ scope: config.scope });
} catch (e) { } catch (e) {
Cu.reportError(`There was an error getting the user's token: ${e.message}`); console.error(`There was an error getting the user's token: ${e.message}`);
return undefined; return undefined;
} }
} }

View File

@@ -2020,7 +2020,7 @@ class LoginManagerChild extends JSWindowActorChild {
this._getLoginDataFromParent(form, { showPrimaryPassword: true }) this._getLoginDataFromParent(form, { showPrimaryPassword: true })
.then(this.loginsFound.bind(this)) .then(this.loginsFound.bind(this))
.catch(Cu.reportError); .catch(console.error);
} }
isPasswordGenerationForcedOn(passwordField) { isPasswordGenerationForcedOn(passwordField) {
@@ -2203,7 +2203,7 @@ class LoginManagerChild extends JSWindowActorChild {
userTriggered: true, userTriggered: true,
}); });
}) })
.catch(Cu.reportError); .catch(console.error);
// Use `loginGUID !== null` to distinguish whether this is called when the // Use `loginGUID !== null` to distinguish whether this is called when the
// field is filled or tabbed away from. For the latter, don't highlight the field. // field is filled or tabbed away from. For the latter, don't highlight the field.
} else if (loginGUID !== null) { } else if (loginGUID !== null) {

View File

@@ -207,7 +207,7 @@ const LoginManagerContextMenu = {
loginFormOrigin: formOrigin, loginFormOrigin: formOrigin,
login, login,
}) })
.catch(Cu.reportError); .catch(console.error);
}, },
/** /**

View File

@@ -84,7 +84,7 @@ class LoginManagerStorage_json {
// Load the data asynchronously. // Load the data asynchronously.
this.log(`Opening database at ${this._store.path}.`); this.log(`Opening database at ${this._store.path}.`);
await this._store.load(); await this._store.load();
})().catch(Cu.reportError); })().catch(console.error);
} catch (e) { } catch (e) {
this.log(`Initialization failed ${e.name}.`); this.log(`Initialization failed ${e.name}.`);
throw new Error("Initialization failed"); throw new Error("Initialization failed");

View File

@@ -288,7 +288,7 @@ class ChromeActions {
} catch (err) { } catch (err) {
// If there's an error here, it means that something is really wrong // If there's an error here, it means that something is really wrong
// on pdf.js side during sandbox initialization phase. // on pdf.js side during sandbox initialization phase.
Cu.reportError(err); console.error(err);
return sendResp(false); return sendResp(false);
} }
@@ -967,7 +967,7 @@ PdfStreamConverter.prototype = {
rv.shouldOpen = true; rv.shouldOpen = true;
// Log that we're doing this to help debug issues if people end up being // Log that we're doing this to help debug issues if people end up being
// surprised by this behaviour. // surprised by this behaviour.
Cu.reportError("Found unusable PDF preferences. Fixing back to PDF.js"); console.error("Found unusable PDF preferences. Fixing back to PDF.js");
mime.preferredAction = Ci.nsIHandlerInfo.handleInternally; mime.preferredAction = Ci.nsIHandlerInfo.handleInternally;
mime.alwaysAskBeforeHandling = false; mime.alwaysAskBeforeHandling = false;

View File

@@ -840,7 +840,7 @@ export var Bookmarks = Object.freeze({
) { ) {
// ...though we don't wait for the calculation. // ...though we don't wait for the calculation.
updateFrecency(db, [item.url, updatedItem.url]).catch( updateFrecency(db, [item.url, updatedItem.url]).catch(
Cu.reportError console.error
); );
} }
@@ -1403,7 +1403,7 @@ export var Bookmarks = Object.freeze({
// We don't wait for the frecency calculation. // We don't wait for the frecency calculation.
if (urls && urls.length) { if (urls && urls.length) {
await lazy.PlacesUtils.keywords.eraseEverything(); await lazy.PlacesUtils.keywords.eraseEverything();
updateFrecency(db, urls).catch(Cu.reportError); updateFrecency(db, urls).catch(console.error);
} }
} }
); );
@@ -2186,7 +2186,7 @@ function insertBookmark(item, parent) {
// If not a tag recalculate frecency... // If not a tag recalculate frecency...
if (item.type == Bookmarks.TYPE_BOOKMARK && !isTagging) { if (item.type == Bookmarks.TYPE_BOOKMARK && !isTagging) {
// ...though we don't wait for the calculation. // ...though we don't wait for the calculation.
updateFrecency(db, [item.url]).catch(Cu.reportError); updateFrecency(db, [item.url]).catch(console.error);
} }
return item; return item;
@@ -2256,7 +2256,7 @@ function insertBookmarkTree(items, source, parent, urls, lastAddedForParent) {
}); });
// We don't wait for the frecency calculation. // We don't wait for the frecency calculation.
updateFrecency(db, urls).catch(Cu.reportError); updateFrecency(db, urls).catch(console.error);
return items; return items;
} }
@@ -2778,7 +2778,7 @@ function removeBookmarks(items, options) {
if (urls.length) { if (urls.length) {
await lazy.PlacesUtils.keywords.removeFromURLsIfNotBookmarked(urls); await lazy.PlacesUtils.keywords.removeFromURLsIfNotBookmarked(urls);
updateFrecency(db, urls).catch(Cu.reportError); updateFrecency(db, urls).catch(console.error);
} }
} }
); );

View File

@@ -1100,7 +1100,7 @@ var notifyCleanup = async function(db, pages, transitionType = 0) {
await Promise.resolve(); await Promise.resolve();
} }
}) })
.catch(Cu.reportError); .catch(console.error);
} }
} }

View File

@@ -485,7 +485,7 @@ export function nsPlacesExpiration() {
// Expire daily on idle. // Expire daily on idle.
Services.obs.addObserver(this, TOPIC_IDLE_DAILY, true); Services.obs.addObserver(this, TOPIC_IDLE_DAILY, true);
}) })
.catch(Cu.reportError); .catch(console.error);
// Block shutdown. // Block shutdown.
let shutdownClient = let shutdownClient =
@@ -503,7 +503,7 @@ export function nsPlacesExpiration() {
// If the database is dirty, we want to expire some entries, to speed up // If the database is dirty, we want to expire some entries, to speed up
// the expiration process. // the expiration process.
if (this.status == STATUS.DIRTY) { if (this.status == STATUS.DIRTY) {
this._expire(ACTION.SHUTDOWN_DIRTY, LIMIT.LARGE).catch(Cu.reportError); this._expire(ACTION.SHUTDOWN_DIRTY, LIMIT.LARGE).catch(console.error);
} }
}); });
} }
@@ -522,19 +522,19 @@ nsPlacesExpiration.prototype = {
// Everything should be expired without any limit. If history is over // Everything should be expired without any limit. If history is over
// capacity then all existing visits will be expired. // capacity then all existing visits will be expired.
// Should only be used in tests, since may cause dataloss. // Should only be used in tests, since may cause dataloss.
this._expire(ACTION.DEBUG, LIMIT.UNLIMITED).catch(Cu.reportError); this._expire(ACTION.DEBUG, LIMIT.UNLIMITED).catch(console.error);
} else if (limit > 0) { } else if (limit > 0) {
// The number of expired visits is limited by this amount. It may be // The number of expired visits is limited by this amount. It may be
// used for testing purposes, like checking that limited queries work. // used for testing purposes, like checking that limited queries work.
this._debugLimit = limit; this._debugLimit = limit;
this._expire(ACTION.DEBUG, LIMIT.DEBUG).catch(Cu.reportError); this._expire(ACTION.DEBUG, LIMIT.DEBUG).catch(console.error);
} else { } else {
// Any other value is intended as a 0 limit, that means no visits // Any other value is intended as a 0 limit, that means no visits
// will be expired. Even if this doesn't touch visits, it will remove // will be expired. Even if this doesn't touch visits, it will remove
// any orphan pages, icons, annotations and similar from the database, // any orphan pages, icons, annotations and similar from the database,
// so it may be used for cleanup purposes. // so it may be used for cleanup purposes.
this._debugLimit = -1; this._debugLimit = -1;
this._expire(ACTION.DEBUG, LIMIT.DEBUG).catch(Cu.reportError); this._expire(ACTION.DEBUG, LIMIT.DEBUG).catch(console.error);
} }
} else if (aTopic == TOPIC_IDLE_BEGIN) { } else if (aTopic == TOPIC_IDLE_BEGIN) {
// Stop the expiration timer. We don't want to keep up expiring on idle // Stop the expiration timer. We don't want to keep up expiring on idle
@@ -544,7 +544,7 @@ nsPlacesExpiration.prototype = {
this._timer = null; this._timer = null;
} }
if (this.expireOnIdle) { if (this.expireOnIdle) {
this._expire(ACTION.IDLE_DIRTY, LIMIT.LARGE).catch(Cu.reportError); this._expire(ACTION.IDLE_DIRTY, LIMIT.LARGE).catch(console.error);
} }
} else if (aTopic == TOPIC_IDLE_END) { } else if (aTopic == TOPIC_IDLE_END) {
// Restart the expiration timer. // Restart the expiration timer.
@@ -552,7 +552,7 @@ nsPlacesExpiration.prototype = {
this._newTimer(); this._newTimer();
} }
} else if (aTopic == TOPIC_IDLE_DAILY) { } else if (aTopic == TOPIC_IDLE_DAILY) {
this._expire(ACTION.IDLE_DAILY, LIMIT.LARGE).catch(Cu.reportError); this._expire(ACTION.IDLE_DAILY, LIMIT.LARGE).catch(console.error);
} else if (aTopic == TOPIC_TESTING_MODE) { } else if (aTopic == TOPIC_TESTING_MODE) {
this._testingMode = true; this._testingMode = true;
} else if (aTopic == lazy.PlacesUtils.TOPIC_INIT_COMPLETE) { } else if (aTopic == lazy.PlacesUtils.TOPIC_INIT_COMPLETE) {
@@ -582,7 +582,7 @@ nsPlacesExpiration.prototype = {
// Adapt expiration aggressivity to the number of pages over the limit. // Adapt expiration aggressivity to the number of pages over the limit.
let limit = let limit =
overLimitPages > OVERLIMIT_PAGES_THRESHOLD ? LIMIT.LARGE : LIMIT.SMALL; overLimitPages > OVERLIMIT_PAGES_THRESHOLD ? LIMIT.LARGE : LIMIT.SMALL;
this._expire(action, limit).catch(Cu.reportError); this._expire(action, limit).catch(console.error);
}, 300000); }, 300000);
}, },

View File

@@ -2152,7 +2152,7 @@ function setupDbForShutdown(conn, name) {
conn.close(); conn.close();
reject(ex); reject(ex);
} }
}).catch(Cu.reportError); }).catch(console.error);
// Make sure that Sqlite.sys.mjs doesn't close until we are done // Make sure that Sqlite.sys.mjs doesn't close until we are done
// with the high-level connection. // with the high-level connection.
@@ -2177,7 +2177,7 @@ XPCOMUtils.defineLazyGetter(lazy, "gAsyncDBConnPromised", () =>
setupDbForShutdown(conn, "PlacesUtils read-only connection"); setupDbForShutdown(conn, "PlacesUtils read-only connection");
return conn; return conn;
}) })
.catch(Cu.reportError) .catch(console.error)
); );
XPCOMUtils.defineLazyGetter(lazy, "gAsyncDBWrapperPromised", () => XPCOMUtils.defineLazyGetter(lazy, "gAsyncDBWrapperPromised", () =>
@@ -2188,7 +2188,7 @@ XPCOMUtils.defineLazyGetter(lazy, "gAsyncDBWrapperPromised", () =>
setupDbForShutdown(conn, "PlacesUtils wrapped connection"); setupDbForShutdown(conn, "PlacesUtils wrapped connection");
return conn; return conn;
}) })
.catch(Cu.reportError) .catch(console.error)
); );
var gAsyncDBLargeCacheConnDeferred = PromiseUtils.defer(); var gAsyncDBLargeCacheConnDeferred = PromiseUtils.defer();
@@ -2225,7 +2225,7 @@ XPCOMUtils.defineLazyGetter(lazy, "gAsyncDBLargeCacheConnPromised", () =>
gAsyncDBLargeCacheConnDeferred.resolve(conn); gAsyncDBLargeCacheConnDeferred.resolve(conn);
return conn; return conn;
}) })
.catch(Cu.reportError) .catch(console.error)
); );
/** /**

View File

@@ -550,7 +550,7 @@ TagAutoCompleteSearch.prototype = {
this._search.cancel(); this._search.cancel();
} }
this._search = new TagSearch(searchString, this, listener); this._search = new TagSearch(searchString, this, listener);
this._search.start().catch(Cu.reportError); this._search.start().catch(console.error);
}, },
/** /**

View File

@@ -84,9 +84,7 @@ function cancelDeferredTasks() {
document.addEventListener( document.addEventListener(
"DOMContentLoaded", "DOMContentLoaded",
e => { e => {
window._initialized = PrintEventHandler.init().catch(e => window._initialized = PrintEventHandler.init().catch(e => console.error(e));
Cu.reportError(e)
);
ourBrowser.setAttribute("flex", "0"); ourBrowser.setAttribute("flex", "0");
ourBrowser.setAttribute("selectmenuconstrained", "false"); ourBrowser.setAttribute("selectmenuconstrained", "false");
ourBrowser.classList.add("printSettingsBrowser"); ourBrowser.classList.add("printSettingsBrowser");
@@ -427,7 +425,7 @@ var PrintEventHandler = {
let bc = this.printPreviewEl.currentBrowsingContext; let bc = this.printPreviewEl.currentBrowsingContext;
await this._doPrint(bc, settings); await this._doPrint(bc, settings);
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
if (settings.printerName == PrintUtils.SAVE_TO_PDF_PRINTER) { if (settings.printerName == PrintUtils.SAVE_TO_PDF_PRINTER) {
@@ -862,7 +860,7 @@ var PrintEventHandler = {
})); }));
} catch (e) { } catch (e) {
this.reportPrintingError("PRINT_PREVIEW"); this.reportPrintingError("PRINT_PREVIEW");
Cu.reportError(e); console.error(e);
throw e; throw e;
} }

View File

@@ -78,7 +78,7 @@ var PrintUtils = {
// Need the await for the try to trigger... // Need the await for the try to trigger...
return await sourceActor.sendQuery("PrintingSelection:HasSelection", {}); return await sourceActor.sendQuery("PrintingSelection:HasSelection", {});
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
return false; return false;
}, },
@@ -203,7 +203,7 @@ var PrintUtils = {
args args
); );
closedPromise.catch(e => { closedPromise.catch(e => {
Cu.reportError(e); console.error(e);
}); });
let settingsBrowser = dialog._frame; let settingsBrowser = dialog._frame;
@@ -549,7 +549,7 @@ var PrintUtils = {
); );
} }
} catch (e) { } catch (e) {
Cu.reportError("PrintUtils.getPrintSettings failed: " + e + "\n"); console.error("PrintUtils.getPrintSettings failed: ", e, "\n");
} }
return printSettings; return printSettings;
}, },

View File

@@ -128,7 +128,7 @@ const AdjustableTitle = {
!DOMException.isInstance(ex) || !DOMException.isInstance(ex) ||
ex.name != "NoModificationAllowedError" ex.name != "NoModificationAllowedError"
) { ) {
Cu.reportError(ex); console.error(ex);
} }
return; return;
} }

View File

@@ -20,7 +20,7 @@ function onDCL() {
let promptType = propBag.getProperty("promptType"); let promptType = propBag.getProperty("promptType");
if (promptType != "select") { if (promptType != "select") {
Cu.reportError("selectDialog opened for unknown type: " + promptType); console.error("selectDialog opened for unknown type: ", promptType);
window.close(); window.close();
} }

View File

@@ -99,8 +99,9 @@ CommonDialog.prototype = {
this.ui.password1Label.setAttribute("value", ""); this.ui.password1Label.setAttribute("value", "");
break; break;
default: default:
Cu.reportError( console.error(
"commonDialog opened for unknown type: " + this.args.promptType "commonDialog opened for unknown type: ",
this.args.promptType
); );
throw new Error("unknown dialog type"); throw new Error("unknown dialog type");
} }
@@ -234,7 +235,7 @@ CommonDialog.prototype = {
.playEventSound(this.soundID); .playEventSound(this.soundID);
} }
} catch (e) { } catch (e) {
Cu.reportError("Couldn't play common dialog event sound: " + e); console.error("Couldn't play common dialog event sound: ", e);
} }
if (commonDialogEl) { if (commonDialogEl) {

View File

@@ -50,9 +50,7 @@ Prompter.prototype = {
].getService(Ci.nsIPromptFactory); ].getService(Ci.nsIPromptFactory);
return pwmgr.getPrompt(domWin, iid); return pwmgr.getPrompt(domWin, iid);
} catch (e) { } catch (e) {
Cu.reportError( console.error("nsPrompter: Delegation to password manager failed: ", e);
"nsPrompter: Delegation to password manager failed: " + e
);
} }
} }
@@ -997,7 +995,7 @@ class ModalPrompter {
) { ) {
// Only show this error if we're not about to fall back again and show a different one. // Only show this error if we're not about to fall back again and show a different one.
if (this.browsingContext?.associatedWindow?.gDialogBox) { if (this.browsingContext?.associatedWindow?.gDialogBox) {
Cu.reportError( console.error(
"Prompter: Browser not available. Falling back to internal window prompt." "Prompter: Browser not available. Falling back to internal window prompt."
); );
} }
@@ -1009,7 +1007,7 @@ class ModalPrompter {
(this.browsingContext?.isContent || (this.browsingContext?.isContent ||
!this.browsingContext?.associatedWindow?.gDialogBox) !this.browsingContext?.associatedWindow?.gDialogBox)
) { ) {
Cu.reportError( console.error(
"Prompter: internal dialogs not available in this context. Falling back to window prompt." "Prompter: internal dialogs not available in this context. Falling back to window prompt."
); );
modalType = MODAL_TYPE_WINDOW; modalType = MODAL_TYPE_WINDOW;
@@ -1067,7 +1065,7 @@ class ModalPrompter {
// and thus not supported as tab or content prompts yet. See Bug 1622817. // and thus not supported as tab or content prompts yet. See Bug 1622817.
// Once they are integrated this override should be removed. // Once they are integrated this override should be removed.
if (args.promptType == "select" && this.modalType !== MODAL_TYPE_WINDOW) { if (args.promptType == "select" && this.modalType !== MODAL_TYPE_WINDOW) {
Cu.reportError( console.error(
"Prompter: 'select' prompts do not support tab/content prompting. Falling back to window prompt." "Prompter: 'select' prompts do not support tab/content prompting. Falling back to window prompt."
); );
args.modalType = MODAL_TYPE_WINDOW; args.modalType = MODAL_TYPE_WINDOW;

View File

@@ -79,7 +79,7 @@ var AboutReader = function(
if (Services.prefs.getBoolPref("reader.errors.includeURLs")) { if (Services.prefs.getBoolPref("reader.errors.includeURLs")) {
errorMsg += " Tried to load: " + url + "."; errorMsg += " Tried to load: " + url + ".";
} }
Cu.reportError(errorMsg); console.error(errorMsg);
win.location.href = "about:blank"; win.location.href = "about:blank";
return; return;
} }

View File

@@ -143,7 +143,7 @@ var ReaderMode = {
win.document.nodePrincipal.originAttributes win.document.nodePrincipal.originAttributes
); );
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
return; return;
} }
let loadFlags = webNav.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL; let loadFlags = webNav.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
@@ -278,7 +278,7 @@ var ReaderMode = {
return null; return null;
} }
} catch (ex) { } catch (ex) {
Cu.reportError( console.error(
new Error(`Couldn't create URI from ${url} to download: ${ex}`) new Error(`Couldn't create URI from ${url} to download: ${ex}`)
); );
return null; return null;
@@ -422,7 +422,7 @@ var ReaderMode = {
options, options,
]); ]);
} catch (e) { } catch (e) {
Cu.reportError("Error in ReaderWorker: " + e); console.error("Error in ReaderWorker: ", e);
histogram.add(PARSE_ERROR_WORKER); histogram.add(PARSE_ERROR_WORKER);
} }

View File

@@ -170,7 +170,7 @@ class RemoteWebNavigation {
try { try {
this._browser.sendMessageToActor(aMessage, aData, "WebNavigation"); this._browser.sendMessageToActor(aMessage, aData, "WebNavigation");
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
} }
} }

View File

@@ -35,7 +35,7 @@ class MessageListener {
try { try {
listener(message); listener(message);
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
} }
} }
@@ -179,7 +179,7 @@ class MessagePort {
let deferred = this.requests[messagedata.requestID]; let deferred = this.requests[messagedata.requestID];
if (!deferred) { if (!deferred) {
Cu.reportError("Received a response to an unknown request."); console.error("Received a response to an unknown request.");
return; return;
} }

View File

@@ -112,7 +112,7 @@ class RemotePages {
// Unless the port is in the process of unloading, something strange // Unless the port is in the process of unloading, something strange
// happened but allow other ports to receive the message // happened but allow other ports to receive the message
if (e.result !== Cr.NS_ERROR_NOT_INITIALIZED) { if (e.result !== Cr.NS_ERROR_NOT_INITIALIZED) {
Cu.reportError(e); console.error(e);
} }
} }
} }
@@ -324,7 +324,7 @@ var RemotePageManagerInternal = {
initPort({ target: browser, data: { url, portID } }) { initPort({ target: browser, data: { url, portID } }) {
let callback = this.pages.get(url); let callback = this.pages.get(url);
if (!callback) { if (!callback) {
Cu.reportError("Unexpected remote page load: " + url); console.error("Unexpected remote page load: ", url);
return; return;
} }

View File

@@ -334,7 +334,7 @@ class _RFPHelper {
_parseLetterboxingDimensions(aPrefValue) { _parseLetterboxingDimensions(aPrefValue) {
if (!aPrefValue || !aPrefValue.match(/^(?:\d+x\d+,\s*)*(?:\d+x\d+)$/)) { if (!aPrefValue || !aPrefValue.match(/^(?:\d+x\d+,\s*)*(?:\d+x\d+)$/)) {
if (aPrefValue) { if (aPrefValue) {
Cu.reportError( console.error(
`Invalid pref value for ${kPrefLetterboxingDimensions}: ${aPrefValue}` `Invalid pref value for ${kPrefLetterboxingDimensions}: ${aPrefValue}`
); );
} }

View File

@@ -22,7 +22,7 @@ FormHistoryStartup.prototype = {
switch (topic) { switch (topic) {
case "idle-daily": case "idle-daily":
case "formhistory-expire-now": case "formhistory-expire-now":
lazy.FormHistory.expireOldEntries().catch(Cu.reportError); lazy.FormHistory.expireOldEntries().catch(console.error);
break; break;
case "profile-after-change": case "profile-after-change":
this.init(); this.init();

View File

@@ -121,7 +121,7 @@ export var TelemetryScheduler = {
if (this._log) { if (this._log) {
this._log.error("shutdown - Already shut down"); this._log.error("shutdown - Already shut down");
} else { } else {
Cu.reportError("TelemetryScheduler.shutdown - Already shut down"); console.error("TelemetryScheduler.shutdown - Already shut down");
} }
return; return;
} }

View File

@@ -395,9 +395,7 @@ const BackgroundPageThumbs = {
return; return;
} }
Cu.reportError( console.error("BackgroundThumbnails remote process crashed - recovering");
"BackgroundThumbnails remote process crashed - recovering"
);
this._destroyBrowser(); this._destroyBrowser();
let curCapture = this._captureQueue.length ? this._captureQueue[0] : null; let curCapture = this._captureQueue.length ? this._captureQueue[0] : null;
// we could retry the pending capture, but it's possible the crash // we could retry the pending capture, but it's possible the crash
@@ -730,7 +728,7 @@ Capture.prototype = {
try { try {
callback.call(options, this.url, reason, info); callback.call(options, this.url, reason, info);
} catch (err) { } catch (err) {
Cu.reportError(err); console.error(err);
} }
} }

View File

@@ -118,7 +118,7 @@ var PageThumbUtils = {
utils.getScrollbarSize(false, sbWidth, sbHeight); utils.getScrollbarSize(false, sbWidth, sbHeight);
} catch (e) { } catch (e) {
// This might fail if the window does not have a presShell. // This might fail if the window does not have a presShell.
Cu.reportError("Unable to get scrollbar size in determineCropSize."); console.error("Unable to get scrollbar size in determineCropSize.");
sbWidth.value = sbHeight.value = 0; sbWidth.value = sbHeight.value = 0;
} }
@@ -313,7 +313,7 @@ var PageThumbUtils = {
utils.getScrollbarSize(false, sbWidth, sbHeight); utils.getScrollbarSize(false, sbWidth, sbHeight);
} catch (e) { } catch (e) {
// This might fail if the window does not have a presShell. // This might fail if the window does not have a presShell.
Cu.reportError("Unable to get scrollbar size in determineCropSize."); console.error("Unable to get scrollbar size in determineCropSize.");
sbWidth.value = sbHeight.value = 0; sbWidth.value = sbHeight.value = 0;
} }

View File

@@ -205,7 +205,7 @@ var PageThumbs = {
resolve(blob, this.contentType); resolve(blob, this.contentType);
}); });
}) })
.catch(e => Cu.reportError(e)); .catch(e => console.error(e));
}); });
}, },
@@ -435,7 +435,7 @@ var PageThumbs = {
let buffer = await TaskUtils.readBlob(blob); let buffer = await TaskUtils.readBlob(blob);
await this._store(originalURL, url, buffer, channelError); await this._store(originalURL, url, buffer, channelError);
} catch (ex) { } catch (ex) {
Cu.reportError("Exception thrown during thumbnail capture: '" + ex + "'"); console.error("Exception thrown during thumbnail capture: '", ex, "'");
} }
}, },
@@ -571,7 +571,7 @@ var PageThumbsStorage = {
lazy.PageThumbsStorageService.path, lazy.PageThumbsStorageService.path,
{ ignoreExisting: true }, { ignoreExisting: true },
]).catch(function onError(aReason) { ]).catch(function onError(aReason) {
Cu.reportError("Could not create thumbnails directory" + aReason); console.error("Could not create thumbnails directory", aReason);
}); });
}, },

View File

@@ -385,7 +385,7 @@ var SafeBrowsing = {
default: default:
let err = let err =
"SafeBrowsing getReportURL() called with unknown kind: " + kind; "SafeBrowsing getReportURL() called with unknown kind: " + kind;
Cu.reportError(err); console.error(err);
throw err; throw err;
} }

View File

@@ -147,7 +147,7 @@ nsURLFormatterService.prototype = {
if (aKey in _this._defaults) { if (aKey in _this._defaults) {
return _this._defaults[aKey].call(_this); return _this._defaults[aKey].call(_this);
} }
Cu.reportError("formatURL: Couldn't find value for key: " + aKey); console.error("formatURL: Couldn't find value for key: ", aKey);
return aMatch; return aMatch;
}; };
return aFormat.replace(/%([A-Z_]+)%/g, replacementCallback); return aFormat.replace(/%([A-Z_]+)%/g, replacementCallback);
@@ -159,7 +159,7 @@ nsURLFormatterService.prototype = {
try { try {
format = Services.prefs.getStringPref(aPref); format = Services.prefs.getStringPref(aPref);
} catch (ex) { } catch (ex) {
Cu.reportError("formatURLPref: Couldn't get pref: " + aPref); console.error("formatURLPref: Couldn't get pref: ", aPref);
return "about:blank"; return "about:blank";
} }

View File

@@ -80,7 +80,7 @@ class ClientEnvironmentBase {
try { try {
target.main = lazy.TelemetryController.getCurrentPingData(); target.main = lazy.TelemetryController.getCurrentPingData();
} catch (err) { } catch (err) {
Cu.reportError(err); console.error(err);
} }
return new Proxy(target, { return new Proxy(target, {

View File

@@ -42,7 +42,7 @@ var WindowsVersionInfo = {
if (throwOnError) { if (throwOnError) {
throw err; throw err;
} }
Cu.reportError(err); console.error(err);
return WindowsVersionInfo.UNKNOWN_VERSION_INFO; return WindowsVersionInfo.UNKNOWN_VERSION_INFO;
} }

View File

@@ -297,7 +297,7 @@ var gViewSourceUtils = {
} }
} catch (ex) { } catch (ex) {
// we failed loading it with the external editor. // we failed loading it with the external editor.
Cu.reportError(ex); console.error(ex);
reject(data); reject(data);
} }
}); });
@@ -317,7 +317,7 @@ var gViewSourceUtils = {
return editor; return editor;
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
return null; return null;
@@ -373,7 +373,7 @@ var gViewSourceUtils = {
this.resolve(this.data); this.resolve(this.data);
} catch (ex) { } catch (ex) {
// we failed loading it with the external editor. // we failed loading it with the external editor.
Cu.reportError(ex); console.error(ex);
this.reject(this.data); this.reject(this.data);
} finally { } finally {
this.destroy(); this.destroy();

View File

@@ -38,8 +38,11 @@ window.addEventListener("load", function onload(event) {
try { try {
await snapshotFormatters[prop](snapshot[prop]); await snapshotFormatters[prop](snapshot[prop]);
} catch (e) { } catch (e) {
Cu.reportError( console.error(
"stack of snapshot error for about:support: " + e + ": " + e.stack "stack of snapshot error for about:support: ",
e,
": ",
e.stack
); );
} }
} }
@@ -55,9 +58,7 @@ window.addEventListener("load", function onload(event) {
$("update-history-row").hidden = true; $("update-history-row").hidden = true;
} }
} catch (e) { } catch (e) {
Cu.reportError( console.error("stack of load error for about:support: ", e, ": ", e.stack);
"stack of load error for about:support: " + e + ": " + e.stack
);
} }
}); });

View File

@@ -342,7 +342,7 @@ function internalSave(
continueSave(); continueSave();
}) })
.catch(Cu.reportError); .catch(console.error);
} }
function continueSave() { function continueSave() {
@@ -835,7 +835,7 @@ function DownloadURL(aURL, aFileName, aInitiatingDocument) {
// Add the download to the list, allowing it to be managed. // Add the download to the list, allowing it to be managed.
let list = await Downloads.getList(Downloads.ALL); let list = await Downloads.getList(Downloads.ALL);
list.add(download); list.add(download);
})().catch(Cu.reportError); })().catch(console.error);
} }
// We have no DOM, and can only save the URL as is. // We have no DOM, and can only save the URL as is.

View File

@@ -113,9 +113,7 @@ function goUpdateCommand(aCommand) {
goSetCommandEnabled(aCommand, enabled); goSetCommandEnabled(aCommand, enabled);
} catch (e) { } catch (e) {
Cu.reportError( console.error("An error occurred updating the ", aCommand, " command: ", e);
"An error occurred updating the " + aCommand + " command: " + e
);
} }
} }
@@ -128,8 +126,11 @@ function goDoCommand(aCommand) {
controller.doCommand(aCommand); controller.doCommand(aCommand);
} }
} catch (e) { } catch (e) {
Cu.reportError( console.error(
"An error occurred executing the " + aCommand + " command: " + e "An error occurred executing the ",
aCommand,
" command: ",
e
); );
} }
} }

View File

@@ -240,7 +240,7 @@ const Preferences = (window.Preferences = (function() {
}); });
return aTarget.dispatchEvent(event); return aTarget.dispatchEvent(event);
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
return false; return false;
}, },
@@ -441,7 +441,7 @@ const Preferences = (window.Preferences = (function() {
return rv; return rv;
} }
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
} }

View File

@@ -45,7 +45,7 @@ function dropOnRemoteBrowserAsync(browser, data, shouldExpectStateChange) {
} catch (ex) { } catch (ex) {
if (shouldExpectStateChange) { if (shouldExpectStateChange) {
ok(false, "Should not have gotten an exception from the dropped link handler, but got: " + ex); ok(false, "Should not have gotten an exception from the dropped link handler, but got: " + ex);
Cu.reportError(ex); console.error(ex);
} }
} }

View File

@@ -1030,12 +1030,12 @@
this.docShell.browsingContext.useGlobalHistory = true; this.docShell.browsingContext.useGlobalHistory = true;
} catch (ex) { } catch (ex) {
// This can occur if the Places database is locked // This can occur if the Places database is locked
Cu.reportError("Error enabling browser global history: " + ex); console.error("Error enabling browser global history: ", ex);
} }
} }
} }
} catch (e) { } catch (e) {
Cu.reportError(e); console.error(e);
} }
try { try {
// Ensures the securityUI is initialized. // Ensures the securityUI is initialized.

View File

@@ -286,7 +286,7 @@
} }
let key = document.getElementById(keyId); let key = document.getElementById(keyId);
if (!key) { if (!key) {
Cu.reportError( console.error(
`Key ${keyId} of menuitem ${this.getAttribute("label")} ` + `Key ${keyId} of menuitem ${this.getAttribute("label")} ` +
`could not be found` `could not be found`
); );

View File

@@ -336,7 +336,7 @@
uri.scheme + uri.scheme +
": link using \ ": link using \
the text-link binding."; the text-link binding.";
Cu.reportError(msg); console.error(msg);
return; return;
} }
@@ -352,7 +352,7 @@
return; return;
} }
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
aEvent.preventDefault(); aEvent.preventDefault();

View File

@@ -164,7 +164,7 @@ Submitter.prototype = {
}) })
); );
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
this.notifyStatus(SUCCESS, ret); this.notifyStatus(SUCCESS, ret);
@@ -542,7 +542,7 @@ var CrashSubmit = {
try { try {
dirIter = new lazy.OS.File.DirectoryIterator(pendingDir); dirIter = new lazy.OS.File.DirectoryIterator(pendingDir);
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
throw ex; throw ex;
} }
@@ -588,7 +588,7 @@ var CrashSubmit = {
} }
} }
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
throw ex; throw ex;
} finally { } finally {
dirIter.close(); dirIter.close();
@@ -636,7 +636,7 @@ var CrashSubmit = {
} }
}); });
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
throw ex; throw ex;
} finally { } finally {
dirIter.close(); dirIter.close();

View File

@@ -20,17 +20,17 @@ document.addEventListener("DOMContentLoaded", () => {
document document
.getElementById("clearUnsubmittedReports") .getElementById("clearUnsubmittedReports")
.addEventListener("click", () => { .addEventListener("click", () => {
clearUnsubmittedReports().catch(Cu.reportError); clearUnsubmittedReports().catch(console.error);
}); });
document document
.getElementById("submitAllUnsubmittedReports") .getElementById("submitAllUnsubmittedReports")
.addEventListener("click", () => { .addEventListener("click", () => {
submitAllUnsubmittedReports().catch(Cu.reportError); submitAllUnsubmittedReports().catch(console.error);
}); });
document document
.getElementById("clearSubmittedReports") .getElementById("clearSubmittedReports")
.addEventListener("click", () => { .addEventListener("click", () => {
clearSubmittedReports().catch(Cu.reportError); clearSubmittedReports().catch(console.error);
}); });
}); });

View File

@@ -147,7 +147,7 @@ export var AppMenuNotifications = {
try { try {
action.callback(win, fromDoorhanger); action.callback(win, fromDoorhanger);
} catch (error) { } catch (error) {
Cu.reportError(error); console.error(error);
} }
dismiss = action.dismiss; dismiss = action.dismiss;

View File

@@ -148,7 +148,7 @@ export class AsyncPrefsParent extends JSProcessActorParent {
try { try {
Services.prefs[methodToUse](pref, value); Services.prefs[methodToUse](pref, value);
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
return Promise.reject(ex.message); return Promise.reject(ex.message);
} }
@@ -164,7 +164,7 @@ export class AsyncPrefsParent extends JSProcessActorParent {
try { try {
Services.prefs.clearUserPref(pref); Services.prefs.clearUserPref(pref);
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
return Promise.reject(ex.message); return Promise.reject(ex.message);
} }

View File

@@ -183,9 +183,7 @@ export var BrowserUtils = {
} }
// otherwise, fall through... // otherwise, fall through...
} catch (ex) { } catch (ex) {
Cu.reportError( console.error("Invalid blob URI passed to formatURIForDisplay: ", ex);
"Invalid blob URI passed to formatURIForDisplay: " + ex
);
} }
/* For blob URIs without an origin, fall through and use the data URI /* For blob URIs without an origin, fall through and use the data URI
* logic (shows just "(data)", localized). */ * logic (shows just "(data)", localized). */
@@ -217,7 +215,7 @@ export var BrowserUtils = {
} }
} }
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
} }
return uri.asciiHost || uri.spec; return uri.asciiHost || uri.spec;

View File

@@ -72,7 +72,7 @@ function validateCert(aCertificate, aCerts) {
if (!aCertificate) { if (!aCertificate) {
const missingCertErr = "A required certificate was not present."; const missingCertErr = "A required certificate was not present.";
Cu.reportError(missingCertErr); console.error(missingCertErr);
throw new Ce(missingCertErr, Cr.NS_ERROR_ILLEGAL_VALUE); throw new Ce(missingCertErr, Cr.NS_ERROR_ILLEGAL_VALUE);
} }
@@ -113,7 +113,7 @@ function validateCert(aCertificate, aCerts) {
errors.forEach(Cu.reportError.bind(Cu)); errors.forEach(Cu.reportError.bind(Cu));
const certCheckErr = const certCheckErr =
"Certificate checks failed. See previous errors for details."; "Certificate checks failed. See previous errors for details.";
Cu.reportError(certCheckErr); console.error(certCheckErr);
throw new Ce(certCheckErr, Cr.NS_ERROR_ILLEGAL_VALUE); throw new Ce(certCheckErr, Cr.NS_ERROR_ILLEGAL_VALUE);
} }
} }

View File

@@ -563,7 +563,7 @@ function sendConsoleAPIMessage(aConsole, aLevel, aFrame, aArgs, aOptions = {}) {
try { try {
consoleEvent.groupName = Array.prototype.join.call(aArgs, " "); consoleEvent.groupName = Array.prototype.join.call(aArgs, " ");
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
Cu.reportError(ex.stack); Cu.reportError(ex.stack);
return; return;
} }

View File

@@ -334,7 +334,7 @@ DeferredTask.prototype = {
// Indicate that the execution of the task has finished. This happens // Indicate that the execution of the task has finished. This happens
// synchronously with the previous state changes in the function. // synchronously with the previous state changes in the function.
this._runningPromise = null; this._runningPromise = null;
})().catch(Cu.reportError) })().catch(console.error)
); );
}, },
@@ -346,7 +346,7 @@ DeferredTask.prototype = {
try { try {
await this._taskFn(); await this._taskFn();
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} finally { } finally {
ChromeUtils.addProfilerMarker( ChromeUtils.addProfilerMarker(
"DeferredTask", "DeferredTask",

View File

@@ -459,7 +459,7 @@ Finder.prototype = {
return; return;
} }
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
} }

View File

@@ -412,7 +412,7 @@ FinderHighlighter.prototype = {
try { try {
window = this.getTopWindow(window); window = this.getTopWindow(window);
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
return; return;
} }
let dict = this.getForWindow(window); let dict = this.getForWindow(window);

View File

@@ -179,7 +179,7 @@ export class FinderIterator {
!this._areParamsEqual(this._currentParams, iterParams, allowDistance) !this._areParamsEqual(this._currentParams, iterParams, allowDistance)
) { ) {
if (kDebug) { if (kDebug) {
Cu.reportError( console.error(
`We're currently iterating over '${this._currentParams.word}', not '${word}'\n` + `We're currently iterating over '${this._currentParams.word}', not '${word}'\n` +
new Error().stack new Error().stack
); );
@@ -363,7 +363,7 @@ export class FinderIterator {
try { try {
listener[callback](params); listener[callback](params);
} catch (ex) { } catch (ex) {
Cu.reportError("FinderIterator Error: " + ex); console.error("FinderIterator Error: ", ex);
} }
} }
} }

View File

@@ -87,11 +87,11 @@ FinderParent.prototype = {
l[aCallback].apply(l, aArgs); l[aCallback].apply(l, aArgs);
} catch (e) { } catch (e) {
if (!l[aCallback]) { if (!l[aCallback]) {
Cu.reportError( console.error(
`Missing ${aCallback} callback on RemoteFinderListener` `Missing ${aCallback} callback on RemoteFinderListener`
); );
} else { } else {
Cu.reportError(e); console.error(e);
} }
} }
} }
@@ -565,7 +565,7 @@ FinderParent.prototype = {
return; return;
} }
} catch (ex) { } catch (ex) {
Cu.reportError(ex); console.error(ex);
} }
} }

View File

@@ -84,7 +84,7 @@ class IgnoreListsManager {
} }
// Don't throw an error just log it, just continue with no data, and hopefully // Don't throw an error just log it, just continue with no data, and hopefully
// a sync will fix things later on. // a sync will fix things later on.
Cu.reportError(ex); console.error(ex);
} }
return result; return result;
} }

Some files were not shown because too many files have changed in this diff Show More