diff --git a/.eslintrc.js b/.eslintrc.js index 95a83a49ef9f..72e1ccbc42b1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -210,7 +210,8 @@ module.exports = { files: [ "dom/push/test/mockpushserviceparent.js", "browser/components/extensions/**", - "toolkit/**", + "toolkit/components/extensions/**", + "toolkit/mozapps/extensions/**", ], rules: { "mozilla/no-cu-reportError": "off", diff --git a/toolkit/actors/AutoCompleteChild.jsm b/toolkit/actors/AutoCompleteChild.jsm index de3023b6a90c..3c0ea952987a 100644 --- a/toolkit/actors/AutoCompleteChild.jsm +++ b/toolkit/actors/AutoCompleteChild.jsm @@ -84,7 +84,7 @@ class AutoCompleteChild extends JSWindowActorChild { try { listener.popupStateChanged(messageName, data, this.contentWindow); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } } diff --git a/toolkit/actors/AutoCompleteParent.jsm b/toolkit/actors/AutoCompleteParent.jsm index 910f74719fcd..577cc3cd3571 100644 --- a/toolkit/actors/AutoCompleteParent.jsm +++ b/toolkit/actors/AutoCompleteParent.jsm @@ -488,7 +488,7 @@ class AutoCompleteParent extends JSWindowActorParent { try { listener(window); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } } diff --git a/toolkit/actors/PrintingChild.jsm b/toolkit/actors/PrintingChild.jsm index f85a8303ade7..93b7d7787e85 100644 --- a/toolkit/actors/PrintingChild.jsm +++ b/toolkit/actors/PrintingChild.jsm @@ -93,7 +93,7 @@ class PrintingChild extends JSWindowActorChild { try { article = await lazy.ReaderMode.parseDocument(contentWindow.document); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } await new Promise(resolve => { diff --git a/toolkit/actors/RemotePageChild.jsm b/toolkit/actors/RemotePageChild.jsm index cd4fbaad2751..dfbc1b62ebd3 100644 --- a/toolkit/actors/RemotePageChild.jsm +++ b/toolkit/actors/RemotePageChild.jsm @@ -109,7 +109,7 @@ class RemotePageChild extends JSWindowActorChild { try { listener(clonedMessage); } catch (e) { - Cu.reportError(e); + console.error(e); } } } diff --git a/toolkit/actors/UAWidgetsChild.jsm b/toolkit/actors/UAWidgetsChild.jsm index a015e2456b26..ec6cc2d8a8be 100644 --- a/toolkit/actors/UAWidgetsChild.jsm +++ b/toolkit/actors/UAWidgetsChild.jsm @@ -56,7 +56,7 @@ class UAWidgetsChild extends JSWindowActorChild { this.unwrap(aElement.openOrClosedShadowRoot) != this.unwrap(widget.shadowRoot) ) { - Cu.reportError( + console.error( "Getting a UAWidgetSetupOrChange event without the ShadowRoot. " + "Torn down already?" ); @@ -65,7 +65,7 @@ class UAWidgetsChild extends JSWindowActorChild { try { widget.onchange(); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } } @@ -109,7 +109,7 @@ class UAWidgetsChild extends JSWindowActorChild { } if (!uri || !widgetName) { - Cu.reportError( + console.error( "Getting a UAWidgetSetupOrChange event on undefined element." ); return; @@ -117,7 +117,7 @@ class UAWidgetsChild extends JSWindowActorChild { let shadowRoot = aElement.openOrClosedShadowRoot; if (!shadowRoot) { - Cu.reportError( + console.error( "Getting a UAWidgetSetupOrChange event without the Shadow Root. " + "Torn down already?" ); @@ -143,13 +143,13 @@ class UAWidgetsChild extends JSWindowActorChild { widget = widget.wrappedJSObject; } 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 }); try { widget.onsetup(); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } @@ -162,7 +162,7 @@ class UAWidgetsChild extends JSWindowActorChild { try { widget.teardown(); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } this.widgets.delete(aElement); @@ -228,7 +228,7 @@ class UAWidgetsChild extends JSWindowActorChild { try { widget.onPrefChange(prefKey, newValue); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } } diff --git a/toolkit/actors/WebChannelChild.sys.mjs b/toolkit/actors/WebChannelChild.sys.mjs index 62ff0e945f94..563f2566a0df 100644 --- a/toolkit/actors/WebChannelChild.sys.mjs +++ b/toolkit/actors/WebChannelChild.sys.mjs @@ -65,7 +65,7 @@ export class WebChannelChild extends JSWindowActorChild { whitelisted => principal.originNoSuffix == whitelisted.originNoSuffix ); if (!objectsAllowed) { - Cu.reportError( + console.error( "WebChannelMessageToChrome sent with an object from a non-whitelisted principal" ); return; @@ -82,7 +82,7 @@ export class WebChannelChild extends JSWindowActorChild { principal, }); } 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); } if (!eventTarget) { - Cu.reportError("WebChannel message failed. No target."); + console.error("WebChannel message failed. No target."); return; } @@ -123,10 +123,10 @@ export class WebChannelChild extends JSWindowActorChild { }) ); } else { - Cu.reportError("WebChannel message failed. Principal mismatch."); + console.error("WebChannel message failed. Principal mismatch."); } } else { - Cu.reportError("WebChannel message failed. No message data."); + console.error("WebChannel message failed. No message data."); } } } diff --git a/toolkit/actors/WebChannelParent.sys.mjs b/toolkit/actors/WebChannelParent.sys.mjs index 872ad5dde36a..98b3ad093a31 100644 --- a/toolkit/actors/WebChannelParent.sys.mjs +++ b/toolkit/actors/WebChannelParent.sys.mjs @@ -22,7 +22,7 @@ export class WebChannelParent extends JSWindowActorParent { try { data = JSON.parse(data); } 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; } } @@ -52,7 +52,7 @@ export class WebChannelParent extends JSWindowActorParent { } } } else { - Cu.reportError("WebChannel channel id missing"); + console.error("WebChannel channel id missing"); } } @@ -85,8 +85,8 @@ export class WebChannelParent extends JSWindowActorParent { principal, }); } 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); } } diff --git a/toolkit/components/DefaultCLH.jsm b/toolkit/components/DefaultCLH.jsm index d4b104b1b960..69e62b381245 100644 --- a/toolkit/components/DefaultCLH.jsm +++ b/toolkit/components/DefaultCLH.jsm @@ -45,7 +45,7 @@ nsDefaultCLH.prototype = { } dump(out + "\n"); - Cu.reportError(out); + console.error(out); } var printDirList; @@ -65,7 +65,7 @@ nsDefaultCLH.prototype = { } dump(out + "\n"); - Cu.reportError(out); + console.error(out); } if (cmdLine.handleFlag("silent", false)) { diff --git a/toolkit/components/aboutthirdparty/content/aboutThirdParty.js b/toolkit/components/aboutthirdparty/content/aboutThirdParty.js index eb166edf6887..08e50a2fff27 100644 --- a/toolkit/components/aboutthirdparty/content/aboutThirdParty.js +++ b/toolkit/components/aboutthirdparty/content/aboutThirdParty.js @@ -65,7 +65,7 @@ async function fetchData() { !(e instanceof Components.Exception) || 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); updatedBlocklist = true; } catch (ex) { - Cu.reportError("Failed to update the blocklist file - " + ex.result); + console.error("Failed to update the blocklist file - ", ex.result); } finally { processingBlockRequest = false; } @@ -582,7 +582,7 @@ async function collectCrashInfo() { try { return BigInt(maybeBigInt); } catch (e) { - Cu.reportError(e); + console.error(e); } return NaN; }; @@ -626,7 +626,7 @@ async function onLoad() { e.target.disabled = true; const data = await fetchData(); - await copyDataToClipboard(data || []).catch(Cu.reportError); + await copyDataToClipboard(data || []).catch(console.error); e.target.disabled = false; }); @@ -665,7 +665,7 @@ async function onLoad() { // we show the reload button to call visualizeData again. button.hidden = false; }) - .catch(Cu.reportError); + .catch(console.error); const data = await fetchData(); // Used for testing purposes @@ -688,5 +688,5 @@ try { } catch (ex) { // Do nothing if we fail to create a singleton instance, // showing the default no-module message. - Cu.reportError(ex); + console.error(ex); } diff --git a/toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.js b/toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.js index 4aef3d0dd73c..0896ae766926 100644 --- a/toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.js +++ b/toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.js @@ -66,5 +66,5 @@ try { } catch (ex) { // Do nothing if we fail to create a singleton instance, // showing the default no-module message. - Cu.reportError(ex); + console.error(ex); } diff --git a/toolkit/components/antitracking/PartitioningExceptionListService.jsm b/toolkit/components/antitracking/PartitioningExceptionListService.jsm index 99e88e810e7f..b024524ba6d3 100644 --- a/toolkit/components/antitracking/PartitioningExceptionListService.jsm +++ b/toolkit/components/antitracking/PartitioningExceptionListService.jsm @@ -40,7 +40,7 @@ class Feature { observe(subject, topic, data) { if (topic != "nsPref:changed" || data != this.prefName) { - Cu.reportError(`Unexpected event ${topic} with ${data}`); + console.error(`Unexpected event ${topic} with ${data}`); return; } diff --git a/toolkit/components/antitracking/TrackingDBService.jsm b/toolkit/components/antitracking/TrackingDBService.jsm index 320791ee3704..ff2fa5fb267c 100644 --- a/toolkit/components/antitracking/TrackingDBService.jsm +++ b/toolkit/components/antitracking/TrackingDBService.jsm @@ -290,7 +290,7 @@ TrackingDBService.prototype = { } }); } 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. diff --git a/toolkit/components/antitracking/URLQueryStrippingListService.jsm b/toolkit/components/antitracking/URLQueryStrippingListService.jsm index c8682f3121f0..108900caba31 100644 --- a/toolkit/components/antitracking/URLQueryStrippingListService.jsm +++ b/toolkit/components/antitracking/URLQueryStrippingListService.jsm @@ -130,7 +130,7 @@ class URLQueryStrippingListService { break; default: - Cu.reportError(`Unexpected pref name ${pref}`); + console.error(`Unexpected pref name ${pref}`); return; } @@ -224,7 +224,7 @@ class URLQueryStrippingListService { this._onPrefUpdate(data, prefValue); break; default: - Cu.reportError(`Unexpected event ${topic}`); + console.error(`Unexpected event ${topic}`); } } diff --git a/toolkit/components/cleardata/ClearDataService.sys.mjs b/toolkit/components/cleardata/ClearDataService.sys.mjs index b77687268ae2..5f0e535f4811 100644 --- a/toolkit/components/cleardata/ClearDataService.sys.mjs +++ b/toolkit/components/cleardata/ClearDataService.sys.mjs @@ -872,7 +872,7 @@ const StorageAccessCleaner = { try { Services.perms.removePermission(perm); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } }); }, @@ -1174,7 +1174,7 @@ const ClientAuthRememberCleaner = { originSuffix ); } 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 // time. 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( c.cleaners.map(cleaner => { return aHelper(cleaner).catch(e => { - Cu.reportError(e); + console.error(e); resultFlags |= c.flag; }); }) diff --git a/toolkit/components/cleardata/PrincipalsCollector.sys.mjs b/toolkit/components/cleardata/PrincipalsCollector.sys.mjs index 6315c57ad73c..b3c82880ba73 100644 --- a/toolkit/components/cleardata/PrincipalsCollector.sys.mjs +++ b/toolkit/components/cleardata/PrincipalsCollector.sys.mjs @@ -112,7 +112,7 @@ export class PrincipalsCollector { resolve(principalsMap); }; }).catch(ex => { - Cu.reportError("QuotaManagerService promise failed: " + ex); + console.error("QuotaManagerService promise failed: ", ex); return []; }); diff --git a/toolkit/components/contentprefs/ContentPrefService2.jsm b/toolkit/components/contentprefs/ContentPrefService2.jsm index 753ebeca4bb4..8091261a46e9 100644 --- a/toolkit/components/contentprefs/ContentPrefService2.jsm +++ b/toolkit/components/contentprefs/ContentPrefService2.jsm @@ -914,10 +914,10 @@ ContentPrefService2.prototype = { try { callbacks.onError(e); } catch (e) { - Cu.reportError(e); + console.error(e); } } else { - Cu.reportError(e); + console.error(e); } } @@ -926,7 +926,7 @@ ContentPrefService2.prototype = { try { callbacks.onRow(row); } catch (e) { - Cu.reportError(e); + console.error(e); } } } @@ -940,7 +940,7 @@ ContentPrefService2.prototype = { rows && !!rows.length ); } catch (e) { - Cu.reportError(e); + console.error(e); } }, @@ -1034,7 +1034,7 @@ ContentPrefService2.prototype = { try { observer.onContentPrefRemoved(aGroup, aName, aIsPrivate); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } }, @@ -1052,7 +1052,7 @@ ContentPrefService2.prototype = { try { observer.onContentPrefSet(aGroup, aName, aValue, aIsPrivate); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } }, @@ -1184,7 +1184,7 @@ ContentPrefService2.prototype = { try { await this._failover(conn, path); } catch (e) { - Cu.reportError(e); + console.error(e); throw e; } return this._getConnection(++aAttemptNum); @@ -1207,14 +1207,14 @@ ContentPrefService2.prototype = { return null; } } catch (e) { - Cu.reportError(e); + console.error(e); return resetAndRetry(e); } try { await this._dbMaybeInit(conn); } catch (e) { - Cu.reportError(e); + console.error(e); return resetAndRetry(e); } diff --git a/toolkit/components/contentprefs/ContentPrefUtils.jsm b/toolkit/components/contentprefs/ContentPrefUtils.jsm index aed82ddf41f8..9fc5c0a77fbd 100644 --- a/toolkit/components/contentprefs/ContentPrefUtils.jsm +++ b/toolkit/components/contentprefs/ContentPrefUtils.jsm @@ -43,7 +43,7 @@ function safeCallback(callbackObj, methodName, args) { try { callbackObj[methodName].apply(callbackObj, args); } catch (err) { - Cu.reportError(err); + console.error(err); } } diff --git a/toolkit/components/contextualidentity/ContextualIdentityService.sys.mjs b/toolkit/components/contextualidentity/ContextualIdentityService.sys.mjs index d31cf05c8c21..f35ca9c2206e 100644 --- a/toolkit/components/contextualidentity/ContextualIdentityService.sys.mjs +++ b/toolkit/components/contextualidentity/ContextualIdentityService.sys.mjs @@ -205,7 +205,7 @@ _ContextualIdentityService.prototype = { loadError(error) { if (error != null && error.name != "NotFoundError") { // Let's report the error. - Cu.reportError(error); + console.error(error); } // If synchronous loading happened in the meantime, exit now. diff --git a/toolkit/components/cookiebanners/CookieBannerParent.jsm b/toolkit/components/cookiebanners/CookieBannerParent.jsm index be12dcbdf0c0..066f17dc35d4 100644 --- a/toolkit/components/cookiebanners/CookieBannerParent.jsm +++ b/toolkit/components/cookiebanners/CookieBannerParent.jsm @@ -132,9 +132,9 @@ class CookieBannerParent extends JSWindowActorParent { // is disabled. We will fallback to global pref setting if any errors // occur. 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 { - Cu.reportError("Fail on getting domain pref:" + e); + console.error("Fail on getting domain pref:", e); } } } diff --git a/toolkit/components/crashes/CrashManager.in.jsm b/toolkit/components/crashes/CrashManager.in.jsm index b5006f43b0e2..402a269e2a5c 100644 --- a/toolkit/components/crashes/CrashManager.in.jsm +++ b/toolkit/components/crashes/CrashManager.in.jsm @@ -83,7 +83,7 @@ function parseAndRemoveField(obj, field) { try { value = JSON.parse(obj[field]); } catch (e) { - Cu.reportError(e); + console.error(e); } delete obj[field]; @@ -344,10 +344,10 @@ CrashManager.prototype = Object.freeze({ break; default: - Cu.reportError( + console.error( "Unhandled crash event file return code. Please " + - "file a bug: " + - result + "file a bug: ", + result ); } } catch (ex) { @@ -360,7 +360,7 @@ CrashManager.prototype = Object.freeze({ // // If we get here, report the error and delete the source file // so we don't see it again. - Cu.reportError( + console.error( "Exception when processing crash event file: " + lazy.Log.exceptionStr(ex) ); @@ -450,10 +450,10 @@ CrashManager.prototype = Object.freeze({ addCrash(processType, crashType, id, date, metadata) { let promise = (async () => { if (!this.isValidProcessType(processType)) { - Cu.reportError( - "Unhandled process type. Please file a bug: '" + - processType + - "'. Ignore in the context of " + + console.error( + "Unhandled process type. Please file a bug: '", + processType, + "'. Ignore in the context of " + "test_crash_manager.js:test_addCrashWrong()." ); return; @@ -645,7 +645,7 @@ CrashManager.prototype = Object.freeze({ return entries; } catch (e) { - Cu.reportError(e); + console.error(e); return []; } })(); diff --git a/toolkit/components/crashes/CrashService.jsm b/toolkit/components/crashes/CrashService.jsm index b3719fd526e7..6e79c348b969 100644 --- a/toolkit/components/crashes/CrashService.jsm +++ b/toolkit/components/crashes/CrashService.jsm @@ -31,7 +31,7 @@ async function maybeRunMinidumpAnalyzer(minidumpPath, allThreads) { } await runMinidumpAnalyzer(minidumpPath, allThreads).catch(e => - Cu.reportError(e) + console.error(e) ); } @@ -123,7 +123,7 @@ function computeMinidumpHash(minidumpPath) { return hash; } catch (e) { - Cu.reportError(e); + console.error(e); return null; } })(); @@ -146,7 +146,7 @@ function processExtraFile(extraPath) { return JSON.parse(decoder.decode(extraData)); } catch (e) { - Cu.reportError(e); + console.error(e); return {}; } })(); diff --git a/toolkit/components/crashmonitor/CrashMonitor.jsm b/toolkit/components/crashmonitor/CrashMonitor.jsm index fd3bc49fd2c8..6a19150b2125 100644 --- a/toolkit/components/crashmonitor/CrashMonitor.jsm +++ b/toolkit/components/crashmonitor/CrashMonitor.jsm @@ -108,7 +108,7 @@ var CrashMonitorInternal = { } catch (ex) { // Ignore file not found errors, but report all others. if (ex.name !== "NotFoundError") { - Cu.reportError( + console.error( `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 (Object(notifications) !== notifications) { - Cu.reportError( + console.error( "Error while parsing crash monitor data: invalid monitor data" ); return null; diff --git a/toolkit/components/downloads/DownloadCore.sys.mjs b/toolkit/components/downloads/DownloadCore.sys.mjs index 2fb210fcb3ae..cd42bec36ed6 100644 --- a/toolkit/components/downloads/DownloadCore.sys.mjs +++ b/toolkit/components/downloads/DownloadCore.sys.mjs @@ -596,7 +596,7 @@ Download.prototype = { this._deferSucceeded.resolve(); 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 // mode, regardless of the value of the pref. @@ -1072,7 +1072,7 @@ Download.prototype = { this._notifyChange(); } - })().catch(Cu.reportError); + })().catch(console.error); }, /** @@ -2053,7 +2053,7 @@ DownloadSaver.prototype = { addToHistory() { if (AppConstants.MOZ_PLACES) { lazy.DownloadHistory.addDownloadToHistory(this.download).catch( - Cu.reportError + console.error ); } }, diff --git a/toolkit/components/downloads/DownloadHistory.sys.mjs b/toolkit/components/downloads/DownloadHistory.sys.mjs index 5fcc12d3befd..9efac0bebf8b 100644 --- a/toolkit/components/downloads/DownloadHistory.sys.mjs +++ b/toolkit/components/downloads/DownloadHistory.sys.mjs @@ -573,7 +573,7 @@ var DownloadHistoryList = function(publicList, place) { this._slotForDownload = new WeakMap(); // Start the asynchronous queries to retrieve history and session downloads. - publicList.addView(this).catch(Cu.reportError); + publicList.addView(this).catch(console.error); let query = {}, options = {}; lazy.PlacesUtils.history.queryStringToQuery(place, query, options); diff --git a/toolkit/components/downloads/DownloadIntegration.sys.mjs b/toolkit/components/downloads/DownloadIntegration.sys.mjs index 325e9b4d3449..273db66dc410 100644 --- a/toolkit/components/downloads/DownloadIntegration.sys.mjs +++ b/toolkit/components/downloads/DownloadIntegration.sys.mjs @@ -1017,7 +1017,7 @@ var DownloadObserver = { }; // 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. for (let download of downloads) { - list.remove(download).catch(Cu.reportError); - download.finalize(true).catch(Cu.reportError); + list.remove(download).catch(console.error); + download.finalize(true).catch(console.error); } })(); // Handle test mode diff --git a/toolkit/components/downloads/DownloadLegacy.sys.mjs b/toolkit/components/downloads/DownloadLegacy.sys.mjs index 31018441dcc9..ae38b0d26cf8 100644 --- a/toolkit/components/downloads/DownloadLegacy.sys.mjs +++ b/toolkit/components/downloads/DownloadLegacy.sys.mjs @@ -119,7 +119,7 @@ DownloadLegacyTransfer.prototype = { } }); }) - .catch(Cu.reportError); + .catch(console.error); } else if ( aStateFlags & Ci.nsIWebProgressListener.STATE_STOP && aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK @@ -137,7 +137,7 @@ DownloadLegacyTransfer.prototype = { } download.saver.onTransferFinished(aStatus); }) - .catch(Cu.reportError); + .catch(console.error); // Release the reference to the component executing the download. this._cancelable = null; @@ -183,7 +183,7 @@ DownloadLegacyTransfer.prototype = { .then(download => { download.saver.onTransferFinished(aStatus); }) - .catch(Cu.reportError); + .catch(console.error); } }, @@ -236,7 +236,7 @@ DownloadLegacyTransfer.prototype = { this._delayedMaxTotalProgress ); }) - .catch(Cu.reportError); + .catch(console.error); }, _hasDelayedProgress: false, _delayedCurTotalProgress: 0, @@ -447,7 +447,7 @@ DownloadLegacyTransfer.prototype = { aDownload._notifyChange(); } }) - .catch(Cu.reportError); + .catch(console.error); }, setSha256Hash(hash) { diff --git a/toolkit/components/downloads/DownloadList.sys.mjs b/toolkit/components/downloads/DownloadList.sys.mjs index 3df6a45b443a..101a3ab2b94e 100644 --- a/toolkit/components/downloads/DownloadList.sys.mjs +++ b/toolkit/components/downloads/DownloadList.sys.mjs @@ -357,10 +357,10 @@ DownloadList.prototype = { // don't need to wait for the procedure to be complete before // processing the other downloads in the list. 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); this._publicList = aPublicList; this._privateList = aPrivateList; - aPublicList.addView(this).catch(Cu.reportError); - aPrivateList.addView(this).catch(Cu.reportError); + aPublicList.addView(this).catch(console.error); + aPrivateList.addView(this).catch(console.error); }; DownloadCombinedList.prototype = { diff --git a/toolkit/components/downloads/test/unit/head.js b/toolkit/components/downloads/test/unit/head.js index e2e251dbc0ac..e5293304cd02 100644 --- a/toolkit/components/downloads/test/unit/head.js +++ b/toolkit/components/downloads/test/unit/head.js @@ -903,7 +903,7 @@ function registerInterruptibleHandler(aPath, aFirstPartFn, aSecondPartFn) { aResponse.finish(); info("Interruptible request finished."); }) - .catch(Cu.reportError); + .catch(console.error); }); } diff --git a/toolkit/components/featuregates/FeatureGateImplementation.jsm b/toolkit/components/featuregates/FeatureGateImplementation.jsm index 6878d3372df2..09a5b98704e7 100644 --- a/toolkit/components/featuregates/FeatureGateImplementation.jsm +++ b/toolkit/components/featuregates/FeatureGateImplementation.jsm @@ -268,7 +268,7 @@ class FeatureGateImplementation { try { observer[method](...args); } catch (err) { - Cu.reportError(err); + console.error(err); } } } @@ -292,7 +292,7 @@ class FeatureGateImplementation { } } } else { - Cu.reportError( + console.error( new Error(`Unexpected event observed: ${aSubject}, ${aTopic}, ${aData}`) ); } diff --git a/toolkit/components/formautofill/.eslintrc.js b/toolkit/components/formautofill/.eslintrc.js index 64779b1fcdeb..12bf577565d3 100644 --- a/toolkit/components/formautofill/.eslintrc.js +++ b/toolkit/components/formautofill/.eslintrc.js @@ -39,7 +39,7 @@ module.exports = { "max-nested-callbacks": ["error", 4], // Disallow using the console API. - "no-console": "error", + "no-console": ["error", { allow: ["error"] }], // Disallow fallthrough of case statements, except if there is a comment. "no-fallthrough": "error", diff --git a/toolkit/components/formautofill/FormAutofillParent.jsm b/toolkit/components/formautofill/FormAutofillParent.jsm index 418e1f83f9d1..a1f60fc66266 100644 --- a/toolkit/components/formautofill/FormAutofillParent.jsm +++ b/toolkit/components/formautofill/FormAutofillParent.jsm @@ -401,7 +401,7 @@ class FormAutofillParent extends JSWindowActorParent { ); } } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } } diff --git a/toolkit/components/messaging-system/lib/SpecialMessageActions.jsm b/toolkit/components/messaging-system/lib/SpecialMessageActions.jsm index 81eec6822f2b..4dae5153b9b6 100644 --- a/toolkit/components/messaging-system/lib/SpecialMessageActions.jsm +++ b/toolkit/components/messaging-system/lib/SpecialMessageActions.jsm @@ -81,7 +81,7 @@ const SpecialMessageActions = { install ); } catch (e) { - Cu.reportError(e); + console.error(e); } }, diff --git a/toolkit/components/messaging-system/targeting/Targeting.jsm b/toolkit/components/messaging-system/targeting/Targeting.jsm index 5e830b61b30c..6ed951b24fdb 100644 --- a/toolkit/components/messaging-system/targeting/Targeting.jsm +++ b/toolkit/components/messaging-system/targeting/Targeting.jsm @@ -134,7 +134,7 @@ class TargetingContext { const logUndesiredEvent = (event, key, prop) => { const value = key ? `${key}.${prop}` : prop; this._sendUndesiredEvent({ event, value }); - Cu.reportError(`${event}: ${value}`); + console.error(`${event}: ${value}`); }; return new Proxy(context, { @@ -157,7 +157,7 @@ class TargetingContext { } catch (error) { logUndesiredEvent(ERROR_TYPES.ATTRIBUTE_ERROR, key, prop); reject(error); - Cu.reportError(error); + console.error(error); } finally { lazy.clearTimeout(timeout); } diff --git a/toolkit/components/narrate/NarrateControls.jsm b/toolkit/components/narrate/NarrateControls.jsm index ef091b7323b0..a597cd326716 100644 --- a/toolkit/components/narrate/NarrateControls.jsm +++ b/toolkit/components/narrate/NarrateControls.jsm @@ -271,7 +271,7 @@ NarrateControls.prototype = { this.narrator .start(options) .catch(err => { - Cu.reportError(`Narrate failed: ${err}.`); + console.error(`Narrate failed: ${err}.`); }) .then(() => { this._updateSpeechControls(false); diff --git a/toolkit/components/nimbus/ExperimentAPI.jsm b/toolkit/components/nimbus/ExperimentAPI.jsm index 2c05318af116..e9421b48e335 100644 --- a/toolkit/components/nimbus/ExperimentAPI.jsm +++ b/toolkit/components/nimbus/ExperimentAPI.jsm @@ -46,7 +46,7 @@ function parseJSON(value) { try { return JSON.parse(value); } catch (e) { - Cu.reportError(e); + console.error(e); } } return null; @@ -112,7 +112,7 @@ const ExperimentAPI = { experimentData = this._store.getExperimentForFeature(featureId); } } catch (e) { - Cu.reportError(e); + console.error(e); } if (experimentData) { return { @@ -151,7 +151,7 @@ const ExperimentAPI = { } } } catch (e) { - Cu.reportError(e); + console.error(e); } if (experimentData) { return { @@ -194,7 +194,7 @@ const ExperimentAPI = { experiment = this._store.getExperimentForFeature(featureId); } } catch (e) { - Cu.reportError(e); + console.error(e); } if (!experiment) { @@ -276,7 +276,7 @@ const ExperimentAPI = { } catch (e) { // If an error occurs in .get(), an empty list is returned and the destructuring // assignment will throw. - Cu.reportError(e); + console.error(e); recipe = undefined; } @@ -319,7 +319,7 @@ const ExperimentAPI = { } ); } catch (e) { - Cu.reportError(e); + console.error(e); } Glean.nimbusEvents.exposure.record({ experiment: experimentSlug, @@ -346,7 +346,7 @@ class _ExperimentFeature { this.prefGetters = {}; this.manifest = manifest || lazy.FeatureManifest[featureId]; if (!this.manifest) { - Cu.reportError( + console.error( `No manifest entry for ${featureId}. Please add one to toolkit/components/nimbus/FeatureManifest.js` ); } diff --git a/toolkit/components/nimbus/lib/ExperimentManager.jsm b/toolkit/components/nimbus/lib/ExperimentManager.jsm index 6b9550065bde..cdd20e5b2d59 100644 --- a/toolkit/components/nimbus/lib/ExperimentManager.jsm +++ b/toolkit/components/nimbus/lib/ExperimentManager.jsm @@ -207,7 +207,7 @@ class _ExperimentManager { } this.unenroll(slug, reason); } catch (err) { - Cu.reportError(err); + console.error(err); } } } diff --git a/toolkit/components/nimbus/lib/ExperimentStore.jsm b/toolkit/components/nimbus/lib/ExperimentStore.jsm index 4b2155e12d3e..0f218d717e74 100644 --- a/toolkit/components/nimbus/lib/ExperimentStore.jsm +++ b/toolkit/components/nimbus/lib/ExperimentStore.jsm @@ -49,7 +49,7 @@ XPCOMUtils.defineLazyGetter(lazy, "syncDataStore", () => { try { branch.setStringPref(pref, JSON.stringify(value)); } catch (e) { - Cu.reportError(e); + console.error(e); } }, _trySetTypedPrefValue(pref, value) { @@ -302,7 +302,7 @@ class ExperimentStore extends SharedDataMap { try { data = Object.values(this._data || {}); } catch (e) { - Cu.reportError(e); + console.error(e); } return data; diff --git a/toolkit/components/nimbus/lib/RemoteSettingsExperimentLoader.jsm b/toolkit/components/nimbus/lib/RemoteSettingsExperimentLoader.jsm index 300e82a72b7b..9c27dff85402 100644 --- a/toolkit/components/nimbus/lib/RemoteSettingsExperimentLoader.jsm +++ b/toolkit/components/nimbus/lib/RemoteSettingsExperimentLoader.jsm @@ -190,7 +190,7 @@ class _RemoteSettingsExperimentLoader { result = await targetingContext.evalWithDefault(jexlString); } catch (e) { lazy.log.debug("Targeting failed because of an error", e); - Cu.reportError(e); + console.error(e); } return result; } @@ -254,7 +254,7 @@ class _RemoteSettingsExperimentLoader { } catch (e) { lazy.log.debug("Error getting recipes from remote settings."); loadingError = true; - Cu.reportError(e); + console.error(e); } let recipeValidator; @@ -292,7 +292,7 @@ class _RemoteSettingsExperimentLoader { if (validationEnabled) { let validation = recipeValidator.validate(r); if (!validation.valid) { - Cu.reportError( + console.error( `Could not validate experiment recipe ${r.id}: ${JSON.stringify( validation.errors, undefined, @@ -409,7 +409,7 @@ class _RemoteSettingsExperimentLoader { emptyListFallback: false, }); } catch (e) { - Cu.reportError(e); + console.error(e); throw new Error("Error getting recipes from remote settings."); } @@ -488,9 +488,7 @@ class _RemoteSettingsExperimentLoader { for (const feature of features) { const { featureId, value } = feature; if (!lazy.NimbusFeatures[featureId]) { - Cu.reportError( - `Experiment ${id} has unknown featureId: ${featureId}` - ); + console.error(`Experiment ${id} has unknown featureId: ${featureId}`); invalidFeatureIds.add(featureId); continue; @@ -525,7 +523,7 @@ class _RemoteSettingsExperimentLoader { const result = validator.validate(value); if (!result.valid) { - Cu.reportError( + console.error( `Experiment ${id} branch ${branchIdx} feature ${featureId} does not validate: ${JSON.stringify( result.errors, undefined, @@ -573,7 +571,7 @@ class _RemoteSettingsExperimentLoader { default: // 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}` ); break; diff --git a/toolkit/components/nimbus/lib/SharedDataMap.jsm b/toolkit/components/nimbus/lib/SharedDataMap.jsm index c5bb9df26ac7..7817f5d6259d 100644 --- a/toolkit/components/nimbus/lib/SharedDataMap.jsm +++ b/toolkit/components/nimbus/lib/SharedDataMap.jsm @@ -42,13 +42,13 @@ class SharedDataMap extends EventEmitter { const profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile).path; path = PathUtils.join(profileDir, `${sharedDataKey}.json`); } catch (e) { - Cu.reportError(e); + console.error(e); } } try { store = new lazy.JSONFile({ path }); } catch (e) { - Cu.reportError(e); + console.error(e); } return store; }); @@ -66,7 +66,7 @@ class SharedDataMap extends EventEmitter { this._syncToChildren({ flush: true }); this._checkIfReady(); } catch (e) { - Cu.reportError(e); + console.error(e); } } } diff --git a/toolkit/components/normandy/Normandy.jsm b/toolkit/components/normandy/Normandy.jsm index facd89def787..ec969a5f4a81 100644 --- a/toolkit/components/normandy/Normandy.jsm +++ b/toolkit/components/normandy/Normandy.jsm @@ -234,7 +234,7 @@ var Normandy = { targetPrefType !== Services.prefs.PREF_INVALID && targetPrefType !== sourcePrefType ) { - Cu.reportError( + console.error( new Error( `Error setting startup pref ${prefName}; pref type does not match.` ) @@ -274,7 +274,7 @@ var Normandy = { originalValues[prefName] = null; } else { // Unexpected error, report it and move on - Cu.reportError(e); + console.error(e); continue; } } @@ -301,7 +301,7 @@ var Normandy = { } default: { // This should never happen. - Cu.reportError( + console.error( new Error( `Error getting startup pref ${prefName}; unexpected value type ${sourcePrefType}.` ) diff --git a/toolkit/components/normandy/actions/BaseAction.jsm b/toolkit/components/normandy/actions/BaseAction.jsm index b8c17a3e2e2d..a06ae385fd7f 100644 --- a/toolkit/components/normandy/actions/BaseAction.jsm +++ b/toolkit/components/normandy/actions/BaseAction.jsm @@ -89,14 +89,12 @@ class BaseAction { break; } default: { - Cu.reportError( - new Error("BaseAction.fail() called at unexpected time") - ); + console.error(new Error("BaseAction.fail() called at unexpected time")); } } this.state = BaseAction.STATE_FAILED; this.lastError = err; - Cu.reportError(err); + console.error(err); } // Gets the name of the action. Does not necessarily match the @@ -170,7 +168,7 @@ class BaseAction { try { recipe.arguments = this.validateArguments(recipe.arguments); } catch (error) { - Cu.reportError(error); + console.error(error); uptakeResult = Uptake.RECIPE_EXECUTION_ERROR; suitability = BaseAction.suitability.ARGUMENTS_INVALID; } @@ -179,7 +177,7 @@ class BaseAction { try { await this._processRecipe(recipe, suitability); } catch (err) { - Cu.reportError(err); + console.error(err); uptakeResult = Uptake.RECIPE_EXECUTION_ERROR; } Uptake.reportRecipe(recipe, uptakeResult); @@ -249,7 +247,7 @@ class BaseAction { } this.lastError = err; - Cu.reportError(err); + console.error(err); } break; } diff --git a/toolkit/components/normandy/actions/BranchedAddonStudyAction.jsm b/toolkit/components/normandy/actions/BranchedAddonStudyAction.jsm index 7ac3f30ef385..1b29ccf4371c 100644 --- a/toolkit/components/normandy/actions/BranchedAddonStudyAction.jsm +++ b/toolkit/components/normandy/actions/BranchedAddonStudyAction.jsm @@ -229,7 +229,7 @@ class BranchedAddonStudyAction extends BaseStudyAction { try { await this.unenroll(study.recipeId, "recipe-not-seen"); } catch (err) { - Cu.reportError(err); + console.error(err); } } } diff --git a/toolkit/components/normandy/actions/PreferenceRolloutAction.jsm b/toolkit/components/normandy/actions/PreferenceRolloutAction.jsm index dc878dd43dfe..90c54775ed4b 100644 --- a/toolkit/components/normandy/actions/PreferenceRolloutAction.jsm +++ b/toolkit/components/normandy/actions/PreferenceRolloutAction.jsm @@ -114,7 +114,7 @@ class PreferenceRolloutAction extends BaseAction { break; } default: { - Cu.reportError( + console.error( new Error( `Updated pref rollout in unexpected state: ${existingRollout.state}` ) diff --git a/toolkit/components/normandy/lib/AddonStudies.jsm b/toolkit/components/normandy/lib/AddonStudies.jsm index 4cc94418b83b..25a47534fab0 100644 --- a/toolkit/components/normandy/lib/AddonStudies.jsm +++ b/toolkit/components/normandy/lib/AddonStudies.jsm @@ -486,7 +486,7 @@ var AddonStudies = { try { await cb(reason); } catch (err) { - Cu.reportError(err); + console.error(err); } } diff --git a/toolkit/components/normandy/lib/CleanupManager.jsm b/toolkit/components/normandy/lib/CleanupManager.jsm index 7b3d28a51eb3..e632221b7b90 100644 --- a/toolkit/components/normandy/lib/CleanupManager.jsm +++ b/toolkit/components/normandy/lib/CleanupManager.jsm @@ -33,7 +33,7 @@ class CleanupManagerClass { try { await handler(); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } })(); diff --git a/toolkit/components/normandy/lib/ShieldPreferences.jsm b/toolkit/components/normandy/lib/ShieldPreferences.jsm index 9dea64cd92eb..fc97903cfc5e 100644 --- a/toolkit/components/normandy/lib/ShieldPreferences.jsm +++ b/toolkit/components/normandy/lib/ShieldPreferences.jsm @@ -74,7 +74,7 @@ var ShieldPreferences = { const allPromises = studyPromises .concat(experimentPromises) - .map(p => p && p.catch(err => Cu.reportError(err))); + .map(p => p && p.catch(err => console.error(err))); await Promise.all(allPromises); } break; diff --git a/toolkit/components/passwordmgr/FirefoxRelay.jsm b/toolkit/components/passwordmgr/FirefoxRelay.jsm index a0beded4a0a4..f150c888946c 100644 --- a/toolkit/components/passwordmgr/FirefoxRelay.jsm +++ b/toolkit/components/passwordmgr/FirefoxRelay.jsm @@ -59,7 +59,7 @@ async function getRelayTokenAsync() { try { return await lazy.fxAccounts.getOAuthToken({ scope: config.scope }); } 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; } } diff --git a/toolkit/components/passwordmgr/LoginManagerChild.jsm b/toolkit/components/passwordmgr/LoginManagerChild.jsm index 051226174847..d00c0cb7d16a 100644 --- a/toolkit/components/passwordmgr/LoginManagerChild.jsm +++ b/toolkit/components/passwordmgr/LoginManagerChild.jsm @@ -2020,7 +2020,7 @@ class LoginManagerChild extends JSWindowActorChild { this._getLoginDataFromParent(form, { showPrimaryPassword: true }) .then(this.loginsFound.bind(this)) - .catch(Cu.reportError); + .catch(console.error); } isPasswordGenerationForcedOn(passwordField) { @@ -2203,7 +2203,7 @@ class LoginManagerChild extends JSWindowActorChild { userTriggered: true, }); }) - .catch(Cu.reportError); + .catch(console.error); // 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. } else if (loginGUID !== null) { diff --git a/toolkit/components/passwordmgr/LoginManagerContextMenu.jsm b/toolkit/components/passwordmgr/LoginManagerContextMenu.jsm index 7fb24a6397b6..fa2d50206d3b 100644 --- a/toolkit/components/passwordmgr/LoginManagerContextMenu.jsm +++ b/toolkit/components/passwordmgr/LoginManagerContextMenu.jsm @@ -207,7 +207,7 @@ const LoginManagerContextMenu = { loginFormOrigin: formOrigin, login, }) - .catch(Cu.reportError); + .catch(console.error); }, /** diff --git a/toolkit/components/passwordmgr/storage-json.js b/toolkit/components/passwordmgr/storage-json.js index fddf5849c985..668ed64775ac 100644 --- a/toolkit/components/passwordmgr/storage-json.js +++ b/toolkit/components/passwordmgr/storage-json.js @@ -84,7 +84,7 @@ class LoginManagerStorage_json { // Load the data asynchronously. this.log(`Opening database at ${this._store.path}.`); await this._store.load(); - })().catch(Cu.reportError); + })().catch(console.error); } catch (e) { this.log(`Initialization failed ${e.name}.`); throw new Error("Initialization failed"); diff --git a/toolkit/components/pdfjs/content/PdfStreamConverter.jsm b/toolkit/components/pdfjs/content/PdfStreamConverter.jsm index 6611b34bbe24..93c84acb6f45 100644 --- a/toolkit/components/pdfjs/content/PdfStreamConverter.jsm +++ b/toolkit/components/pdfjs/content/PdfStreamConverter.jsm @@ -288,7 +288,7 @@ class ChromeActions { } catch (err) { // If there's an error here, it means that something is really wrong // on pdf.js side during sandbox initialization phase. - Cu.reportError(err); + console.error(err); return sendResp(false); } @@ -967,7 +967,7 @@ PdfStreamConverter.prototype = { rv.shouldOpen = true; // Log that we're doing this to help debug issues if people end up being // 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.alwaysAskBeforeHandling = false; diff --git a/toolkit/components/places/Bookmarks.sys.mjs b/toolkit/components/places/Bookmarks.sys.mjs index 93342b40c065..f9e44456160e 100644 --- a/toolkit/components/places/Bookmarks.sys.mjs +++ b/toolkit/components/places/Bookmarks.sys.mjs @@ -840,7 +840,7 @@ export var Bookmarks = Object.freeze({ ) { // ...though we don't wait for the calculation. 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. if (urls && urls.length) { 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 (item.type == Bookmarks.TYPE_BOOKMARK && !isTagging) { // ...though we don't wait for the calculation. - updateFrecency(db, [item.url]).catch(Cu.reportError); + updateFrecency(db, [item.url]).catch(console.error); } return item; @@ -2256,7 +2256,7 @@ function insertBookmarkTree(items, source, parent, urls, lastAddedForParent) { }); // We don't wait for the frecency calculation. - updateFrecency(db, urls).catch(Cu.reportError); + updateFrecency(db, urls).catch(console.error); return items; } @@ -2778,7 +2778,7 @@ function removeBookmarks(items, options) { if (urls.length) { await lazy.PlacesUtils.keywords.removeFromURLsIfNotBookmarked(urls); - updateFrecency(db, urls).catch(Cu.reportError); + updateFrecency(db, urls).catch(console.error); } } ); diff --git a/toolkit/components/places/History.sys.mjs b/toolkit/components/places/History.sys.mjs index e43937a34826..26e9e89cbc32 100644 --- a/toolkit/components/places/History.sys.mjs +++ b/toolkit/components/places/History.sys.mjs @@ -1100,7 +1100,7 @@ var notifyCleanup = async function(db, pages, transitionType = 0) { await Promise.resolve(); } }) - .catch(Cu.reportError); + .catch(console.error); } } diff --git a/toolkit/components/places/PlacesExpiration.sys.mjs b/toolkit/components/places/PlacesExpiration.sys.mjs index e9f8238d8025..131d9fddcdf0 100644 --- a/toolkit/components/places/PlacesExpiration.sys.mjs +++ b/toolkit/components/places/PlacesExpiration.sys.mjs @@ -485,7 +485,7 @@ export function nsPlacesExpiration() { // Expire daily on idle. Services.obs.addObserver(this, TOPIC_IDLE_DAILY, true); }) - .catch(Cu.reportError); + .catch(console.error); // Block shutdown. let shutdownClient = @@ -503,7 +503,7 @@ export function nsPlacesExpiration() { // If the database is dirty, we want to expire some entries, to speed up // the expiration process. 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 // capacity then all existing visits will be expired. // 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) { // The number of expired visits is limited by this amount. It may be // used for testing purposes, like checking that limited queries work. this._debugLimit = limit; - this._expire(ACTION.DEBUG, LIMIT.DEBUG).catch(Cu.reportError); + this._expire(ACTION.DEBUG, LIMIT.DEBUG).catch(console.error); } else { // 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 // any orphan pages, icons, annotations and similar from the database, // so it may be used for cleanup purposes. 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) { // Stop the expiration timer. We don't want to keep up expiring on idle @@ -544,7 +544,7 @@ nsPlacesExpiration.prototype = { this._timer = null; } 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) { // Restart the expiration timer. @@ -552,7 +552,7 @@ nsPlacesExpiration.prototype = { this._newTimer(); } } 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) { this._testingMode = true; } 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. let limit = overLimitPages > OVERLIMIT_PAGES_THRESHOLD ? LIMIT.LARGE : LIMIT.SMALL; - this._expire(action, limit).catch(Cu.reportError); + this._expire(action, limit).catch(console.error); }, 300000); }, diff --git a/toolkit/components/places/PlacesUtils.sys.mjs b/toolkit/components/places/PlacesUtils.sys.mjs index 478c12372ba8..f964075f5c63 100644 --- a/toolkit/components/places/PlacesUtils.sys.mjs +++ b/toolkit/components/places/PlacesUtils.sys.mjs @@ -2152,7 +2152,7 @@ function setupDbForShutdown(conn, name) { conn.close(); reject(ex); } - }).catch(Cu.reportError); + }).catch(console.error); // Make sure that Sqlite.sys.mjs doesn't close until we are done // with the high-level connection. @@ -2177,7 +2177,7 @@ XPCOMUtils.defineLazyGetter(lazy, "gAsyncDBConnPromised", () => setupDbForShutdown(conn, "PlacesUtils read-only connection"); return conn; }) - .catch(Cu.reportError) + .catch(console.error) ); XPCOMUtils.defineLazyGetter(lazy, "gAsyncDBWrapperPromised", () => @@ -2188,7 +2188,7 @@ XPCOMUtils.defineLazyGetter(lazy, "gAsyncDBWrapperPromised", () => setupDbForShutdown(conn, "PlacesUtils wrapped connection"); return conn; }) - .catch(Cu.reportError) + .catch(console.error) ); var gAsyncDBLargeCacheConnDeferred = PromiseUtils.defer(); @@ -2225,7 +2225,7 @@ XPCOMUtils.defineLazyGetter(lazy, "gAsyncDBLargeCacheConnPromised", () => gAsyncDBLargeCacheConnDeferred.resolve(conn); return conn; }) - .catch(Cu.reportError) + .catch(console.error) ); /** diff --git a/toolkit/components/places/TaggingService.sys.mjs b/toolkit/components/places/TaggingService.sys.mjs index e55df786f2a2..77222d727f2b 100644 --- a/toolkit/components/places/TaggingService.sys.mjs +++ b/toolkit/components/places/TaggingService.sys.mjs @@ -550,7 +550,7 @@ TagAutoCompleteSearch.prototype = { this._search.cancel(); } this._search = new TagSearch(searchString, this, listener); - this._search.start().catch(Cu.reportError); + this._search.start().catch(console.error); }, /** diff --git a/toolkit/components/printing/content/print.js b/toolkit/components/printing/content/print.js index a87826e7e057..4b79ab6b4d7d 100644 --- a/toolkit/components/printing/content/print.js +++ b/toolkit/components/printing/content/print.js @@ -84,9 +84,7 @@ function cancelDeferredTasks() { document.addEventListener( "DOMContentLoaded", e => { - window._initialized = PrintEventHandler.init().catch(e => - Cu.reportError(e) - ); + window._initialized = PrintEventHandler.init().catch(e => console.error(e)); ourBrowser.setAttribute("flex", "0"); ourBrowser.setAttribute("selectmenuconstrained", "false"); ourBrowser.classList.add("printSettingsBrowser"); @@ -427,7 +425,7 @@ var PrintEventHandler = { let bc = this.printPreviewEl.currentBrowsingContext; await this._doPrint(bc, settings); } catch (e) { - Cu.reportError(e); + console.error(e); } if (settings.printerName == PrintUtils.SAVE_TO_PDF_PRINTER) { @@ -862,7 +860,7 @@ var PrintEventHandler = { })); } catch (e) { this.reportPrintingError("PRINT_PREVIEW"); - Cu.reportError(e); + console.error(e); throw e; } diff --git a/toolkit/components/printing/content/printUtils.js b/toolkit/components/printing/content/printUtils.js index e15c4e43a71f..279e707c88ac 100644 --- a/toolkit/components/printing/content/printUtils.js +++ b/toolkit/components/printing/content/printUtils.js @@ -78,7 +78,7 @@ var PrintUtils = { // Need the await for the try to trigger... return await sourceActor.sendQuery("PrintingSelection:HasSelection", {}); } catch (e) { - Cu.reportError(e); + console.error(e); } return false; }, @@ -203,7 +203,7 @@ var PrintUtils = { args ); closedPromise.catch(e => { - Cu.reportError(e); + console.error(e); }); let settingsBrowser = dialog._frame; @@ -549,7 +549,7 @@ var PrintUtils = { ); } } catch (e) { - Cu.reportError("PrintUtils.getPrintSettings failed: " + e + "\n"); + console.error("PrintUtils.getPrintSettings failed: ", e, "\n"); } return printSettings; }, diff --git a/toolkit/components/prompts/content/adjustableTitle.js b/toolkit/components/prompts/content/adjustableTitle.js index 2614480bc267..bd9afd909aca 100644 --- a/toolkit/components/prompts/content/adjustableTitle.js +++ b/toolkit/components/prompts/content/adjustableTitle.js @@ -128,7 +128,7 @@ const AdjustableTitle = { !DOMException.isInstance(ex) || ex.name != "NoModificationAllowedError" ) { - Cu.reportError(ex); + console.error(ex); } return; } diff --git a/toolkit/components/prompts/content/selectDialog.js b/toolkit/components/prompts/content/selectDialog.js index d079beb755cf..86809bc87983 100644 --- a/toolkit/components/prompts/content/selectDialog.js +++ b/toolkit/components/prompts/content/selectDialog.js @@ -20,7 +20,7 @@ function onDCL() { let promptType = propBag.getProperty("promptType"); if (promptType != "select") { - Cu.reportError("selectDialog opened for unknown type: " + promptType); + console.error("selectDialog opened for unknown type: ", promptType); window.close(); } diff --git a/toolkit/components/prompts/src/CommonDialog.sys.mjs b/toolkit/components/prompts/src/CommonDialog.sys.mjs index 3bcb60ded23a..a0812aa8eca2 100644 --- a/toolkit/components/prompts/src/CommonDialog.sys.mjs +++ b/toolkit/components/prompts/src/CommonDialog.sys.mjs @@ -99,8 +99,9 @@ CommonDialog.prototype = { this.ui.password1Label.setAttribute("value", ""); break; default: - Cu.reportError( - "commonDialog opened for unknown type: " + this.args.promptType + console.error( + "commonDialog opened for unknown type: ", + this.args.promptType ); throw new Error("unknown dialog type"); } @@ -234,7 +235,7 @@ CommonDialog.prototype = { .playEventSound(this.soundID); } } catch (e) { - Cu.reportError("Couldn't play common dialog event sound: " + e); + console.error("Couldn't play common dialog event sound: ", e); } if (commonDialogEl) { diff --git a/toolkit/components/prompts/src/Prompter.sys.mjs b/toolkit/components/prompts/src/Prompter.sys.mjs index a79f5b5527b3..c88a64fccc27 100644 --- a/toolkit/components/prompts/src/Prompter.sys.mjs +++ b/toolkit/components/prompts/src/Prompter.sys.mjs @@ -50,9 +50,7 @@ Prompter.prototype = { ].getService(Ci.nsIPromptFactory); return pwmgr.getPrompt(domWin, iid); } catch (e) { - Cu.reportError( - "nsPrompter: Delegation to password manager failed: " + e - ); + console.error("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. if (this.browsingContext?.associatedWindow?.gDialogBox) { - Cu.reportError( + console.error( "Prompter: Browser not available. Falling back to internal window prompt." ); } @@ -1009,7 +1007,7 @@ class ModalPrompter { (this.browsingContext?.isContent || !this.browsingContext?.associatedWindow?.gDialogBox) ) { - Cu.reportError( + console.error( "Prompter: internal dialogs not available in this context. Falling back to window prompt." ); modalType = MODAL_TYPE_WINDOW; @@ -1067,7 +1065,7 @@ class ModalPrompter { // and thus not supported as tab or content prompts yet. See Bug 1622817. // Once they are integrated this override should be removed. 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." ); args.modalType = MODAL_TYPE_WINDOW; diff --git a/toolkit/components/reader/AboutReader.jsm b/toolkit/components/reader/AboutReader.jsm index 4bf04a710511..151cd02c796f 100644 --- a/toolkit/components/reader/AboutReader.jsm +++ b/toolkit/components/reader/AboutReader.jsm @@ -79,7 +79,7 @@ var AboutReader = function( if (Services.prefs.getBoolPref("reader.errors.includeURLs")) { errorMsg += " Tried to load: " + url + "."; } - Cu.reportError(errorMsg); + console.error(errorMsg); win.location.href = "about:blank"; return; } diff --git a/toolkit/components/reader/ReaderMode.jsm b/toolkit/components/reader/ReaderMode.jsm index 1449338e2a61..fbfd59679632 100644 --- a/toolkit/components/reader/ReaderMode.jsm +++ b/toolkit/components/reader/ReaderMode.jsm @@ -143,7 +143,7 @@ var ReaderMode = { win.document.nodePrincipal.originAttributes ); } catch (e) { - Cu.reportError(e); + console.error(e); return; } let loadFlags = webNav.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL; @@ -278,7 +278,7 @@ var ReaderMode = { return null; } } catch (ex) { - Cu.reportError( + console.error( new Error(`Couldn't create URI from ${url} to download: ${ex}`) ); return null; @@ -422,7 +422,7 @@ var ReaderMode = { options, ]); } catch (e) { - Cu.reportError("Error in ReaderWorker: " + e); + console.error("Error in ReaderWorker: ", e); histogram.add(PARSE_ERROR_WORKER); } diff --git a/toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm b/toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm index d68fe6c1ad15..fbefd4fbffbb 100644 --- a/toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm +++ b/toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm @@ -170,7 +170,7 @@ class RemoteWebNavigation { try { this._browser.sendMessageToActor(aMessage, aData, "WebNavigation"); } catch (e) { - Cu.reportError(e); + console.error(e); } } } diff --git a/toolkit/components/remotepagemanager/MessagePort.jsm b/toolkit/components/remotepagemanager/MessagePort.jsm index 5de2b78a3337..3abac6ec86b5 100644 --- a/toolkit/components/remotepagemanager/MessagePort.jsm +++ b/toolkit/components/remotepagemanager/MessagePort.jsm @@ -35,7 +35,7 @@ class MessageListener { try { listener(message); } catch (e) { - Cu.reportError(e); + console.error(e); } } } @@ -179,7 +179,7 @@ class MessagePort { let deferred = this.requests[messagedata.requestID]; if (!deferred) { - Cu.reportError("Received a response to an unknown request."); + console.error("Received a response to an unknown request."); return; } diff --git a/toolkit/components/remotepagemanager/RemotePageManagerParent.jsm b/toolkit/components/remotepagemanager/RemotePageManagerParent.jsm index 0dcedb8fb3bc..0cc32ac5aa27 100644 --- a/toolkit/components/remotepagemanager/RemotePageManagerParent.jsm +++ b/toolkit/components/remotepagemanager/RemotePageManagerParent.jsm @@ -112,7 +112,7 @@ class RemotePages { // Unless the port is in the process of unloading, something strange // happened but allow other ports to receive the message 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 } }) { let callback = this.pages.get(url); if (!callback) { - Cu.reportError("Unexpected remote page load: " + url); + console.error("Unexpected remote page load: ", url); return; } diff --git a/toolkit/components/resistfingerprinting/RFPHelper.jsm b/toolkit/components/resistfingerprinting/RFPHelper.jsm index 332fcc7a43e7..91194f5c84f5 100644 --- a/toolkit/components/resistfingerprinting/RFPHelper.jsm +++ b/toolkit/components/resistfingerprinting/RFPHelper.jsm @@ -334,7 +334,7 @@ class _RFPHelper { _parseLetterboxingDimensions(aPrefValue) { if (!aPrefValue || !aPrefValue.match(/^(?:\d+x\d+,\s*)*(?:\d+x\d+)$/)) { if (aPrefValue) { - Cu.reportError( + console.error( `Invalid pref value for ${kPrefLetterboxingDimensions}: ${aPrefValue}` ); } diff --git a/toolkit/components/satchel/FormHistoryStartup.sys.mjs b/toolkit/components/satchel/FormHistoryStartup.sys.mjs index 05bfdf3ceeb2..2fe368e0c838 100644 --- a/toolkit/components/satchel/FormHistoryStartup.sys.mjs +++ b/toolkit/components/satchel/FormHistoryStartup.sys.mjs @@ -22,7 +22,7 @@ FormHistoryStartup.prototype = { switch (topic) { case "idle-daily": case "formhistory-expire-now": - lazy.FormHistory.expireOldEntries().catch(Cu.reportError); + lazy.FormHistory.expireOldEntries().catch(console.error); break; case "profile-after-change": this.init(); diff --git a/toolkit/components/telemetry/app/TelemetryScheduler.sys.mjs b/toolkit/components/telemetry/app/TelemetryScheduler.sys.mjs index d35221e0d445..6eb07c50d8f2 100644 --- a/toolkit/components/telemetry/app/TelemetryScheduler.sys.mjs +++ b/toolkit/components/telemetry/app/TelemetryScheduler.sys.mjs @@ -121,7 +121,7 @@ export var TelemetryScheduler = { if (this._log) { this._log.error("shutdown - Already shut down"); } else { - Cu.reportError("TelemetryScheduler.shutdown - Already shut down"); + console.error("TelemetryScheduler.shutdown - Already shut down"); } return; } diff --git a/toolkit/components/thumbnails/BackgroundPageThumbs.jsm b/toolkit/components/thumbnails/BackgroundPageThumbs.jsm index 1eff8ebb094b..be8f2a269a2d 100644 --- a/toolkit/components/thumbnails/BackgroundPageThumbs.jsm +++ b/toolkit/components/thumbnails/BackgroundPageThumbs.jsm @@ -395,9 +395,7 @@ const BackgroundPageThumbs = { return; } - Cu.reportError( - "BackgroundThumbnails remote process crashed - recovering" - ); + console.error("BackgroundThumbnails remote process crashed - recovering"); this._destroyBrowser(); let curCapture = this._captureQueue.length ? this._captureQueue[0] : null; // we could retry the pending capture, but it's possible the crash @@ -730,7 +728,7 @@ Capture.prototype = { try { callback.call(options, this.url, reason, info); } catch (err) { - Cu.reportError(err); + console.error(err); } } diff --git a/toolkit/components/thumbnails/PageThumbUtils.jsm b/toolkit/components/thumbnails/PageThumbUtils.jsm index fe5df93348a8..cc96c5ea3ab6 100644 --- a/toolkit/components/thumbnails/PageThumbUtils.jsm +++ b/toolkit/components/thumbnails/PageThumbUtils.jsm @@ -118,7 +118,7 @@ var PageThumbUtils = { utils.getScrollbarSize(false, sbWidth, sbHeight); } catch (e) { // 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; } @@ -313,7 +313,7 @@ var PageThumbUtils = { utils.getScrollbarSize(false, sbWidth, sbHeight); } catch (e) { // 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; } diff --git a/toolkit/components/thumbnails/PageThumbs.jsm b/toolkit/components/thumbnails/PageThumbs.jsm index a203f3a749dd..d7fa188c3c29 100644 --- a/toolkit/components/thumbnails/PageThumbs.jsm +++ b/toolkit/components/thumbnails/PageThumbs.jsm @@ -205,7 +205,7 @@ var PageThumbs = { 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); await this._store(originalURL, url, buffer, channelError); } 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, { ignoreExisting: true }, ]).catch(function onError(aReason) { - Cu.reportError("Could not create thumbnails directory" + aReason); + console.error("Could not create thumbnails directory", aReason); }); }, diff --git a/toolkit/components/url-classifier/SafeBrowsing.jsm b/toolkit/components/url-classifier/SafeBrowsing.jsm index 5c4a619e5592..232b00777519 100644 --- a/toolkit/components/url-classifier/SafeBrowsing.jsm +++ b/toolkit/components/url-classifier/SafeBrowsing.jsm @@ -385,7 +385,7 @@ var SafeBrowsing = { default: let err = "SafeBrowsing getReportURL() called with unknown kind: " + kind; - Cu.reportError(err); + console.error(err); throw err; } diff --git a/toolkit/components/urlformatter/URLFormatter.jsm b/toolkit/components/urlformatter/URLFormatter.jsm index 728debca0f18..22bf3429d47c 100644 --- a/toolkit/components/urlformatter/URLFormatter.jsm +++ b/toolkit/components/urlformatter/URLFormatter.jsm @@ -147,7 +147,7 @@ nsURLFormatterService.prototype = { if (aKey in _this._defaults) { 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 aFormat.replace(/%([A-Z_]+)%/g, replacementCallback); @@ -159,7 +159,7 @@ nsURLFormatterService.prototype = { try { format = Services.prefs.getStringPref(aPref); } catch (ex) { - Cu.reportError("formatURLPref: Couldn't get pref: " + aPref); + console.error("formatURLPref: Couldn't get pref: ", aPref); return "about:blank"; } diff --git a/toolkit/components/utils/ClientEnvironment.jsm b/toolkit/components/utils/ClientEnvironment.jsm index 25ee0cea15ef..ccd4af897c72 100644 --- a/toolkit/components/utils/ClientEnvironment.jsm +++ b/toolkit/components/utils/ClientEnvironment.jsm @@ -80,7 +80,7 @@ class ClientEnvironmentBase { try { target.main = lazy.TelemetryController.getCurrentPingData(); } catch (err) { - Cu.reportError(err); + console.error(err); } return new Proxy(target, { diff --git a/toolkit/components/utils/WindowsVersionInfo.jsm b/toolkit/components/utils/WindowsVersionInfo.jsm index 753bfe31e135..d582ed0e5b21 100644 --- a/toolkit/components/utils/WindowsVersionInfo.jsm +++ b/toolkit/components/utils/WindowsVersionInfo.jsm @@ -42,7 +42,7 @@ var WindowsVersionInfo = { if (throwOnError) { throw err; } - Cu.reportError(err); + console.error(err); return WindowsVersionInfo.UNKNOWN_VERSION_INFO; } diff --git a/toolkit/components/viewsource/content/viewSourceUtils.js b/toolkit/components/viewsource/content/viewSourceUtils.js index cf3093f255f2..b30f5137ed39 100644 --- a/toolkit/components/viewsource/content/viewSourceUtils.js +++ b/toolkit/components/viewsource/content/viewSourceUtils.js @@ -297,7 +297,7 @@ var gViewSourceUtils = { } } catch (ex) { // we failed loading it with the external editor. - Cu.reportError(ex); + console.error(ex); reject(data); } }); @@ -317,7 +317,7 @@ var gViewSourceUtils = { return editor; } catch (ex) { - Cu.reportError(ex); + console.error(ex); } return null; @@ -373,7 +373,7 @@ var gViewSourceUtils = { this.resolve(this.data); } catch (ex) { // we failed loading it with the external editor. - Cu.reportError(ex); + console.error(ex); this.reject(this.data); } finally { this.destroy(); diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index b1bffd0bce0f..0be6d3752ca3 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -38,8 +38,11 @@ window.addEventListener("load", function onload(event) { try { await snapshotFormatters[prop](snapshot[prop]); } catch (e) { - Cu.reportError( - "stack of snapshot error for about:support: " + e + ": " + e.stack + console.error( + "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; } } catch (e) { - Cu.reportError( - "stack of load error for about:support: " + e + ": " + e.stack - ); + console.error("stack of load error for about:support: ", e, ": ", e.stack); } }); diff --git a/toolkit/content/contentAreaUtils.js b/toolkit/content/contentAreaUtils.js index 5a370ef1eabe..29cdeed640f3 100644 --- a/toolkit/content/contentAreaUtils.js +++ b/toolkit/content/contentAreaUtils.js @@ -342,7 +342,7 @@ function internalSave( continueSave(); }) - .catch(Cu.reportError); + .catch(console.error); } function continueSave() { @@ -835,7 +835,7 @@ function DownloadURL(aURL, aFileName, aInitiatingDocument) { // Add the download to the list, allowing it to be managed. let list = await Downloads.getList(Downloads.ALL); list.add(download); - })().catch(Cu.reportError); + })().catch(console.error); } // We have no DOM, and can only save the URL as is. diff --git a/toolkit/content/globalOverlay.js b/toolkit/content/globalOverlay.js index c021bfe74024..718d3e6aaee4 100644 --- a/toolkit/content/globalOverlay.js +++ b/toolkit/content/globalOverlay.js @@ -113,9 +113,7 @@ function goUpdateCommand(aCommand) { goSetCommandEnabled(aCommand, enabled); } catch (e) { - Cu.reportError( - "An error occurred updating the " + aCommand + " command: " + e - ); + console.error("An error occurred updating the ", aCommand, " command: ", e); } } @@ -128,8 +126,11 @@ function goDoCommand(aCommand) { controller.doCommand(aCommand); } } catch (e) { - Cu.reportError( - "An error occurred executing the " + aCommand + " command: " + e + console.error( + "An error occurred executing the ", + aCommand, + " command: ", + e ); } } diff --git a/toolkit/content/preferencesBindings.js b/toolkit/content/preferencesBindings.js index e2e6494f9a75..f7db86247a4c 100644 --- a/toolkit/content/preferencesBindings.js +++ b/toolkit/content/preferencesBindings.js @@ -240,7 +240,7 @@ const Preferences = (window.Preferences = (function() { }); return aTarget.dispatchEvent(event); } catch (e) { - Cu.reportError(e); + console.error(e); } return false; }, @@ -441,7 +441,7 @@ const Preferences = (window.Preferences = (function() { return rv; } } catch (e) { - Cu.reportError(e); + console.error(e); } } diff --git a/toolkit/content/tests/chrome/window_browser_drop.xhtml b/toolkit/content/tests/chrome/window_browser_drop.xhtml index ab8cbacbeb47..7999f25ae310 100644 --- a/toolkit/content/tests/chrome/window_browser_drop.xhtml +++ b/toolkit/content/tests/chrome/window_browser_drop.xhtml @@ -45,7 +45,7 @@ function dropOnRemoteBrowserAsync(browser, data, shouldExpectStateChange) { } catch (ex) { if (shouldExpectStateChange) { ok(false, "Should not have gotten an exception from the dropped link handler, but got: " + ex); - Cu.reportError(ex); + console.error(ex); } } diff --git a/toolkit/content/widgets/browser-custom-element.js b/toolkit/content/widgets/browser-custom-element.js index 9417ecd8fd6d..5ce39981d107 100644 --- a/toolkit/content/widgets/browser-custom-element.js +++ b/toolkit/content/widgets/browser-custom-element.js @@ -1030,12 +1030,12 @@ this.docShell.browsingContext.useGlobalHistory = true; } catch (ex) { // 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) { - Cu.reportError(e); + console.error(e); } try { // Ensures the securityUI is initialized. diff --git a/toolkit/content/widgets/menu.js b/toolkit/content/widgets/menu.js index 0ac0edc7ec97..acd8e51c5f3f 100644 --- a/toolkit/content/widgets/menu.js +++ b/toolkit/content/widgets/menu.js @@ -286,7 +286,7 @@ } let key = document.getElementById(keyId); if (!key) { - Cu.reportError( + console.error( `Key ${keyId} of menuitem ${this.getAttribute("label")} ` + `could not be found` ); diff --git a/toolkit/content/widgets/text.js b/toolkit/content/widgets/text.js index 654afd6c2cee..3ada26b6f540 100644 --- a/toolkit/content/widgets/text.js +++ b/toolkit/content/widgets/text.js @@ -336,7 +336,7 @@ uri.scheme + ": link using \ the text-link binding."; - Cu.reportError(msg); + console.error(msg); return; } @@ -352,7 +352,7 @@ return; } } catch (ex) { - Cu.reportError(ex); + console.error(ex); } aEvent.preventDefault(); diff --git a/toolkit/crashreporter/CrashSubmit.jsm b/toolkit/crashreporter/CrashSubmit.jsm index 417250541b80..c9a4f72497de 100644 --- a/toolkit/crashreporter/CrashSubmit.jsm +++ b/toolkit/crashreporter/CrashSubmit.jsm @@ -164,7 +164,7 @@ Submitter.prototype = { }) ); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } this.notifyStatus(SUCCESS, ret); @@ -542,7 +542,7 @@ var CrashSubmit = { try { dirIter = new lazy.OS.File.DirectoryIterator(pendingDir); } catch (ex) { - Cu.reportError(ex); + console.error(ex); throw ex; } @@ -588,7 +588,7 @@ var CrashSubmit = { } } } catch (ex) { - Cu.reportError(ex); + console.error(ex); throw ex; } finally { dirIter.close(); @@ -636,7 +636,7 @@ var CrashSubmit = { } }); } catch (ex) { - Cu.reportError(ex); + console.error(ex); throw ex; } finally { dirIter.close(); diff --git a/toolkit/crashreporter/content/crashes.js b/toolkit/crashreporter/content/crashes.js index 89469f7dbe6d..8cb0551e2b7a 100644 --- a/toolkit/crashreporter/content/crashes.js +++ b/toolkit/crashreporter/content/crashes.js @@ -20,17 +20,17 @@ document.addEventListener("DOMContentLoaded", () => { document .getElementById("clearUnsubmittedReports") .addEventListener("click", () => { - clearUnsubmittedReports().catch(Cu.reportError); + clearUnsubmittedReports().catch(console.error); }); document .getElementById("submitAllUnsubmittedReports") .addEventListener("click", () => { - submitAllUnsubmittedReports().catch(Cu.reportError); + submitAllUnsubmittedReports().catch(console.error); }); document .getElementById("clearSubmittedReports") .addEventListener("click", () => { - clearSubmittedReports().catch(Cu.reportError); + clearSubmittedReports().catch(console.error); }); }); diff --git a/toolkit/modules/AppMenuNotifications.sys.mjs b/toolkit/modules/AppMenuNotifications.sys.mjs index 15a71b03eeb8..77487437ac7a 100644 --- a/toolkit/modules/AppMenuNotifications.sys.mjs +++ b/toolkit/modules/AppMenuNotifications.sys.mjs @@ -147,7 +147,7 @@ export var AppMenuNotifications = { try { action.callback(win, fromDoorhanger); } catch (error) { - Cu.reportError(error); + console.error(error); } dismiss = action.dismiss; diff --git a/toolkit/modules/AsyncPrefs.sys.mjs b/toolkit/modules/AsyncPrefs.sys.mjs index 583c0af1774f..3bbd27e47d9d 100644 --- a/toolkit/modules/AsyncPrefs.sys.mjs +++ b/toolkit/modules/AsyncPrefs.sys.mjs @@ -148,7 +148,7 @@ export class AsyncPrefsParent extends JSProcessActorParent { try { Services.prefs[methodToUse](pref, value); } catch (ex) { - Cu.reportError(ex); + console.error(ex); return Promise.reject(ex.message); } @@ -164,7 +164,7 @@ export class AsyncPrefsParent extends JSProcessActorParent { try { Services.prefs.clearUserPref(pref); } catch (ex) { - Cu.reportError(ex); + console.error(ex); return Promise.reject(ex.message); } diff --git a/toolkit/modules/BrowserUtils.sys.mjs b/toolkit/modules/BrowserUtils.sys.mjs index 07e327cc4169..66d3ca8d2587 100644 --- a/toolkit/modules/BrowserUtils.sys.mjs +++ b/toolkit/modules/BrowserUtils.sys.mjs @@ -183,9 +183,7 @@ export var BrowserUtils = { } // otherwise, fall through... } catch (ex) { - Cu.reportError( - "Invalid blob URI passed to formatURIForDisplay: " + ex - ); + console.error("Invalid blob URI passed to formatURIForDisplay: ", ex); } /* For blob URIs without an origin, fall through and use the data URI * logic (shows just "(data)", localized). */ @@ -217,7 +215,7 @@ export var BrowserUtils = { } } } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } return uri.asciiHost || uri.spec; diff --git a/toolkit/modules/CertUtils.sys.mjs b/toolkit/modules/CertUtils.sys.mjs index 523d504abe59..b8f4a900afe4 100644 --- a/toolkit/modules/CertUtils.sys.mjs +++ b/toolkit/modules/CertUtils.sys.mjs @@ -72,7 +72,7 @@ function validateCert(aCertificate, aCerts) { if (!aCertificate) { const missingCertErr = "A required certificate was not present."; - Cu.reportError(missingCertErr); + console.error(missingCertErr); throw new Ce(missingCertErr, Cr.NS_ERROR_ILLEGAL_VALUE); } @@ -113,7 +113,7 @@ function validateCert(aCertificate, aCerts) { errors.forEach(Cu.reportError.bind(Cu)); const certCheckErr = "Certificate checks failed. See previous errors for details."; - Cu.reportError(certCheckErr); + console.error(certCheckErr); throw new Ce(certCheckErr, Cr.NS_ERROR_ILLEGAL_VALUE); } } diff --git a/toolkit/modules/Console.sys.mjs b/toolkit/modules/Console.sys.mjs index 41260b97675c..0f395313d9fa 100644 --- a/toolkit/modules/Console.sys.mjs +++ b/toolkit/modules/Console.sys.mjs @@ -563,7 +563,7 @@ function sendConsoleAPIMessage(aConsole, aLevel, aFrame, aArgs, aOptions = {}) { try { consoleEvent.groupName = Array.prototype.join.call(aArgs, " "); } catch (ex) { - Cu.reportError(ex); + console.error(ex); Cu.reportError(ex.stack); return; } diff --git a/toolkit/modules/DeferredTask.sys.mjs b/toolkit/modules/DeferredTask.sys.mjs index ca738e119ed9..b8f66a50da37 100644 --- a/toolkit/modules/DeferredTask.sys.mjs +++ b/toolkit/modules/DeferredTask.sys.mjs @@ -334,7 +334,7 @@ DeferredTask.prototype = { // Indicate that the execution of the task has finished. This happens // synchronously with the previous state changes in the function. this._runningPromise = null; - })().catch(Cu.reportError) + })().catch(console.error) ); }, @@ -346,7 +346,7 @@ DeferredTask.prototype = { try { await this._taskFn(); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } finally { ChromeUtils.addProfilerMarker( "DeferredTask", diff --git a/toolkit/modules/Finder.sys.mjs b/toolkit/modules/Finder.sys.mjs index fb117414fe9d..eb27a12cdf8b 100644 --- a/toolkit/modules/Finder.sys.mjs +++ b/toolkit/modules/Finder.sys.mjs @@ -459,7 +459,7 @@ Finder.prototype = { return; } } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } diff --git a/toolkit/modules/FinderHighlighter.sys.mjs b/toolkit/modules/FinderHighlighter.sys.mjs index 3905bf1c77b2..425146646af6 100644 --- a/toolkit/modules/FinderHighlighter.sys.mjs +++ b/toolkit/modules/FinderHighlighter.sys.mjs @@ -412,7 +412,7 @@ FinderHighlighter.prototype = { try { window = this.getTopWindow(window); } catch (ex) { - Cu.reportError(ex); + console.error(ex); return; } let dict = this.getForWindow(window); diff --git a/toolkit/modules/FinderIterator.sys.mjs b/toolkit/modules/FinderIterator.sys.mjs index 4abf17c76e84..f09873bed8fb 100644 --- a/toolkit/modules/FinderIterator.sys.mjs +++ b/toolkit/modules/FinderIterator.sys.mjs @@ -179,7 +179,7 @@ export class FinderIterator { !this._areParamsEqual(this._currentParams, iterParams, allowDistance) ) { if (kDebug) { - Cu.reportError( + console.error( `We're currently iterating over '${this._currentParams.word}', not '${word}'\n` + new Error().stack ); @@ -363,7 +363,7 @@ export class FinderIterator { try { listener[callback](params); } catch (ex) { - Cu.reportError("FinderIterator Error: " + ex); + console.error("FinderIterator Error: ", ex); } } } diff --git a/toolkit/modules/FinderParent.sys.mjs b/toolkit/modules/FinderParent.sys.mjs index 91b3490c3e51..057bb4cb7c9d 100644 --- a/toolkit/modules/FinderParent.sys.mjs +++ b/toolkit/modules/FinderParent.sys.mjs @@ -87,11 +87,11 @@ FinderParent.prototype = { l[aCallback].apply(l, aArgs); } catch (e) { if (!l[aCallback]) { - Cu.reportError( + console.error( `Missing ${aCallback} callback on RemoteFinderListener` ); } else { - Cu.reportError(e); + console.error(e); } } } @@ -565,7 +565,7 @@ FinderParent.prototype = { return; } } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } diff --git a/toolkit/modules/IgnoreLists.sys.mjs b/toolkit/modules/IgnoreLists.sys.mjs index d2553c915db6..62fd0bd2fe53 100644 --- a/toolkit/modules/IgnoreLists.sys.mjs +++ b/toolkit/modules/IgnoreLists.sys.mjs @@ -84,7 +84,7 @@ class IgnoreListsManager { } // Don't throw an error just log it, just continue with no data, and hopefully // a sync will fix things later on. - Cu.reportError(ex); + console.error(ex); } return result; } diff --git a/toolkit/modules/InlineSpellChecker.sys.mjs b/toolkit/modules/InlineSpellChecker.sys.mjs index 37f01f80194d..7d70c6a89a74 100644 --- a/toolkit/modules/InlineSpellChecker.sys.mjs +++ b/toolkit/modules/InlineSpellChecker.sys.mjs @@ -26,11 +26,11 @@ InlineSpellChecker.prototype = { if (this.mRemote) { // We shouldn't get here, but let's just recover instead of bricking the // menu by throwing exceptions: - Cu.reportError(new Error("Unexpected remote spellchecker present!")); + console.error(new Error("Unexpected remote spellchecker present!")); try { this.mRemote.uninit(); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } this.mRemote = null; } diff --git a/toolkit/modules/Integration.sys.mjs b/toolkit/modules/Integration.sys.mjs index 1df048cafdd7..89136c9d2bec 100644 --- a/toolkit/modules/Integration.sys.mjs +++ b/toolkit/modules/Integration.sys.mjs @@ -146,7 +146,7 @@ var IntegrationPoint = function() { " they change when new overrides are registered.", Cr.NS_ERROR_NO_INTERFACE ); - Cu.reportError(ex); + console.error(ex); throw ex; }, }; @@ -243,7 +243,7 @@ IntegrationPoint.prototype = { combined = Object.create(combined, descriptors); } catch (ex) { // Any error will result in the current override being skipped. - Cu.reportError(ex); + console.error(ex); } } diff --git a/toolkit/modules/JSONFile.sys.mjs b/toolkit/modules/JSONFile.sys.mjs index c9bd290de568..cea569c5794e 100644 --- a/toolkit/modules/JSONFile.sys.mjs +++ b/toolkit/modules/JSONFile.sys.mjs @@ -232,7 +232,7 @@ JSONFile.prototype = { let errorNo = ex.winLastError || ex.unixErrno; this._recordTelemetry("load", errorNo ? errorNo.toString() : ""); if (!(DOMException.isInstance(ex) && ex.name == "NotFoundError")) { - Cu.reportError(ex); + console.error(ex); // Move the original file to a backup location, ignoring errors. try { @@ -244,7 +244,7 @@ JSONFile.prototype = { await IOUtils.move(this.path, uniquePath); this._recordTelemetry("load", "invalid_json"); } catch (e2) { - Cu.reportError(e2); + console.error(e2); } } @@ -256,7 +256,7 @@ JSONFile.prototype = { await IOUtils.copy(this._options.backupFile, this.path); } catch (e) { if (!(DOMException.isInstance(e) && e.name == "NotFoundError")) { - Cu.reportError(e); + console.error(e); } } @@ -275,7 +275,7 @@ JSONFile.prototype = { this._recordTelemetry("load", "used_backup"); } catch (e3) { if (!(DOMException.isInstance(e3) && e3.name == "NotFoundError")) { - Cu.reportError(e3); + console.error(e3); } } } @@ -337,7 +337,7 @@ JSONFile.prototype = { ex.result == Cr.NS_ERROR_FILE_NOT_FOUND ) ) { - Cu.reportError(ex); + console.error(ex); // Move the original file to a backup location, ignoring errors. try { let originalFile = new lazy.FileUtils.File(this.path); @@ -350,7 +350,7 @@ JSONFile.prototype = { backupFile.remove(false); originalFile.moveTo(backupFile.parent, backupFile.leafName); } catch (e2) { - Cu.reportError(e2); + console.error(e2); } } @@ -364,7 +364,7 @@ JSONFile.prototype = { backupFile.copyTo(null, basename); } catch (e) { if (e.result != Cr.NS_ERROR_FILE_NOT_FOUND) { - Cu.reportError(e); + console.error(e); } } @@ -390,7 +390,7 @@ JSONFile.prototype = { } } catch (e3) { if (e3.result != Cr.NS_ERROR_FILE_NOT_FOUND) { - Cu.reportError(e3); + console.error(e3); } } } diff --git a/toolkit/modules/JsonSchema.sys.mjs b/toolkit/modules/JsonSchema.sys.mjs index d4f7dfee1344..62b063ec8aff 100644 --- a/toolkit/modules/JsonSchema.sys.mjs +++ b/toolkit/modules/JsonSchema.sys.mjs @@ -93,7 +93,7 @@ class Validator { addSchema(schema, id) { const draft = detectSchemaDraft(schema, undefined); if (draft && this.#draft != draft) { - Cu.reportError( + console.error( `Adding a draft "${draft}" schema to a draft "${ this.#draft }" validator.` @@ -162,7 +162,7 @@ function detectSchemaDraft(schema, defaultDraft = "2019-09") { return "2020-12"; default: - Cu.reportError( + console.error( `Unexpected $schema "${$schema}", defaulting to ${defaultDraft}.` ); return defaultDraft; diff --git a/toolkit/modules/KeywordUtils.sys.mjs b/toolkit/modules/KeywordUtils.sys.mjs index d2386b45a50d..2765dd3ce969 100644 --- a/toolkit/modules/KeywordUtils.sys.mjs +++ b/toolkit/modules/KeywordUtils.sys.mjs @@ -53,7 +53,7 @@ export var KeywordUtils = { } } catch (ex) { // makeURI() throws if url is invalid. - Cu.reportError(ex); + console.error(ex); } } diff --git a/toolkit/modules/NewTabUtils.sys.mjs b/toolkit/modules/NewTabUtils.sys.mjs index 924f982fb8d0..e88f492a1e9b 100644 --- a/toolkit/modules/NewTabUtils.sys.mjs +++ b/toolkit/modules/NewTabUtils.sys.mjs @@ -137,10 +137,10 @@ function LinksStorage() { } catch (ex) { // Something went wrong in the update process, we can't recover from here, // so just clear the storage and start from scratch (dataloss!). - Cu.reportError( + console.error( "Unable to migrate the newTab storage to the current version. " + - "Restarting from scratch.\n" + - ex + "Restarting from scratch.\n", + ex ); this.clear(); } @@ -560,7 +560,7 @@ var BlockedLinks = { try { obs[methodName](...args); } catch (err) { - Cu.reportError(err); + console.error(err); } } } @@ -719,7 +719,7 @@ var PlacesProvider = { try { obs[aMethodName](this, aArg); } catch (err) { - Cu.reportError(err); + console.error(err); } } } @@ -1018,7 +1018,7 @@ var ActivityStreamProvider = { return []; } } catch (e) { - Cu.reportError(e); + console.error(e); return []; } /* Extract relevant parts needed to show this card as a highlight: @@ -2143,7 +2143,7 @@ var Links = { try { obs[methodName](this, ...args); } catch (err) { - Cu.reportError(err); + console.error(err); } } } diff --git a/toolkit/modules/OsEnvironment.sys.mjs b/toolkit/modules/OsEnvironment.sys.mjs index 6af5d9db0ca2..ef8db0b72ee1 100644 --- a/toolkit/modules/OsEnvironment.sys.mjs +++ b/toolkit/modules/OsEnvironment.sys.mjs @@ -56,7 +56,7 @@ export let OsEnvironment = { try { haveAppSourcesFeature = OsEnvironment.Policy.windowsVersionHasAppSourcesFeature(); } catch (ex) { - Cu.reportError(ex); + console.error(ex); Services.telemetry.scalarSet(appSourceScalar, "Error"); return; } @@ -69,7 +69,7 @@ export let OsEnvironment = { try { allowedAppSources = OsEnvironment.Policy.getAllowedAppSources(); } catch (ex) { - Cu.reportError(ex); + console.error(ex); Services.telemetry.scalarSet(appSourceScalar, "Error"); return; } diff --git a/toolkit/modules/PopupNotifications.sys.mjs b/toolkit/modules/PopupNotifications.sys.mjs index 55025c624716..cff108982b10 100644 --- a/toolkit/modules/PopupNotifications.sys.mjs +++ b/toolkit/modules/PopupNotifications.sys.mjs @@ -644,7 +644,7 @@ PopupNotifications.prototype = { * temporarily be hidden while the given panel is showing. */ suppressWhileOpen(panel) { - this._hidePanel().catch(Cu.reportError); + this._hidePanel().catch(console.error); panel.addEventListener("popuphidden", aEvent => { this._update(); }); @@ -739,7 +739,7 @@ PopupNotifications.prototype = { // Notifications are suppressed, ensure that the panel is hidden. if (!this._suppress) { this._suppress = true; - this._hidePanel().catch(Cu.reportError); + this._hidePanel().catch(console.error); } }, @@ -947,10 +947,10 @@ PopupNotifications.prototype = { text.secondName = tmp; } } else if (array.length > 3) { - Cu.reportError( + console.error( "Unexpected array length encountered in " + - "_formatDescriptionMessage: " + - array.length + "_formatDescriptionMessage: ", + array.length ); } return text; @@ -1081,7 +1081,7 @@ PopupNotifications.prototype = { } popupnotification.setAttribute("origin", uri); } catch (e) { - Cu.reportError(e); + console.error(e); popupnotification.removeAttribute("origin"); } } else { @@ -1642,7 +1642,7 @@ PopupNotifications.prototype = { let other = otherBrowser.ownerGlobal.PopupNotifications; if (!other) { if (ourNotifications.length) { - Cu.reportError( + console.error( "unable to swap notifications: otherBrowser doesn't support notifications" ); } @@ -1695,7 +1695,7 @@ PopupNotifications.prototype = { return n.options.eventCallback.call(n, event, ...args); } } catch (error) { - Cu.reportError(error); + console.error(error); } return undefined; }, @@ -1905,7 +1905,7 @@ PopupNotifications.prototype = { event, }); } catch (error) { - Cu.reportError(error); + console.error(error); } if (action.dismiss) { @@ -1937,7 +1937,7 @@ PopupNotifications.prototype = { source: "menucommand", }); } catch (error) { - Cu.reportError(error); + console.error(error); } if (target.action.dismiss) { diff --git a/toolkit/modules/Preferences.sys.mjs b/toolkit/modules/Preferences.sys.mjs index d4b78ae36357..83fa827c6adc 100644 --- a/toolkit/modules/Preferences.sys.mjs +++ b/toolkit/modules/Preferences.sys.mjs @@ -137,13 +137,12 @@ Preferences._set = function(prefName, prefValue) { } this._prefBranch.setIntPref(prefName, prefValue); if (prefValue % 1 != 0) { - Cu.reportError( - "Warning: setting the " + - prefName + - " pref to the " + - "non-integer number " + - prefValue + - " converted it " + + console.error( + "Warning: setting the ", + prefName, + " pref to the non-integer number ", + prefValue, + " converted it " + "to the integer number " + this.get(prefName) + "; to retain fractional precision, store non-integer " + @@ -343,7 +342,7 @@ Preferences.ignore = function(prefName, callback, thisObject) { Preferences._prefBranch.removeObserver(fullPrefName, observer); observers.splice(observers.indexOf(observer), 1); } else { - Cu.reportError( + console.error( `Attempt to stop observing a preference "${prefName}" that's not being observed` ); } diff --git a/toolkit/modules/RemotePageAccessManager.sys.mjs b/toolkit/modules/RemotePageAccessManager.sys.mjs index 3078644a450f..f21c7844be1e 100644 --- a/toolkit/modules/RemotePageAccessManager.sys.mjs +++ b/toolkit/modules/RemotePageAccessManager.sys.mjs @@ -279,11 +279,11 @@ export let RemotePageAccessManager = { aDocument ); if (!accessMapForFeature) { - Cu.reportError( - "RemotePageAccessManager does not allow access to Feature: " + - aFeature + - " for: " + - aDocument.location + console.error( + "RemotePageAccessManager does not allow access to Feature: ", + aFeature, + " for: ", + aDocument.location ); return false; diff --git a/toolkit/modules/ServiceRequest.sys.mjs b/toolkit/modules/ServiceRequest.sys.mjs index 9f3b0787ae54..ab3d9ceb42da 100644 --- a/toolkit/modules/ServiceRequest.sys.mjs +++ b/toolkit/modules/ServiceRequest.sys.mjs @@ -59,7 +59,7 @@ function recordEvent(service, source = {}) { } catch (err) { // If the telemetry throws just log the error so it doesn't break any // functionality. - Cu.reportError(err); + console.error(err); } } diff --git a/toolkit/modules/ShortcutUtils.sys.mjs b/toolkit/modules/ShortcutUtils.sys.mjs index a8a7b1a7740c..f27702aedae7 100644 --- a/toolkit/modules/ShortcutUtils.sys.mjs +++ b/toolkit/modules/ShortcutUtils.sys.mjs @@ -130,7 +130,7 @@ export var ShortcutUtils = { // Some keys might not exist in the locale file, which will throw. key = bundle.GetStringFromName(keyCode); } catch (ex) { - Cu.reportError("Error finding " + keyCode + ": " + ex); + console.error("Error finding ", keyCode, ": ", ex); key = keyCode.replace(/^VK_/, ""); } } else { diff --git a/toolkit/modules/SubDialog.sys.mjs b/toolkit/modules/SubDialog.sys.mjs index 50c1a94e74b5..54b830433482 100644 --- a/toolkit/modules/SubDialog.sys.mjs +++ b/toolkit/modules/SubDialog.sys.mjs @@ -247,7 +247,7 @@ SubDialog.prototype = { try { this._closingCallback.call(null, aEvent); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } this._closingCallback = null; } @@ -275,7 +275,7 @@ SubDialog.prototype = { try { this._closedCallback.call(null, aEvent); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } this._closedCallback = null; } @@ -618,13 +618,12 @@ SubDialog.prototype = { let maxHeight = this._window.innerHeight - frameOverhead; // Do this with a frame height in pixels... if (!frameHeight.endsWith("px")) { - Cu.reportError( - "This dialog (" + - this._frame.contentWindow.location.href + - ") " + - "set a height in non-px-non-em units ('" + - frameHeight + - "'), " + + console.error( + "This dialog (", + this._frame.contentWindow.location.href, + ") set a height in non-px-non-em units ('", + frameHeight, + "'), " + "which is likely to lead to bad sizing in in-content preferences. " + "Please consider changing this." ); diff --git a/toolkit/modules/UpdateUtils.sys.mjs b/toolkit/modules/UpdateUtils.sys.mjs index 643fc19b3dde..b7f8244bd995 100644 --- a/toolkit/modules/UpdateUtils.sys.mjs +++ b/toolkit/modules/UpdateUtils.sys.mjs @@ -57,7 +57,7 @@ export var UpdateUtils = { }); } } catch (e) { - Cu.reportError(e); + console.error(e); } } @@ -135,10 +135,9 @@ export var UpdateUtils = { } } - Cu.reportError( - FILE_UPDATE_LOCALE + - " file doesn't exist in either the " + - "application or GRE directories" + console.error( + FILE_UPDATE_LOCALE, + " file doesn't exist in either the application or GRE directories" ); return (this._locale = null); @@ -458,10 +457,10 @@ export var UpdateUtils = { await writeUpdateConfig(config); return config; } catch (e) { - Cu.reportError( + console.error( "UpdateUtils.writeUpdateConfigSetting: App update configuration " + - "file write failed. Exception: " + - e + "file write failed. Exception: ", + e ); // Re-throw the error so the caller knows that writing the value in // the app update config file failed. @@ -778,7 +777,7 @@ function readEffectiveValue(config, prefName) { if (prefTypeFns.isValid(config[prefName])) { return config[prefName]; } - Cu.reportError( + console.error( `readEffectiveValue: Got invalid value for update config's` + ` '${prefName}' value: "${config[prefName]}"` ); @@ -813,7 +812,7 @@ function readDefaultValue(config, prefName) { if (prefTypeFns.isValid(defaults[prefName])) { return defaults[prefName]; } - Cu.reportError( + console.error( `readEffectiveValue: Got invalid default value for update` + ` config's '${prefName}' value: "${defaults[prefName]}"` ); @@ -849,7 +848,7 @@ async function readUpdateConfig() { onMigrationSuccessful(); return migrationConfig; } catch (e) { - Cu.reportError("readUpdateConfig: Migration failed: " + e); + console.error("readUpdateConfig: Migration failed: ", e); } } } else { @@ -858,10 +857,10 @@ async function readUpdateConfig() { // it doesn't happen again. setUpdateConfigMigrationDone(); - Cu.reportError( + console.error( "readUpdateConfig: Unable to read app update configuration file. " + - "Exception: " + - e + "Exception: ", + e ); } return makeDefaultUpdateConfig(); @@ -948,9 +947,7 @@ function getMemoryMB() { memoryMB = Math.round(memoryMB / 1024 / 1024); } } catch (e) { - Cu.reportError( - "Error getting system info memsize property. Exception: " + e - ); + console.error("Error getting system info memsize property. Exception: ", e); } return memoryMB; } @@ -1009,7 +1006,7 @@ XPCOMUtils.defineLazyGetter(lazy, "gWinCPUArch", function aus_gWinCPUArch() { try { kernel32 = lazy.ctypes.open("Kernel32"); } catch (e) { - Cu.reportError("Unable to open kernel32! Exception: " + e); + console.error("Unable to open kernel32! Exception: ", e); } if (kernel32) { @@ -1040,7 +1037,7 @@ XPCOMUtils.defineLazyGetter(lazy, "gWinCPUArch", function aus_gWinCPUArch() { break; } } catch (e) { - Cu.reportError("Error getting processor architecture. Exception: " + e); + console.error("Error getting processor architecture. Exception: ", e); } finally { kernel32.close(); } @@ -1054,7 +1051,7 @@ XPCOMUtils.defineLazyGetter(UpdateUtils, "ABI", function() { try { abi = Services.appinfo.XPCOMABI; } catch (e) { - Cu.reportError("XPCOM ABI unknown"); + console.error("XPCOM ABI unknown"); } if (AppConstants.platform == "win") { @@ -1078,7 +1075,7 @@ XPCOMUtils.defineLazyGetter(UpdateUtils, "OSVersion", function() { " " + Services.sysinfo.getProperty("version"); } catch (e) { - Cu.reportError("OS Version unknown."); + console.error("OS Version unknown."); } if (osVersion) { @@ -1092,9 +1089,7 @@ XPCOMUtils.defineLazyGetter(UpdateUtils, "OSVersion", function() { } = lazy.WindowsVersionInfo.get(); osVersion += `.${servicePackMajor}.${servicePackMinor}.${buildNumber}`; } catch (err) { - Cu.reportError( - "Unable to retrieve windows version information: " + err - ); + console.error("Unable to retrieve windows version information: ", err); osVersion += ".unknown"; } diff --git a/toolkit/modules/WebChannel.sys.mjs b/toolkit/modules/WebChannel.sys.mjs index 730d96529b73..a2f2ccec99b7 100644 --- a/toolkit/modules/WebChannel.sys.mjs +++ b/toolkit/modules/WebChannel.sys.mjs @@ -26,7 +26,7 @@ export var WebChannelBroker = Object.create({ if (!this._channelMap.has(channel)) { this._channelMap.set(channel); } else { - Cu.reportError("Failed to register the channel. Channel already exists."); + console.error("Failed to register the channel. Channel already exists."); } }, @@ -40,7 +40,7 @@ export var WebChannelBroker = Object.create({ */ unregisterChannel(channelToRemove) { if (!this._channelMap.delete(channelToRemove)) { - Cu.reportError("Failed to unregister the channel. Channel not found."); + console.error("Failed to unregister the channel. Channel not found."); } }, @@ -215,7 +215,7 @@ WebChannel.prototype = { if (message && browsingContext && principal) { let { currentWindowGlobal } = browsingContext; if (!currentWindowGlobal) { - Cu.reportError( + console.error( "Failed to send a WebChannel message. No currentWindowGlobal." ); return; @@ -229,9 +229,9 @@ WebChannel.prototype = { principal, }); } else if (!message) { - Cu.reportError("Failed to send a WebChannel message. Message not set."); + console.error("Failed to send a WebChannel message. Message not set."); } else { - Cu.reportError("Failed to send a WebChannel message. Target invalid."); + console.error("Failed to send a WebChannel message. Target invalid."); } }, @@ -264,11 +264,11 @@ WebChannel.prototype = { }, sendingContext ); - Cu.reportError("Failed to execute WebChannel callback:"); - Cu.reportError(ex); + console.error("Failed to execute WebChannel callback:"); + console.error(ex); } } else { - Cu.reportError("No callback set for this channel."); + console.error("No callback set for this channel."); } }, }; diff --git a/toolkit/modules/subprocess/subprocess_common.sys.mjs b/toolkit/modules/subprocess/subprocess_common.sys.mjs index 873a2bc8ed9b..aa3a28fb7b1f 100644 --- a/toolkit/modules/subprocess/subprocess_common.sys.mjs +++ b/toolkit/modules/subprocess/subprocess_common.sys.mjs @@ -104,7 +104,7 @@ export class PromiseWorker extends ChromeWorker { try { listener(event.data); } catch (e) { - Cu.reportError(e); + console.error(e); } } } diff --git a/toolkit/modules/tests/modules/PromiseTestUtils.sys.mjs b/toolkit/modules/tests/modules/PromiseTestUtils.sys.mjs index f3169e014d9e..2286ac03da24 100644 --- a/toolkit/modules/tests/modules/PromiseTestUtils.sys.mjs +++ b/toolkit/modules/tests/modules/PromiseTestUtils.sys.mjs @@ -50,7 +50,7 @@ export var PromiseTestUtils = { */ init() { if (this._initialized) { - Cu.reportError("This object was already initialized."); + console.error("This object was already initialized."); return; } diff --git a/toolkit/mozapps/downloads/HelperAppDlg.jsm b/toolkit/mozapps/downloads/HelperAppDlg.jsm index 870f2cec179c..5ec97a8771f5 100644 --- a/toolkit/mozapps/downloads/HelperAppDlg.jsm +++ b/toolkit/mozapps/downloads/HelperAppDlg.jsm @@ -417,7 +417,7 @@ nsUnknownContentTypeDialog.prototype = { aLauncher.saveDestinationAvailable(result, true); }); }); - })().catch(Cu.reportError); + })().catch(console.error); }, getFinalLeafName(aLeafName, aFileExt) {