Bug 1811334 - Automatically replace Cu.reportError with console.error (most of browser/components). r=settings-reviewers,mconley

Differential Revision: https://phabricator.services.mozilla.com/D167297
This commit is contained in:
Mark Banner 2023-01-20 17:49:21 +00:00
Родитель ac470c9e71
Коммит a94fe03b9d
78 изменённых файлов: 284 добавлений и 289 удалений

Просмотреть файл

@ -208,11 +208,10 @@ module.exports = {
// Bug 877389 - Gradually migrate from Cu.reportError to console.error.
// Report as warnings where it is not yet passing.
files: [
"browser/components/**",
"dom/push/test/mockpushserviceparent.js",
"browser/components/extensions/**",
"toolkit/**",
],
excludedFiles: ["browser/components/Browser*.*"],
rules: {
"mozilla/no-cu-reportError": "off",
},

Просмотреть файл

@ -2214,7 +2214,7 @@ var CustomizableUIInternal = {
try {
aWidget.onClick.call(null, aEvent);
} catch (e) {
Cu.reportError(e);
console.error(e);
}
} else {
// XXXunf Need to think this through more, and formalize.
@ -2951,7 +2951,7 @@ var CustomizableUIInternal = {
}
},
err => {
Cu.reportError(err);
console.error(err);
}
);
}
@ -3125,7 +3125,7 @@ var CustomizableUIInternal = {
aArgs
);
} catch (e) {
Cu.reportError(e);
console.error(e);
return undefined;
}
};

Просмотреть файл

