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

Depends on D167518

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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