Bug 1301287 - Password manager: enable eslint brace-style rule on shipping code. r=johannh

MozReview-Commit-ID: BDHUOlv83eR

--HG--
extra : rebase_source : 3de2fc445198aedaee0e81fc4a92688a9e992097
This commit is contained in:
Matthew Noorenberghe 2016-09-07 21:45:20 -07:00
Родитель 7c5b309a37
Коммит 2d7fae1aca
9 изменённых файлов: 18 добавлений и 28 удалений

Просмотреть файл

@ -4,6 +4,9 @@
// Require spacing around => // Require spacing around =>
"arrow-spacing": 2, "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 // No space before always a space after a comma
"comma-spacing": [2, {"before": false, "after": true}], "comma-spacing": [2, {"before": false, "after": true}],

Просмотреть файл

@ -89,8 +89,7 @@ this.LoginHelper = {
* @throws String with English message in case validation failed. * @throws String with English message in case validation failed.
*/ */
checkLoginValues(aLogin) { checkLoginValues(aLogin) {
function badCharacterPresent(l, c) function badCharacterPresent(l, c) {
{
return ((l.formSubmitURL && l.formSubmitURL.indexOf(c) != -1) || return ((l.formSubmitURL && l.formSubmitURL.indexOf(c) != -1) ||
(l.httpRealm && l.httpRealm.indexOf(c) != -1) || (l.httpRealm && l.httpRealm.indexOf(c) != -1) ||
l.hostname.indexOf(c) != -1 || l.hostname.indexOf(c) != -1 ||

Просмотреть файл

@ -45,8 +45,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
* @param aPath * @param aPath
* String containing the file path of the SQLite login database. * String containing the file path of the SQLite login database.
*/ */
this.LoginImport = function (aStore, aPath) this.LoginImport = function (aStore, aPath) {
{
this.store = aStore; this.store = aStore;
this.path = aPath; this.path = aPath;
} }

Просмотреть файл

@ -126,8 +126,7 @@ const PERMISSION_SAVE_LOGINS = "login-saving";
* @param aPath * @param aPath
* String containing the file path where data should be saved. * String containing the file path where data should be saved.
*/ */
function LoginStore(aPath) function LoginStore(aPath) {
{
this.path = aPath; this.path = aPath;
this._saver = new DeferredTask(() => this.save(), kSaveDelayMs); this._saver = new DeferredTask(() => this.save(), kSaveDelayMs);
@ -162,8 +161,7 @@ LoginStore.prototype = {
* @resolves When the operation finished successfully. * @resolves When the operation finished successfully.
* @rejects JavaScript exception. * @rejects JavaScript exception.
*/ */
load: function () load() {
{
return Task.spawn(function* () { return Task.spawn(function* () {
try { try {
let bytes = yield OS.File.read(this.path); let bytes = yield OS.File.read(this.path);
@ -214,8 +212,7 @@ LoginStore.prototype = {
/** /**
* Loads persistent data from the file to memory, synchronously. * Loads persistent data from the file to memory, synchronously.
*/ */
ensureDataReady: function () ensureDataReady() {
{
if (this.dataReady) { if (this.dataReady) {
return; return;
} }
@ -266,8 +263,7 @@ LoginStore.prototype = {
/** /**
* Synchronously work on the data just loaded into memory. * Synchronously work on the data just loaded into memory.
*/ */
_processLoadedData: function () _processLoadedData() {
{
// Create any arrays that are not present in the saved file. // Create any arrays that are not present in the saved file.
if (!this.data.logins) { if (!this.data.logins) {
this.data.logins = []; this.data.logins = [];
@ -307,8 +303,7 @@ LoginStore.prototype = {
/** /**
* Called when the data changed, this triggers asynchronous serialization. * Called when the data changed, this triggers asynchronous serialization.
*/ */
saveSoon: function () saveSoon() {
{
return this._saver.arm(); return this._saver.arm();
}, },
@ -326,8 +321,7 @@ LoginStore.prototype = {
* @resolves When the operation finished successfully. * @resolves When the operation finished successfully.
* @rejects JavaScript exception. * @rejects JavaScript exception.
*/ */
save: function () save() {
{
return Task.spawn(function* () { return Task.spawn(function* () {
// Create or overwrite the file. // Create or overwrite the file.
let bytes = gTextEncoder.encode(JSON.stringify(this.data)); let bytes = gTextEncoder.encode(JSON.stringify(this.data));

Просмотреть файл

@ -486,8 +486,7 @@ function HandleSignonKeyPress(e) {
} }
if (e.keyCode == KeyboardEvent.DOM_VK_DELETE || if (e.keyCode == KeyboardEvent.DOM_VK_DELETE ||
(AppConstants.platform == "macosx" && (AppConstants.platform == "macosx" &&
e.keyCode == KeyboardEvent.DOM_VK_BACK_SPACE)) e.keyCode == KeyboardEvent.DOM_VK_BACK_SPACE)) {
{
DeleteSignon(); DeleteSignon();
} }
} }

Просмотреть файл

@ -661,8 +661,7 @@ LoginManagerPrompter.prototype = {
this._factory._asyncPrompts[hashKey] = asyncPrompt; this._factory._asyncPrompts[hashKey] = asyncPrompt;
this._factory._doAsyncPrompt(); this._factory._doAsyncPrompt();
} } catch (e) {
catch (e) {
Components.utils.reportError("LoginManagerPrompter: " + Components.utils.reportError("LoginManagerPrompter: " +
"asyncPromptAuth: " + e + "\nFalling back to promptAuth\n"); "asyncPromptAuth: " + e + "\nFalling back to promptAuth\n");
// Fail the prompt operation to let the consumer fall back // Fail the prompt operation to let the consumer fall back
@ -907,8 +906,7 @@ LoginManagerPrompter.prototype = {
accessKey: this._getLocalizedString(initialMsgNames.buttonAccessKey), accessKey: this._getLocalizedString(initialMsgNames.buttonAccessKey),
callback: () => { callback: () => {
histogram.add(PROMPT_ADD_OR_UPDATE); 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); Services.obs.notifyObservers(null, 'LoginStats:NewSavedPassword', null);
} }
readDataFromUI(); readDataFromUI();

Просмотреть файл

@ -180,8 +180,7 @@ this.LoginManagerStorage_json.prototype = {
// Check if the new GUID is duplicate. // Check if the new GUID is duplicate.
if (newLogin.guid != oldStoredLogin.guid && if (newLogin.guid != oldStoredLogin.guid &&
!this._isGuidUnique(newLogin.guid)) !this._isGuidUnique(newLogin.guid)) {
{
throw new Error("specified GUID already exists"); throw new Error("specified GUID already exists");
} }

Просмотреть файл

@ -27,8 +27,7 @@ function Transaction(aDatabase) {
try { try {
this._db.beginTransaction(); this._db.beginTransaction();
this._hasTransaction = true; this._hasTransaction = true;
} } catch (e) { /* om nom nom exceptions */ }
catch (e) { /* om nom nom exceptions */ }
} }
Transaction.prototype = { Transaction.prototype = {
@ -335,8 +334,7 @@ LoginManagerStorage_mozStorage.prototype = {
// Check if the new GUID is duplicate. // Check if the new GUID is duplicate.
if (newLogin.guid != oldStoredLogin.guid && if (newLogin.guid != oldStoredLogin.guid &&
!this._isGuidUnique(newLogin.guid)) !this._isGuidUnique(newLogin.guid)) {
{
throw new Error("specified GUID already exists"); throw new Error("specified GUID already exists");
} }

Просмотреть файл

@ -4,6 +4,7 @@
"../../../../testing/mochitest/chrome.eslintrc" "../../../../testing/mochitest/chrome.eslintrc"
], ],
"rules": { "rules": {
"brace-style": 0,
"no-undef": 0, "no-undef": 0,
"no-unused-vars": 0, "no-unused-vars": 0,
}, },