Bug 1803914 - Automatically replace Cu.reportError with console.error (misc). r=mossop

Differential Revision: https://phabricator.services.mozilla.com/D163772
This commit is contained in:
Mark Banner 2022-12-06 14:34:57 +00:00
parent 9f4b707f11
commit ff47c36f9b
10 changed files with 11 additions and 16 deletions

View file

@ -226,11 +226,6 @@ module.exports = {
"dom/serviceworkers/test/browser_download.js",
"dom/system/NetworkGeolocationProvider.*",
"dom/tests/browser/browser_hasbeforeunload.js",
"editor/AsyncSpellCheckTestHelper.*",
"intl/locale/LangPackMatcher.sys.mjs",
"js/xpconnect/loader/XPCOMUtils.sys.mjs",
"layout/base/tests/chrome/**",
"security/manager/ssl/tests/mochitest/mixedcontent/test_bug383369.html",
"toolkit/**",
"uriloader/exthandler/**",
],

View file

@ -65,7 +65,7 @@ function maybeOnSpellCheck(editableElement, callback) {
? SPELL_CHECK_ENDED_TOPIC
: SPELL_CHECK_STARTED_TOPIC;
if (topic != expectedTopic) {
Cu.reportError("Expected " + expectedTopic + " but got " + topic + "!");
console.error("Expected " + expectedTopic + " but got " + topic + "!");
}
waitingForEnded = !waitingForEnded;
}

View file

@ -148,7 +148,7 @@ const mockable = {
try {
return lazy.AddonRepository.getAvailableLangpacks();
} catch (error) {
Cu.reportError(
console.error(
`Failed to get the list of available language packs: ${error?.message}`
);
return null;
@ -169,14 +169,14 @@ const mockable = {
},
});
} catch (error) {
Cu.reportError(error);
console.error(error);
return false;
}
try {
await install.install();
} catch (error) {
Cu.reportError(error);
console.error(error);
return false;
}
return true;

View file

@ -235,7 +235,7 @@ export var XPCOMUtils = {
aPostLambda.apply(proxy);
}
} catch (ex) {
Cu.reportError("Failed to load module " + aResource + ".");
console.error("Failed to load module " + aResource + ".");
throw ex;
}
return temp[aSymbol || aName];

View file

@ -26,7 +26,7 @@ async function run() {
ok(true, "Retrieved printer basic attributes successfully.");
} catch (e) {
ok(false, `Error thrown while retrieving printer basic attributes: ${e}.`);
Cu.reportError(e);
console.error(e);
}
SimpleTest.finish();
}

View file

@ -40,7 +40,7 @@ async function run() {
ok(true, "Finished traversing printers.");
} catch (e) {
ok(false, `Error thrown while retrieving printer info: ${e}.`);
Cu.reportError(e);
console.error(e);
}
SimpleTest.finish();
}

View file

@ -59,7 +59,7 @@ async function run() {
}
} catch (e) {
ok(false, `Shouldn't throw: ${e}`);
Cu.reportError(e);
console.error(e);
}
SimpleTest.finish();
}

View file

@ -53,7 +53,7 @@ async function run() {
}
} catch (e) {
ok(false, `Shouldn't throw: ${e}`);
Cu.reportError(e);
console.error(e);
}
SimpleTest.finish();
}

View file

@ -25,7 +25,7 @@ module.exports = {
"no-case-declarations": "error",
// Disallow use of the console API.
"no-console": "error",
"no-console": ["error", { allow: ["error"] }],
// Disallow constant expressions in conditions (except for loops).
"no-constant-condition": ["error", { checkLoops: false }],

View file

@ -51,7 +51,7 @@
},
});
sendAsyncMessage("navigate", "download.auto");
}).catch(Cu.reportError);
}).catch(console.error);
});
script.addMessageListener("navigate", function(url) {
window.location = url;