@ -572,7 +572,7 @@ if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) {
promise.then(function() {
let otherWindow = Services.wm.getMostRecentWindow("navigator:browser");
if (otherWindow.closed) {
Cu.reportError("Got a closed window!");
console.error("Got a closed window!");
}
if (otherWindow.PanicButtonNotifier) {
otherWindow.PanicButtonNotifier.notify();

Просмотреть файл

@ -1078,7 +1078,7 @@ CustomizeMode.prototype = {
try {
item = this.unwrapToolbarItem(aWrapper);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
resolve(item);
});

Просмотреть файл

@ -234,7 +234,7 @@ var AssociatedToNode = class {
// Any exception in the blocker will cancel the operation.
blockers.add(
promise.catch(ex => {
Cu.reportError(ex);
console.error(ex);
return true;
})
);
@ -253,7 +253,7 @@ var AssociatedToNode = class {
]);
cancel = cancel || results.some(result => result === false);
} catch (ex) {
Cu.reportError(
console.error(
new Error(`One of the blockers for ${eventName} timed out.`)
);
return true;
@ -656,7 +656,7 @@ var PanelMultiView = class extends AssociatedToNode {
* subview when a "title" attribute is not specified.
*/
showSubView(viewIdOrNode, anchor) {
this._showSubView(viewIdOrNode, anchor).catch(Cu.reportError);
this._showSubView(viewIdOrNode, anchor).catch(console.error);
}
async _showSubView(viewIdOrNode, anchor) {
let viewNode =
@ -664,19 +664,19 @@ var PanelMultiView = class extends AssociatedToNode {
? PanelMultiView.getViewNode(this.document, viewIdOrNode)
: viewIdOrNode;
if (!viewNode) {
Cu.reportError(new Error(`Subview ${viewIdOrNode} doesn't exist.`));
console.error(new Error(`Subview ${viewIdOrNode} doesn't exist.`));
return;
}
if (!this.openViews.length) {
Cu.reportError(new Error(`Cannot show a subview in a closed panel.`));
console.error(new Error(`Cannot show a subview in a closed panel.`));
return;
}
let prevPanelView = this.openViews[this.openViews.length - 1];
let nextPanelView = PanelView.forNode(viewNode);
if (this.openViews.includes(nextPanelView)) {
Cu.reportError(new Error(`Subview ${viewNode.id} is already open.`));
console.error(new Error(`Subview ${viewNode.id} is already open.`));
return;
}
@ -753,7 +753,7 @@ var PanelMultiView = class extends AssociatedToNode {
* Navigates backwards by sliding out the most recent subview.
*/
goBack() {
this._goBack().catch(Cu.reportError);
this._goBack().catch(console.error);
}
async _goBack() {
if (this.openViews.length < 2) {

Просмотреть файл

@ -228,7 +228,7 @@ const PanelUI = {
await PanelMultiView.openPopup(this.panel, anchor, {
triggerEvent: domEvent,
});
})().catch(Cu.reportError);
})().catch(console.error);
},
/**
@ -408,13 +408,14 @@ const PanelUI = {
let viewNode = PanelMultiView.getViewNode(document, aViewId);
if (!viewNode) {
Cu.reportError("Could not show panel subview with id: " + aViewId);
console.error("Could not show panel subview with id: ", aViewId);
return;
}
if (!aAnchor) {
Cu.reportError(
"Expected an anchor when opening subview with id: " + aViewId
console.error(
"Expected an anchor when opening subview with id: ",
aViewId
);
return;
}
@ -487,7 +488,7 @@ const PanelUI = {
triggerEvent: aEvent,
});
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
if (viewShown) {

Просмотреть файл

@ -20,7 +20,7 @@ add_task(function testAddbrokenViewWidget() {
CustomizableUI.createWidget(widgetSpec);
CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_NAVBAR);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
noError = false;
}
ok(
@ -32,7 +32,7 @@ add_task(function testAddbrokenViewWidget() {
try {
CustomizableUI.destroyWidget(kWidgetId);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
noError = false;
}
ok(

Просмотреть файл

@ -21,7 +21,7 @@ add_task(function() {
try {
CustomizableUI.destroyWidget(kWidget1Id);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
noError = false;
}
ok(
@ -43,7 +43,7 @@ add_task(function() {
try {
CustomizableUI.destroyWidget(kWidget2Id);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
noError = false;
}
ok(

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function() {
CustomizableUI.removeWidgetFromArea(kWidgetId);
} catch (ex) {
noError = false;
Cu.reportError(ex);
console.error(ex);
}
ok(noError, "Shouldn't throw an error removing a destroyed widget.");
});

Просмотреть файл

@ -14,7 +14,7 @@ registerCleanupFunction(() => {
CustomizableUI.destroyWidget(kTestWidget);
CustomizableUI.destroyWidget(kUnregisterAreaTestWidget);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
});

Просмотреть файл

@ -25,7 +25,7 @@ add_task(async function() {
"No separator in the palette."
);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
ok(false, "Shouldn't throw an exception moving an item to the navbar.");
} finally {
await endCustomizing();

Просмотреть файл

@ -17,7 +17,7 @@ add_task(async function addOverflowingToolbar() {
CustomizableUI.destroyWidget(id);
}
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
});

Просмотреть файл

@ -93,7 +93,7 @@ DistributionCustomizer.prototype = {
Services.prefs.clearUserPref(PREF_CACHED_FILE_EXISTENCE);
} else {
// Unable to parse INI.
Cu.reportError("Unable to parse distribution.ini");
console.error("Unable to parse distribution.ini");
}
}
this.__defineGetter__("_ini", () => ini);
@ -264,7 +264,7 @@ DistributionCustomizer.prototype = {
Services.scriptSecurityManager.getSystemPrincipal()
);
} catch (e) {
Cu.reportError(e);
console.error(e);
}
}

Просмотреть файл

@ -56,7 +56,7 @@ function getProviderListFromPref(prefName) {
try {
return JSON.parse(prefVal);
} catch (e) {
Cu.reportError(`DoH provider list not a valid JSON array: ${prefName}`);
console.error(`DoH provider list not a valid JSON array: ${prefName}`);
}
}
return undefined;

Просмотреть файл

@ -361,7 +361,7 @@ async function platform() {
indications = linkService.platformDNSIndications;
} catch (e) {
if (e.result != Cr.NS_ERROR_NOT_IMPLEMENTED) {
Cu.reportError(e);
console.error(e);
}
}

Просмотреть файл

@ -113,7 +113,7 @@ class DNSLookup {
{}
);
} catch (e) {
Cu.reportError(e);
console.error(e);
}
}
@ -155,7 +155,7 @@ class LookupAggregator {
run() {
if (this._ran || this._aborted) {
Cu.reportError("Trying to re-run a LookupAggregator.");
console.error("Trying to re-run a LookupAggregator.");
return;
}
@ -211,7 +211,7 @@ class LookupAggregator {
domain.includes(lazy.kCanonicalDomain)
)
) {
Cu.reportError("Expected known domain for reporting, got " + domain);
console.error("Expected known domain for reporting, got ", domain);
return;
}

Просмотреть файл

@ -366,7 +366,7 @@ export var DownloadsCommon = {
}
await download.manuallyRemoveData();
if (clearHistory < 2) {
lazy.DownloadHistory.updateMetaData(download).catch(Cu.reportError);
lazy.DownloadHistory.updateMetaData(download).catch(console.error);
}
},
@ -861,7 +861,7 @@ DownloadsDataCtor.prototype = {
this._isPrivate ? lazy.Downloads.PRIVATE : lazy.Downloads.PUBLIC
)
.then(list => list.removeFinished())
.catch(Cu.reportError);
.catch(console.error);
},
// Integration with the asynchronous Downloads back-end
@ -898,7 +898,7 @@ DownloadsDataCtor.prototype = {
// This state transition code should actually be located in a Downloads
// API module (bug 941009).
lazy.DownloadHistory.updateMetaData(download).catch(Cu.reportError);
lazy.DownloadHistory.updateMetaData(download).catch(console.error);
}
if (
@ -932,7 +932,7 @@ DownloadsDataCtor.prototype = {
* removeView before termination.
*/
addView(aView) {
this._promiseList.then(list => list.addView(aView)).catch(Cu.reportError);
this._promiseList.then(list => list.addView(aView)).catch(console.error);
},
/**
@ -942,9 +942,7 @@ DownloadsDataCtor.prototype = {
* DownloadsView object to be removed.
*/
removeView(aView) {
this._promiseList
.then(list => list.removeView(aView))
.catch(Cu.reportError);
this._promiseList.then(list => list.removeView(aView)).catch(console.error);
},
// Notifications sent to the most recent browser window only

Просмотреть файл

@ -46,8 +46,8 @@ export var DownloadsMacFinderProgress = {
let path = download.target.path;
finderProgress.init(path, () => {
download.cancel().catch(Cu.reportError);
download.removePartialData().catch(Cu.reportError);
download.cancel().catch(console.error);
download.removePartialData().catch(console.error);
});
if (download.hasProgress) {

Просмотреть файл

@ -119,7 +119,7 @@ export var DownloadsTaskbar = {
this._summary = summary;
return this._summary.addView(this);
})
.catch(Cu.reportError);
.catch(console.error);
}
},

Просмотреть файл

@ -981,7 +981,7 @@ DownloadsViewUI.DownloadElementShell.prototype = {
}
return Promise.resolve();
})
.catch(Cu.reportError);
.catch(console.error);
},
/**
@ -1095,12 +1095,12 @@ DownloadsViewUI.DownloadElementShell.prototype = {
this.download.cancel().catch(() => {});
this.download
.removePartialData()
.catch(Cu.reportError)
.catch(console.error)
.finally(() => this.download.target.refresh());
},
downloadsCmd_confirmBlock() {
this.download.confirmBlock().catch(Cu.reportError);
this.download.confirmBlock().catch(console.error);
},
downloadsCmd_open(openWhere = "tab") {
@ -1153,7 +1153,7 @@ DownloadsViewUI.DownloadElementShell.prototype = {
},
cmd_delete() {
lazy.DownloadsCommon.deleteDownload(this.download).catch(Cu.reportError);
lazy.DownloadsCommon.deleteDownload(this.download).catch(console.error);
},
async downloadsCmd_deleteFile() {
@ -1169,7 +1169,7 @@ DownloadsViewUI.DownloadElementShell.prototype = {
// mime-type and open using the system viewer
lazy.DownloadsCommon.openDownload(this.download, {
useSystemDefault: true,
}).catch(Cu.reportError);
}).catch(console.error);
},
downloadsCmd_alwaysOpenInSystemViewer() {
@ -1200,7 +1200,7 @@ DownloadsViewUI.DownloadElementShell.prototype = {
mimeInfo.preferredAction = mimeInfo.handleInternally;
}
lazy.handlerSvc.store(mimeInfo);
lazy.DownloadsCommon.openDownload(this.download).catch(Cu.reportError);
lazy.DownloadsCommon.openDownload(this.download).catch(console.error);
},
downloadsCmd_alwaysOpenSimilarFiles() {
@ -1215,7 +1215,7 @@ DownloadsViewUI.DownloadElementShell.prototype = {
if (mimeInfo.preferredAction !== mimeInfo.useSystemDefault) {
mimeInfo.preferredAction = mimeInfo.useSystemDefault;
lazy.handlerSvc.store(mimeInfo);
lazy.DownloadsCommon.openDownload(this.download).catch(Cu.reportError);
lazy.DownloadsCommon.openDownload(this.download).catch(console.error);
} else {
// Otherwise, if user unchecks this option after already enabling it from the
// context menu, resort to saveToDisk.

Просмотреть файл

@ -178,7 +178,7 @@ HistoryDownloadElementShell.prototype = {
if (!this._targetFileChecked) {
this.download
.refresh()
.catch(Cu.reportError)
.catch(console.error)
.then(() => {
// Do not try to check for existence again even if this failed.
this._targetFileChecked = true;
@ -732,7 +732,7 @@ DownloadsPlacesView.prototype = {
.removeVisitsByFilter({
transition: PlacesUtils.history.TRANSITIONS.DOWNLOAD,
})
.catch(Cu.reportError);
.catch(console.error);
}
// There may be no selection or focus change as a result
// of these change, and we want the command updated immediately.

Просмотреть файл

@ -609,7 +609,7 @@ var DownloadsPanel = {
// do these checks on a background thread, and don't prevent the panel to
// be displayed while these checks are being performed.
for (let viewItem of DownloadsView._visibleViewItems.values()) {
viewItem.download.refresh().catch(Cu.reportError);
viewItem.download.refresh().catch(console.error);
}
DownloadsCommon.log("Opening downloads panel popup.");
@ -1152,7 +1152,7 @@ class DownloadsViewItem extends DownloadsViewUI.DownloadElementShell {
downloadsCmd_unblockAndOpen() {
DownloadsPanel.hidePanel();
this.unblockAndOpenDownload().catch(Cu.reportError);
this.unblockAndOpenDownload().catch(console.error);
}
downloadsCmd_unblockAndSave() {
DownloadsPanel.hidePanel();
@ -1216,7 +1216,7 @@ class DownloadsViewItem extends DownloadsViewUI.DownloadElementShell {
// So the remaining view item needs to be refreshed to hide the "Delete" option.
// That example only concerns 2 duplicate view items but you can have an arbitrary number, so iterate over all items...
for (let viewItem of DownloadsView._visibleViewItems.values()) {
viewItem.download.refresh().catch(Cu.reportError);
viewItem.download.refresh().catch(console.error);
}
// Don't use DownloadsPanel.hidePanel for this method because it will remove
// the view item from the list, which is already sufficient feedback.

Просмотреть файл

@ -336,7 +336,7 @@ function startServer() {
aResponse.finish();
info("Interruptible request finished.");
})
.catch(Cu.reportError);
.catch(console.error);
});
}

Просмотреть файл

@ -91,7 +91,7 @@ async function setDownloadDir() {
try {
await IOUtils.remove(tmpDir, { recursive: true });
} catch (e) {
Cu.reportError(e);
console.error(e);
}
});
Services.prefs.setIntPref("browser.download.folderList", 2);

Просмотреть файл

@ -77,7 +77,7 @@ Bookmarks.prototype = {
try {
new URL(url);
} catch (ex) {
Cu.reportError(
console.error(
`Ignoring ${url} when importing from 360se because of exception: ${ex}`
);
continue;
@ -106,7 +106,7 @@ Bookmarks.prototype = {
})().then(
() => aCallback(true),
e => {
Cu.reportError(e);
console.error(e);
aCallback(false);
}
);
@ -124,7 +124,7 @@ export var Qihoo360seMigrationUtils = {
let { lastModified } = await IOUtils.stat(bookmarksPath);
lastModificationDate = new Date(lastModified);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
}
@ -144,7 +144,7 @@ export var Qihoo360seMigrationUtils = {
lastModificationDate = new Date(lastModified);
path = legacyBookmarksPath;
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
}
}
@ -181,7 +181,7 @@ export var Qihoo360seMigrationUtils = {
parentFolder = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
parentFolder.initWithPath(aParentFolder);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
return null;
}

Просмотреть файл

@ -113,7 +113,7 @@ export class ChromeMacOSLoginCrypto {
["decrypt", "encrypt"]
);
})
.catch(Cu.reportError);
.catch(console.error);
}
/**

Просмотреть файл

@ -68,7 +68,7 @@ export var ChromeMigrationUtils = {
}
}
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
return extensionList;
},
@ -129,7 +129,7 @@ export var ChromeMigrationUtils = {
}
}
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
return extensionInformation;
},
@ -190,7 +190,7 @@ export var ChromeMigrationUtils = {
localeString = localeFile[key].message;
}
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
return localeString;
},
@ -240,7 +240,7 @@ export var ChromeMigrationUtils = {
} catch (ex) {
// Don't report the error if it's just a file not existing.
if (ex.name != "NotFoundError") {
Cu.reportError(ex);
console.error(ex);
}
throw ex;
}
@ -337,7 +337,7 @@ export var ChromeMigrationUtils = {
return target.path;
} catch (ex) {
// The path logic here shouldn't error, so log it:
Cu.reportError(ex);
console.error(ex);
}
return null;
},
@ -364,7 +364,7 @@ export var ChromeMigrationUtils = {
}
}
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
entries = [];
}
@ -437,7 +437,7 @@ export var ChromeMigrationUtils = {
const path = PathUtils.join(dataPath, profile.id, "Login Data");
// Skip if login data is missing.
if (!(await IOUtils.exists(path))) {
Cu.reportError(`Missing file at ${path}`);
console.error(`Missing file at ${path}`);
continue;
}
@ -463,13 +463,13 @@ export var ChromeMigrationUtils = {
entries.push(browserId);
}
} catch (ex) {
Cu.reportError(
console.error(
`Failed to process importable url ${url} from ${browserId} ${ex}`
);
}
}
} catch (ex) {
Cu.reportError(
console.error(
`Failed to get importable logins from ${browserId} ${ex}`
);
}

Просмотреть файл

@ -61,7 +61,7 @@ function convertBookmarks(items, errorAccumulator) {
itemsToInsert.push(folderItem);
}
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
errorAccumulator(ex);
}
}
@ -175,7 +175,7 @@ export class ChromeProfileMigrator extends MigratorBase {
} catch (e) {
// Avoid reporting NotFoundErrors from trying to get local state.
if (localState || e.name != "NotFoundError") {
Cu.reportError("Error detecting Chrome profiles: " + e);
console.error("Error detecting Chrome profiles: ", e);
}
// If we weren't able to detect any profiles above, fallback to the Default profile.
let defaultProfilePath = PathUtils.join(chromeUserDataPath, "Default");
@ -229,7 +229,7 @@ export class ChromeProfileMigrator extends MigratorBase {
password_element, password_value, signon_realm, scheme, date_created,
times_used FROM logins WHERE blacklisted_by_user = 0`
).catch(ex => {
Cu.reportError(ex);
console.error(ex);
aCallback(false);
});
// If the promise was rejected we will have already called aCallback,
@ -267,7 +267,7 @@ export class ChromeProfileMigrator extends MigratorBase {
}
} catch (ex) {
// Handle the user canceling Keychain access or other OSCrypto errors.
Cu.reportError(ex);
console.error(ex);
aCallback(false);
return;
}
@ -333,7 +333,7 @@ export class ChromeProfileMigrator extends MigratorBase {
}
logins.push(loginInfo);
} catch (e) {
Cu.reportError(e);
console.error(e);
}
}
try {
@ -341,7 +341,7 @@ export class ChromeProfileMigrator extends MigratorBase {
await MigrationUtils.insertLoginsWrapper(logins);
}
} catch (e) {
Cu.reportError(e);
console.error(e);
}
if (crypto.finalize) {
crypto.finalize();
@ -360,7 +360,7 @@ async function GetBookmarksResource(aProfileFolder, aBrowserKey) {
try {
localState = await lazy.ChromeMigrationUtils.getLocalState("360 SE");
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
let alternativeBookmarks = await lazy.Qihoo360seMigrationUtils.getAlternativeBookmarks(
@ -484,7 +484,7 @@ async function GetHistoryResource(aProfileFolder) {
],
});
} catch (e) {
Cu.reportError(e);
console.error(e);
}
}
@ -496,7 +496,7 @@ async function GetHistoryResource(aProfileFolder) {
aCallback(true);
},
ex => {
Cu.reportError(ex);
console.error(ex);
aCallback(false);
}
);
@ -520,7 +520,7 @@ async function GetCookiesResource(aProfileFolder) {
"Chrome cookies",
`PRAGMA table_info(cookies)`
).catch(ex => {
Cu.reportError(ex);
console.error(ex);
aCallback(false);
});
// If the promise was rejected we will have already called aCallback,
@ -546,7 +546,7 @@ async function GetCookiesResource(aProfileFolder) {
FROM cookies
WHERE length(encrypted_value) = 0`
).catch(ex => {
Cu.reportError(ex);
console.error(ex);
aCallback(false);
});
@ -599,7 +599,7 @@ async function GetCookiesResource(aProfileFolder) {
schemeType
);
} catch (e) {
Cu.reportError(e);
console.error(e);
}
}
aCallback(true);

Просмотреть файл

@ -58,7 +58,7 @@ export class ChromeWindowsLoginCrypto {
const encryptedKey = withHeader.slice(DPAPI_KEY_PREFIX.length);
keyData = this.osCrypto.decryptData(encryptedKey, null, "bytes");
} catch (ex) {
Cu.reportError(`${userDataPathSuffix} os_crypt key: ${ex}`);
console.error(`${userDataPathSuffix} os_crypt key: ${ex}`);
// Use a generic key that will fail for actually encrypted data, but for
// testing it'll be consistent for both encrypting and decrypting.

Просмотреть файл

@ -424,7 +424,7 @@ ESEDB.prototype = {
try {
this._close();
} catch (innerException) {
Cu.reportError(innerException);
console.error(innerException);
}
// Make sure caller knows we failed.
throw ex;
@ -574,11 +574,11 @@ ESEDB.prototype = {
// Deal with null values:
buffer = null;
} else {
Cu.reportError(
"Unexpected JET error: " +
err +
"; retrieving value for column " +
column.name
console.error(
"Unexpected JET error: ",
err,
"; retrieving value for column ",
column.name
);
throw new Error(convertESEError(err));
}
@ -591,8 +591,10 @@ ESEDB.prototype = {
}
if (column.type == "guid") {
if (buffer.length != 16) {
Cu.reportError(
"Buffer size for guid field " + column.id + " should have been 16!"
console.error(
"Buffer size for guid field ",
column.id,
" should have been 16!"
);
return "";
}
@ -785,7 +787,7 @@ export let ESEDBReader = {
const locked = await utils.isDbLocked(dbFile);
if (locked) {
Cu.reportError(`ESE DB at ${dbFile.path} is locked.`);
console.error(`ESE DB at ${dbFile.path} is locked.`);
}
return locked;

Просмотреть файл

@ -89,13 +89,13 @@ function readTableFromEdgeDB(
}
}
} catch (ex) {
Cu.reportError(
"Failed to extract items from table " +
tableName +
" in Edge database at " +
dbFile.path +
" due to the following error: " +
ex
console.error(
"Failed to extract items from table ",
tableName,
" in Edge database at ",
dbFile.path,
" due to the following error: ",
ex
);
// Deliberately make this fail so we expose failure in the UI:
throw ex;
@ -134,7 +134,7 @@ EdgeTypedURLMigrator.prototype = {
continue;
}
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
continue;
}
@ -178,7 +178,7 @@ EdgeTypedURLDBMigrator.prototype = {
this._migrateTypedURLsFromDB().then(
() => callback(true),
ex => {
Cu.reportError(ex);
console.error(ex);
callback(false);
}
);
@ -237,7 +237,7 @@ EdgeTypedURLDBMigrator.prototype = {
],
});
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
}
await MigrationUtils.insertVisitsWrapper(pageInfos);
@ -263,7 +263,7 @@ EdgeReadingListMigrator.prototype = {
this._migrateReadingList(lazy.PlacesUtils.bookmarks.menuGuid).then(
() => callback(true),
ex => {
Cu.reportError(ex);
console.error(ex);
callback(false);
}
);
@ -364,7 +364,7 @@ EdgeBookmarksMigrator.prototype = {
this._migrateBookmarks().then(
() => callback(true),
ex => {
Cu.reportError(ex);
console.error(ex);
callback(false);
}
);
@ -420,7 +420,7 @@ EdgeBookmarksMigrator.prototype = {
try {
new URL(bookmark.URL);
} catch (ex) {
Cu.reportError(
console.error(
`Ignoring ${bookmark.URL} when importing from Edge because of exception: ${ex}`
);
continue;

Просмотреть файл

@ -220,9 +220,7 @@ IE7FormPasswords.prototype = {
});
}
} catch (e) {
Cu.reportError(
"Error while importing logins for " + uri.spec + ": " + e
);
console.error("Error while importing logins for ", uri.spec, ": ", e);
}
}
@ -233,7 +231,7 @@ IE7FormPasswords.prototype = {
// if the number of the imported values is less than the number of values in the key, it means
// that not all the values were imported and an error should be reported
if (successfullyDecryptedValues < key.valueCount) {
Cu.reportError(
console.error(
"We failed to decrypt and import some logins. " +
"This is likely because we didn't find the URLs where these " +
"passwords were submitted in the IE history and which are needed to be used " +

Просмотреть файл

@ -314,8 +314,9 @@ function getEdgeLocalDataFolder() {
}
}
} catch (ex) {
Cu.reportError(
"Exception trying to find the Edge favorites directory: " + ex
console.error(
"Exception trying to find the Edge favorites directory: ",
ex
);
}
return null;
@ -391,7 +392,7 @@ Bookmarks.prototype = {
})().then(
() => aCallback(true),
e => {
Cu.reportError(e);
console.error(e);
aCallback(false);
}
);
@ -479,13 +480,13 @@ Bookmarks.prototype = {
}
}
} catch (ex) {
Cu.reportError(
"Unable to import " +
this.importedAppLabel +
" favorite (" +
entry.leafName +
"): " +
ex
console.error(
"Unable to import ",
this.importedAppLabel,
" favorite (",
entry.leafName,
"): ",
ex
);
}
}
@ -612,9 +613,7 @@ Cookies.prototype = {
fileReader.removeEventListener("loadend", onLoadEnd);
if (fileReader.readyState != fileReader.DONE) {
Cu.reportError(
"Could not read cookie contents: " + fileReader.error
);
console.error("Could not read cookie contents: ", fileReader.error);
aCallback(false);
return;
}
@ -623,7 +622,7 @@ Cookies.prototype = {
try {
this._parseCookieBuffer(fileReader.result);
} catch (ex) {
Cu.reportError("Unable to migrate cookie: " + ex);
console.error("Unable to migrate cookie: ", ex);
success = false;
} finally {
aCallback(success);
@ -710,7 +709,7 @@ Cookies.prototype = {
Number(expireTimeLo)
);
} catch (ex) {
Cu.reportError("Failed to get expiry time for cookie for " + host);
console.error("Failed to get expiry time for cookie for ", host);
}
Services.cookies.add(
@ -778,7 +777,7 @@ function getTypedURLs(registryKeyPath) {
try {
urlTime = typedURLTimeKey.readBinaryValue(entryName);
} catch (ex) {
Cu.reportError("Couldn't read url time for " + entryName);
console.error("Couldn't read url time for ", entryName);
}
if (urlTime.length == 8) {
let urlTimeHex = [];
@ -809,7 +808,7 @@ function getTypedURLs(registryKeyPath) {
typedURLs.set(url, timeTyped * 1000);
}
} catch (ex) {
Cu.reportError("Error reading typed URL history: " + ex);
console.error("Error reading typed URL history: ", ex);
} finally {
if (typedURLKey) {
typedURLKey.close();
@ -967,7 +966,7 @@ WindowsVaultFormPasswords.prototype = {
}
} catch (e) {
migrationSucceeded = false;
Cu.reportError(e);
console.error(e);
} finally {
// move to next item in the table returned by VaultEnumerateItems
item = item.increment();
@ -978,14 +977,14 @@ WindowsVaultFormPasswords.prototype = {
await MigrationUtils.insertLoginsWrapper(logins);
}
} catch (e) {
Cu.reportError(e);
console.error(e);
migrationSucceeded = false;
} finally {
if (successfulVaultOpen) {
// close current vault
error = ctypesVaultHelpers._functions.VaultCloseVault(vault);
if (error == FREE_CLOSE_FAILED) {
Cu.reportError("Unable to close vault: " + error);
console.error("Unable to close vault: ", error);
}
}
ctypesKernelHelpers.finalize();

Просмотреть файл

@ -167,7 +167,7 @@ class MigrationUtils {
aFunction.apply(null, arguments);
success = true;
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
// Do not change this to call aCallback directly in try try & catch
// blocks, because if aCallback throws, we may end up calling aCallback
@ -234,7 +234,7 @@ class MigrationUtils {
rows = await db.execute(selectQuery);
} catch (ex) {
if (previousException.message != ex.message) {
Cu.reportError(ex);
console.error(ex);
}
previousException = ex;
} finally {
@ -342,7 +342,7 @@ class MigrationUtils {
try {
return migrator && (await migrator.isSourceAvailable()) ? migrator : null;
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
return null;
}
}
@ -402,7 +402,7 @@ class MigrationUtils {
key = "firefox";
}
} catch (ex) {
Cu.reportError("Could not detect default browser: " + ex);
console.error("Could not detect default browser: ", ex);
}
// "firefox" is the least useful entry here, and might just be because we've set
@ -443,7 +443,7 @@ class MigrationUtils {
// Save the value for future callers.
gPreviousDefaultBrowserKey = key;
} catch (ex) {
Cu.reportError(
console.error(
"Could not convert old default browser value to description."
);
}
@ -718,7 +718,7 @@ class MigrationUtils {
);
}
},
ex => Cu.reportError(ex)
ex => console.error(ex)
);
}

Просмотреть файл

@ -275,7 +275,7 @@ export class MigratorBase {
.getKeyedHistogramById(histogramId)
.add(browserKey, accumulatedDelay);
} catch (ex) {
Cu.reportError(histogramId + ": " + ex);
console.error(histogramId, ": ", ex);
}
}
}
@ -295,7 +295,7 @@ export class MigratorBase {
lazy.MigrationUtils._importQuantities[resourceType]
);
} catch (ex) {
Cu.reportError(histogramId + ": " + ex);
console.error(histogramId, ": ", ex);
}
}
};
@ -374,7 +374,7 @@ export class MigratorBase {
try {
res.migrate(resourceDone);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
resourceDone(false);
}
@ -408,7 +408,7 @@ export class MigratorBase {
replace: true,
source: lazy.PlacesUtils.bookmarks.SOURCES.RESTORE_ON_STARTUP,
}
).catch(Cu.reportError);
).catch(console.error);
// We'll tell nsBrowserGlue we've imported bookmarks, but before that
// we need to make sure we're going to know when it's finished
@ -463,7 +463,7 @@ export class MigratorBase {
exists = !!profiles.length;
}
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
return exists;
}

Просмотреть файл

@ -43,7 +43,7 @@ Bookmarks.prototype = {
})().then(
() => aCallback(true),
e => {
Cu.reportError(e);
console.error(e);
aCallback(false);
}
);
@ -173,7 +173,7 @@ Bookmarks.prototype = {
try {
new URL(url);
} catch (ex) {
Cu.reportError(
console.error(
`Ignoring ${url} when importing from Safari because of exception: ${ex}`
);
return null;
@ -242,7 +242,7 @@ History.prototype = {
} catch (ex) {
// Safari's History file may contain malformed URIs which
// will be ignored.
Cu.reportError(ex);
console.error(ex);
failedOnce = true;
}
}
@ -260,7 +260,7 @@ History.prototype = {
() => aCallback(false)
);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
aCallback(false);
}
});
@ -304,7 +304,7 @@ MainPreferencesPropertyList.prototype = {
try {
callback(aDict);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
}
this._callbacks.splice(0);

Просмотреть файл

@ -544,7 +544,7 @@ var MigrationWizard = {
try {
this.reportDataRecencyTelemetry();
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
}
if (this._autoMigrate) {

Просмотреть файл

@ -365,7 +365,7 @@ let eseDBWritingHelpers = {
try {
this._close();
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
}
},
@ -580,7 +580,7 @@ add_task(async function() {
let migrateResult = await new Promise(resolve =>
bookmarksMigrator.migrate(resolve)
).catch(ex => {
Cu.reportError(ex);
console.error(ex);
Assert.ok(false, "Got an exception trying to migrate data! " + ex);
return false;
});
@ -732,7 +732,7 @@ add_task(async function() {
migrateResult = await new Promise(resolve =>
readingListMigrator.migrate(resolve)
).catch(ex => {
Cu.reportError(ex);
console.error(ex);
Assert.ok(false, "Got an exception trying to migrate data! " + ex);
return false;
});

Просмотреть файл

@ -669,7 +669,7 @@ class InteractionsStore {
this.#timerResolve = resolve;
this.#timer = lazy.setTimeout(() => {
this.#updateDatabase()
.catch(Cu.reportError)
.catch(console.error)
.then(resolve);
}, lazy.saveInterval);
});

Просмотреть файл

@ -440,7 +440,7 @@ class BookmarkState {
tag: this._newState.title,
})
.transact()
.catch(Cu.reportError);
.catch(console.error);
return this._guid;
}
@ -640,7 +640,7 @@ export var PlacesUIUtils = {
!bookmarkGuid &&
topUndoEntry != lazy.PlacesTransactions.topUndoEntry
) {
await lazy.PlacesTransactions.undo().catch(Cu.reportError);
await lazy.PlacesTransactions.undo().catch(console.error);
}
this.lastBookmarkDialogDeferred.resolve(bookmarkGuid);

Просмотреть файл

@ -482,7 +482,7 @@ var BookmarkPropertiesPanel = {
if (this._charSet) {
PlacesUIUtils.setCharsetForPage(this._uri, this._charSet, window).catch(
Cu.reportError
console.error
);
}

Просмотреть файл

@ -1486,7 +1486,7 @@ class PlacesToolbar extends PlacesViewBase {
if (elt == this._rootElt) {
// Container is the toolbar itself.
this._rebuild().catch(Cu.reportError);
this._rebuild().catch(console.error);
return;
}
@ -1833,7 +1833,7 @@ class PlacesToolbar extends PlacesViewBase {
PlacesControllerDragHelper.onDrop(
dropPoint.ip,
aEvent.dataTransfer
).catch(Cu.reportError);
).catch(console.error);
aEvent.preventDefault();
}

Просмотреть файл

@ -246,10 +246,10 @@ PlacesController.prototype = {
doCommand: function PC_doCommand(aCommand) {
switch (aCommand) {
case "cmd_undo":
PlacesTransactions.undo().catch(Cu.reportError);
PlacesTransactions.undo().catch(console.error);
break;
case "cmd_redo":
PlacesTransactions.redo().catch(Cu.reportError);
PlacesTransactions.redo().catch(console.error);
break;
case "cmd_cut":
case "placesCmd_cut":
@ -261,14 +261,14 @@ PlacesController.prototype = {
break;
case "cmd_paste":
case "placesCmd_paste":
this.paste().catch(Cu.reportError);
this.paste().catch(console.error);
break;
case "cmd_delete":
case "placesCmd_delete":
this.remove("Remove Selection").catch(Cu.reportError);
this.remove("Remove Selection").catch(console.error);
break;
case "placesCmd_deleteDataHost":
this.forgetAboutThisSite().catch(Cu.reportError);
this.forgetAboutThisSite().catch(console.error);
break;
case "cmd_selectAll":
this.selectAll();
@ -295,19 +295,19 @@ PlacesController.prototype = {
PlacesUIUtils.openNodeIn(this._view.selectedNode, "tab", this._view);
break;
case "placesCmd_new:folder":
this.newItem("folder").catch(Cu.reportError);
this.newItem("folder").catch(console.error);
break;
case "placesCmd_new:bookmark":
this.newItem("bookmark").catch(Cu.reportError);
this.newItem("bookmark").catch(console.error);
break;
case "placesCmd_new:separator":
this.newSeparator().catch(Cu.reportError);
this.newSeparator().catch(console.error);
break;
case "placesCmd_show:info":
this.showBookmarkPropertiesForSelection();
break;
case "placesCmd_sortBy:name":
this.sortFolderByName().catch(Cu.reportError);
this.sortFolderByName().catch(console.error);
break;
case "placesCmd_createBookmark": {
const nodes = this._view.selectedNodes.map(node => {
@ -874,7 +874,7 @@ PlacesController.prototype = {
Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY
) {
// This is a uri node inside an history query.
await PlacesUtils.history.remove(node.uri).catch(Cu.reportError);
await PlacesUtils.history.remove(node.uri).catch(console.error);
// History deletes are not undoable, so we don't have a transaction.
} else if (
node.itemId == -1 &&
@ -885,7 +885,7 @@ PlacesController.prototype = {
// This is a dynamically generated history query, like queries
// grouped by site, time or both. Dynamically generated queries don't
// have an itemId even if they are descendants of a bookmark.
await this._removeHistoryContainer(node).catch(Cu.reportError);
await this._removeHistoryContainer(node).catch(console.error);
// History deletes are not undoable, so we don't have a transaction.
} else {
// This is a common bookmark item.
@ -944,7 +944,7 @@ PlacesController.prototype = {
PlacesUtils.asQuery(node).queryOptions.queryType ==
Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY
) {
await this._removeHistoryContainer(node).catch(Cu.reportError);
await this._removeHistoryContainer(node).catch(console.error);
}
}

Просмотреть файл

@ -340,7 +340,7 @@ var gEditItemOverlay = {
}
if (showOrCollapse("keywordRow", isBookmark, "keyword")) {
await this._initKeywordField().catch(Cu.reportError);
await this._initKeywordField().catch(console.error);
// paneInfo can be null if paneInfo is uninitialized while
// the process above is awaiting initialization
if (instance != this._instance || this._paneInfo == null) {
@ -353,7 +353,7 @@ var gEditItemOverlay = {
if (showOrCollapse("tagsRow", isURI || bulkTagging, "tags")) {
this._initTagsField();
} else if (!this._element("tagsSelectorRow").hidden) {
this.toggleTagsSelector().catch(Cu.reportError);
this.toggleTagsSelector().catch(console.error);
}
// Folder picker.
@ -361,7 +361,7 @@ var gEditItemOverlay = {
// not cheap (we don't always have the parent), and there's no use case for
// this (it's only the Star UI that shows the folderPicker)
if (showOrCollapse("folderRow", isItem, "folderPicker")) {
await this._initFolderMenuList(parentGuid).catch(Cu.reportError);
await this._initFolderMenuList(parentGuid).catch(console.error);
if (instance != this._instance || this._paneInfo == null) {
return;
}
@ -580,7 +580,7 @@ var gEditItemOverlay = {
// Hide the tag selector if it was previously visible.
var tagsSelectorRow = this._element("tagsSelectorRow");
if (!tagsSelectorRow.hidden) {
this.toggleTagsSelector().catch(Cu.reportError);
this.toggleTagsSelector().catch(console.error);
}
}
@ -1026,7 +1026,7 @@ var gEditItemOverlay = {
title,
index: await ip.getIndex(),
}).transact();
this.transactionPromises.push(promise.catch(Cu.reportError));
this.transactionPromises.push(promise.catch(console.error));
let guid = await promise;
this._folderTree.focus();

Просмотреть файл

@ -328,7 +328,7 @@ var gEditItemOverlay = {
}
if (showOrCollapse("keywordRow", isBookmark, "keyword")) {
await this._initKeywordField().catch(Cu.reportError);
await this._initKeywordField().catch(console.error);
// paneInfo can be null if paneInfo is uninitialized while
// the process above is awaiting initialization
if (instance != this._instance || this._paneInfo == null) {
@ -341,7 +341,7 @@ var gEditItemOverlay = {
if (showOrCollapse("tagsRow", isURI || bulkTagging, "tags")) {
this._initTagsField();
} else if (!this._element("tagsSelectorRow").hidden) {
this.toggleTagsSelector().catch(Cu.reportError);
this.toggleTagsSelector().catch(console.error);
}
// Folder picker.
@ -349,7 +349,7 @@ var gEditItemOverlay = {
// not cheap (we don't always have the parent), and there's no use case for
// this (it's only the Star UI that shows the folderPicker)
if (showOrCollapse("folderRow", isItem, "folderPicker")) {
await this._initFolderMenuList(parentGuid).catch(Cu.reportError);
await this._initFolderMenuList(parentGuid).catch(console.error);
if (instance != this._instance || this._paneInfo == null) {
return;
}
@ -577,7 +577,7 @@ var gEditItemOverlay = {
// Hide the tag selector if it was previously visible.
var tagsSelectorRow = this._element("tagsSelectorRow");
if (!tagsSelectorRow.hidden) {
this.toggleTagsSelector().catch(Cu.reportError);
this.toggleTagsSelector().catch(console.error);
}
}
@ -679,14 +679,14 @@ var gEditItemOverlay = {
tags: removedTags,
})
.transact()
.catch(Cu.reportError);
.catch(console.error);
this.transactionPromises.push(promise);
promises.push(promise);
}
if (newTags.length) {
let promise = PlacesTransactions.Tag({ urls: aURIs, tags: newTags })
.transact()
.catch(Cu.reportError);
.catch(console.error);
this.transactionPromises.push(promise);
promises.push(promise);
}
@ -778,7 +778,7 @@ var gEditItemOverlay = {
this._paneInfo.title = tag;
}
let promise = PlacesTransactions.RenameTag({ oldTag, tag }).transact();
this.transactionPromises.push(promise.catch(Cu.reportError));
this.transactionPromises.push(promise.catch(console.error));
await promise;
return;
}
@ -788,7 +788,7 @@ var gEditItemOverlay = {
guid: this._paneInfo.itemGuid,
title: this._namePicker.value,
}).transact();
this.transactionPromises.push(promise.catch(Cu.reportError));
this.transactionPromises.push(promise.catch(console.error));
await promise;
},
@ -814,7 +814,7 @@ var gEditItemOverlay = {
this.transactionPromises.push(
PlacesTransactions.EditUrl({ guid, url: newURI })
.transact()
.catch(Cu.reportError)
.catch(console.error)
);
},
@ -830,7 +830,7 @@ var gEditItemOverlay = {
this.transactionPromises.push(
PlacesTransactions.EditKeyword({ guid, keyword, postData, oldKeyword })
.transact()
.catch(Cu.reportError)
.catch(console.error)
);
},
@ -941,7 +941,7 @@ var gEditItemOverlay = {
guid: this._paneInfo.itemGuid,
newParentGuid: containerGuid,
}).transact();
this.transactionPromises.push(promise.catch(Cu.reportError));
this.transactionPromises.push(promise.catch(console.error));
await promise;
// Auto-show the bookmarks toolbar when adding / moving an item there.
@ -1122,7 +1122,7 @@ var gEditItemOverlay = {
title,
index: await ip.getIndex(),
}).transact();
this.transactionPromises.push(promise.catch(Cu.reportError));
this.transactionPromises.push(promise.catch(console.error));
let guid = await promise;
this._folderTree.focus();
@ -1191,7 +1191,7 @@ var gEditItemOverlay = {
break;
case "bookmark-tags-changed":
if (this._paneInfo.visibleRows.has("tagsRow")) {
this._onTagsChange(event.guid).catch(Cu.reportError);
this._onTagsChange(event.guid).catch(console.error);
}
break;
case "bookmark-title-changed":
@ -1214,7 +1214,7 @@ var gEditItemOverlay = {
if (this._paneInfo.visibleRows.has("tagsRow")) {
delete this._paneInfo._cachedCommonTags;
this._onTagsChange(event.guid, newURI).catch(Cu.reportError);
this._onTagsChange(event.guid, newURI).catch(console.error);
}
}
break;
@ -1338,7 +1338,7 @@ var gEditItemOverlay = {
switch (aProperty) {
case "keyword":
if (this._paneInfo.visibleRows.has("keywordRow")) {
this._initKeywordField(aValue).catch(Cu.reportError);
this._initKeywordField(aValue).catch(console.error);
}
break;
}

Просмотреть файл

@ -448,7 +448,7 @@ function closingPopupEndsDrag(popup) {
PlacesControllerDragHelper.onDrop(
dropPoint.ip,
event.dataTransfer
).catch(Cu.reportError);
).catch(console.error);
event.preventDefault();
}

Просмотреть файл

@ -482,7 +482,7 @@ var PlacesOrganizer = {
var { BookmarkHTMLUtils } = ChromeUtils.importESModule(
"resource://gre/modules/BookmarkHTMLUtils.sys.mjs"
);
BookmarkHTMLUtils.importFromURL(fp.fileURL.spec).catch(Cu.reportError);
BookmarkHTMLUtils.importFromURL(fp.fileURL.spec).catch(console.error);
}
};
@ -505,7 +505,7 @@ var PlacesOrganizer = {
var { BookmarkHTMLUtils } = ChromeUtils.importESModule(
"resource://gre/modules/BookmarkHTMLUtils.sys.mjs"
);
BookmarkHTMLUtils.exportToFile(fp.file.path).catch(Cu.reportError);
BookmarkHTMLUtils.exportToFile(fp.file.path).catch(console.error);
}
};
@ -694,7 +694,7 @@ var PlacesOrganizer = {
if (aResult != Ci.nsIFilePicker.returnCancel) {
// There is no OS.File version of the filepicker yet (Bug 937812).
PlacesBackups.saveBookmarksToJSONFile(fp.file.path).catch(
Cu.reportError
console.error
);
}
};

Просмотреть файл

@ -1849,7 +1849,7 @@ PlacesTreeView.prototype = {
if (node.title != aText) {
PlacesTransactions.EditTitle({ guid: node.bookmarkGuid, title: aText })
.transact()
.catch(Cu.reportError);
.catch(console.error);
}
},

Просмотреть файл

@ -475,7 +475,7 @@ var pktUI = (function() {
function openTabWithUrl(url, aTriggeringPrincipal, aCsp) {
let recentWindow = Services.wm.getMostRecentWindow("navigator:browser");
if (!recentWindow) {
Cu.reportError("Pocket: No open browser windows to openTabWithUrl");
console.error("Pocket: No open browser windows to openTabWithUrl");
return;
}
closePanel();

Просмотреть файл

@ -152,7 +152,7 @@ var gFontsDialog = {
preference.setElementValue(element);
}
}
})().catch(Cu.reportError);
})().catch(console.error);
},
readFontLanguageGroup() {

Просмотреть файл

@ -33,7 +33,7 @@ var gLanguagesDialog = {
);
Preferences.get("intl.accept_languages").on("change", () =>
this._readAcceptLanguages().catch(Cu.reportError)
this._readAcceptLanguages().catch(console.error)
);
if (!this._availableLanguagesList.length) {
@ -225,7 +225,7 @@ var gLanguagesDialog = {
this._availableLanguages.selectedItem = null;
// Rebuild the available list with the added item removed...
this._buildAvailableLanguageList().catch(Cu.reportError);
this._buildAvailableLanguageList().catch(console.error);
},
removeLanguage() {
@ -253,7 +253,7 @@ var gLanguagesDialog = {
var preference = Preferences.get("intl.accept_languages");
preference.value = string;
this._buildAvailableLanguageList().catch(Cu.reportError);
this._buildAvailableLanguageList().catch(console.error);
},
_getLocaleName(localeCode) {

Просмотреть файл

@ -559,7 +559,7 @@ var gHomePane = {
// FIXME Bug 244192: using dangerous "|" joiner!
if (tabs.length) {
HomePage.set(tabs.map(getTabURI).join("|")).catch(Cu.reportError);
HomePage.set(tabs.map(getTabURI).join("|")).catch(console.error);
}
},
@ -569,7 +569,7 @@ var gHomePane = {
}
if (rv.urls && rv.names) {
// XXX still using dangerous "|" joiner!
HomePage.set(rv.urls.join("|")).catch(Cu.reportError);
HomePage.set(rv.urls.join("|")).catch(console.error);
}
},
@ -599,7 +599,7 @@ var gHomePane = {
onCustomHomePageChange(event) {
const value = event.target.value || HomePage.getDefault();
HomePage.set(value).catch(Cu.reportError);
HomePage.set(value).catch(console.error);
},
/**

Просмотреть файл

@ -1699,7 +1699,7 @@ var gMainPane = {
preference.setElementValue(element);
}
}
})().catch(Cu.reportError);
})().catch(console.error);
},
/**
@ -2912,7 +2912,7 @@ var gMainPane = {
* response to the choice, if one is made.
*/
chooseFolder() {
return this.chooseFolderTask().catch(Cu.reportError);
return this.chooseFolderTask().catch(console.error);
},
async chooseFolderTask() {
let [title] = await document.l10n.formatValues([
@ -2955,7 +2955,7 @@ var gMainPane = {
* preferences.
*/
displayDownloadDirPref() {
this.displayDownloadDirPrefTask().catch(Cu.reportError);
this.displayDownloadDirPrefTask().catch(console.error);
// don't override the preference's value in UI
return undefined;

Просмотреть файл

@ -41,7 +41,7 @@ class PromptCollection {
"resendButton.label"
);
} catch (exception) {
Cu.reportError("Failed to get strings from appstrings.properties");
console.error("Failed to get strings from appstrings.properties");
return false;
}
@ -88,7 +88,7 @@ class PromptCollection {
"OnBeforeUnloadStayButton"
);
} catch (exception) {
Cu.reportError("Failed to get strings from dom.properties");
console.error("Failed to get strings from dom.properties");
return false;
}
@ -98,7 +98,7 @@ class PromptCollection {
(contentViewer && !contentViewer.isTabModalPromptAllowed) ||
!browsingContext.ancestorsAreCurrent
) {
Cu.reportError("Can't prompt from inactive content viewer");
console.error("Can't prompt from inactive content viewer");
return true;
}
@ -148,7 +148,7 @@ class PromptCollection {
"FolderUploadPrompt.acceptButtonLabel"
);
} catch (exception) {
Cu.reportError("Failed to get strings from dom.properties");
console.error("Failed to get strings from dom.properties");
return false;
}

Просмотреть файл

@ -55,7 +55,7 @@ var SessionCookiesInternal = {
cookie.originAttributes || {}
);
} catch (ex) {
Cu.reportError(
console.error(
`CookieService::CookieExists failed with error '${ex}' for '${JSON.stringify(
cookie
)}'.`
@ -77,7 +77,7 @@ var SessionCookiesInternal = {
cookie.schemeMap || Ci.nsICookie.SCHEME_HTTPS
);
} catch (ex) {
Cu.reportError(
console.error(
`CookieService::Add failed with error '${ex}' for cookie ${JSON.stringify(
cookie
)}.`

Просмотреть файл

@ -233,7 +233,7 @@ var SessionFileInternal = {
// 1546847. Just in case there are problems in the format of
// the parsed data, continue on. Favicons might be broken, but
// the session will at least be recovered
Cu.reportError(e);
console.error(e);
}
}
@ -246,12 +246,10 @@ var SessionFileInternal = {
)
) {
// Skip sessionstore files that we don't understand.
Cu.reportError(
"Cannot extract data from Session Restore file " +
path +
". Wrong format/version: " +
JSON.stringify(parsed.version) +
"."
console.error(
"Cannot extract data from Session Restore file ",
path,
". Wrong format/version: " + JSON.stringify(parsed.version) + "."
);
continue;
}

Просмотреть файл

@ -2197,8 +2197,9 @@ var SessionStoreInternal = {
try {
Services.obs.removeObserver(observer, topic);
} catch (ex) {
Cu.reportError(
"SessionStore: exception whilst flushing all windows: " + ex
console.error(
"SessionStore: exception whilst flushing all windows: ",
ex
);
}
};
@ -4476,7 +4477,7 @@ var SessionStoreInternal = {
return true;
} catch (error) {
// Can't setup speculative connection for this url.
Cu.reportError(error);
console.error(error);
return false;
}
}
@ -4671,7 +4672,7 @@ var SessionStoreInternal = {
let browser = tab.linkedBrowser;
if (TAB_STATE_FOR_BROWSER.has(browser)) {
Cu.reportError("Must reset tab before calling restoreTab.");
console.error("Must reset tab before calling restoreTab.");
return;
}
@ -5968,7 +5969,7 @@ var SessionStoreInternal = {
let previousState = TAB_STATE_FOR_BROWSER.get(browser);
if (!previousState) {
Cu.reportError("Given tab is not restoring.");
console.error("Given tab is not restoring.");
return;
}
@ -5998,7 +5999,7 @@ var SessionStoreInternal = {
let browser = tab.linkedBrowser;
if (!TAB_STATE_FOR_BROWSER.has(browser)) {
Cu.reportError("Given tab is not restoring.");
console.error("Given tab is not restoring.");
return;
}

Просмотреть файл

@ -192,7 +192,7 @@ var TabStateFlusherInternal = {
}
if (!success) {
Cu.reportError("Failed to flush browser: " + message);
console.error("Failed to flush browser: ", message);
}
// Resolve the request with the given id.
@ -225,7 +225,7 @@ var TabStateFlusherInternal = {
let { cancel } = this._requests.get(browser.permanentKey);
if (!success) {
Cu.reportError("Failed to flush browser: " + message);
console.error("Failed to flush browser: ", message);
}
// Resolve all requests.

Просмотреть файл

@ -156,7 +156,7 @@ add_task(async function testRestore() {
// calls, so we will just wait for the document to finish loadig.
return SpecialPowers.spawn(regular_browser, [], () => {
return content.document.readyState == "complete";
}).catch(Cu.reportError);
}).catch(console.error);
});
newWin.gBrowser.selectedTab = regular_tab;
await TabStateFlusher.flush(regular_browser);

Просмотреть файл

@ -38,7 +38,7 @@ function loadContentWindow(browser, url) {
uri = Services.io.newURI(url);
} catch (e) {
let msg = `Invalid URL passed to loadContentWindow(): ${url}`;
Cu.reportError(msg);
console.error(msg);
return Promise.reject(new Error(msg));
}

Просмотреть файл

@ -347,7 +347,7 @@ let ShellServiceInternal = {
// await the result of setAsDefaultUserChoice() here, either, we just need
// to fall back in case it fails.
this.setAsDefaultUserChoice().catch(err => {
Cu.reportError(err);
console.error(err);
this.shellService.setDefaultBrowser(claimAllTypes, forAllUsers);
});
return;
@ -373,7 +373,7 @@ let ShellServiceInternal = {
ShellService.setDefaultBrowser(claimAllTypes, false);
} catch (ex) {
setAsDefaultError = true;
Cu.reportError(ex);
console.error(ex);
}
// Here BROWSER_IS_USER_DEFAULT and BROWSER_SET_USER_DEFAULT_ERROR appear
// to be inverse of each other, but that is only because this function is
@ -463,7 +463,7 @@ let ShellServiceInternal = {
this.macDockSupport.ensureAppIsPinnedToDock();
}
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
}
},

Просмотреть файл

@ -33,7 +33,7 @@ EventEmitter.prototype = {
try {
listener.apply(this, args);
} catch (e) {
Cu.reportError(e);
console.error(e);
}
}
},

Просмотреть файл

@ -96,7 +96,7 @@ SyncedTabsDeckComponent.prototype = {
this.updateDir();
// Go ahead and trigger sync
this._SyncedTabs.syncTabs().catch(Cu.reportError);
this._SyncedTabs.syncTabs().catch(console.error);
this._deckView = new this._DeckView(this._window, this.tabListComponent, {
onConnectDeviceClick: event => this.openConnectDevice(event),
@ -160,7 +160,7 @@ SyncedTabsDeckComponent.prototype = {
}
return this.PANELS.SINGLE_DEVICE_INFO;
} catch (err) {
Cu.reportError(err);
console.error(err);
return this.PANELS.NOT_AUTHED_INFO;
}
},
@ -182,7 +182,7 @@ SyncedTabsDeckComponent.prototype = {
// return promise for tests
return this.getPanelStatus()
.then(panelId => this._deckStore.selectPanel(panelId))
.catch(Cu.reportError);
.catch(console.error);
},
openSyncPrefs() {

Просмотреть файл

@ -254,6 +254,6 @@ Object.assign(SyncedTabsListStore.prototype, EventEmitter.prototype, {
this.data = result;
this._change(updateType);
})
.catch(Cu.reportError);
.catch(console.error);
},
});

Просмотреть файл

@ -115,7 +115,7 @@ TabListComponent.prototype = {
onBookmarkTab(uri, title) {
this._window.top.PlacesCommandHook.bookmarkLink(uri, title).catch(
Cu.reportError
console.error
);
},

Просмотреть файл

@ -123,5 +123,5 @@ async function onLoad() {
try {
document.addEventListener("DOMContentLoaded", onLoad, { once: true });
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}

Просмотреть файл

@ -542,7 +542,7 @@ var UITour = {
case "setDefaultSearchEngine": {
let enginePromise = this.selectSearchEngine(data.identifier);
enginePromise.catch(Cu.reportError);
enginePromise.catch(console.error);
break;
}
@ -603,7 +603,7 @@ var UITour = {
searchbar.openSuggestionsPanel();
}
})
.catch(Cu.reportError);
.catch(console.error);
break;
}

Просмотреть файл

@ -41,7 +41,7 @@ class UITourChild extends JSWindowActorChild {
return true;
}
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
}
return false;

Просмотреть файл

@ -273,7 +273,7 @@ var tests = [
"Highlight should be shown after showHighlight() for fixed panel items"
);
})
.catch(Cu.reportError);
.catch(console.error);
},
function test_highlight_effect(done) {
function waitForHighlightWithEffect(highlightEl, effect, next, error) {

Просмотреть файл

@ -121,7 +121,7 @@ var tests = [
);
});
})
.catch(Cu.reportError);
.catch(console.error);
},
taskify(async function test_bookmarks_menu() {
CustomizableUI.addWidgetToArea(

Просмотреть файл

@ -608,7 +608,7 @@ export class UrlbarController {
*/
handleDeleteEntry(event, result = undefined) {
if (!this._lastQueryContextWrapper) {
Cu.reportError("Cannot delete - the latest query is not present");
console.error("Cannot delete - the latest query is not present");
return false;
}
let { queryContext } = this._lastQueryContextWrapper;
@ -640,7 +640,7 @@ export class UrlbarController {
// First call `provider.blockResult()`.
let provider = lazy.UrlbarProvidersManager.getProvider(result.providerName);
if (!provider) {
Cu.reportError(`Provider not found: ${result.providerName}`);
console.error(`Provider not found: ${result.providerName}`);
}
let blockedByProvider = provider?.tryMethod(
"blockResult",
@ -659,7 +659,7 @@ export class UrlbarController {
let index = queryContext.results.indexOf(result);
if (index < 0) {
Cu.reportError("Failed to find the selected result in the results");
console.error("Failed to find the selected result in the results");
return false;
}
@ -677,20 +677,20 @@ export class UrlbarController {
}
// Generate the search url to remove it from browsing history.
let { url } = lazy.UrlbarUtils.getUrlFromResult(result);
lazy.PlacesUtils.history.remove(url).catch(Cu.reportError);
lazy.PlacesUtils.history.remove(url).catch(console.error);
// Now remove form history.
lazy.FormHistory.update({
op: "remove",
fieldname: queryContext.formHistoryName,
value: result.payload.suggestion,
}).catch(error =>
Cu.reportError(`Removing form history failed: ${error}`)
console.error(`Removing form history failed: ${error}`)
);
return true;
}
// Remove browsing history entries from Places.
lazy.PlacesUtils.history.remove(result.payload.url).catch(Cu.reportError);
lazy.PlacesUtils.history.remove(result.payload.url).catch(console.error);
return true;
}
@ -707,7 +707,7 @@ export class UrlbarController {
try {
listener[name](...params);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
}
}
@ -779,7 +779,7 @@ class TelemetryEvent {
return;
}
if (!event) {
Cu.reportError("Must always provide an event");
console.error("Must always provide an event");
return;
}
const validEvents = [
@ -793,7 +793,7 @@ class TelemetryEvent {
"focus",
];
if (!validEvents.includes(event.type)) {
Cu.reportError("Can't start recording from event type: " + event.type);
console.error("Can't start recording from event type: ", event.type);
return;
}
@ -846,7 +846,7 @@ class TelemetryEvent {
try {
this._internalRecord(event, details);
} catch (ex) {
Cu.reportError("Could not record event: " + ex);
console.error("Could not record event: ", ex);
} finally {
this._startEventInfo = null;
this._discarded = false;
@ -1126,7 +1126,7 @@ class TelemetryEvent {
results,
};
} else {
Cu.reportError(`Unknown telemetry event method: ${method}`);
console.error(`Unknown telemetry event method: ${method}`);
return;
}

Просмотреть файл

@ -632,7 +632,7 @@ export class UrlbarInput {
this,
searchString,
oneOffParams.engine.name
).catch(Cu.reportError);
).catch(console.error);
} else {
// Use the current value if we don't have a UrlbarResult e.g. because the
// view is closed.
@ -964,7 +964,7 @@ export class UrlbarInput {
// We don't await for this, because a rejection should not interrupt
// the load. Just reportError it.
lazy.UrlbarUtils.addToInputHistory(url, searchString).catch(
Cu.reportError
console.error
);
}
@ -1027,7 +1027,7 @@ export class UrlbarInput {
this,
result.payload.suggestion || result.payload.query,
engine.name
).catch(Cu.reportError);
).catch(console.error);
}
break;
}
@ -1131,7 +1131,7 @@ export class UrlbarInput {
if (input !== undefined) {
// We don't await for this, because a rejection should not interrupt
// the load. Just reportError it.
lazy.UrlbarUtils.addToInputHistory(url, input).catch(Cu.reportError);
lazy.UrlbarUtils.addToInputHistory(url, input).catch(console.error);
}
}
@ -1691,7 +1691,7 @@ export class UrlbarInput {
if (sourceName) {
searchMode = { source };
} else {
Cu.reportError(`Unrecognized source: ${source}`);
console.error(`Unrecognized source: ${source}`);
}
}
@ -1731,7 +1731,7 @@ export class UrlbarInput {
try {
lazy.BrowserSearchTelemetry.recordSearchMode(searchMode);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
}
}
@ -2049,7 +2049,7 @@ export class UrlbarInput {
try {
return Services.uriFixup.getFixupURIInfo(searchString, flags);
} catch (ex) {
Cu.reportError(
console.error(
`An error occured while trying to fixup "${searchString}": ${ex}`
);
}
@ -2535,9 +2535,7 @@ export class UrlbarInput {
);
value = info.fixedURI.spec;
} catch (ex) {
Cu.reportError(
`An error occured while trying to fixup "${value}": ${ex}`
);
console.error(`An error occured while trying to fixup "${value}": ${ex}`);
}
this.value = value;
@ -2636,7 +2634,7 @@ export class UrlbarInput {
} 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);
}
// TODO: When bug 1498553 is resolved, we should be able to

Просмотреть файл

@ -901,7 +901,7 @@ class Preferences {
}
if (!this.FIREFOX_SUGGEST_DEFAULT_PREFS.hasOwnProperty(scenario)) {
scenario = "history";
Cu.reportError(`Unrecognized Firefox Suggest scenario "${scenario}"`);
console.error(`Unrecognized Firefox Suggest scenario "${scenario}"`);
}
return scenario;
}
@ -1011,7 +1011,7 @@ class Preferences {
try {
this[methodName](scenario);
} catch (error) {
Cu.reportError(
console.error(
`Error migrating Firefox Suggest prefs to version ${nextVersion}: ` +
error
);

Просмотреть файл

@ -111,7 +111,7 @@ export class UrlbarProviderOpenTabs extends UrlbarProvider {
// Populate the table with the current cached tabs.
for (let [userContextId, urls] of UrlbarProviderOpenTabs._openTabs) {
for (let url of urls) {
await addToMemoryTable(url, userContextId).catch(Cu.reportError);
await addToMemoryTable(url, userContextId).catch(console.error);
}
}
}
@ -134,7 +134,7 @@ export class UrlbarProviderOpenTabs extends UrlbarProvider {
UrlbarProviderOpenTabs._openTabs.set(userContextId, []);
}
UrlbarProviderOpenTabs._openTabs.get(userContextId).push(url);
await addToMemoryTable(url, userContextId).catch(Cu.reportError);
await addToMemoryTable(url, userContextId).catch(console.error);
}
/**
@ -155,7 +155,7 @@ export class UrlbarProviderOpenTabs extends UrlbarProvider {
let index = openTabs.indexOf(url);
if (index != -1) {
openTabs.splice(index, 1);
await removeFromMemoryTable(url, userContextId).catch(Cu.reportError);
await removeFromMemoryTable(url, userContextId).catch(console.error);
}
}
}

Просмотреть файл

@ -341,7 +341,7 @@ function makeUrlbarResult(tokens, info) {
})
);
default:
Cu.reportError(`Unexpected action type: ${action.type}`);
console.error(`Unexpected action type: ${action.type}`);
return null;
}
}

Просмотреть файл

@ -310,7 +310,7 @@ export var UrlbarUtils = {
try {
entry = await lazy.PlacesUtils.keywords.fetch(keyword);
} catch (ex) {
Cu.reportError(`Unable to fetch Places keyword "${keyword}": ${ex}`);
console.error(`Unable to fetch Places keyword "${keyword}": ${ex}`);
}
if (!entry || !entry.url) {
// This is not a Places keyword.
@ -535,9 +535,9 @@ export var UrlbarUtils = {
if (result.providerType == UrlbarUtils.PROVIDER_TYPE.EXTENSION) {
return UrlbarUtils.RESULT_GROUP.HEURISTIC_EXTENSION;
}
Cu.reportError(
"Returning HEURISTIC_FALLBACK for unrecognized heuristic result: " +
result
console.error(
"Returning HEURISTIC_FALLBACK for unrecognized heuristic result: ",
result
);
return UrlbarUtils.RESULT_GROUP.HEURISTIC_FALLBACK;
}
@ -1192,7 +1192,7 @@ export var UrlbarUtils = {
let { type } = result.autofill;
if (!type) {
type = "other";
Cu.reportError(
console.error(
new Error(
"`result.autofill.type` not set, falling back to 'other'"
)
@ -2064,7 +2064,7 @@ export class UrlbarProvider {
try {
return this[methodName](...args);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
return undefined;
}
@ -2388,7 +2388,7 @@ export class SkippableTimer {
this.logger.debug(line);
}
if (isError) {
Cu.reportError(line);
console.error(line);
}
}
}
@ -2476,8 +2476,9 @@ export class L10nCache {
}
let messages = await l10n.formatMessages([{ id, args }]);
if (!messages?.length) {
Cu.reportError(
"l10n.formatMessages returned an unexpected value for ID: " + id
console.error(
"l10n.formatMessages returned an unexpected value for ID: ",
id
);
return;
}
@ -2661,7 +2662,7 @@ export class TaskQueue {
let value = await callback();
resolve(value);
} catch (error) {
Cu.reportError(error);
console.error(error);
reject(error);
}
this._queue.shift();

Просмотреть файл

@ -1178,7 +1178,7 @@ export class UrlbarView {
provider.getViewTemplate?.(result) ||
UrlbarView.dynamicViewTemplatesByName.get(dynamicType);
if (!viewTemplate) {
Cu.reportError(`No viewTemplate found for ${result.providerName}`);
console.error(`No viewTemplate found for ${result.providerName}`);
}
this.#buildViewForDynamicType(
dynamicType,
@ -1198,7 +1198,7 @@ export class UrlbarView {
if (name == "id") {
// We do not allow dynamic results to set IDs for their Nodes. IDs are
// managed by the view to ensure they are unique.
Cu.reportError(
console.error(
"Dynamic results are prohibited from setting their own IDs."
);
continue;
@ -1700,7 +1700,7 @@ export class UrlbarView {
if (attrName == "id") {
// We do not allow dynamic results to set IDs for their Nodes. IDs are
// managed by the view to ensure they are unique.
Cu.reportError(
console.error(
"Dynamic results are prohibited from setting their own IDs."
);
continue;
@ -2665,7 +2665,7 @@ export class UrlbarView {
favicon.src = result.payload.icon || lazy.UrlbarUtils.ICON.DEFAULT;
}
} else {
Cu.reportError("An item is missing the action setter");
console.error("An item is missing the action setter");
}
item.removeAttribute("source");
}
@ -2937,7 +2937,7 @@ async function addDynamicStylesheet(window, stylesheetURL) {
);
window.windowUtils.addSheet(sheet, Ci.nsIDOMWindowUtils.AGENT_SHEET);
} catch (ex) {
Cu.reportError(`Error adding dynamic stylesheet: ${ex}`);
console.error(`Error adding dynamic stylesheet: ${ex}`);
}
}
@ -2957,6 +2957,6 @@ function removeDynamicStylesheet(window, stylesheetURL) {
Ci.nsIDOMWindowUtils.AGENT_SHEET
);
} catch (ex) {
Cu.reportError(`Error removing dynamic stylesheet: ${ex}`);
console.error(`Error removing dynamic stylesheet: ${ex}`);
}
}

Просмотреть файл

@ -370,7 +370,7 @@ async function withAwaitProvider(args, promise, callback) {
try {
await callback();
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
} finally {
UrlbarProvidersManager.unregisterProvider(provider);
}