Bug 1806500 - Automatically replace Cu.reportError with console.error (uriloader dom). r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D165067
This commit is contained in:
Mark Banner 2022-12-20 18:34:36 +00:00
parent 42ae364fef
commit 099830ac94
13 changed files with 29 additions and 38 deletions

View File

@ -216,18 +216,9 @@ module.exports = {
"browser/extensions/search-detection/**",
"browser/modules/**",
"browser/themes/BuiltInThemes.sys.mjs",
"devtools/**",
"dom/base/DOMRequestHelper.*",
"dom/console/ConsoleAPIStorage.*",
"dom/push/PushComponents.sys.mjs",
"dom/push/PushServiceHttp2.sys.mjs",
"dom/push/test/mockpushserviceparent.js",
"dom/push/test/xpcshell/head.js",
"dom/serviceworkers/test/browser_download.js",
"dom/system/NetworkGeolocationProvider.*",
"dom/tests/browser/browser_hasbeforeunload.js",
"devtools/**",
"toolkit/**",
"uriloader/exthandler/**",
],
rules: {
"mozilla/no-cu-reportError": "off",

View File

@ -270,7 +270,7 @@ DOMRequestIpcHelper.prototype = {
createRequest() {
// If we don't have a valid window object, throw.
if (!this._window) {
Cu.reportError(
console.error(
"DOMRequestHelper trying to create a DOMRequest without a valid window, failing."
);
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
@ -286,7 +286,7 @@ DOMRequestIpcHelper.prototype = {
createPromise(aPromiseInit) {
// If we don't have a valid window object, throw.
if (!this._window) {
Cu.reportError(
console.error(
"DOMRequestHelper trying to create a Promise without a valid window, failing."
);
throw Components.Exception("", Cr.NS_ERROR_FAILURE);

View File

@ -154,7 +154,7 @@ Object.assign(PushServiceParent.prototype, {
this._deliverSubscriptionError(callback, error);
}
)
.catch(Cu.reportError);
.catch(console.error);
},
unsubscribe(scope, principal, callback) {
@ -169,7 +169,7 @@ Object.assign(PushServiceParent.prototype, {
callback.onUnsubscribe(Cr.NS_ERROR_FAILURE, false);
}
)
.catch(Cu.reportError);
.catch(console.error);
},
getSubscription(scope, principal, callback) {
@ -184,7 +184,7 @@ Object.assign(PushServiceParent.prototype, {
this._deliverSubscriptionError(callback, error);
}
)
.catch(Cu.reportError);
.catch(console.error);
},
clearForDomain(domain, callback) {
@ -199,7 +199,7 @@ Object.assign(PushServiceParent.prototype, {
callback.onClear(Cr.NS_ERROR_FAILURE);
}
)
.catch(Cu.reportError);
.catch(console.error);
},
// nsIPushQuotaManager methods
@ -250,7 +250,7 @@ Object.assign(PushServiceParent.prototype, {
});
}
)
.catch(Cu.reportError);
.catch(console.error);
},
ensureReady() {

View File

@ -735,14 +735,14 @@ export var PushServiceHttp2 = {
if (this._mainPushService) {
this._mainPushService
.updateRegistrationAndNotifyApp(aSubscriptionUri, recordNew)
.catch(Cu.reportError);
.catch(console.error);
}
},
error => {
if (this._mainPushService) {
this._mainPushService
.dropRegistrationAndNotifyApp(aSubscriptionUri)
.catch(Cu.reportError);
.catch(console.error);
}
}
)

View File

@ -18,7 +18,7 @@ function waterfall(...callbacks) {
}),
Promise.resolve()
)
.catch(Cu.reportError);
.catch(console.error);
}
/**
@ -97,7 +97,7 @@ addMessageListener("socket-teardown", function(msg) {
sendAsyncMessage("socket-server-teardown");
})
.catch(error => {
Cu.reportError(`Error restoring service backend: ${error}`);
console.error(`Error restoring service backend: ${error}`);
});
});
@ -132,7 +132,7 @@ var MockService = {
handleResponse(response) {
if (!this.resolvers.has(response.id)) {
Cu.reportError(`Unexpected response for request ${response.id}`);
console.error(`Unexpected response for request ${response.id}`);
return;
}
let resolver = this.resolvers.get(response.id);
@ -182,7 +182,7 @@ addMessageListener("service-replace", function() {
sendAsyncMessage("service-replaced");
})
.catch(error => {
Cu.reportError(`Error replacing service: ${error}`);
console.error(`Error replacing service: ${error}`);
});
});
@ -192,7 +192,7 @@ addMessageListener("service-restore", function() {
sendAsyncMessage("service-restored");
})
.catch(error => {
Cu.reportError(`Error restoring service: ${error}`);
console.error(`Error restoring service: ${error}`);
});
});

View File

@ -62,7 +62,7 @@ Services.obs.addObserver(function observe(subject, topic, data) {
try {
thread.processNextEvent(true);
} catch (e) {
Cu.reportError(e);
console.error(e);
}
}
}, "profile-change-net-teardown");
@ -99,7 +99,7 @@ function waterfall(...callbacks) {
}),
Promise.resolve()
)
.catch(Cu.reportError);
.catch(console.error);
}
/**

View File

@ -73,8 +73,8 @@ function test() {
ok(file.exists(), "download completed");
is(file.fileSize, 33, "downloaded file has correct size");
file.remove(false);
downloadList.remove(aDownload).catch(Cu.reportError);
downloadList.removeView(downloadListener).catch(Cu.reportError);
downloadList.remove(aDownload).catch(console.error);
downloadList.removeView(downloadListener).catch(console.error);
gBrowser.removeTab(tab);
Services.ww.unregisterNotification(windowObserver);

View File

@ -472,7 +472,7 @@ NetworkGeolocationProvider.prototype = {
);
} catch (err) {
LOG("Location request hit error: " + err.name);
Cu.reportError(err);
console.error(err);
if (err.name == "AbortError") {
this.onStatus(true, "xhr-timeout");
} else {

View File

@ -315,7 +315,7 @@ function controlFrameAt(browser, frameDepth, command) {
break;
}
}
}).catch(Cu.reportError);
}).catch(console.error);
}
/**

View File

@ -124,7 +124,7 @@ HandlerService.prototype = {
this._store.saveSoon();
}
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
},
@ -300,7 +300,7 @@ HandlerService.prototype = {
try {
kMigrations[migration]();
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
}
@ -316,7 +316,7 @@ HandlerService.prototype = {
}
this.__store = null;
this.__storeInitialized = false;
})().catch(Cu.reportError);
})().catch(console.error);
},
// nsIObserver
@ -348,7 +348,7 @@ HandlerService.prototype = {
this._ensureStoreInitialized();
}
})
.catch(Cu.reportError);
.catch(console.error);
}
},

View File

@ -94,7 +94,7 @@ addMessageListener("unregister", async function() {
await dl.refresh();
if (dl.target.exists || dl.target.partFileExists) {
dump("Finalizing download.\n");
await dl.finalize(true).catch(Cu.reportError);
await dl.finalize(true).catch(console.error);
}
}
await list.removeFinished();

View File

@ -273,7 +273,7 @@ async function setupFilePickerDirectory() {
try {
await IOUtils.remove(saveDir.path, { recursive: true });
} catch (e) {
Cu.reportError(e);
console.error(e);
}
});

View File

@ -123,7 +123,7 @@ async function openHelperAppDialog(launcher) {
false,
"Trying to show unknownContentType.xhtml failed with exception: " + ex
);
Cu.reportError(ex);
console.error(ex);
}
let dlg = await helperAppDialogShownPromise;
@ -293,7 +293,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);