зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
7c5b309a37
Коммит
2d7fae1aca
|
@ -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,
|
||||||
},
|
},
|
||||||
|
|
Загрузка…
Ссылка в новой задаче