From 0f4ebab4692de0fc68dd8933e71a0fc987d1e889 Mon Sep 17 00:00:00 2001 From: Noemi Erli Date: Thu, 28 Mar 2019 06:52:07 +0200 Subject: [PATCH] Backed out 2 changesets (bug 1147563) for perma-failures in test_insecure_form_field_autocomplete.html a=backout Backed out changeset 53c71a1d9183 (bug 1147563) Backed out changeset fef0ddcd6bba (bug 1147563) --- .../components/passwordmgr/LoginHelper.jsm | 22 +- .../passwordmgr/LoginManagerContent.jsm | 23 +- .../passwordmgr/LoginManagerParent.jsm | 24 +- .../passwordmgr/test/mochitest/mochitest.ini | 8 - .../test/mochitest/pwmgr_common.js | 46 +--- .../test/mochitest/pwmgr_common_parent.js | 22 +- ...test_autofill_different_formSubmitURL.html | 78 ------ .../test/mochitest/test_basic_form.html | 21 +- .../test/mochitest/test_basic_form_1pw.html | 1 - .../test/mochitest/test_basic_form_1pw_2.html | 1 - .../test/mochitest/test_basic_form_2pw_1.html | 1 - .../test/mochitest/test_basic_form_3pw_1.html | 1 - .../test_basic_form_autocomplete.html | 250 ++++++++---------- ...basic_form_autocomplete_formSubmitURL.html | 112 -------- .../mochitest/test_basic_form_pwevent.html | 13 +- .../mochitest/test_basic_form_pwonly.html | 1 - .../test/mochitest/test_case_differences.html | 10 +- .../test/mochitest/test_form_action_1.html | 1 - .../test/mochitest/test_form_action_2.html | 1 - .../mochitest/test_formless_autofill.html | 2 +- .../test/mochitest/test_input_events.html | 1 - ...test_insecure_form_field_autocomplete.html | 197 ++++++-------- .../test/mochitest/test_master_password.html | 1 - .../test/mochitest/test_maxlength.html | 1 - .../test_passwords_in_type_password.html | 1 - .../mochitest/test_recipe_login_fields.html | 1 - 26 files changed, 252 insertions(+), 588 deletions(-) delete mode 100644 toolkit/components/passwordmgr/test/mochitest/test_autofill_different_formSubmitURL.html delete mode 100644 toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete_formSubmitURL.html diff --git a/toolkit/components/passwordmgr/LoginHelper.jsm b/toolkit/components/passwordmgr/LoginHelper.jsm index 79a1857b0561..06d22fe7faf3 100644 --- a/toolkit/components/passwordmgr/LoginHelper.jsm +++ b/toolkit/components/passwordmgr/LoginHelper.jsm @@ -272,7 +272,6 @@ var LoginHelper = { */ isOriginMatching(aLoginOrigin, aSearchOrigin, aOptions = { schemeUpgrades: false, - acceptWildcardMatch: false, }) { if (aLoginOrigin == aSearchOrigin) { return true; @@ -282,10 +281,6 @@ var LoginHelper = { return false; } - if (aOptions.acceptWildcardMatch && aLoginOrigin == "") { - return true; - } - if (aOptions.schemeUpgrades) { try { let loginURI = Services.io.newURI(aLoginOrigin); @@ -485,17 +480,12 @@ var LoginHelper = { * String representing the origin to use for preferring one login over * another when they are dupes. This is used with "scheme" for * `resolveBy` so the scheme from this origin will be preferred. - * @param {string} [preferredFormActionOrigin = undefined] - * String representing the action origin to use for preferring one login over - * another when they are dupes. This is used with "actionOrigin" for - * `resolveBy` so the scheme from this action origin will be preferred. * * @returns {nsILoginInfo[]} list of unique logins. */ dedupeLogins(logins, uniqueKeys = ["username", "password"], resolveBy = ["timeLastUsed"], - preferredOrigin = undefined, - preferredFormActionOrigin = undefined) { + preferredOrigin = undefined) { const KEY_DELIMITER = ":"; if (!preferredOrigin && resolveBy.includes("scheme")) { @@ -540,16 +530,6 @@ var LoginHelper = { for (let preference of resolveBy) { switch (preference) { - case "actionOrigin": { - if (!preferredFormActionOrigin) { - break; - } - if (LoginHelper.isOriginMatching(existingLogin.formSubmitURL, preferredFormActionOrigin, {schemeUpgrades: LoginHelper.schemeUpgrades}) && - !LoginHelper.isOriginMatching(login.formSubmitURL, preferredFormActionOrigin, {schemeUpgrades: LoginHelper.schemeUpgrades})) { - return false; - } - break; - } case "scheme": { if (!preferredOriginScheme) { break; diff --git a/toolkit/components/passwordmgr/LoginManagerContent.jsm b/toolkit/components/passwordmgr/LoginManagerContent.jsm index 44b31348d9d4..7099c672d77f 100644 --- a/toolkit/components/passwordmgr/LoginManagerContent.jsm +++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm @@ -1174,10 +1174,9 @@ var LoginManagerContent = { * * @param {LoginForm} form * @param {nsILoginInfo[]} foundLogins an array of nsILoginInfo that could be - * used for the form, including ones with a different form action origin - * which are only used when the fill is userTriggered + used for the form * @param {Set} recipes a set of recipes that could be used to affect how the - * form is filled + form is filled * @param {Object} [options = {}] a list of options for this method * @param {HTMLInputElement} [options.inputElement = null] an optional target * input element we want to fill @@ -1225,9 +1224,8 @@ var LoginManagerContent = { }; try { - // Nothing to do if we have no matching (excluding form action - // checks) logins available, and there isn't a need to show - // the insecure form warning. + // Nothing to do if we have no matching logins available, + // and there isn't a need to show the insecure form warning. if (foundLogins.length == 0 && (InsecurePasswordUtils.isFormSecure(form) || !LoginHelper.showInsecureFieldWarning)) { @@ -1283,19 +1281,6 @@ var LoginManagerContent = { usernameField.addEventListener("keydown", observer); } - if (!userTriggered) { - // Only autofill logins that match the form's action. In the above code - // we have attached autocomplete for logins that don't match the form action. - foundLogins = foundLogins.filter(l => { - return LoginHelper.isOriginMatching(l.formSubmitURL, - LoginHelper.getFormActionOrigin(form), - { - schemeUpgrades: LoginHelper.schemeUpgrades, - acceptWildcardMatch: true, - }); - }); - } - // Nothing to do if we have no matching logins available. // Only insecure pages reach this block and logs the same // telemetry flag. diff --git a/toolkit/components/passwordmgr/LoginManagerParent.jsm b/toolkit/components/passwordmgr/LoginManagerParent.jsm index d915b477346a..45b37b5635ae 100644 --- a/toolkit/components/passwordmgr/LoginManagerParent.jsm +++ b/toolkit/components/passwordmgr/LoginManagerParent.jsm @@ -40,17 +40,14 @@ var LoginManagerParent = { // to avoid spamming master password prompts on autocomplete searches. _lastMPLoginCancelled: Math.NEGATIVE_INFINITY, - _searchAndDedupeLogins(formOrigin, actionOrigin, {looseActionOriginMatch} = {}) { + _searchAndDedupeLogins(formOrigin, actionOrigin) { let logins; - let matchData = { - hostname: formOrigin, - schemeUpgrades: LoginHelper.schemeUpgrades, - }; - if (!looseActionOriginMatch) { - matchData.formSubmitURL = actionOrigin; - } try { - logins = LoginHelper.searchLoginsWithObject(matchData); + logins = LoginHelper.searchLoginsWithObject({ + hostname: formOrigin, + formSubmitURL: actionOrigin, + schemeUpgrades: LoginHelper.schemeUpgrades, + }); } catch (e) { // Record the last time the user cancelled the MP prompt // to avoid spamming them with MP prompts for autocomplete. @@ -64,11 +61,10 @@ var LoginManagerParent = { // Dedupe so the length checks below still make sense with scheme upgrades. let resolveBy = [ - "actionOrigin", "scheme", "timePasswordChanged", ]; - return LoginHelper.dedupeLogins(logins, ["username"], resolveBy, formOrigin, actionOrigin); + return LoginHelper.dedupeLogins(logins, ["username"], resolveBy, formOrigin); }, // Listeners are added in BrowserGlue.jsm on desktop @@ -226,8 +222,7 @@ var LoginManagerParent = { return; } - // Autocomplete results do not need to match actionOrigin. - let logins = this._searchAndDedupeLogins(formOrigin, actionOrigin, {looseActionOriginMatch: true}); + let logins = this._searchAndDedupeLogins(formOrigin, actionOrigin); log("sendLoginDataToChild:", logins.length, "deduped logins"); // Convert the array of nsILoginInfo to vanilla JS objects since nsILoginInfo @@ -275,8 +270,7 @@ var LoginManagerParent = { } else { log("Creating new autocomplete search result."); - // Autocomplete results do not need to match actionOrigin. - logins = this._searchAndDedupeLogins(formOrigin, actionOrigin, {looseActionOriginMatch: true}); + logins = this._searchAndDedupeLogins(formOrigin, actionOrigin); } let matchingLogins = logins.filter(function(fullMatch) { diff --git a/toolkit/components/passwordmgr/test/mochitest/mochitest.ini b/toolkit/components/passwordmgr/test/mochitest/mochitest.ini index 814437009800..09f011ffb4c4 100644 --- a/toolkit/components/passwordmgr/test/mochitest/mochitest.ini +++ b/toolkit/components/passwordmgr/test/mochitest/mochitest.ini @@ -35,9 +35,6 @@ skip-if = toolkit == 'android' # autocomplete [test_autofill_autocomplete_types.html] scheme = https skip-if = toolkit == 'android' # bug 1533965 -[test_autofill_different_formSubmitURL.html] -scheme = https -skip-if = toolkit == 'android' # Bug 1259768 [test_autofill_from_bfcache.html] scheme = https skip-if = toolkit == 'android' # bug 1527403 @@ -60,11 +57,7 @@ skip-if = toolkit == 'android' # autocomplete [test_basic_form_2pw_2.html] [test_basic_form_3pw_1.html] [test_basic_form_autocomplete.html] -skip-if = toolkit == 'android' || (webrender && os == 'linux' && debug) # android:autocomplete, linux: bug 1538955 -scheme = https -[test_basic_form_autocomplete_formSubmitURL.html] skip-if = toolkit == 'android' # android:autocomplete. -scheme = https [test_basic_form_honor_autocomplete_off.html] scheme = https skip-if = toolkit == 'android' # android:autocomplete. @@ -82,7 +75,6 @@ skip-if = toolkit == 'android' # Tests desktop prompts [test_bug_776171.html] [test_case_differences.html] skip-if = toolkit == 'android' # autocomplete -scheme = https [test_form_action_1.html] [test_form_action_2.html] [test_form_action_javascript.html] diff --git a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js index a88f49680085..3a204c619a67 100644 --- a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js +++ b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js @@ -134,7 +134,11 @@ function checkUnmodifiedForm(formNum) { function registerRunTests() { return new Promise(resolve => { - function onDOMContentLoaded() { + // We provide a general mechanism for our tests to know when they can + // safely run: we add a final form that we know will be filled in, wait + // for the login manager to tell us that it's filled in and then continue + // with the rest of the tests. + window.addEventListener("DOMContentLoaded", (event) => { var form = document.createElement("form"); form.id = "observerforcer"; var username = document.createElement("input"); @@ -161,18 +165,7 @@ function registerRunTests() { SpecialPowers.addObserver(observer, "passwordmgr-processed-form"); document.body.appendChild(form); - } - // We provide a general mechanism for our tests to know when they can - // safely run: we add a final form that we know will be filled in, wait - // for the login manager to tell us that it's filled in and then continue - // with the rest of the tests. - if (document.readyState == "complete" || - document.readyState == "loaded" || - document.readyState == "interactive") { - onDOMContentLoaded(); - } else { - window.addEventListener("DOMContentLoaded", onDOMContentLoaded); - } + }); }); } @@ -278,31 +271,6 @@ function runInParent(aFunctionOrURL) { return chromeScript; } -/* - * gTestDependsOnDeprecatedLogin Set this global to true if your test relies - * on the testuser/testpass login that is created in pwmgr_common.js. New tests - * should not rely on this login. - */ -var gTestDependsOnDeprecatedLogin = false; - -/** - * Replace the content innerHTML with the provided form and wait for autofill to fill in the form. - * - * @param {string} form The form to be appended to the #content element. - * @param {string} fieldSelector The CSS selector for the field to-be-filled - * @param {string} fieldValue The value expected to be filled - * @param {string} formId The ID (excluding the # character) of the form - */ -function setFormAndWaitForFieldFilled(form, {fieldSelector, fieldValue, formId}) { - // eslint-disable-next-line no-unsanitized/property - document.querySelector("#content").innerHTML = form; - return SimpleTest.promiseWaitForCondition(() => { - let ancestor = formId ? document.querySelector("#" + formId) : - document.documentElement; - return ancestor.querySelector(fieldSelector).value == fieldValue; - }, "Wait for password manager to fill form"); -} - /** * Run commonInit synchronously in the parent then run the test function after the runTests event. * @@ -314,7 +282,7 @@ function runChecksAfterCommonInit(aFunction = null) { window.addEventListener("runTests", aFunction); PWMGR_COMMON_PARENT.addMessageListener("registerRunTests", () => registerRunTests()); } - PWMGR_COMMON_PARENT.sendSyncMessage("setupParent", {testDependsOnDeprecatedLogin: gTestDependsOnDeprecatedLogin}); + PWMGR_COMMON_PARENT.sendSyncMessage("setupParent"); return PWMGR_COMMON_PARENT; } diff --git a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common_parent.js b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common_parent.js index 2debf8994e7f..d9d0da95522e 100644 --- a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common_parent.js +++ b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common_parent.js @@ -21,7 +21,7 @@ var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); * the test can start checking filled-in values. Tests that check observer * notifications might be confused by this. */ -function commonInit(selfFilling, testDependsOnDeprecatedLogin) { +function commonInit(selfFilling) { var pwmgr = Services.logins; assert.ok(pwmgr != null, "Access LoginManager"); @@ -36,18 +36,16 @@ function commonInit(selfFilling, testDependsOnDeprecatedLogin) { } } - if (testDependsOnDeprecatedLogin) { - // Add a login that's used in multiple tests - var login = Cc["@mozilla.org/login-manager/loginInfo;1"]. - createInstance(Ci.nsILoginInfo); - login.init("http://mochi.test:8888", "http://mochi.test:8888", null, - "testuser", "testpass", "uname", "pword"); - pwmgr.addLogin(login); - } + // Add a login that's used in multiple tests + var login = Cc["@mozilla.org/login-manager/loginInfo;1"]. + createInstance(Ci.nsILoginInfo); + login.init("http://mochi.test:8888", "http://mochi.test:8888", null, + "testuser", "testpass", "uname", "pword"); + pwmgr.addLogin(login); // Last sanity check logins = pwmgr.getAllLogins(); - assert.equal(logins.length, testDependsOnDeprecatedLogin ? 1 : 0, "Checking for successful init login"); + assert.equal(logins.length, 1, "Checking for successful init login"); disabledHosts = pwmgr.getAllDisabledHosts(); assert.equal(disabledHosts.length, 0, "Checking for no disabled hosts"); @@ -106,8 +104,8 @@ Services.obs.addObserver(onPrompt, "passwordmgr-prompt-save"); // Begin message listeners -addMessageListener("setupParent", ({selfFilling = false, testDependsOnDeprecatedLogin = false} = {}) => { - commonInit(selfFilling, testDependsOnDeprecatedLogin); +addMessageListener("setupParent", ({selfFilling = false} = {selfFilling: false}) => { + commonInit(selfFilling); sendAsyncMessage("doneSetup"); }); diff --git a/toolkit/components/passwordmgr/test/mochitest/test_autofill_different_formSubmitURL.html b/toolkit/components/passwordmgr/test/mochitest/test_autofill_different_formSubmitURL.html deleted file mode 100644 index 809cf751bbf2..000000000000 --- a/toolkit/components/passwordmgr/test/mochitest/test_autofill_different_formSubmitURL.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - Test autofill on an HTTPS page using upgraded HTTP logins wtih different formSubmitURL - - - - - - - - -

- - -
- -
- -
-
-
- - diff --git a/toolkit/components/passwordmgr/test/mochitest/test_basic_form.html b/toolkit/components/passwordmgr/test/mochitest/test_basic_form.html index 2cd11069849c..3c38343a5da4 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_basic_form.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form.html @@ -11,22 +11,11 @@ Login Manager test: simple form fill

diff --git a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_1pw_2.html b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_1pw_2.html index 99fd98e7e065..e77693ed9350 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_1pw_2.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_1pw_2.html @@ -10,7 +10,6 @@ Login Manager test: forms with 1 password field, part 2

diff --git a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_2pw_1.html b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_2pw_1.html index edc68d402d91..ebd2019d6c95 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_2pw_1.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_2pw_1.html @@ -10,7 +10,6 @@ Login Manager test: forms with 2 password fields

diff --git a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_3pw_1.html b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_3pw_1.html index 012c609c8de6..e7cd73dcae31 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_3pw_1.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_3pw_1.html @@ -10,7 +10,6 @@ Login Manager test: forms with 3 password fields (form filling)

diff --git a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete.html b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete.html index 5d0ffb91511c..4f9cfe5dfe9e 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete.html @@ -25,48 +25,45 @@ var setupScript = runInParent(function setup() { assert.ok(nsLoginInfo != null, "nsLoginInfo constructor"); // login0 has no username, so should be filtered out from the autocomplete list. - var login0 = new nsLoginInfo("https://example.com", "https://autocomplete:8888", null, + var login0 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete:8888", null, "", "user0pass", "", "pword"); - var login1 = new nsLoginInfo("https://example.com", "https://autocomplete:8888", null, + var login1 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete:8888", null, "tempuser1", "temppass1", "uname", "pword"); - var login2 = new nsLoginInfo("https://example.com", "https://autocomplete:8888", null, + var login2 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete:8888", null, "testuser2", "testpass2", "uname", "pword"); - var login3 = new nsLoginInfo("https://example.com", "https://autocomplete:8888", null, + var login3 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete:8888", null, "testuser3", "testpass3", "uname", "pword"); - var login4 = new nsLoginInfo("https://example.com", "https://autocomplete:8888", null, + var login4 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete:8888", null, "zzzuser4", "zzzpass4", "uname", "pword"); - // The following unused variables are referenced by `eval` in the message listeners below. // login 5 only used in the single-user forms - /* eslint-disable no-unused-vars */ - var login5 = new nsLoginInfo("https://example.com", "https://autocomplete2", null, + var login5 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete2", null, "singleuser5", "singlepass5", "uname", "pword"); - var login6A = new nsLoginInfo("https://example.com", "https://autocomplete3", null, + var login6A = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete3", null, "form7user1", "form7pass1", "uname", "pword"); - var login6B = new nsLoginInfo("https://example.com", "https://autocomplete3", null, + var login6B = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete3", null, "form7user2", "form7pass2", "uname", "pword"); - var login7 = new nsLoginInfo("https://example.com", "https://autocomplete4", null, + var login7 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete4", null, "form8user", "form8pass", "uname", "pword"); - var login8A = new nsLoginInfo("https://example.com", "https://autocomplete5", null, + var login8A = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete5", null, "form9userAB", "form9pass", "uname", "pword"); - var login8B = new nsLoginInfo("https://example.com", "https://autocomplete5", null, + var login8B = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete5", null, "form9userAAB", "form9pass", "uname", "pword"); - var login8C = new nsLoginInfo("https://example.com", "https://autocomplete5", null, + // Reference by `eval` in the message listeners below. + // eslint-disable-next-line no-unused-vars + var login8C = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete5", null, "form9userAABzz", "form9pass", "uname", "pword"); - var login10 = new nsLoginInfo("https://example.com", "https://autocomplete7", null, + var login10 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete7", null, "testuser10", "testpass10", "uname", "pword"); - var login11 = new nsLoginInfo("https://example.com", "https://example.com", null, - "testuser11", "testpass11", "uname", "pword"); - /* eslint-enable no-unused-vars */ // try/catch in case someone runs the tests manually, twice. try { @@ -75,6 +72,14 @@ var setupScript = runInParent(function setup() { Services.logins.addLogin(login2); Services.logins.addLogin(login3); Services.logins.addLogin(login4); + Services.logins.addLogin(login5); + Services.logins.addLogin(login6A); + Services.logins.addLogin(login6B); + Services.logins.addLogin(login7); + Services.logins.addLogin(login8A); + Services.logins.addLogin(login8B); + // login8C is added later + Services.logins.addLogin(login10); } catch (e) { assert.ok(false, "addLogin threw: " + e); } @@ -99,13 +104,85 @@ var setupScript = runInParent(function setup() {
- -
+
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
@@ -168,7 +245,7 @@ add_task(async function test_form1_menuitems() {
                            "testuser2",
                            "testuser3",
                            "zzzuser4"];
-  checkAutoCompleteResults(results, expectedMenuItems, "example.com", "Check all menuitems are displayed correctly.");
+  checkAutoCompleteResults(results, expectedMenuItems, "mochi.test", "Check all menuitems are displayed correctly.");
 
   checkACForm("", ""); // value shouldn't update just by selecting
   synthesizeKey("KEY_Enter");
@@ -391,7 +468,7 @@ add_task(async function test_form1_delete() {
 
   // Delete the first entry (of 4), "tempuser1"
   synthesizeKey("KEY_ArrowDown");
-  let numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
+  let numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 5, "Correct number of logins before deleting one");
 
   let countChangedPromise = notifyMenuChanged(4);
@@ -402,7 +479,7 @@ add_task(async function test_form1_delete() {
   await deletionPromise;
 
   checkACForm("", "");
-  numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
+  numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 4, "Correct number of logins after deleting one");
   await countChangedPromise;
   synthesizeKey("KEY_Enter");
@@ -434,7 +511,7 @@ add_task(async function test_form1_delete_second() {
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Delete", {shiftKey: true});
   checkACForm("", "");
-  let numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
+  let numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 3, "Correct number of logins after deleting one");
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
@@ -466,7 +543,7 @@ add_task(async function test_form1_delete_last() {
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Delete", {shiftKey: true});
   checkACForm("", "");
-  let numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
+  let numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 2, "Correct number of logins after deleting one");
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Enter");
@@ -498,27 +575,15 @@ add_task(async function test_form1_check_only_entry_remaining() {
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Delete", {shiftKey: true});
   checkACForm("", "");
-  let numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
+  let numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 1, "Correct number of logins after deleting one");
 
-  // remove the logins for the previous tests
+  // remove the login that's not shown in the list.
   setupScript.sendSyncMessage("removeLogin", "login0");
-  setupScript.sendSyncMessage("removeLogin", "login1");
-  setupScript.sendSyncMessage("removeLogin", "login2");
-  setupScript.sendSyncMessage("removeLogin", "login3");
-  setupScript.sendSyncMessage("removeLogin", "login4");
-  setupScript.sendSyncMessage("addLogin", "login5");
 });
 
 /* Tests for single-user forms for ignoring autocomplete=off */
 add_task(async function test_form2() {
-  await setFormAndWaitForFieldFilled(`
-    
- - - -
`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"}); - // Turn our attention to form2 uname = $_(2, "uname"); pword = $_(2, "pword"); @@ -538,13 +603,6 @@ add_task(async function test_form2() { }); add_task(async function test_form3() { - await setFormAndWaitForFieldFilled(` -
- - - -
`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"}); - uname = $_(3, "uname"); pword = $_(3, "pword"); checkACForm("singleuser5", "singlepass5"); @@ -562,13 +620,6 @@ add_task(async function test_form3() { }); add_task(async function test_form4() { - await setFormAndWaitForFieldFilled(` -
- - - -
`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"}); - uname = $_(4, "uname"); pword = $_(4, "pword"); checkACForm("singleuser5", "singlepass5"); @@ -586,13 +637,6 @@ add_task(async function test_form4() { }); add_task(async function test_form5() { - await setFormAndWaitForFieldFilled(` -
- - - -
`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"}); - uname = $_(5, "uname"); pword = $_(5, "pword"); checkACForm("singleuser5", "singlepass5"); @@ -610,14 +654,6 @@ add_task(async function test_form5() { }); add_task(async function test_form6() { - await setFormAndWaitForFieldFilled(` - -
- - - -
`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"}); - // (this is a control, w/o autocomplete=off, to ensure the login // that was being suppressed would have been filled in otherwise) uname = $_(6, "uname"); @@ -635,22 +671,11 @@ add_task(async function test_form6_changeUsername() { pword.focus(); await spinEventLoop(); checkACForm("singleuser5X", "singlepass5"); - uname.focus(); setupScript.sendSyncMessage("removeLogin", "login5"); }); add_task(async function test_form7() { - setupScript.sendSyncMessage("addLogin", "login6A"); - setupScript.sendSyncMessage("addLogin", "login6B"); - await setFormAndWaitForFieldFilled(` - -
- - - -
`, {fieldSelector: `input[name="uname"]`, fieldValue: ""}); - uname = $_(7, "uname"); pword = $_(7, "pword"); checkACForm("", ""); @@ -691,21 +716,6 @@ add_task(async function test_form7_2() { }); add_task(async function test_form8() { - setupScript.sendSyncMessage("addLogin", "login7"); - await setFormAndWaitForFieldFilled(` - -
- - - -
- -
- - - -
`, {fieldSelector: `input[name="uname"]`, fieldValue: "form8user", formId: "form8"}); - uname = $_(8, "uname"); pword = $_(8, "pword"); checkACForm("form8user", "form8pass"); @@ -726,19 +736,9 @@ add_task(async function test_form8_2() { add_task(async function test_form8_3() { checkACForm("", ""); setupScript.sendSyncMessage("removeLogin", "login7"); - setupScript.sendSyncMessage("addLogin", "login8A"); - setupScript.sendSyncMessage("addLogin", "login8B"); }); add_task(async function test_form9_filtering() { - await setFormAndWaitForFieldFilled(` - -
- - - -
`, {fieldSelector: `input[name="uname"]`, fieldValue: ""}); - // Turn our attention to form9 to test the dropdown - bug 497541 uname = $_(9, "uname"); pword = $_(9, "pword"); @@ -755,7 +755,7 @@ add_task(async function test_form9_filtering() { let results = await shownPromise; checkACForm("form9userAAB", ""); - checkAutoCompleteResults(results, ["form9userAAB"], "example.com", "Check dropdown is updated after inserting 'A'"); + checkAutoCompleteResults(results, ["form9userAAB"], "mochi.test", "Check dropdown is updated after inserting 'A'"); synthesizeKey("KEY_ArrowDown"); synthesizeKey("KEY_Enter"); await promiseFormsProcessed(); @@ -771,28 +771,16 @@ add_task(async function test_form9_autocomplete_cache() { let promise1 = notifyMenuChanged(1); sendString("z"); let results = await promise1; - checkAutoCompleteResults(results, [], "example.com", "Check popup does not have any login items"); + checkAutoCompleteResults(results, [], "mochi.test", "Check popup does not have any login items"); // check that empty results are cached - bug 496466 promise1 = notifyMenuChanged(1); sendString("z"); results = await promise1; - checkAutoCompleteResults(results, [], "example.com", "Check popup only has the footer when it opens"); + checkAutoCompleteResults(results, [], "mochi.test", "Check popup only has the footer when it opens"); }); add_task(async function test_form11_formless() { - setupScript.sendSyncMessage("removeLogin", "login8A"); - setupScript.sendSyncMessage("removeLogin", "login8B"); - setupScript.sendSyncMessage("removeLogin", "login8C"); - setupScript.sendSyncMessage("addLogin", "login11"); - await setFormAndWaitForFieldFilled(` - -
- - - -
`, {fieldSelector: `input[name="uname"]`, fieldValue: "testuser11"}); - // Test form-less autocomplete uname = $_(11, "uname"); pword = $_(11, "pword"); @@ -808,7 +796,7 @@ add_task(async function test_form11_formless() { let processedPromise = promiseFormsProcessed(); synthesizeKey("KEY_Enter"); await processedPromise; - checkACForm("testuser11", "testpass11"); + checkACForm("testuser", "testpass"); }); add_task(async function test_form11_open_on_trusted_focus() { @@ -835,23 +823,13 @@ add_task(async function test_form11_open_on_trusted_focus() { const processedPromise = promiseFormsProcessed(); synthesizeKey("KEY_Enter"); await processedPromise; - checkACForm("testuser11", "testpass11"); - setupScript.sendSyncMessage("removeLogin", "login11"); + checkACForm("testuser", "testpass"); }); add_task(async function test_form12_recipes() { - setupScript.sendSyncMessage("addLogin", "login10"); - await setFormAndWaitForFieldFilled(` - -
- - - -
`, {fieldSelector: `input[name="1"]`, fieldValue: ""}); - await loadRecipes({ siteRecipes: [{ - "hosts": ["example.com"], + "hosts": ["mochi.test:8888"], "usernameSelector": "input[name='1']", "passwordSelector": "input[name='2']", }], @@ -888,14 +866,6 @@ add_task(async function test_form12_recipes() { }); add_task(async function test_form13_stays_open_upon_empty_search() { - await setFormAndWaitForFieldFilled(` - -
- - - -
`, {fieldSelector: `input[name="uname"]`, fieldValue: "prefilled"}); - uname = $_(13, "uname"); pword = $_(13, "pword"); checkACForm("prefilled", "prefilled"); diff --git a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete_formSubmitURL.html b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete_formSubmitURL.html deleted file mode 100644 index 72d9ca05d93e..000000000000 --- a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete_formSubmitURL.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - Test that logins with non-matching formSubmitURL appear in autocomplete dropdown - - - - - - - - -Login Manager test: logins with non-matching formSubmitURL appear in autocomplete dropdown - - -

- - -
- - -
- - - -
-
-
-
-
- - diff --git a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_pwevent.html b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_pwevent.html index b8e2e78a2443..e0a2883c824a 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_pwevent.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_pwevent.html @@ -11,8 +11,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=355063

diff --git a/toolkit/components/passwordmgr/test/mochitest/test_form_action_2.html b/toolkit/components/passwordmgr/test/mochitest/test_form_action_2.html index b4dee479aa69..a2c5849fb97b 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_form_action_2.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_form_action_2.html @@ -10,7 +10,6 @@ Login Manager test: Bug 360493

diff --git a/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html b/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html index 6de1a1bac9cd..956a198fead1 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html @@ -13,7 +13,7 @@ document.addEventListener("DOMContentLoaded", () => { document.getElementById("loginFrame").addEventListener("load", (evt) => { // Tell the parent to setup test logins. - PWMGR_COMMON_PARENT.sendAsyncMessage("setupParent", { selfFilling: true, testDependsOnDeprecatedLogin: true }); + PWMGR_COMMON_PARENT.sendAsyncMessage("setupParent", { selfFilling: true }); }); }); diff --git a/toolkit/components/passwordmgr/test/mochitest/test_input_events.html b/toolkit/components/passwordmgr/test/mochitest/test_input_events.html index 0127dd47a3c1..0e77956d87dd 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_input_events.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_input_events.html @@ -11,7 +11,6 @@ Login Manager test: input events should fire.

diff --git a/toolkit/components/passwordmgr/test/mochitest/test_passwords_in_type_password.html b/toolkit/components/passwordmgr/test/mochitest/test_passwords_in_type_password.html index 341f697b6d08..6b7db98296d3 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_passwords_in_type_password.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_passwords_in_type_password.html @@ -10,7 +10,6 @@ Login Manager test: Bug 242956

diff --git a/toolkit/components/passwordmgr/test/mochitest/test_recipe_login_fields.html b/toolkit/components/passwordmgr/test/mochitest/test_recipe_login_fields.html index 284d502d23aa..7c1679521b09 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_recipe_login_fields.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_recipe_login_fields.html @@ -10,7 +10,6 @@