зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1330791 - Enable no-else-return rule for eslint in /services and fix associated errors. r=markh
MozReview-Commit-ID: 7Os4uZQCDox --HG-- extra : rebase_source : 2a1d9ef6fb6510f7f3b02b6c727bc706e56637b0
This commit is contained in:
Родитель
cd4fc8120a
Коммит
ac53e1b8be
|
@ -11,7 +11,6 @@ module.exports = {
|
|||
"brace-style": "warn",
|
||||
"consistent-return": "warn",
|
||||
"no-cond-assign": "warn",
|
||||
"no-else-return": "warn",
|
||||
"no-ex-assign": "warn",
|
||||
"no-func-assign": "warn",
|
||||
"no-native-reassign": "warn",
|
||||
|
|
|
@ -92,8 +92,7 @@ StringBundle.prototype = {
|
|||
get(key, args) {
|
||||
if (args)
|
||||
return this.stringBundle.formatStringFromName(key, args, args.length);
|
||||
else
|
||||
return this.stringBundle.GetStringFromName(key);
|
||||
return this.stringBundle.GetStringFromName(key);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -260,12 +260,11 @@ this.CryptoUtils = {
|
|||
forceJS) {
|
||||
if (Svc.Crypto.deriveKeyFromPassphrase && !forceJS) {
|
||||
return Svc.Crypto.deriveKeyFromPassphrase(passphrase, salt, keyLength);
|
||||
} else {
|
||||
// Fall back to JS implementation.
|
||||
// 4096 is hardcoded in WeaveCrypto, so do so here.
|
||||
return CryptoUtils.pbkdf2Generate(passphrase, atob(salt), 4096,
|
||||
keyLength);
|
||||
}
|
||||
// Fall back to JS implementation.
|
||||
// 4096 is hardcoded in WeaveCrypto, so do so here.
|
||||
return CryptoUtils.pbkdf2Generate(passphrase, atob(salt), 4096,
|
||||
keyLength);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -170,14 +170,13 @@ this.FxAccountsProfileClient.prototype = {
|
|||
body,
|
||||
etag: request.response.headers["etag"]
|
||||
});
|
||||
} else {
|
||||
return reject(new FxAccountsProfileClientError({
|
||||
error: body.error || ERROR_UNKNOWN,
|
||||
errno: body.errno || ERRNO_UNKNOWN_ERROR,
|
||||
code: request.response.status,
|
||||
message: body.message || body,
|
||||
}));
|
||||
}
|
||||
return reject(new FxAccountsProfileClientError({
|
||||
error: body.error || ERROR_UNKNOWN,
|
||||
errno: body.errno || ERRNO_UNKNOWN_ERROR,
|
||||
code: request.response.status,
|
||||
message: body.message || body,
|
||||
}));
|
||||
};
|
||||
|
||||
if (method === "GET") {
|
||||
|
|
|
@ -491,9 +491,8 @@ function validationHelper(params, expected) {
|
|||
} catch (e) {
|
||||
if (typeof expected === "string") {
|
||||
return do_check_eq(e.toString(), expected);
|
||||
} else {
|
||||
return do_check_true(e.toString().match(expected));
|
||||
}
|
||||
return do_check_true(e.toString().match(expected));
|
||||
}
|
||||
throw new Error("Validation helper error");
|
||||
}
|
||||
|
|
|
@ -296,9 +296,8 @@ AddonsReconciler.prototype = {
|
|||
if (element == listener) {
|
||||
this._log.debug("Removing change listener.");
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
|
|
|
@ -314,9 +314,8 @@ AddonUtilsInternal.prototype = {
|
|||
|
||||
if (param.indexOf("src=") == 0) {
|
||||
return "src=sync";
|
||||
} else {
|
||||
return param;
|
||||
}
|
||||
return param;
|
||||
});
|
||||
|
||||
addon.sourceURI.query = params.join("&");
|
||||
|
|
|
@ -407,9 +407,8 @@ this.BrowserIDManager.prototype = {
|
|||
// field directly and instead call a isSyncKeyValid() function
|
||||
// that we can override.
|
||||
return "99999999999999999999999999";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
set syncKey(value) {
|
||||
|
|
|
@ -662,11 +662,9 @@ Sync11Service.prototype = {
|
|||
|
||||
// Last-ditch case.
|
||||
return false;
|
||||
} else {
|
||||
// No update needed: we're good!
|
||||
return true;
|
||||
}
|
||||
|
||||
// No update needed: we're good!
|
||||
return true;
|
||||
} catch (ex) {
|
||||
// This means no keys are present, or there's a network error.
|
||||
this._log.debug("Failed to fetch and verify keys", ex);
|
||||
|
@ -1220,20 +1218,19 @@ Sync11Service.prototype = {
|
|||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
if (!this.upgradeSyncKey(meta.payload.syncID)) {
|
||||
this._log.warn("Failed to upgrade sync key. Failing remote setup.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.verifyAndFetchSymmetricKeys(infoResponse)) {
|
||||
this._log.warn("Failed to fetch symmetric keys. Failing remote setup.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
if (!this.upgradeSyncKey(meta.payload.syncID)) {
|
||||
this._log.warn("Failed to upgrade sync key. Failing remote setup.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.verifyAndFetchSymmetricKeys(infoResponse)) {
|
||||
this._log.warn("Failed to fetch symmetric keys. Failing remote setup.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -473,20 +473,19 @@ add_task(async function test_refreshCertificateOn401() {
|
|||
headers: {"content-type": "application/json"},
|
||||
body: JSON.stringify({}),
|
||||
};
|
||||
} else {
|
||||
didReturn200 = true;
|
||||
return {
|
||||
status: 200,
|
||||
headers: {"content-type": "application/json"},
|
||||
body: JSON.stringify({
|
||||
id: "id",
|
||||
key: "key",
|
||||
api_endpoint: "http://example.com/",
|
||||
uid: "uid",
|
||||
duration: 300,
|
||||
})
|
||||
};
|
||||
}
|
||||
didReturn200 = true;
|
||||
return {
|
||||
status: 200,
|
||||
headers: {"content-type": "application/json"},
|
||||
body: JSON.stringify({
|
||||
id: "id",
|
||||
key: "key",
|
||||
api_endpoint: "http://example.com/",
|
||||
uid: "uid",
|
||||
duration: 300,
|
||||
})
|
||||
};
|
||||
});
|
||||
|
||||
browseridManager._tokenServerClient = mockTSC;
|
||||
|
|
|
@ -217,9 +217,8 @@ PlacesItem.prototype = {
|
|||
folder_parts[i]);
|
||||
if (subfolder_id == -1) {
|
||||
return -1;
|
||||
} else {
|
||||
folder_id = subfolder_id;
|
||||
}
|
||||
folder_id = subfolder_id;
|
||||
}
|
||||
return folder_id;
|
||||
},
|
||||
|
|
|
@ -167,12 +167,11 @@ FormData.prototype = {
|
|||
// this item doesn't exist yet in the db, so we need to insert it
|
||||
return FormDB.insertValue(this.fieldname, this.value,
|
||||
this.hours_to_us(this.date));
|
||||
} else {
|
||||
/* Right now, we ignore this case. If bug 552531 is ever fixed,
|
||||
we might need to add code here to update the firstUsed or
|
||||
lastUsed fields, as appropriate.
|
||||
*/
|
||||
}
|
||||
/* Right now, we ignore this case. If bug 552531 is ever fixed,
|
||||
we might need to add code here to update the firstUsed or
|
||||
lastUsed fields, as appropriate.
|
||||
*/
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче