diff --git a/toolkit/components/passwordmgr/.eslintrc b/toolkit/components/passwordmgr/.eslintrc index fd49a0b7d53d..26c02ed9e20e 100644 --- a/toolkit/components/passwordmgr/.eslintrc +++ b/toolkit/components/passwordmgr/.eslintrc @@ -4,6 +4,9 @@ // Require spacing around => "arrow-spacing": 2, + // No newline before open brace for a block + "brace-style": [2, "1tbs", {"allowSingleLine": true}], + // No space before always a space after a comma "comma-spacing": [2, {"before": false, "after": true}], diff --git a/toolkit/components/passwordmgr/LoginHelper.jsm b/toolkit/components/passwordmgr/LoginHelper.jsm index 9f7de0461143..e5fed061d496 100644 --- a/toolkit/components/passwordmgr/LoginHelper.jsm +++ b/toolkit/components/passwordmgr/LoginHelper.jsm @@ -89,8 +89,7 @@ this.LoginHelper = { * @throws String with English message in case validation failed. */ checkLoginValues(aLogin) { - function badCharacterPresent(l, c) - { + function badCharacterPresent(l, c) { return ((l.formSubmitURL && l.formSubmitURL.indexOf(c) != -1) || (l.httpRealm && l.httpRealm.indexOf(c) != -1) || l.hostname.indexOf(c) != -1 || diff --git a/toolkit/components/passwordmgr/LoginImport.jsm b/toolkit/components/passwordmgr/LoginImport.jsm index 75db3892ca1d..a1904a3d40ce 100644 --- a/toolkit/components/passwordmgr/LoginImport.jsm +++ b/toolkit/components/passwordmgr/LoginImport.jsm @@ -45,8 +45,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", * @param aPath * String containing the file path of the SQLite login database. */ -this.LoginImport = function (aStore, aPath) -{ +this.LoginImport = function (aStore, aPath) { this.store = aStore; this.path = aPath; } diff --git a/toolkit/components/passwordmgr/LoginStore.jsm b/toolkit/components/passwordmgr/LoginStore.jsm index 1f75b83dac12..e17c3f6356c7 100644 --- a/toolkit/components/passwordmgr/LoginStore.jsm +++ b/toolkit/components/passwordmgr/LoginStore.jsm @@ -126,8 +126,7 @@ const PERMISSION_SAVE_LOGINS = "login-saving"; * @param aPath * String containing the file path where data should be saved. */ -function LoginStore(aPath) -{ +function LoginStore(aPath) { this.path = aPath; this._saver = new DeferredTask(() => this.save(), kSaveDelayMs); @@ -162,8 +161,7 @@ LoginStore.prototype = { * @resolves When the operation finished successfully. * @rejects JavaScript exception. */ - load: function () - { + load() { return Task.spawn(function* () { try { let bytes = yield OS.File.read(this.path); @@ -214,8 +212,7 @@ LoginStore.prototype = { /** * Loads persistent data from the file to memory, synchronously. */ - ensureDataReady: function () - { + ensureDataReady() { if (this.dataReady) { return; } @@ -266,8 +263,7 @@ LoginStore.prototype = { /** * Synchronously work on the data just loaded into memory. */ - _processLoadedData: function () - { + _processLoadedData() { // Create any arrays that are not present in the saved file. if (!this.data.logins) { this.data.logins = []; @@ -307,8 +303,7 @@ LoginStore.prototype = { /** * Called when the data changed, this triggers asynchronous serialization. */ - saveSoon: function () - { + saveSoon() { return this._saver.arm(); }, @@ -326,8 +321,7 @@ LoginStore.prototype = { * @resolves When the operation finished successfully. * @rejects JavaScript exception. */ - save: function () - { + save() { return Task.spawn(function* () { // Create or overwrite the file. let bytes = gTextEncoder.encode(JSON.stringify(this.data)); diff --git a/toolkit/components/passwordmgr/content/passwordManager.js b/toolkit/components/passwordmgr/content/passwordManager.js index 59a54deaf076..bba35aeefceb 100644 --- a/toolkit/components/passwordmgr/content/passwordManager.js +++ b/toolkit/components/passwordmgr/content/passwordManager.js @@ -486,8 +486,7 @@ function HandleSignonKeyPress(e) { } if (e.keyCode == KeyboardEvent.DOM_VK_DELETE || (AppConstants.platform == "macosx" && - e.keyCode == KeyboardEvent.DOM_VK_BACK_SPACE)) - { + e.keyCode == KeyboardEvent.DOM_VK_BACK_SPACE)) { DeleteSignon(); } } diff --git a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js index 622261461cd3..29325e419d2c 100644 --- a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js +++ b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js @@ -661,8 +661,7 @@ LoginManagerPrompter.prototype = { this._factory._asyncPrompts[hashKey] = asyncPrompt; this._factory._doAsyncPrompt(); - } - catch (e) { + } catch (e) { Components.utils.reportError("LoginManagerPrompter: " + "asyncPromptAuth: " + e + "\nFalling back to promptAuth\n"); // Fail the prompt operation to let the consumer fall back @@ -907,8 +906,7 @@ LoginManagerPrompter.prototype = { accessKey: this._getLocalizedString(initialMsgNames.buttonAccessKey), callback: () => { histogram.add(PROMPT_ADD_OR_UPDATE); - if (histogramName == "PWMGR_PROMPT_REMEMBER_ACTION") - { + if (histogramName == "PWMGR_PROMPT_REMEMBER_ACTION") { Services.obs.notifyObservers(null, 'LoginStats:NewSavedPassword', null); } readDataFromUI(); diff --git a/toolkit/components/passwordmgr/storage-json.js b/toolkit/components/passwordmgr/storage-json.js index abcf46070c43..9d14cfd2ee04 100644 --- a/toolkit/components/passwordmgr/storage-json.js +++ b/toolkit/components/passwordmgr/storage-json.js @@ -180,8 +180,7 @@ this.LoginManagerStorage_json.prototype = { // Check if the new GUID is duplicate. if (newLogin.guid != oldStoredLogin.guid && - !this._isGuidUnique(newLogin.guid)) - { + !this._isGuidUnique(newLogin.guid)) { throw new Error("specified GUID already exists"); } diff --git a/toolkit/components/passwordmgr/storage-mozStorage.js b/toolkit/components/passwordmgr/storage-mozStorage.js index b939f55aeb27..8cef12b29381 100644 --- a/toolkit/components/passwordmgr/storage-mozStorage.js +++ b/toolkit/components/passwordmgr/storage-mozStorage.js @@ -27,8 +27,7 @@ function Transaction(aDatabase) { try { this._db.beginTransaction(); this._hasTransaction = true; - } - catch (e) { /* om nom nom exceptions */ } + } catch (e) { /* om nom nom exceptions */ } } Transaction.prototype = { @@ -335,8 +334,7 @@ LoginManagerStorage_mozStorage.prototype = { // Check if the new GUID is duplicate. if (newLogin.guid != oldStoredLogin.guid && - !this._isGuidUnique(newLogin.guid)) - { + !this._isGuidUnique(newLogin.guid)) { throw new Error("specified GUID already exists"); } diff --git a/toolkit/components/passwordmgr/test/.eslintrc b/toolkit/components/passwordmgr/test/.eslintrc index e116c5d14a1f..6c4908066032 100644 --- a/toolkit/components/passwordmgr/test/.eslintrc +++ b/toolkit/components/passwordmgr/test/.eslintrc @@ -4,6 +4,7 @@ "../../../../testing/mochitest/chrome.eslintrc" ], "rules": { + "brace-style": 0, "no-undef": 0, "no-unused-vars": 0, },