From 3a07fcf436e30132ba70fc188eb34fe9652d003e Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Tue, 27 Dec 2022 10:08:58 +0000 Subject: [PATCH] Bug 1806503 - Automatically replace Cu.reportError with console.error (browser/actors, browser/base). r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D165068 --- .eslintrc.js | 2 -- browser/actors/AboutReaderChild.sys.mjs | 2 +- browser/actors/AboutReaderParent.sys.mjs | 9 +++--- browser/actors/ClickHandlerParent.sys.mjs | 2 +- browser/actors/ContentSearchParent.sys.mjs | 4 +-- browser/actors/ContextMenuChild.sys.mjs | 2 +- browser/actors/DecoderDoctorParent.sys.mjs | 7 +++-- browser/actors/EncryptedMediaChild.sys.mjs | 2 +- browser/actors/EncryptedMediaParent.sys.mjs | 4 +-- browser/actors/LinkHandlerParent.jsm | 4 +-- browser/actors/PluginParent.jsm | 9 +++--- browser/actors/PromptParent.jsm | 2 +- browser/actors/WebRTCParent.jsm | 4 +-- .../browser-fullScreenAndPointerLock.js | 2 +- browser/base/content/browser-fullZoom.js | 2 +- browser/base/content/browser-pageActions.js | 4 +-- browser/base/content/browser-places.js | 17 ++++++----- browser/base/content/browser-siteIdentity.js | 10 +++---- .../content/browser-sitePermissionPanel.js | 4 +-- .../base/content/browser-siteProtections.js | 12 ++++---- browser/base/content/browser-sync.js | 8 ++--- browser/base/content/browser.js | 30 +++++++++---------- browser/base/content/nsContextMenu.js | 6 ++-- browser/base/content/sanitizeDialog.js | 6 ++-- browser/base/content/tabbrowser-tabs.js | 4 +-- browser/base/content/tabbrowser.js | 22 +++++++------- .../content/test/general/browser_bug676619.js | 2 +- .../browser_unknownContentType_title.js | 2 +- .../siteIdentity/browser_no_mcb_for_onions.js | 2 +- .../test/static/browser_parsable_css.js | 2 +- browser/base/content/test/zoom/head.js | 4 +-- browser/base/content/utilityOverlay.js | 2 +- browser/base/content/webrtcLegacyIndicator.js | 2 +- 33 files changed, 99 insertions(+), 97 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2221c63a6672..320cacfcb1fc 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -208,8 +208,6 @@ module.exports = { // Bug 877389 - Gradually migrate from Cu.reportError to console.error. // Report as warnings where it is not yet passing. files: [ - "browser/actors/**", - "browser/base/content/**", "browser/components/Browser*.*", "browser/components/**", "browser/extensions/report-site-issue/**", diff --git a/browser/actors/AboutReaderChild.sys.mjs b/browser/actors/AboutReaderChild.sys.mjs index 728b098a0e32..eea50dca2df7 100644 --- a/browser/actors/AboutReaderChild.sys.mjs +++ b/browser/actors/AboutReaderChild.sys.mjs @@ -56,7 +56,7 @@ export class AboutReaderChild extends JSWindowActorChild { gUrlsToDocTitle.set(this.document.URL, this.document.title); this._articlePromise = lazy.ReaderMode.parseDocument( this.document - ).catch(Cu.reportError); + ).catch(console.error); // Get the article data and cache it in the parent process. The reader mode // page will retrieve it when it has loaded. diff --git a/browser/actors/AboutReaderParent.sys.mjs b/browser/actors/AboutReaderParent.sys.mjs index 337a2d2f3e35..8ffc2ce0aaa8 100644 --- a/browser/actors/AboutReaderParent.sys.mjs +++ b/browser/actors/AboutReaderParent.sys.mjs @@ -83,7 +83,7 @@ export class AboutReaderParent extends JSWindowActorParent { try { listener.receiveMessage(message); } catch (e) { - Cu.reportError(e); + console.error(e); } } } @@ -171,8 +171,9 @@ export class AboutReaderParent extends JSWindowActorParent { this.callListeners(message); return result; } catch (ex) { - Cu.reportError( - "Error requesting favicon URL for about:reader content: " + ex + console.error( + "Error requesting favicon URL for about:reader content: ", + ex ); } @@ -332,7 +333,7 @@ export class AboutReaderParent extends JSWindowActorParent { // Pass up the error so we can navigate the browser in question to the new URL: throw e; } - Cu.reportError("Error downloading and parsing document: " + e); + console.error("Error downloading and parsing document: ", e); return null; }); } diff --git a/browser/actors/ClickHandlerParent.sys.mjs b/browser/actors/ClickHandlerParent.sys.mjs index e3ae3a02aacd..fb0484ff1830 100644 --- a/browser/actors/ClickHandlerParent.sys.mjs +++ b/browser/actors/ClickHandlerParent.sys.mjs @@ -153,7 +153,7 @@ export class ClickHandlerParent extends JSWindowActorParent { listener.onContentClick(browser, data); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } } diff --git a/browser/actors/ContentSearchParent.sys.mjs b/browser/actors/ContentSearchParent.sys.mjs index d89027ef24ce..a9c805bbb8f7 100644 --- a/browser/actors/ContentSearchParent.sys.mjs +++ b/browser/actors/ContentSearchParent.sys.mjs @@ -336,7 +336,7 @@ export let ContentSearch = { fieldname: browserData.controller.formHistoryParam, value: entry.value, source: entry.engineName, - }).catch(err => Cu.reportError("Error adding form history entry: " + err)); + }).catch(err => console.error("Error adding form history entry: ", err)); return true; }, @@ -380,7 +380,7 @@ export let ContentSearch = { try { await this["_on" + event.type](event); } catch (err) { - Cu.reportError(err); + console.error(err); } finally { this._currentEventPromise = null; diff --git a/browser/actors/ContextMenuChild.sys.mjs b/browser/actors/ContextMenuChild.sys.mjs index 9071b16e0f17..fd2d5fb4f12c 100644 --- a/browser/actors/ContextMenuChild.sys.mjs +++ b/browser/actors/ContextMenuChild.sys.mjs @@ -277,7 +277,7 @@ export class ContextMenuChild extends JSWindowActorChild { let imageName = url.substr(url.lastIndexOf("/") + 1); return Promise.resolve({ failed: false, dataURL, imageName }); } catch (e) { - Cu.reportError(e); + console.error(e); } } diff --git a/browser/actors/DecoderDoctorParent.sys.mjs b/browser/actors/DecoderDoctorParent.sys.mjs index 6c309d78d860..8f6fab55fbcc 100644 --- a/browser/actors/DecoderDoctorParent.sys.mjs +++ b/browser/actors/DecoderDoctorParent.sys.mjs @@ -112,8 +112,9 @@ export class DecoderDoctorParent extends JSWindowActorParent { try { parsedData = JSON.parse(aMessage.data); } catch (ex) { - Cu.reportError( - "Malformed Decoder Doctor message with data: " + aMessage.data + console.error( + "Malformed Decoder Doctor message with data: ", + aMessage.data ); return; } @@ -190,7 +191,7 @@ export class DecoderDoctorParent extends JSWindowActorParent { } } } else if (!decodeIssue) { - Cu.reportError( + console.error( "Malformed Decoder Doctor unsolved message with no formats nor decode issue" ); return; diff --git a/browser/actors/EncryptedMediaChild.sys.mjs b/browser/actors/EncryptedMediaChild.sys.mjs index 4ed0423d34f8..7db643df67f1 100644 --- a/browser/actors/EncryptedMediaChild.sys.mjs +++ b/browser/actors/EncryptedMediaChild.sys.mjs @@ -106,7 +106,7 @@ export class EncryptedMediaChild extends JSWindowActorChild { try { parsedData = JSON.parse(aData); } catch (ex) { - Cu.reportError("Malformed EME video message with data: " + aData); + console.error("Malformed EME video message with data: ", aData); return; } const { status } = parsedData; diff --git a/browser/actors/EncryptedMediaParent.sys.mjs b/browser/actors/EncryptedMediaParent.sys.mjs index 740808561efa..46a76ccb28ba 100644 --- a/browser/actors/EncryptedMediaParent.sys.mjs +++ b/browser/actors/EncryptedMediaParent.sys.mjs @@ -73,7 +73,7 @@ export class EncryptedMediaParent extends JSWindowActorParent { try { parsedData = JSON.parse(aMessage.data); } catch (ex) { - Cu.reportError("Malformed EME video message with data: " + aMessage.data); + console.error("Malformed EME video message with data: ", aMessage.data); return; } let { status, keySystem } = parsedData; @@ -129,7 +129,7 @@ export class EncryptedMediaParent extends JSWindowActorParent { // about it. return; default: - Cu.reportError( + console.error( new Error( "Unknown message ('" + status + diff --git a/browser/actors/LinkHandlerParent.jsm b/browser/actors/LinkHandlerParent.jsm index 5a86699503db..1b6db6c80305 100644 --- a/browser/actors/LinkHandlerParent.jsm +++ b/browser/actors/LinkHandlerParent.jsm @@ -124,7 +124,7 @@ class LinkHandlerParent extends JSWindowActorParent { try { iconURI = Services.io.newURI(iconURL); } catch (ex) { - Cu.reportError(ex); + console.error(ex); return; } if (iconURI.scheme != "data") { @@ -149,7 +149,7 @@ class LinkHandlerParent extends JSWindowActorParent { iconURI ); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } diff --git a/browser/actors/PluginParent.jsm b/browser/actors/PluginParent.jsm index 9cc923973297..21e15bbf5c17 100644 --- a/browser/actors/PluginParent.jsm +++ b/browser/actors/PluginParent.jsm @@ -46,7 +46,7 @@ const PluginManager = { !propertyBag.hasKey("pluginDumpID") || !propertyBag.hasKey("pluginName") ) { - Cu.reportError("PluginManager can not read plugin information."); + console.error("PluginManager can not read plugin information."); return; } @@ -85,7 +85,7 @@ const PluginManager = { submitCrashReport(pluginCrashID, keyVals = {}) { let report = this.getCrashReport(pluginCrashID); if (!report) { - Cu.reportError( + console.error( `Could not find plugin dump IDs for ${JSON.stringify(pluginCrashID)}.` + `It is possible that a report was already submitted.` ); @@ -119,8 +119,9 @@ class PluginParent extends JSWindowActorParent { break; default: - Cu.reportError( - "PluginParent did not expect to handle message " + msg.name + console.error( + "PluginParent did not expect to handle message ", + msg.name ); break; } diff --git a/browser/actors/PromptParent.jsm b/browser/actors/PromptParent.jsm index 0208b9d73b48..bc775897ed3f 100644 --- a/browser/actors/PromptParent.jsm +++ b/browser/actors/PromptParent.jsm @@ -238,7 +238,7 @@ class PromptParent extends JSWindowActorParent { return promise; } catch (ex) { - Cu.reportError(ex); + console.error(ex); onPromptClose(true); } diff --git a/browser/actors/WebRTCParent.jsm b/browser/actors/WebRTCParent.jsm index c7e9331d2ec7..32d97d44e403 100644 --- a/browser/actors/WebRTCParent.jsm +++ b/browser/actors/WebRTCParent.jsm @@ -79,7 +79,7 @@ class WebRTCParent extends JSWindowActorParent { return false; } } catch (err) { - Cu.reportError(`error in PeerConnection blocker: ${err.message}`); + console.error(`error in PeerConnection blocker: ${err.message}`); } } return true; @@ -1017,7 +1017,7 @@ function prompt(aActor, aBrowser, aRequest) { // No preview for you. return; } - Cu.reportError( + console.error( `error in preview: ${err.message} ${err.constraint}` ); } diff --git a/browser/base/content/browser-fullScreenAndPointerLock.js b/browser/base/content/browser-fullScreenAndPointerLock.js index b9fec084f37d..65e0bea37958 100644 --- a/browser/base/content/browser-fullScreenAndPointerLock.js +++ b/browser/base/content/browser-fullScreenAndPointerLock.js @@ -382,7 +382,7 @@ var FullScreen = { */ shiftMacToolbarDown(shiftSize) { if (typeof shiftSize !== "number") { - Cu.reportError("Tried to shift the toolbar by a non-numeric distance."); + console.error("Tried to shift the toolbar by a non-numeric distance."); return; } diff --git a/browser/base/content/browser-fullZoom.js b/browser/base/content/browser-fullZoom.js index 1f39986d8603..28cab745fab8 100644 --- a/browser/base/content/browser-fullZoom.js +++ b/browser/base/content/browser-fullZoom.js @@ -382,7 +382,7 @@ var FullZoom = { try { browser.sendMessageToActor(name, {}, "Pdfjs"); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } }, diff --git a/browser/base/content/browser-pageActions.js b/browser/base/content/browser-pageActions.js index 9efad331bda5..3a4040fef10a 100644 --- a/browser/base/content/browser-pageActions.js +++ b/browser/base/content/browser-pageActions.js @@ -346,7 +346,7 @@ var BrowserPageActions = { PanelMultiView.openPopup(panelNode, anchorNode, { position: "bottomright topright", triggerEvent: event, - }).catch(Cu.reportError); + }).catch(console.error); }, _makeActivatedActionPanelForAction(action) { @@ -923,7 +923,7 @@ var BrowserPageActions = { PanelMultiView.openPopup(this.panelNode, this.mainButtonNode, { position: "bottomright topright", triggerEvent: event, - }).catch(Cu.reportError); + }).catch(console.error); }, /** diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index 22f664bdb73d..8ed61aef321e 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -100,14 +100,14 @@ var StarUI = { if (removeBookmarksOnPopupHidden && guidsForRemoval) { if (this._isNewBookmark) { - PlacesTransactions.undo().catch(Cu.reportError); + PlacesTransactions.undo().catch(console.error); break; } // Remove all bookmarks for the bookmark's url, this also removes // the tags for the url. PlacesTransactions.Remove(guidsForRemoval) .transact() - .catch(Cu.reportError); + .catch(console.error); } else if (this._isNewBookmark) { this.showConfirmation(); } @@ -303,7 +303,7 @@ var StarUI = { let canvas = PageThumbs.createCanvas(window); PageThumbs.captureToCanvas(gBrowser.selectedBrowser, canvas).catch(e => - Cu.reportError(e) + console.error(e) ); document.mozSetImageElement("editBookmarkPanelImageCanvas", canvas); }, @@ -465,7 +465,7 @@ var PlacesCommandHook = { info.title = info.title || url.href; charset = browser.characterSet; } catch (e) { - Cu.reportError(e); + console.error(e); } if (showEditUI) { @@ -479,7 +479,7 @@ var PlacesCommandHook = { if (charset) { PlacesUIUtils.setCharsetForPage(url, charset, window).catch( - Cu.reportError + console.error ); } } @@ -1767,7 +1767,7 @@ var BookmarkingUI = { PlacesUtils.bookmarks .fetch({ url: this._uri }, b => guids.add(b.guid), { concurrent: true }) - .catch(Cu.reportError) + .catch(console.error) .then(() => { if (pendingUpdate != this._pendingUpdate) { return; @@ -1799,8 +1799,9 @@ var BookmarkingUI = { ); this._hasBookmarksObserver = true; } catch (ex) { - Cu.reportError( - "BookmarkingUI failed adding a bookmarks observer: " + ex + console.error( + "BookmarkingUI failed adding a bookmarks observer: ", + ex ); } } diff --git a/browser/base/content/browser-siteIdentity.js b/browser/base/content/browser-siteIdentity.js index 287e0d000ce5..f90be2d0c2dd 100644 --- a/browser/base/content/browser-siteIdentity.js +++ b/browser/base/content/browser-siteIdentity.js @@ -449,7 +449,7 @@ var gIdentityHandler = { removeCertException() { if (!this._uriHasHost) { - Cu.reportError( + console.error( "Trying to revoke a cert exception on a URI without a host?" ); return; @@ -626,9 +626,9 @@ var gIdentityHandler = { ); return principal.isOriginPotentiallyTrustworthy; } catch (error) { - Cu.reportError( - "Error while computing isPotentiallyTrustWorthy for pdf viewer page: " + - error + console.error( + "Error while computing isPotentiallyTrustWorthy for pdf viewer page: ", + error ); return false; } @@ -1209,7 +1209,7 @@ var gIdentityHandler = { PanelMultiView.openPopup(this._identityPopup, this._identityIconBox, { position: "bottomleft topleft", triggerEvent: event, - }).catch(Cu.reportError); + }).catch(console.error); }, onPopupShown(event) { diff --git a/browser/base/content/browser-sitePermissionPanel.js b/browser/base/content/browser-sitePermissionPanel.js index 8caf10156b3c..2ae8e1b28948 100644 --- a/browser/base/content/browser-sitePermissionPanel.js +++ b/browser/base/content/browser-sitePermissionPanel.js @@ -247,7 +247,7 @@ var gPermissionPanel = { PanelMultiView.openPopup(this._permissionPopup, this._popupAnchor, { position: this._popupPosition, triggerEvent: event, - }).catch(Cu.reportError); + }).catch(console.error); }, /** @@ -855,7 +855,7 @@ var gPermissionPanel = { } let lastAccess = new Date(lastAccessStr); if (isNaN(lastAccess)) { - Cu.reportError("Invalid timestamp for last geolocation access"); + console.error("Invalid timestamp for last geolocation access"); return; } diff --git a/browser/base/content/browser-siteProtections.js b/browser/base/content/browser-siteProtections.js index 7126010ccf51..42aa7b9e9ca4 100644 --- a/browser/base/content/browser-siteProtections.js +++ b/browser/base/content/browser-siteProtections.js @@ -611,7 +611,7 @@ let ThirdPartyCookies = new (class ThirdPartyCookies extends ProtectionCategory case Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN: return "cookiesfromunvisitedsitesblocked"; default: - Cu.reportError( + console.error( `Error: Unknown cookieBehavior pref observed: ${this.behaviorPref}` ); // fall through @@ -684,7 +684,7 @@ let ThirdPartyCookies = new (class ThirdPartyCookies extends ProtectionCategory label = "contentBlocking.cookies.blockingTrackers3.label"; break; default: - Cu.reportError( + console.error( `Error: Unknown cookieBehavior pref observed: ${this.behaviorPref}` ); break; @@ -781,7 +781,7 @@ let ThirdPartyCookies = new (class ThirdPartyCookies extends ProtectionCategory : "protections.blocking.cookies.trackers.title"; break; default: - Cu.reportError( + console.error( `Error: Unknown cookieBehavior pref when updating subview: ${this.behaviorPref}` ); break; @@ -2361,7 +2361,7 @@ var gProtectionsHandler = { position: "bottomleft topleft", triggerEvent: event, } - ).catch(Cu.reportError); + ).catch(console.error); }, showSiteNotWorkingView() { @@ -2487,7 +2487,7 @@ var gProtectionsHandler = { .then(response => { this._protectionsPopupSendReportButton.disabled = false; if (!response.ok) { - Cu.reportError( + console.error( `Content Blocking report to ${reportEndpoint} failed with status ${response.status}` ); this._protectionsPopupSiteNotWorkingReportError.hidden = false; @@ -2499,7 +2499,7 @@ var gProtectionsHandler = { ); } }) - .catch(Cu.reportError); + .catch(console.error); }, onSendReportClicked() { diff --git a/browser/base/content/browser-sync.js b/browser/base/content/browser-sync.js index 8930211c473e..d24fcb99d396 100644 --- a/browser/base/content/browser-sync.js +++ b/browser/base/content/browser-sync.js @@ -73,7 +73,7 @@ this.SyncedTabsPanelList = class SyncedTabsPanelList { } // force a background sync. SyncedTabs.syncTabs().catch(ex => { - Cu.reportError(ex); + console.error(ex); }); this.deck.toggleAttribute("syncingtabs", true); // show the current list - it will be updated by our observer. @@ -99,7 +99,7 @@ this.SyncedTabsPanelList = class SyncedTabsPanelList { return this.__showSyncedTabs(paginationInfo); }, e => { - Cu.reportError(e); + console.error(e); } ); } @@ -176,7 +176,7 @@ this.SyncedTabsPanelList = class SyncedTabsPanelList { this.tabsList.appendChild(fragment); }) .catch(err => { - Cu.reportError(err); + console.error(err); }) .then(() => { // an observer for tests. @@ -574,7 +574,7 @@ var gSync = { observe(subject, topic, data) { if (!this._initialized) { - Cu.reportError("browser-sync observer called after unload: " + topic); + console.error("browser-sync observer called after unload: ", topic); return; } switch (topic) { diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index a01e149b3b0d..a970041261e7 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -435,7 +435,7 @@ XPCOMUtils.defineLazyGetter(this, "PopupNotifications", () => { { shouldSuppress } ); } catch (ex) { - Cu.reportError(ex); + console.error(ex); return null; } }); @@ -1847,7 +1847,7 @@ var gBrowserInit = { try { gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, tabToAdopt); } catch (e) { - Cu.reportError(e); + console.error(e); } // Clear the reference to the tab once its adoption has been completed. @@ -1966,7 +1966,7 @@ var gBrowserInit = { BookmarkingUI.init(); BrowserSearch.delayedStartupInit(); gProtectionsHandler.init(); - HomePage.delayedStartup().catch(Cu.reportError); + HomePage.delayedStartup().catch(console.error); let safeMode = document.getElementById("helpSafeMode"); if (Services.appinfo.inSafeMode) { @@ -2352,7 +2352,7 @@ var gBrowserInit = { triggeringRemoteType, }); } catch (e) { - Cu.reportError(e); + console.error(e); } window.focus(); @@ -2440,7 +2440,7 @@ var gBrowserInit = { } Services.telemetry.setEventRecordingEnabled("downloads", true); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } }, { timeout: 10000 } @@ -3151,7 +3151,7 @@ function loadURI( allowInheritPrincipal, }); } catch (e) { - Cu.reportError(e); + console.error(e); } } @@ -3732,7 +3732,7 @@ function openHomeDialog(aURL) { ); if (pressedVal == 0) { - HomePage.set(aURL).catch(Cu.reportError); + HomePage.set(aURL).catch(console.error); } } @@ -4420,7 +4420,7 @@ const BrowserSearch = { this._updateURLBarPlaceholderFromDefaultEngine( PrivateBrowsingUtils.isWindowPrivate(window), false - ).catch(Cu.reportError); + ).catch(console.error); }, }; @@ -6243,7 +6243,7 @@ nsBrowserAccess.prototype = { openURI(aURI, aOpenWindowInfo, aWhere, aFlags, aTriggeringPrincipal, aCsp) { if (!aURI) { - Cu.reportError("openURI should only be called with a valid URI"); + console.error("openURI should only be called with a valid URI"); throw Components.Exception("", Cr.NS_ERROR_FAILURE); } return this.getContentWindowOrOpenURI( @@ -6270,7 +6270,7 @@ nsBrowserAccess.prototype = { var isExternal = !!(aFlags & Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL); if (aOpenWindowInfo && isExternal) { - Cu.reportError( + console.error( "nsBrowserAccess.openURI did not expect aOpenWindowInfo to be " + "passed if the context is OPEN_EXTERNAL." ); @@ -6360,7 +6360,7 @@ nsBrowserAccess.prototype = { // context for a newly opened window is ready. browsingContext = null; } catch (ex) { - Cu.reportError(ex); + console.error(ex); } break; case Ci.nsIBrowserDOMWindow.OPEN_NEWTAB: { @@ -7272,7 +7272,7 @@ function middleMousePaste(event) { } catch (ex) { // Things may go wrong when adding url to session history, // but don't let that interfere with the loading of the url. - Cu.reportError(ex); + console.error(ex); } if ( @@ -8977,7 +8977,7 @@ var MousePosTracker = { try { this._callListener(listener); } catch (e) { - Cu.reportError(e); + console.error(e); } }); }, @@ -9176,7 +9176,7 @@ var PanicButtonNotifier = { let anchor = widget.anchor.icon; popup.openPopup(anchor, popup.getAttribute("position")); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } }, close() { @@ -9799,7 +9799,7 @@ var gDialogBox = { try { await this._open(uri, args); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } finally { let dialog = document.getElementById("window-modal-dialog"); if (dialog.open) { diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index 3b7015da0a6a..6615119d8e5a 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -2287,14 +2287,14 @@ class nsContextMenu { } bookmarkThisPage() { - window.top.PlacesCommandHook.bookmarkPage().catch(Cu.reportError); + window.top.PlacesCommandHook.bookmarkPage().catch(console.error); } bookmarkLink() { window.top.PlacesCommandHook.bookmarkLink( this.linkURL, this.linkTextStr - ).catch(Cu.reportError); + ).catch(console.error); } addBookmarkForFrame() { @@ -2302,7 +2302,7 @@ class nsContextMenu { this.actor.getFrameTitle(this.targetIdentifier).then(title => { window.top.PlacesCommandHook.bookmarkLink(uri.spec, title).catch( - Cu.reportError + console.error ); }); } diff --git a/browser/base/content/sanitizeDialog.js b/browser/base/content/sanitizeDialog.js index 3429f17289e8..62b3f3b2c8ed 100644 --- a/browser/base/content/sanitizeDialog.js +++ b/browser/base/content/sanitizeDialog.js @@ -131,12 +131,12 @@ var gSanitizePromptDialog = { range, }; Sanitizer.sanitize(null, options) - .catch(Cu.reportError) + .catch(console.error) .then(() => window.close()) - .catch(Cu.reportError); + .catch(console.error); event.preventDefault(); } catch (er) { - Cu.reportError("Exception during sanitize: " + er); + console.error("Exception during sanitize: ", er); } }, diff --git a/browser/base/content/tabbrowser-tabs.js b/browser/base/content/tabbrowser-tabs.js index fdd727a7e485..b3e2d56baadf 100644 --- a/browser/base/content/tabbrowser-tabs.js +++ b/browser/base/content/tabbrowser-tabs.js @@ -501,12 +501,12 @@ // since we can update the image during the dnd. PageThumbs.captureToCanvas(browser, canvas) .then(captureListener) - .catch(e => Cu.reportError(e)); + .catch(e => console.error(e)); } else { // For the non e10s case we can just use PageThumbs // sync, so let's use the canvas for setDragImage. PageThumbs.captureToCanvas(browser, canvas).catch(e => - Cu.reportError(e) + console.error(e) ); dragImageOffset = dragImageOffset * scale; } diff --git a/browser/base/content/tabbrowser.js b/browser/base/content/tabbrowser.js index 21711756af71..96b4ed11d45f 100644 --- a/browser/base/content/tabbrowser.js +++ b/browser/base/content/tabbrowser.js @@ -927,7 +927,7 @@ } } catch (e) { // don't inhibit other listeners - Cu.reportError(e); + console.error(e); } } } @@ -1018,7 +1018,7 @@ description: aDescription, previewImageURL: aPreviewImage, }; - PlacesUtils.history.update(pageInfo).catch(Cu.reportError); + PlacesUtils.history.update(pageInfo).catch(console.error); } }, @@ -2837,8 +2837,8 @@ } } } catch (e) { - Cu.reportError("Failed to create tab"); - Cu.reportError(e); + console.error("Failed to create tab"); + console.error(e); t.remove(); if (t.linkedBrowser) { this._tabFilters.delete(t); @@ -2922,7 +2922,7 @@ triggeringRemoteType, }); } catch (ex) { - Cu.reportError(ex); + console.error(ex); } } } @@ -3627,7 +3627,7 @@ } } } catch (e) { - Cu.reportError(e); + console.error(e); } return false; }, @@ -3721,7 +3721,7 @@ this.removeTab(lastToClose, aParams); } } catch (e) { - Cu.reportError(e); + console.error(e); } this._clearMultiSelectionLocked = false; @@ -4619,12 +4619,12 @@ addProgressListener(aListener) { if (arguments.length != 1) { - Cu.reportError( + console.error( "gBrowser.addProgressListener was " + "called with a second argument, " + "which is not supported. See bug " + - "608628. Call stack: " + - new Error().stack + "608628. Call stack: ", + new Error().stack ); } @@ -5183,7 +5183,7 @@ this.selectedTab = selectedTabs.at(-1); } } catch (e) { - Cu.reportError(e); + console.error(e); } this._clearMultiSelectionLocked = false; diff --git a/browser/base/content/test/general/browser_bug676619.js b/browser/base/content/test/general/browser_bug676619.js index d2c2714ca343..ae915a33086d 100644 --- a/browser/base/content/test/general/browser_bug676619.js +++ b/browser/base/content/test/general/browser_bug676619.js @@ -171,7 +171,7 @@ async function setDownloadDir() { try { await IOUtils.remove(tmpDir, { recursive: true }); } catch (e) { - Cu.reportError(e); + console.error(e); } Services.prefs.clearUserPref("browser.download.folderList"); Services.prefs.clearUserPref("browser.download.dir"); diff --git a/browser/base/content/test/general/browser_unknownContentType_title.js b/browser/base/content/test/general/browser_unknownContentType_title.js index 33fab050886e..b12ceef6aa1e 100644 --- a/browser/base/content/test/general/browser_unknownContentType_title.js +++ b/browser/base/content/test/general/browser_unknownContentType_title.js @@ -27,7 +27,7 @@ add_setup(async function() { try { await IOUtils.remove(tmpDir, { recursive: true }); } catch (e) { - Cu.reportError(e); + console.error(e); } Services.prefs.clearUserPref("browser.download.folderList"); Services.prefs.clearUserPref("browser.download.dir"); diff --git a/browser/base/content/test/siteIdentity/browser_no_mcb_for_onions.js b/browser/base/content/test/siteIdentity/browser_no_mcb_for_onions.js index 5336cd807fe2..a35ce05e12ef 100644 --- a/browser/base/content/test/siteIdentity/browser_no_mcb_for_onions.js +++ b/browser/base/content/test/siteIdentity/browser_no_mcb_for_onions.js @@ -30,7 +30,7 @@ add_task(async function allowOnionMixedContent() { const tab = await BrowserTestUtils.openNewForegroundTab( gBrowser, TEST_URL - ).catch(Cu.reportError); + ).catch(console.error); const browser = gBrowser.getBrowserForTab(tab); await assertMixedContentBlockingState(browser, { diff --git a/browser/base/content/test/static/browser_parsable_css.js b/browser/base/content/test/static/browser_parsable_css.js index 40d1207f725c..191ac620eb45 100644 --- a/browser/base/content/test/static/browser_parsable_css.js +++ b/browser/base/content/test/static/browser_parsable_css.js @@ -389,7 +389,7 @@ function chromeFileExists(aURI) { } catch (e) { if (e.result != Cr.NS_ERROR_FILE_NOT_FOUND) { dump("Checking " + aURI + ": " + e + "\n"); - Cu.reportError(e); + console.error(e); } } return available > 0; diff --git a/browser/base/content/test/zoom/head.js b/browser/base/content/test/zoom/head.js index ca0459e83e6b..d07247118bdb 100644 --- a/browser/base/content/test/zoom/head.js +++ b/browser/base/content/test/zoom/head.js @@ -76,7 +76,7 @@ var FullZoomHelper = { resolve(value); }, handleError(error) { - Cu.reportError(error); + console.error(error); }, }); }); @@ -179,7 +179,7 @@ var FullZoomHelper = { failAndContinue: function failAndContinue(func) { return function(err) { - Cu.reportError(err); + console.error(err); ok(false, err); func(); }; diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js index 27cd8c709400..43846a36b254 100644 --- a/browser/base/content/utilityOverlay.js +++ b/browser/base/content/utilityOverlay.js @@ -329,7 +329,7 @@ function openLinkIn(url, where, params) { ); } else { if (!aInitiatingDoc) { - Cu.reportError( + console.error( "openUILink/openLinkIn was called with " + "where == 'save' but without initiatingDoc. See bug 814264." ); diff --git a/browser/base/content/webrtcLegacyIndicator.js b/browser/base/content/webrtcLegacyIndicator.js index 1022ea95c035..e75b4f3dab6f 100644 --- a/browser/base/content/webrtcLegacyIndicator.js +++ b/browser/base/content/webrtcLegacyIndicator.js @@ -68,7 +68,7 @@ function updateIndicatorState() { break; default: if (ssi) { - Cu.reportError(`Unknown showScreenSharingIndicator: ${ssi}`); + console.error(`Unknown showScreenSharingIndicator: ${ssi}`); } ssL10nId = ""; }