Bug 1301287 - Password manager: enable eslint space-infix-ops rule. r=johannh
.js files were fixed automatically with --fix
MozReview-Commit-ID: wzRpQhqEH7
--- a/toolkit/components/passwordmgr/.eslintrc
+++ b/toolkit/components/passwordmgr/.eslintrc
@@ -16,10 +16,13 @@
// No using undeclared variables
"no-undef": 2,
// Don't allow unused local variables unless they match the pattern
"no-unused-vars": [2, {"args": "none", "vars": "local", "varsIgnorePattern": "^(ids|ignored|unused)$"}],
// Always require semicolon at end of statement
"semi": [2, "always"],
+
+ // Require spaces around operators
+ "space-infix-ops": 2,
}
}
--- a/toolkit/components/passwordmgr/LoginHelper.jsm
+++ b/toolkit/components/passwordmgr/LoginHelper.jsm
@@ -387,17 +387,17 @@ this.LoginHelper = {
* @returns {nsILoginInfo[]} list of unique logins.
*/
dedupeLogins(logins, uniqueKeys = ["username", "password"],
resolveBy = ["timeLastUsed"],
preferredOrigin = undefined) {
const KEY_DELIMITER = ":";
if (!preferredOrigin && resolveBy.includes("scheme")) {
- throw new Error("dedupeLogins: `preferredOrigin` is required in order to "+
+ throw new Error("dedupeLogins: `preferredOrigin` is required in order to " +
"prefer schemes which match it.");
}
let preferredOriginScheme;
if (preferredOrigin) {
try {
preferredOriginScheme = Services.io.newURI(preferredOrigin, null, null).scheme;
} catch (ex) {
--- a/toolkit/components/passwordmgr/content/passwordManager.js
+++ b/toolkit/components/passwordmgr/content/passwordManager.js
@@ -157,17 +157,17 @@ let signonsTreeView = {
getProgressMode(row, column) {},
getCellValue(row, column) {},
getCellText(row, column) {
let time;
let signon = this._filterSet.length ? this._filterSet[row] : signons[row];
switch (column.id) {
case "siteCol":
return signon.httpRealm ?
- (signon.hostname + " (" + signon.httpRealm + ")"):
+ (signon.hostname + " (" + signon.httpRealm + ")") :
signon.hostname;
case "userCol":
return signon.username || "";
case "passwordCol":
return signon.password || "";
case "timeCreatedCol":
time = new Date(signon.timeCreated);
return dateFormatter.format(time);
@@ -378,17 +378,17 @@ function DeleteSignon() {
view.rowCount -= k - j;
tree.treeBoxObject.rowCountChanged(j, j - k);
}
}
// update selection and/or buttons
if (table.length) {
// update selection
- let nextSelection = (selections[0] < table.length) ? selections[0] : table.length-1;
+ let nextSelection = (selections[0] < table.length) ? selections[0] : table.length - 1;
tree.view.selection.select(nextSelection);
tree.treeBoxObject.ensureRowIsVisible(nextSelection);
} else {
// disable buttons
removeButton.setAttribute("disabled", "true");
removeAllButton.setAttribute("disabled", "true");
}
tree.view.selection.selectEventsSuppressed = false;
--- a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
+++ b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
@@ -1576,17 +1576,17 @@ LoginManagerPrompter.prototype = {
var flags = aAuthInfo.flags;
if (flags & Ci.nsIAuthInformation.NEED_DOMAIN) {
// Domain is separated from username by a backslash
var idx = username.indexOf("\\");
if (idx == -1) {
aAuthInfo.username = username;
} else {
aAuthInfo.domain = username.substring(0, idx);
- aAuthInfo.username = username.substring(idx+1);
+ aAuthInfo.username = username.substring(idx + 1);
}
} else {
aAuthInfo.username = username;
}
aAuthInfo.password = password;
},
_newAsyncPromptConsumer : function(aCallback, aContext) {
--- a/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_sort.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_sort.js
@@ -45,17 +45,17 @@ function test() {
"absolutely",
"mozilla",
"mozilla.com",
];
let nsLoginInfo = new Components.Constructor("@mozilla.org/login-manager/loginInfo;1",
Ci.nsILoginInfo, "init");
for (let i = 0; i < 10; i++)
pwmgr.addLogin(new nsLoginInfo(urls[i], urls[i], null, users[i], pwds[i],
- "u"+(i+1), "p"+(i+1)));
+ "u" + (i + 1), "p" + (i + 1)));
// Open the password manager dialog
const PWMGR_DLG = "chrome://passwordmgr/content/passwordManager.xul";
let pwmgrdlg = window.openDialog(PWMGR_DLG, "Toolkit:PasswordManager", "");
SimpleTest.waitForFocus(doTest, pwmgrdlg);
// the meat of the test
function doTest() {
@@ -128,17 +128,17 @@ function test() {
is(col.getAttribute("sortDirection"), direction,
col.id + ": sort direction is " + direction);
}
function checkColumnEntries(aCol, expectedValues) {
let actualValues = getColumnEntries(aCol);
is(actualValues.length, expectedValues.length, "Checking length of expected column");
for (let i = 0; i < expectedValues.length; i++)
- is(actualValues[i], expectedValues[i], "Checking column entry #"+i);
+ is(actualValues[i], expectedValues[i], "Checking column entry #" + i);
}
function getColumnEntries(aCol) {
let entries = [];
let column = sTree.columns[aCol];
let numRows = sTree.view.rowCount;
for (let i = 0; i < numRows; i++)
entries.push(sTree.view.getCellText(i, column));
--- a/toolkit/components/passwordmgr/test/chrome/test_privbrowsing_perwindowpb.html
+++ b/toolkit/components/passwordmgr/test/chrome/test_privbrowsing_perwindowpb.html
@@ -100,17 +100,17 @@ function loadNextTest() {
if (testNum === 7) {
observer = SpecialPowers.wrapCallback(function(subject, topic, data) {
SimpleTest.executeSoon(() => { iframe.contentWindow.postMessage("go", "*"); });
});
SpecialPowers.addObserver(observer, "passwordmgr-processed-form", false);
}
ok(true, "Starting test #" + testNum);
- iframe.src = prefix + subtests[testNum-1];
+ iframe.src = prefix + subtests[testNum - 1];
}
function checkTest() {
var popup;
var gotUser;
var gotPass;
switch (testNum) {
--- a/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth_proxy.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth_proxy.html
@@ -39,17 +39,17 @@ var proxyAuthinfo = {
flags : Ci.nsIAuthInformation.AUTH_PROXY,
authenticationScheme : "basic",
realm : ""
};
// Force parent to not look for tab-modal prompts, as they're not used for auth prompts.
isTabModal = false;
-const Cc_promptFac= Cc["@mozilla.org/passwordmanager/authpromptfactory;1"];
+const Cc_promptFac = Cc["@mozilla.org/passwordmanager/authpromptfactory;1"];
ok(Cc_promptFac != null, "Access Cc[@mozilla.org/passwordmanager/authpromptfactory;1]");
const Ci_promptFac = Ci.nsIPromptFactory;
ok(Ci_promptFac != null, "Access Ci.nsIPromptFactory");
const promptFac = Cc_promptFac.getService(Ci_promptFac);
ok(promptFac != null, "promptFac getService()");
--- a/toolkit/components/passwordmgr/test/notification_common.js
+++ b/toolkit/components/passwordmgr/test/notification_common.js
@@ -1,16 +1,16 @@
/*
* Initialization: for each test, remove any prior notifications.
*/
function cleanUpPopupNotifications() {
var container = getPopupNotifications(window.top);
var notes = container._currentNotifications;
info(true, "Removing " + notes.length + " popup notifications.");
- for (var i = notes.length-1; i >= 0; i--) {
+ for (var i = notes.length - 1; i >= 0; i--) {
notes[i].remove();
}
}
cleanUpPopupNotifications();
/*
* getPopupNotifications
*
--- a/toolkit/components/passwordmgr/test/test_prompt_async.html
+++ b/toolkit/components/passwordmgr/test/test_prompt_async.html
@@ -208,39 +208,39 @@
case 1:
// Load through a single proxy with authentication required 3 different
// pages, first with one login, other two with their own different login.
// We expect to show just a single dialog for proxy authentication and
// then two dialogs to authenticate to login 1 and then login 2.
ok(true, "doTest testNum 1");
expectedLoads = 3;
expectedDialogs = 3;
- iframe1.src = exampleCom + "authenticate.sjs?"+
- "r=1&"+
- "user=user1name&"+
- "pass=user1pass&"+
- "realm=mochirealm&"+
- "proxy_user=proxy_user&"+
- "proxy_pass=proxy_pass&"+
+ iframe1.src = exampleCom + "authenticate.sjs?" +
+ "r=1&" +
+ "user=user1name&" +
+ "pass=user1pass&" +
+ "realm=mochirealm&" +
+ "proxy_user=proxy_user&" +
+ "proxy_pass=proxy_pass&" +
"proxy_realm=proxy_realm";
- iframe2a.src = exampleOrg + "authenticate.sjs?"+
- "r=2&"+
- "user=user2name&"+
- "pass=user2pass&"+
- "realm=mochirealm2&"+
- "proxy_user=proxy_user&"+
- "proxy_pass=proxy_pass&"+
+ iframe2a.src = exampleOrg + "authenticate.sjs?" +
+ "r=2&" +
+ "user=user2name&" +
+ "pass=user2pass&" +
+ "realm=mochirealm2&" +
+ "proxy_user=proxy_user&" +
+ "proxy_pass=proxy_pass&" +
"proxy_realm=proxy_realm";
- iframe2b.src = exampleOrg + "authenticate.sjs?"+
- "r=3&"+
- "user=user2name&"+
- "pass=user2pass&"+
- "realm=mochirealm2&"+
- "proxy_user=proxy_user&"+
- "proxy_pass=proxy_pass&"+
+ iframe2b.src = exampleOrg + "authenticate.sjs?" +
+ "r=3&" +
+ "user=user2name&" +
+ "pass=user2pass&" +
+ "realm=mochirealm2&" +
+ "proxy_user=proxy_user&" +
+ "proxy_pass=proxy_pass&" +
"proxy_realm=proxy_realm";
break;
case 2:
// Load an iframe with 3 subpages all requiring the same login through
// anuthenticated proxy. We expect 2 dialogs, proxy authentication
// and web authentication.
ok(true, "doTest testNum 2");
@@ -253,76 +253,76 @@
case 3:
// Load in the iframe page through unauthenticated proxy
// and discard the proxy authentication. We expect to see
// unauthenticated page content and just a single dialog.
ok(true, "doTest testNum 3");
expectedLoads = 1;
expectedDialogs = 1;
- iframe1.src = exampleCom + "authenticate.sjs?"+
- "user=user4name&"+
- "pass=user4pass&"+
- "realm=mochirealm4&"+
- "proxy_user=proxy_user3&"+
- "proxy_pass=proxy_pass3&"+
+ iframe1.src = exampleCom + "authenticate.sjs?" +
+ "user=user4name&" +
+ "pass=user4pass&" +
+ "realm=mochirealm4&" +
+ "proxy_user=proxy_user3&" +
+ "proxy_pass=proxy_pass3&" +
"proxy_realm=proxy_realm3";
break;
case 4:
// Reload the frame from previous step and pass the proxy authentication
// but cancel the WWW authentication. We should get the proxy=ok and WWW=fail
// content as a result.
ok(true, "doTest testNum 4");
expectedLoads = 1;
expectedDialogs = 2;
- iframe1.src = exampleCom + "authenticate.sjs?"+
- "user=user4name&"+
- "pass=user4pass&"+
- "realm=mochirealm4&"+
- "proxy_user=proxy_user3&"+
- "proxy_pass=proxy_pass3&"+
+ iframe1.src = exampleCom + "authenticate.sjs?" +
+ "user=user4name&" +
+ "pass=user4pass&" +
+ "realm=mochirealm4&" +
+ "proxy_user=proxy_user3&" +
+ "proxy_pass=proxy_pass3&" +
"proxy_realm=proxy_realm3";
break;
case 5:
// Same as the previous two steps but let the server generate
// huge content load to check http channel is capable to handle
// case when auth dialog is canceled or accepted before unauthenticated
// content data is load from the server. (This would be better to
// implement using delay of server response).
ok(true, "doTest testNum 5");
expectedLoads = 1;
expectedDialogs = 1;
- iframe1.src = exampleCom + "authenticate.sjs?"+
- "user=user5name&"+
- "pass=user5pass&"+
- "realm=mochirealm5&"+
- "proxy_user=proxy_user4&"+
- "proxy_pass=proxy_pass4&"+
- "proxy_realm=proxy_realm4&"+
+ iframe1.src = exampleCom + "authenticate.sjs?" +
+ "user=user5name&" +
+ "pass=user5pass&" +
+ "realm=mochirealm5&" +
+ "proxy_user=proxy_user4&" +
+ "proxy_pass=proxy_pass4&" +
+ "proxy_realm=proxy_realm4&" +
"huge=1";
break;
case 6:
// Reload the frame from the previous step and let the proxy
// authentication pass but WWW fail. We expect two dialogs
// and an unathenticated page content load.
ok(true, "doTest testNum 6");
expectedLoads = 1;
expectedDialogs = 2;
- iframe1.src = exampleCom + "authenticate.sjs?"+
- "user=user5name&"+
- "pass=user5pass&"+
- "realm=mochirealm5&"+
- "proxy_user=proxy_user4&"+
- "proxy_pass=proxy_pass4&"+
- "proxy_realm=proxy_realm4&"+
+ iframe1.src = exampleCom + "authenticate.sjs?" +
+ "user=user5name&" +
+ "pass=user5pass&" +
+ "realm=mochirealm5&" +
+ "proxy_user=proxy_user4&" +
+ "proxy_pass=proxy_pass4&" +
+ "proxy_realm=proxy_realm4&" +
"huge=1";
break;
case 7:
// Reload again and let pass all authentication dialogs.
// Check we get the authenticated content not broken by
// the unauthenticated content.
ok(true, "doTest testNum 7");
@@ -332,24 +332,24 @@
break;
case 8:
// Check we proccess all challenges sent by server when
// user cancels prompts
ok(true, "doTest testNum 8");
expectedLoads = 1;
expectedDialogs = 5;
- iframe1.src = exampleCom + "authenticate.sjs?"+
- "user=user6name&"+
- "pass=user6pass&"+
- "realm=mochirealm6&"+
- "proxy_user=proxy_user5&"+
- "proxy_pass=proxy_pass5&"+
- "proxy_realm=proxy_realm5&"+
- "huge=1&"+
+ iframe1.src = exampleCom + "authenticate.sjs?" +
+ "user=user6name&" +
+ "pass=user6pass&" +
+ "realm=mochirealm6&" +
+ "proxy_user=proxy_user5&" +
+ "proxy_pass=proxy_pass5&" +
+ "proxy_realm=proxy_realm5&" +
+ "huge=1&" +
"multiple=3";
break;
case 9:
finishTest();
return;
}
@@ -398,17 +398,17 @@
case 8:
if (expectedDialogs == 3 || expectedDialogs == 1)
dialog.acceptDialog();
else
dialog.cancelDialog();
break;
default:
- ok(false, "Unhandled testNum "+testNum+" in handleDialog");
+ ok(false, "Unhandled testNum " + testNum + " in handleDialog");
}
if (--expectedDialogs > 0)
startCallbackTimer();
}
function doCheck(testNum)
{
@@ -521,17 +521,17 @@
is(authok1, "PASS", "WWW Authorization OK, frame1");
is(proxyok1, "PASS", "Proxy Authorization OK, frame1");
is(footnote, "This is a footnote after the huge content fill",
"Footnote present and loaded completely");
break;
default:
- ok(false, "Unhandled testNum "+testNum+" in doCheck");
+ ok(false, "Unhandled testNum " + testNum + " in doCheck");
}
}
</script>
</head>
<body>
<iframe id="iframe1"></iframe>
<iframe id="iframe2a"></iframe>
--- a/toolkit/components/passwordmgr/test/unit/test_notifications.js
+++ b/toolkit/components/passwordmgr/test/unit/test_notifications.js
@@ -79,17 +79,17 @@ Services.logins.addLogin(testuser1);
LoginTestUtils.checkLogins([testuser1]);
do_check_eq(expectedNotification, null); // check that observer got a notification
/* ========== 3 ========== */
testnum++;
testdesc = "modifyLogin";
expectedNotification = "modifyLogin";
-expectedData=[testuser1, testuser2];
+expectedData = [testuser1, testuser2];
Services.logins.modifyLogin(testuser1, testuser2);
do_check_eq(expectedNotification, null);
LoginTestUtils.checkLogins([testuser2]);
/* ========== 4 ========== */
testnum++;
testdesc = "removeLogin";