Bug 1803757 - Automatically replace Cu.reportError with console.error (credentials). r=credential-management-reviewers,sgalich

Depends on D163701

Differential Revision: https://phabricator.services.mozilla.com/D163702
This commit is contained in:
Mark Banner 2022-12-02 18:44:44 +00:00
parent 2b35e5d5d2
commit c338c0398d
17 changed files with 28 additions and 29 deletions

View File

@ -212,7 +212,6 @@ module.exports = {
"browser/base/content/**",
"browser/components/Browser*.*",
"browser/components/**",
"browser/extensions/formautofill/**",
"browser/extensions/report-site-issue/**",
"browser/extensions/search-detection/**",
"browser/modules/**",

View File

@ -40,7 +40,7 @@ function recordTelemetryEvent(event) {
extra
);
} catch (ex) {
Cu.reportError(
console.error(
"AboutLoginsChild: error recording telemetry event: " + ex.message
);
}

View File

@ -196,7 +196,7 @@ class AboutLoginsParent extends JSWindowActorParent {
// Remove the path from the origin, if it was provided.
let origin = lazy.LoginHelper.getLoginOrigin(newLogin.origin);
if (!origin) {
Cu.reportError(
console.error(
"AboutLogins:CreateLogin: Unable to get an origin from the login details."
);
return;
@ -238,7 +238,7 @@ class AboutLoginsParent extends JSWindowActorParent {
lazy.MigrationUtils.MIGRATION_ENTRYPOINT_PASSWORDS,
]);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
}
@ -492,7 +492,7 @@ class AboutLoginsParent extends JSWindowActorParent {
try {
summary = await lazy.LoginCSVImport.importFromCSV(path);
} catch (e) {
Cu.reportError(e);
console.error(e);
this.sendAsyncMessage(
"AboutLogins:ImportPasswordsErrorDialog",
e.errorType

View File

@ -38,8 +38,8 @@ module.exports = {
// Maximum depth callbacks can be nested.
"max-nested-callbacks": ["error", 4],
// Disallow using the console API.
"no-console": "error",
// Disallow using the console API, except for error statments.
"no-console": ["error", { allow: ["error"] }],
// Disallow fallthrough of case statements, except if there is a comment.
"no-fallthrough": "error",

View File

@ -161,7 +161,7 @@ this.formautofill = class extends ExtensionAPI {
if (this.autofillManifest) {
Components.manager.addBootstrappedManifestLocation(this.autofillManifest);
} else {
Cu.reportError(
console.error(
"Cannot find formautofill chrome.manifest for registring translated strings"
);
}

View File

@ -220,7 +220,7 @@ class EditCreditCardDialog extends AutofillEditDialog {
window.close();
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
}
}

View File

@ -390,7 +390,7 @@ class ManageCreditCards extends ManageRecords {
// Recover from encryption error so the user gets a chance to re-enter
// unencrypted credit card number.
decryptedCCNumObj["cc-number"] = "";
Cu.reportError(ex);
console.error(ex);
}
}
let decryptedCreditCard = Object.assign({}, creditCard, decryptedCCNumObj);

View File

@ -144,7 +144,7 @@ class LoginCSVImport {
try {
csvString = await IOUtils.readUTF8(filePath, { encoding: "utf-8" });
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
throw new ImportFailedException(
ImportFailedErrorType.FILE_PERMISSIONS_ERROR
);
@ -221,7 +221,7 @@ class LoginCSVImport {
.add(accumulatedDelay);
TelemetryStopwatch.finish("PWMGR_IMPORT_LOGINS_FROM_FILE_MS");
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
LoginCSVImport.lastImportReport = report;
return report;

View File

@ -226,7 +226,7 @@ class ImportRowProcessor {
LoginHelper.checkLoginValues(login);
} catch (e) {
this.addLoginToSummary({ ...loginData }, "error");
Cu.reportError(e);
console.error(e);
return true;
}
return false;
@ -348,7 +348,7 @@ class ImportRowProcessor {
Services.logins.modifyLogin(summaryRow.login, summaryRow.propBag);
}
} catch (e) {
Cu.reportError(e);
console.error(e);
summaryRow.result = "error";
}
}

View File

@ -332,7 +332,7 @@ LoginManager.prototype = {
try {
this._checkLogin(logins[i]);
} catch (e) {
Cu.reportError(e);
console.error(e);
continue;
}
@ -613,7 +613,7 @@ LoginManager.prototype = {
);
} catch (ex) {
if (!origin.startsWith("chrome:")) {
Cu.reportError(ex);
console.error(ex);
}
return false;
}

View File

@ -239,7 +239,7 @@ LoginManagerAuthPromptFactory.prototype = {
// Prompts throw NS_ERROR_NOT_AVAILABLE if they're aborted.
promptAborted = true;
} else {
Cu.reportError("LoginManagerAuthPrompter: _doAsyncPrompt " + e + "\n");
console.error("LoginManagerAuthPrompter: _doAsyncPrompt " + e + "\n");
}
}
@ -666,7 +666,7 @@ LoginManagerAuthPrompter.prototype = {
} catch (e) {
// Ignore any errors and display the prompt anyway.
epicfail = true;
Cu.reportError(
console.error(
"LoginManagerAuthPrompter: Epic fail in promptAuth: " + e + "\n"
);
}
@ -768,7 +768,7 @@ LoginManagerAuthPrompter.prototype = {
);
}
} catch (e) {
Cu.reportError("LoginManagerAuthPrompter: Fail2 in promptAuth: " + e);
console.error("LoginManagerAuthPrompter: Fail2 in promptAuth: " + e);
}
return ok;
@ -833,7 +833,7 @@ LoginManagerAuthPrompter.prototype = {
this._factory._doAsyncPrompt(asyncPrompt, hashKey);
} catch (e) {
Cu.reportError(
console.error(
"LoginManagerAuthPrompter: " +
"asyncPromptAuth: " +
e +

View File

@ -2543,7 +2543,7 @@ class LoginManagerChild extends JSWindowActorChild {
}
this.sendAsyncMessage(messageName, detail);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
throw ex;
} finally {
detail.form = form;
@ -3067,7 +3067,7 @@ class LoginManagerChild extends JSWindowActorChild {
autofillResult = AUTOFILL_RESULT.FILLED_USERNAME_ONLY_FORM;
}
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
throw ex;
} finally {
if (autofillResult == -1) {

View File

@ -271,7 +271,7 @@ class LoginManagerPrompter {
let updateButtonLabel = () => {
if (!currentNotification) {
Cu.reportError("updateButtonLabel, no currentNotification");
console.error("updateButtonLabel, no currentNotification");
}
let foundLogins = lazy.LoginHelper.searchLoginsWithObject({
formActionOrigin: login.formActionOrigin,

View File

@ -128,7 +128,7 @@ LoginStore.prototype._backupHandler = async function() {
// This notification is specifically sent out for a test.
Services.obs.notifyObservers(null, "logins-backup-updated");
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
} else if (!logins.length) {
// If no logins are stored anymore, delete backup.

View File

@ -75,7 +75,7 @@ function OSCrypto() {
.declare("LocalFree", ctypes.winapi_abi, wintypes.DWORD, wintypes.PVOID)
);
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
this.finalize();
throw ex;
}
@ -279,7 +279,7 @@ OSCrypto.prototype = {
try {
lib.close();
} catch (ex) {
Cu.reportError(ex);
console.error(ex);
}
}
this._libs.clear();

View File

@ -19,7 +19,7 @@ module.exports = {
},
],
"max-nested-callbacks": ["error", 4],
"no-console": "error",
"no-console": ["error", { allow: ["error"] }],
"no-fallthrough": "error",
"no-multi-str": "error",
"no-proto": "error",

View File

@ -115,7 +115,7 @@ FormHistoryClient.prototype = {
}
if (!callback) {
Cu.reportError("FormHistoryClient received response with no callback");
console.error("FormHistoryClient received response with no callback");
return;
}
@ -286,7 +286,7 @@ FormAutoComplete.prototype = {
params[name] = value;
}
} catch (ex) {
Cu.reportError("Invalid options object: " + ex);
console.error("Invalid options object: " + ex);
}
}