Backed out changeset cbae72da0dc4 (bug 1540828) for mochitest failures at test_autofill_sandboxed.html. CLOSED TREE
authorBrindusan Cristian <cbrindusan@mozilla.com>
Fri, 12 Apr 2019 17:43:09 +0300
changeset 528105 a9b02d3daee397853a8498f344f2e237e67d3545
parent 528104 c78a681b16f9bb4fb2394cf735b17e73e3e67ceb
child 528106 2934d8b830ffd41d9828b2c6d05f0f71dc686493
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1540828
milestone68.0a1
backs outcbae72da0dc4b0ab70cb29dbec66b460c83c9d7f
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset cbae72da0dc4 (bug 1540828) for mochitest failures at test_autofill_sandboxed.html. CLOSED TREE
toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js
toolkit/components/passwordmgr/test/mochitest/test_autocomplete_https_upgrade.html
toolkit/components/passwordmgr/test/mochitest/test_autocomplete_password_open.html
toolkit/components/passwordmgr/test/mochitest/test_autocomplete_sandboxed.html
toolkit/components/passwordmgr/test/mochitest/test_autofill_different_formSubmitURL.html
toolkit/components/passwordmgr/test/mochitest/test_autofill_from_bfcache.html
toolkit/components/passwordmgr/test/mochitest/test_autofill_https_upgrade.html
toolkit/components/passwordmgr/test/mochitest/test_autofill_sandboxed.html
toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete.html
toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete_formSubmitURL.html
toolkit/components/passwordmgr/test/mochitest/test_case_differences.html
toolkit/components/passwordmgr/test/mochitest/test_insecure_form_field_autocomplete.html
toolkit/components/passwordmgr/test/mochitest/test_insecure_form_field_no_saved_login.html
--- a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js
+++ b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js
@@ -390,15 +390,8 @@ this.LoginManager = new Proxy({}, {
       return PWMGR_COMMON_PARENT.sendSyncMessage("proxyLoginManager", {
         args: cloneableArgs,
         loginInfoIndices,
         methodName: prop,
       })[0][0];
     };
   },
 });
-
-// Check for expected username/password in form.
-function checkACForm(usernameField, expectedUsername, passwordField, expectedPassword) {
-  let formID = usernameField.parentNode.id;
-  is(usernameField.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
-  is(passwordField.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
-}
--- a/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_https_upgrade.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_https_upgrade.html
@@ -63,16 +63,23 @@ let pword;
 // Restore the form to the default state.
 function restoreForm() {
   pword.focus();
   uname.value = "";
   pword.value = "";
   uname.focus();
 }
 
+// Check for expected username/password in form.
+function checkACForm(expectedUsername, expectedPassword) {
+  let formID = uname.parentNode.id;
+  is(uname.value, expectedUsername, "Checking " + formID + " username");
+  is(pword.value, expectedPassword, "Checking " + formID + " password");
+}
+
 add_task(async function setup() {
   await SpecialPowers.pushPrefEnv({"set": [["signon.schemeUpgrades", true]]});
 
   iframe.src = "https://example.org/tests/toolkit/components/passwordmgr/test/mochitest/form_basic.html";
   await new Promise(resolve => {
     iframe.addEventListener("load", function() {
       resolve();
     }, {once: true});
@@ -81,65 +88,65 @@ add_task(async function setup() {
   iframeDoc = iframe.contentDocument;
   hostname = iframeDoc.documentURIObject.host;
   uname = iframeDoc.getElementById("form-basic-username");
   pword = iframeDoc.getElementById("form-basic-password");
 });
 
 add_task(async function test_empty_first_entry() {
   // Make sure initial form is empty.
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   // Trigger autocomplete popup
   restoreForm();
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is initially closed");
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown");
   let results = await shownPromise;
   popupState = await getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected");
   checkAutoCompleteResults(results, ["name", "name1", "name2"], hostname, "initial");
 
   // Check first entry
   let index0Promise = notifySelectedIndex(0);
   synthesizeKey("KEY_ArrowDown");
   await index0Promise;
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "name", pword, "pass");
+  checkACForm("name", "pass");
 });
 
 add_task(async function test_empty_second_entry() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_ArrowDown"); // second
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "name1", pword, "pass1");
+  checkACForm("name1", "pass1");
 });
 
 add_task(async function test_search() {
   restoreForm();
   let shownPromise = promiseACShown();
   // We need to blur for the autocomplete controller to notice the forced value below.
   uname.blur();
   uname.value = "name";
   uname.focus();
   sendChar("1");
   synthesizeKey("KEY_ArrowDown"); // open
   let results = await shownPromise;
   checkAutoCompleteResults(results, ["name1"], hostname, "check result deduping for 'name1'");
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "name1", pword, "pass1");
+  checkACForm("name1", "pass1");
 
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is now closed");
 });
 
 add_task(async function test_delete_first_entry() {
   restoreForm();
   uname.focus();
@@ -151,17 +158,17 @@ add_task(async function test_delete_firs
   synthesizeKey("KEY_ArrowDown");
   await index0Promise;
 
   let deletionPromise = promiseStorageChanged(["removeLogin"]);
   // On OS X, shift-backspace and shift-delete work, just delete does not.
   // On Win/Linux, shift-backspace does not work, delete and shift-delete do.
   synthesizeKey("KEY_Delete", {shiftKey: true});
   await deletionPromise;
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
 
   let results = await notifyMenuChanged(3, "name1");
 
   checkAutoCompleteResults(results, ["name1", "name2"], hostname, "two logins should remain after deleting the first");
   let popupState = await getPopupState();
   is(popupState.open, true, "Check popup stays open after deleting");
   synthesizeKey("KEY_Escape");
   popupState = await getPopupState();
@@ -179,17 +186,17 @@ add_task(async function test_delete_dupl
   synthesizeKey("KEY_ArrowDown");
   await index0Promise;
 
   let deletionPromise = promiseStorageChanged(["removeLogin"]);
   // On OS X, shift-backspace and shift-delete work, just delete does not.
   // On Win/Linux, shift-backspace does not work, delete and shift-delete do.
   synthesizeKey("KEY_Delete", {shiftKey: true});
   await deletionPromise;
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
 
   is(LoginManager.countLogins("http://example.org", "http://example.org", null), 1,
      "Check that the HTTP login remains");
   is(LoginManager.countLogins("https://example.org", "https://example.org", null), 0,
      "Check that the HTTPS login was deleted");
 
   // Two menu items should remain as the HTTPS login should have been deleted but
   // the HTTP would remain.
--- a/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_password_open.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_password_open.html
@@ -46,19 +46,26 @@ var setupScript = runInParent(function s
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Login Manager: Test password field autocomplete footer with and without logins **/
 
 let uname = document.getElementById("uname");
 let pword = document.getElementById("pword");
 
+// Check for expected username/password in form.
+function checkACForm(expectedUsername, expectedPassword) {
+  var formID = uname.parentNode.id;
+  is(uname.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
+  is(pword.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
+}
+
 add_task(async function test_no_autofill() {
   // Make sure initial form is empty as autofill shouldn't happen in the sandboxed frame.
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is initially closed");
 });
 
 add_task(async function test_two_logins() {
   let shownPromise = promiseACShown();
   uname.focus();
   await shownPromise;
@@ -71,17 +78,17 @@ add_task(async function test_two_logins(
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
   let expectedMenuItems = [
     "tempuser1",
     "tempuser2",
   ];
   checkAutoCompleteResults(results, expectedMenuItems, "example.com", "Check all menuitems are displayed correctly.");
 
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let removedPromise = promiseStorageChanged(["removeAllLogins"]);
   LoginManager.removeAllLogins();
   await removedPromise;
 });
 
 add_task(async function test_zero_logins() {
   uname.focus();
 
@@ -92,20 +99,20 @@ add_task(async function test_zero_logins
   let results = await Promise.race([
     shownPromise,
     new Promise(resolve => setTimeout(resolve, 2000)), // Wait 2s for the popup to appear
   ]);
 
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is still closed");
 
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   shownPromise = promiseACShown();
   info("arrow down should still open the popup");
   synthesizeKey("KEY_ArrowDown");
   results = await shownPromise;
   checkAutoCompleteResults(results, [], "example.com", "Check only footer is displayed.");
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
 });
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_sandboxed.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_sandboxed.html
@@ -50,16 +50,23 @@ var setupScript = runInParent(function s
 
 /** Test for Login Manager: form field autocomplete in sandboxed documents (null principal) **/
 
 let sandboxed = document.getElementById("sandboxed");
 let uname;
 let pword;
 let hostname;
 
+// Check for expected username/password in form.
+function checkACForm(expectedUsername, expectedPassword) {
+  var formID = uname.parentNode.id;
+  is(uname.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
+  is(pword.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
+}
+
 add_task(async function setup() {
   await SpecialPowers.pushPrefEnv({"set": [
     ["security.insecure_field_warning.contextual.enabled", true],
   ]});
 
   let frameWindow = SpecialPowers.wrap(sandboxed).contentWindow;
   // Can't use SimpleTest.promiseFocus as it doesn't work with the sandbox.
   await SimpleTest.promiseWaitForCondition(() => {
@@ -68,17 +75,17 @@ add_task(async function setup() {
   let frameDoc = SpecialPowers.wrap(sandboxed).contentDocument;
   uname = frameDoc.getElementById("form-basic-username");
   pword = frameDoc.getElementById("form-basic-password");
   hostname = frameDoc.documentURIObject.host;
 });
 
 add_task(async function test_no_autofill() {
   // Make sure initial form is empty as autofill shouldn't happen in the sandboxed frame.
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is initially closed");
 });
 
 add_task(async function test_autocomplete_warning_no_logins() {
   pword.focus();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open the popup
@@ -87,14 +94,14 @@ add_task(async function test_autocomplet
   let popupState = await getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
   let expectedMenuItems = [
     "This connection is not secure. Logins entered here could be compromised. Learn More",
   ];
   checkAutoCompleteResults(results, expectedMenuItems, hostname, "Check all menuitems are displayed correctly.");
 
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
 });
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/mochitest/test_autofill_different_formSubmitURL.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_autofill_different_formSubmitURL.html
@@ -25,16 +25,25 @@ let nsLoginInfo = SpecialPowers.wrap(Spe
 <div id="content">
   <iframe></iframe>
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 let iframe = SpecialPowers.wrap(document.getElementsByTagName("iframe")[0]);
 
+// Check for expected username/password in form.
+function checkACForm(expectedUsername, expectedPassword) {
+  let iframeDoc = iframe.contentDocument;
+  let uname = iframeDoc.getElementById("form-basic-username");
+  let pword = iframeDoc.getElementById("form-basic-password");
+  let formID = uname.parentNode.id;
+  is(uname.value, expectedUsername, "Checking " + formID + " username");
+  is(pword.value, expectedPassword, "Checking " + formID + " password");
+}
 async function prepareLoginsAndProcessForm(url, logins = []) {
   LoginManager.removeAllLogins();
 
   let dates = Date.now();
   for (let login of logins) {
     SpecialPowers.do_QueryInterface(login, SpecialPowers.Ci.nsILoginMetaInfo);
     // Force all dates to be the same so they don't affect things like deduping.
     login.timeCreated = login.timePasswordChanged = login.timeLastUsed = dates;
@@ -46,30 +55,24 @@ async function prepareLoginsAndProcessFo
 }
 
 add_task(async function test_formSubmitURL_wildcard_should_autofill() {
   await prepareLoginsAndProcessForm("https://example.com" + MISSING_ACTION_PATH, [
     new nsLoginInfo("https://example.com", "", null,
                     "name2", "pass2", "uname", "pword"),
   ]);
 
-  let iframeDoc = iframe.contentDocument;
-  let uname = iframeDoc.getElementById("form-basic-username");
-  let pword = iframeDoc.getElementById("form-basic-password");
-  checkACForm(uname, "name2", pword, "pass2");
+  checkACForm("name2", "pass2");
 });
 
 add_task(async function test_formSubmitURL_different_shouldnt_autofill() {
   await prepareLoginsAndProcessForm("https://example.com" + MISSING_ACTION_PATH, [
     new nsLoginInfo("https://example.com", "https://another.domain", null,
                     "name2", "pass2", "uname", "pword"),
   ]);
 
-  let iframeDoc = iframe.contentDocument;
-  let uname = iframeDoc.getElementById("form-basic-username");
-  let pword = iframeDoc.getElementById("form-basic-password");
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
 });
 
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/mochitest/test_autofill_from_bfcache.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_autofill_from_bfcache.html
@@ -26,38 +26,44 @@ runInParent(function initLogins() {
 
 <div id="content">
   <a id="next" href="https://example.org/" target="loginWin">Next</a>
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 let win;
+// Check for expected username/password in form.
+function checkACForm(expectedUsername, expectedPassword) {
+  let doc = win.document;
+  let uname = doc.getElementById("form-basic-username");
+  let pword = doc.getElementById("form-basic-password");
+  let formID = uname.parentNode.id;
+  is(uname.value, expectedUsername, "Checking " + formID + " username");
+  is(pword.value, expectedPassword, "Checking " + formID + " password");
+}
 
 add_task(async function test_crossOriginBfcacheRestore() {
   let processedPromise = promiseFormsProcessed();
   win = window.open("form_basic.html", "loginWin");
   await processedPromise;
-  let doc = win.document;
-  let uname = doc.getElementById("form-basic-username");
-  let pword = doc.getElementById("form-basic-password");
-  checkACForm(uname, "autofilled", pword, "pass1");
+  checkACForm("autofilled", "pass1");
 
   let pageHidePromise = new Promise(resolve => {
     win.addEventListener("pagehide", resolve, {once: true});
   });
   info("Navigate to another page on a different origin");
   document.getElementById("next").click();
   let pageHideEvent = await pageHidePromise;
   await SimpleTest.promiseFocus(win);
   ok(pageHideEvent.persisted, "First document should have been persisted in bfcache");
 
   info("go back to the first page (login form)");
   processedPromise = promiseFormsProcessed();
   SpecialPowers.wrap(win).history.back();
   await processedPromise;
-  checkACForm(uname, "autofilled", pword, "pass1");
+  checkACForm("autofilled", "pass1");
   win.close();
 });
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/mochitest/test_autofill_https_upgrade.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_autofill_https_upgrade.html
@@ -26,16 +26,25 @@ let nsLoginInfo = SpecialPowers.wrap(Spe
 <div id="content">
   <iframe></iframe>
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 let iframe = SpecialPowers.wrap(document.getElementsByTagName("iframe")[0]);
 
+// Check for expected username/password in form.
+function checkACForm(expectedUsername, expectedPassword) {
+  let iframeDoc = iframe.contentDocument;
+  let uname = iframeDoc.getElementById("form-basic-username");
+  let pword = iframeDoc.getElementById("form-basic-password");
+  let formID = uname.parentNode.id;
+  is(uname.value, expectedUsername, "Checking " + formID + " username");
+  is(pword.value, expectedPassword, "Checking " + formID + " password");
+}
 async function prepareLoginsAndProcessForm(url, logins = []) {
   LoginManager.removeAllLogins();
 
   let dates = Date.now();
   for (let login of logins) {
     SpecialPowers.do_QueryInterface(login, SpecialPowers.Ci.nsILoginMetaInfo);
     // Force all dates to be the same so they don't affect things like deduping.
     login.timeCreated = login.timePasswordChanged = login.timeLastUsed = dates;
@@ -51,72 +60,57 @@ add_task(async function setup() {
 });
 
 add_task(async function test_simpleNoDupesNoAction() {
   await prepareLoginsAndProcessForm("https://example.com" + MISSING_ACTION_PATH, [
     new nsLoginInfo("http://example.com", "http://example.com", null,
                     "name2", "pass2", "uname", "pword"),
   ]);
 
-  let iframeDoc = iframe.contentDocument;
-  let uname = iframeDoc.getElementById("form-basic-username");
-  let pword = iframeDoc.getElementById("form-basic-password");
-  checkACForm(uname, "name2", pword, "pass2");
+  checkACForm("name2", "pass2");
 });
 
 add_task(async function test_simpleNoDupesUpgradeOriginAndAction() {
   await prepareLoginsAndProcessForm("https://example.com" + CROSS_ORIGIN_SECURE_PATH, [
     new nsLoginInfo("http://example.com", "http://another.domain", null,
                     "name2", "pass2", "uname", "pword"),
   ]);
 
-  let iframeDoc = iframe.contentDocument;
-  let uname = iframeDoc.getElementById("form-basic-username");
-  let pword = iframeDoc.getElementById("form-basic-password");
-  checkACForm(uname, "name2", pword, "pass2");
+  checkACForm("name2", "pass2");
 });
 
 add_task(async function test_simpleNoDupesUpgradeOriginOnly() {
   await prepareLoginsAndProcessForm("https://example.com" + CROSS_ORIGIN_SECURE_PATH, [
     new nsLoginInfo("http://example.com", "https://another.domain", null,
                     "name2", "pass2", "uname", "pword"),
   ]);
 
-  let iframeDoc = iframe.contentDocument;
-  let uname = iframeDoc.getElementById("form-basic-username");
-  let pword = iframeDoc.getElementById("form-basic-password");
-  checkACForm(uname, "name2", pword, "pass2");
+  checkACForm("name2", "pass2");
 });
 
 add_task(async function test_simpleNoDupesUpgradeActionOnly() {
   await prepareLoginsAndProcessForm("https://example.com" + CROSS_ORIGIN_SECURE_PATH, [
     new nsLoginInfo("https://example.com", "http://another.domain", null,
                     "name2", "pass2", "uname", "pword"),
   ]);
 
-  let iframeDoc = iframe.contentDocument;
-  let uname = iframeDoc.getElementById("form-basic-username");
-  let pword = iframeDoc.getElementById("form-basic-password");
-  checkACForm(uname, "name2", pword, "pass2");
+  checkACForm("name2", "pass2");
 });
 
 add_task(async function test_dedupe() {
   await prepareLoginsAndProcessForm("https://example.com" + MISSING_ACTION_PATH, [
     new nsLoginInfo("https://example.com", "https://example.com", null,
                     "name1", "passHTTPStoHTTPS", "uname", "pword"),
     new nsLoginInfo("http://example.com", "http://example.com", null,
                     "name1", "passHTTPtoHTTP", "uname", "pword"),
     new nsLoginInfo("http://example.com", "https://example.com", null,
                     "name1", "passHTTPtoHTTPS", "uname", "pword"),
     new nsLoginInfo("https://example.com", "http://example.com", null,
                     "name1", "passHTTPStoHTTP", "uname", "pword"),
   ]);
 
-  let iframeDoc = iframe.contentDocument;
-  let uname = iframeDoc.getElementById("form-basic-username");
-  let pword = iframeDoc.getElementById("form-basic-password");
-  checkACForm(uname, "name1", pword, "passHTTPStoHTTPS");
+  checkACForm("name1", "passHTTPStoHTTPS");
 });
 
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/mochitest/test_autofill_sandboxed.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_autofill_sandboxed.html
@@ -44,16 +44,23 @@ var setupScript = runInParent(function s
 <script class="testbody" type="text/javascript">
 
 /** Test for Login Manager: form field autofill in sandboxed documents (null principal) **/
 
 let sandboxed = document.getElementById("sandboxed");
 let uname;
 let pword;
 
+// Check for expected username/password in form.
+function checkACForm(expectedUsername, expectedPassword) {
+  var formID = uname.parentNode.id;
+  is(uname.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
+  is(pword.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
+}
+
 function promiseExecuteSoon() {
   return new Promise(SimpleTest.executeSoon);
 }
 
 add_task(async function setup() {
   await SpecialPowers.pushPrefEnv({"set": [
     ["security.insecure_field_warning.contextual.enabled", true],
   ]});
@@ -78,26 +85,26 @@ add_task(async function test_no_autofill
   let frameDoc = SpecialPowers.wrap(sandboxed).contentDocument;
 
   uname = frameDoc.getElementById("form-basic-username");
   pword = frameDoc.getElementById("form-basic-password");
 
   await promiseExecuteSoon();
   // Autofill shouldn't happen in the sandboxed frame but would have happened by
   // now since DOMFormHasPassword was observed above.
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
 
   info("blurring the username field after typing the username");
   uname.focus();
   uname.setUserInput("tempuser1");
   synthesizeKey("VK_TAB", {}, frameWindow);
   await promiseExecuteSoon();
   await promiseExecuteSoon();
   await promiseExecuteSoon();
-  checkACForm(uname, "tempuser1", pword, "");
+  checkACForm("tempuser1", "");
 });
 
 add_task(async function test_no_autofill_outside_form() {
   sandboxed.src = "formless_basic.html";
   let frameWindow = SpecialPowers.wrap(sandboxed).contentWindow;
   let DOMInputPasswordAddedPromise = new Promise(resolve => {
     SpecialPowers.addChromeEventListener("DOMInputPasswordAdded", function onDIPA() {
       SpecialPowers.removeChromeEventListener("DOMInputPasswordAdded", onDIPA);
@@ -114,14 +121,14 @@ add_task(async function test_no_autofill
   let frameDoc = SpecialPowers.wrap(sandboxed).contentDocument;
 
   uname = frameDoc.getElementById("form-basic-username");
   pword = frameDoc.getElementById("form-basic-password");
 
   await promiseExecuteSoon();
   // Autofill shouldn't happen in the sandboxed frame but would have happened by
   // now since DOMInputPasswordAdded was observed above.
-  checkACForm(uname, pword, "", "");
+  checkACForm("", "");
 });
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete.html
@@ -118,16 +118,23 @@ var pword = $_(1, "pword");
 
 // Restore the form to the default state.
 function restoreForm() {
   uname.value = "";
   pword.value = "";
   uname.focus();
 }
 
+// Check for expected username/password in form.
+function checkACForm(expectedUsername, expectedPassword) {
+  var formID = uname.parentNode.id;
+  is(uname.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
+  is(pword.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
+}
+
 function sendFakeAutocompleteEvent(element) {
   var acEvent = document.createEvent("HTMLEvents");
   acEvent.initEvent("DOMAutoComplete", true, false);
   element.dispatchEvent(acEvent);
 }
 
 function spinEventLoop() {
   return Promise.resolve();
@@ -136,17 +143,17 @@ function spinEventLoop() {
 add_task(async function setup() {
   listenForUnexpectedPopupShown();
 });
 
 add_task(async function test_form1_initial_empty() {
   await SimpleTest.promiseFocus(window);
 
   // Make sure initial form is empty.
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is initially closed");
 });
 
 add_task(async function test_form1_menuitems() {
   await SimpleTest.promiseFocus(window);
   // Trigger autocomplete popup
   restoreForm();
@@ -158,83 +165,83 @@ add_task(async function test_form1_menui
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
   let expectedMenuItems = ["tempuser1",
                            "testuser2",
                            "testuser3",
                            "zzzuser4"];
   checkAutoCompleteResults(results, expectedMenuItems, "example.com", "Check all menuitems are displayed correctly.");
 
-  checkACForm(uname, "", pword, ""); // value shouldn't update just by selecting
+  checkACForm("", ""); // value shouldn't update just by selecting
   synthesizeKey("KEY_Enter");
   await spinEventLoop(); // let focus happen
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
 });
 
 add_task(async function test_form1_first_entry() {
   await SimpleTest.promiseFocus(window);
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   let popupState = await getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
   synthesizeKey("KEY_ArrowDown"); // first
-  checkACForm(uname, "", pword, ""); // value shouldn't update just by selecting
+  checkACForm("", ""); // value shouldn't update just by selecting
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "tempuser1", pword, "temppass1");
+  checkACForm("tempuser1", "temppass1");
 });
 
 add_task(async function test_form1_second_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_ArrowDown"); // second
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser2", pword, "testpass2");
+  checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_third_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_ArrowDown"); // second
   synthesizeKey("KEY_ArrowDown"); // third
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser3", pword, "testpass3");
+  checkACForm("testuser3", "testpass3");
 });
 
 add_task(async function test_form1_fourth_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_ArrowDown"); // second
   synthesizeKey("KEY_ArrowDown"); // third
   synthesizeKey("KEY_ArrowDown"); // fourth
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "zzzuser4", pword, "zzzpass4");
+  checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_wraparound_first_entry() {
   // Trigger autocomplete popup
   restoreForm();
   await spinEventLoop(); // let focus happen
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
@@ -244,47 +251,47 @@ add_task(async function test_form1_wrapa
   synthesizeKey("KEY_ArrowDown"); // second
   synthesizeKey("KEY_ArrowDown"); // third
   synthesizeKey("KEY_ArrowDown"); // fourth
   synthesizeKey("KEY_ArrowDown"); // footer
   synthesizeKey("KEY_ArrowDown"); // deselects
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "tempuser1", pword, "temppass1");
+  checkACForm("tempuser1", "temppass1");
 });
 
 add_task(async function test_form1_wraparound_up_last_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowUp"); // footer
   synthesizeKey("KEY_ArrowUp"); // last (fourth)
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "zzzuser4", pword, "zzzpass4");
+  checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_wraparound_down_up_up() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // select first entry
   synthesizeKey("KEY_ArrowUp"); // selects nothing!
   synthesizeKey("KEY_ArrowUp"); // footer
   synthesizeKey("KEY_ArrowUp"); // select last entry
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "zzzuser4", pword, "zzzpass4");
+  checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_wraparound_up_last() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
@@ -295,85 +302,85 @@ add_task(async function test_form1_wrapa
   synthesizeKey("KEY_ArrowUp");
   synthesizeKey("KEY_ArrowUp");
   synthesizeKey("KEY_ArrowUp"); // first entry
   synthesizeKey("KEY_ArrowUp"); // deselects
   synthesizeKey("KEY_ArrowUp"); // footer
   synthesizeKey("KEY_ArrowUp"); // last entry
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "zzzuser4", pword, "zzzpass4");
+  checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_fill_username_without_autofill_right() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Set first entry w/o triggering autocomplete
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_ArrowRight");
   await spinEventLoop();
-  checkACForm(uname, "tempuser1", pword, ""); // empty password
+  checkACForm("tempuser1", ""); // empty password
 });
 
 add_task(async function test_form1_fill_username_without_autofill_left() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Set first entry w/o triggering autocomplete
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_ArrowLeft");
-  checkACForm(uname, "tempuser1", pword, ""); // empty password
+  checkACForm("tempuser1", ""); // empty password
 });
 
 add_task(async function test_form1_pageup_first() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Check first entry (page up)
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_ArrowDown"); // second
   synthesizeKey("KEY_PageUp"); // first
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "tempuser1", pword, "temppass1");
+  checkACForm("tempuser1", "temppass1");
 });
 
 add_task(async function test_form1_pagedown_last() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   /* test 13 */
   // Check last entry (page down)
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_PageDown"); // footer
   synthesizeKey("KEY_ArrowUp"); // last
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "zzzuser4", pword, "zzzpass4");
+  checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_untrusted_event() {
   restoreForm();
   await spinEventLoop();
 
   // Send a fake (untrusted) event.
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   uname.value = "zzzuser4";
   sendFakeAutocompleteEvent(uname);
   await spinEventLoop();
-  checkACForm(uname, "zzzuser4", pword, "");
+  checkACForm("zzzuser4", "");
 });
 
 add_task(async function test_form1_delete() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
@@ -389,114 +396,114 @@ add_task(async function test_form1_delet
 
   let countChangedPromise = notifyMenuChanged(4);
   var deletionPromise = promiseStorageChanged(["removeLogin"]);
   // On OS X, shift-backspace and shift-delete work, just delete does not.
   // On Win/Linux, shift-backspace does not work, delete and shift-delete do.
   synthesizeKey("KEY_Delete", {shiftKey: true});
   await deletionPromise;
 
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
   is(numLogins, 4, "Correct number of logins after deleting one");
   await countChangedPromise;
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser2", pword, "testpass2");
+  checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_first_after_deletion() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Check the new first entry (of 3)
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser2", pword, "testpass2");
+  checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_delete_second() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Delete the second entry (of 3), "testuser3"
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Delete", {shiftKey: true});
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
   is(numLogins, 3, "Correct number of logins after deleting one");
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "zzzuser4", pword, "zzzpass4");
+  checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_first_after_deletion2() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Check the new first entry (of 2)
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser2", pword, "testpass2");
+  checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_delete_last() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   /* test 54 */
   // Delete the last entry (of 2), "zzzuser4"
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Delete", {shiftKey: true});
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
   is(numLogins, 2, "Correct number of logins after deleting one");
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser2", pword, "testpass2");
+  checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_first_after_3_deletions() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Check the only remaining entry
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser2", pword, "testpass2");
+  checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_check_only_entry_remaining() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   /* test 56 */
   // Delete the only remaining entry, "testuser2"
   synthesizeKey("KEY_ArrowDown");
   let storageChanged = promiseStorageChanged(["removeLogin", "removeLogin", "addLogin"]);
   synthesizeKey("KEY_Delete", {shiftKey: true});
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
   is(numLogins, 1, "Correct number of logins after deleting one");
 
   // remove the logins for the previous tests
   setupScript.sendSyncMessage("removeLogin", "login0");
   setupScript.sendSyncMessage("addLogin", "login5");
   await storageChanged;
 });
@@ -508,129 +515,129 @@ add_task(async function test_form2() {
       <input  type="text"       name="uname">
       <input  type="password"   name="pword" autocomplete="off">
       <button type="submit">Submit</button>
     </form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
 
   // Turn our attention to form2
   uname = $_(2, "uname");
   pword = $_(2, "pword");
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
 
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Check first entry
   synthesizeKey("KEY_ArrowDown");
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form3() {
   await setFormAndWaitForFieldFilled(`
     <form id="form3" action="https://autocomplete2" onsubmit="return false;">
       <input  type="text"       name="uname" autocomplete="off">
       <input  type="password"   name="pword">
       <button type="submit">Submit</button>
     </form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
 
   uname = $_(3, "uname");
   pword = $_(3, "pword");
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Check first entry
   synthesizeKey("KEY_ArrowDown");
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form4() {
   await setFormAndWaitForFieldFilled(`
     <form id="form4" action="https://autocomplete2" onsubmit="return false;" autocomplete="off">
       <input  type="text"       name="uname">
       <input  type="password"   name="pword">
       <button type="submit">Submit</button>
     </form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
 
   uname = $_(4, "uname");
   pword = $_(4, "pword");
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Check first entry
   synthesizeKey("KEY_ArrowDown");
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form5() {
   await setFormAndWaitForFieldFilled(`
     <form id="form5" action="https://autocomplete2" onsubmit="return false;">
       <input  type="text"       name="uname" autocomplete="off">
       <input  type="password"   name="pword" autocomplete="off">
       <button type="submit">Submit</button>
     </form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
 
   uname = $_(5, "uname");
   pword = $_(5, "pword");
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Check first entry
   synthesizeKey("KEY_ArrowDown");
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form6() {
   await setFormAndWaitForFieldFilled(`
     <!-- control -->
     <form id="form6" action="https://autocomplete2" onsubmit="return false;">
       <input  type="text"       name="uname">
       <input  type="password"   name="pword">
       <button type="submit">Submit</button>
     </form>`, {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");
   pword = $_(6, "pword");
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form6_changeUsername() {
   // Test that the password field remains filled in after changing
   // the username.
   uname.focus();
   synthesizeKey("KEY_ArrowRight");
   synthesizeKey("X", {shiftKey: true});
   // Trigger the 'blur' event on uname
   pword.focus();
   await spinEventLoop();
-  checkACForm(uname, "singleuser5X", pword, "singlepass5");
+  checkACForm("singleuser5X", "singlepass5");
   uname.focus();
 
   let storageChanged = promiseStorageChanged(["removeLogin"]);
   setupScript.sendSyncMessage("removeLogin", "login5");
   await storageChanged;
 });
 
 add_task(async function test_form7() {
@@ -643,17 +650,17 @@ add_task(async function test_form7() {
     <form id="form7" action="https://autocomplete3" onsubmit="return false;">
       <input  type="text"       name="uname">
       <input  type="password"   name="pword">
       <button type="submit">Submit</button>
     </form>`, {fieldSelector: `input[name="uname"]`, fieldValue: ""});
 
   uname = $_(7, "uname");
   pword = $_(7, "pword");
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
 
   // Insert a new username field into the form. We'll then make sure
   // that invoking the autocomplete doesn't try to fill the form.
   var newField = document.createElement("input");
   newField.setAttribute("type", "text");
   newField.setAttribute("name", "uname2");
   pword.parentNode.insertBefore(newField, pword);
   is($_(7, "uname2").value, "", "Verifying empty uname2");
@@ -671,27 +678,26 @@ add_task(async function test_form7_2() {
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   let results = await shownPromise;
   checkAutoCompleteResults(results,
                            ["form7user1"],
                            "example.com",
                            "Check dropdown is showing all logins while field is blank");
 
-
   // Check first entry
   synthesizeKey("KEY_ArrowDown");
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   synthesizeKey("KEY_Enter");
   // The form changes, so we expect the old username field to get the
   // selected autocomplete value, but neither the new username field nor
   // the password field should have any values filled in.
   await SimpleTest.promiseWaitForCondition(() => uname.value == "form7user1",
                                            "Wait for username to get filled");
-  checkACForm(uname, "form7user1", pword, "");
+  checkACForm("form7user1", "");
   is($_(7, "uname2").value, "", "Verifying empty uname2");
   restoreForm(); // clear field, so reloading test doesn't fail
 
   let storageChanged = promiseStorageChanged(["removeLogin"]);
   setupScript.sendSyncMessage("removeLogin", "login6A");
   await storageChanged;
 });
 
@@ -710,33 +716,33 @@ add_task(async function test_form8() {
     <form id="form8" action="https://autocomplete4" onsubmit="return false;">
       <input  type="text"       name="uname">
       <input  type="password"   name="pword">
       <button type="submit">Submit</button>
     </form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "form8user", formId: "form8"});
 
   uname = $_(8, "uname");
   pword = $_(8, "pword");
-  checkACForm(uname, "form8user", pword, "form8pass");
+  checkACForm("form8user", "form8pass");
   restoreForm();
 });
 
 add_task(async function test_form8_blur() {
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   // Focus the previous form to trigger a blur.
   $_(7, "uname").focus();
 });
 
 add_task(async function test_form8_2() {
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   restoreForm();
 });
 
 add_task(async function test_form8_3() {
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let storageChanged = promiseStorageChanged(["removeLogin", "addLogin", "addLogin"]);
   setupScript.sendSyncMessage("removeLogin", "login7");
   setupScript.sendSyncMessage("addLogin", "login8A");
   setupScript.sendSyncMessage("addLogin", "login8B");
   await storageChanged;
 });
 
 add_task(async function test_form9_filtering() {
@@ -763,29 +769,29 @@ add_task(async function test_form9_filte
   shownPromise = promiseACShown();
   sendString("form9userAB");
   results = await shownPromise;
   checkAutoCompleteResults(results,
                            ["form9userAB"],
                            "example.com",
                            "Check dropdown is showing login with only one 'A'");
 
-  checkACForm(uname, "form9userAB", pword, "");
+  checkACForm("form9userAB", "");
   uname.focus();
   synthesizeKey("KEY_ArrowLeft");
   shownPromise = promiseACShown();
   synthesizeKey("A", {shiftKey: true});
   results = await shownPromise;
 
-  checkACForm(uname, "form9userAAB", pword, "");
+  checkACForm("form9userAAB", "");
   checkAutoCompleteResults(results, ["form9userAAB"], "example.com", "Check dropdown is updated after inserting 'A'");
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "form9userAAB", pword, "form9pass");
+  checkACForm("form9userAAB", "form9pass");
 });
 
 add_task(async function test_form9_autocomplete_cache() {
   // Note that this addLogin call will only be seen by the autocomplete
   // attempt for the synthesizeKey if we do not successfully cache the
   // autocomplete results.
   let storageChanged = promiseStorageChanged(["addLogin"]);
   setupScript.sendSyncMessage("addLogin", "login8C");
@@ -817,55 +823,55 @@ add_task(async function test_form11_form
       <input  type="password"   name="pword" id="pword">
       <button type="submit">Submit</button>
     </div>`, {fieldSelector: `input[name="uname"]`, fieldValue: "testuser11"});
 
   // Test form-less autocomplete
   uname = $_(11, "uname");
   pword = $_(11, "pword");
   restoreForm();
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Trigger autocomplete
   synthesizeKey("KEY_ArrowDown");
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   let processedPromise = promiseFormsProcessed();
   synthesizeKey("KEY_Enter");
   await processedPromise;
-  checkACForm(uname, "testuser11", pword, "testpass11");
+  checkACForm("testuser11", "testpass11");
 });
 
 add_task(async function test_form11_open_on_trusted_focus() {
   uname = $_(11, "uname");
   pword = $_(11, "pword");
   uname.value = "";
   pword.value = "";
 
   // Move focus to the password field so we can test the first click on the
   // username field.
   pword.focus();
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   const firePrivEventPromise = new Promise((resolve) => {
     uname.addEventListener("click", (e) => {
       ok(e.isTrusted, "Ensure event is trusted");
       resolve();
     });
   });
   const shownPromise = promiseACShown();
   synthesizeMouseAtCenter(uname, {});
   await firePrivEventPromise;
   await shownPromise;
   synthesizeKey("KEY_ArrowDown");
   const processedPromise = promiseFormsProcessed();
   synthesizeKey("KEY_Enter");
   await processedPromise;
-  checkACForm(uname, "testuser11", pword, "testpass11");
+  checkACForm("testuser11", "testpass11");
   let storageChanged = promiseStorageChanged(["removeLogin"]);
   setupScript.sendSyncMessage("removeLogin", "login11");
   await storageChanged;
 });
 
 add_task(async function test_form12_recipes() {
   let storageChanged = promiseStorageChanged(["addLogin"]);
   setupScript.sendSyncMessage("addLogin", "login10");
@@ -889,69 +895,69 @@ add_task(async function test_form12_reci
   pword = $_(12, "2");
 
   // First test DOMAutocomplete
   // Switch the password field to type=password so _fillForm marks the username
   // field for autocomplete.
   pword.type = "password";
   await promiseFormsProcessed();
   restoreForm();
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown");
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser10", pword, "testpass10");
+  checkACForm("testuser10", "testpass10");
 
   // Now test recipes with blur on the username field.
   restoreForm();
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   uname.value = "testuser10";
-  checkACForm(uname, "testuser10", pword, "");
+  checkACForm("testuser10", "");
   synthesizeKey("KEY_Tab");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser10", pword, "testpass10");
+  checkACForm("testuser10", "testpass10");
   await resetRecipes();
 });
 
 add_task(async function test_form13_stays_open_upon_empty_search() {
   await setFormAndWaitForFieldFilled(`
     <!-- test not closing when the search string (.value) becomes empty -->
     <form id="form13" action="http://autocomplete:8888/formtest.js" onsubmit="return false;">
       <input  type="text"       name="uname" value="prefilled">
       <input  type="password"   name="pword" value="prefilled">
       <button type="submit">Submit</button>
     </form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "prefilled"});
 
   uname = $_(13, "uname");
   pword = $_(13, "pword");
-  checkACForm(uname, "prefilled", pword, "prefilled");
+  checkACForm("prefilled", "prefilled");
 
   uname.scrollIntoView();
   let shownPromise = promiseACShown();
   synthesizeMouseAtCenter(uname, {});
   await shownPromise;
   uname.select();
   synthesizeKey("KEY_Delete");
 
   await spinEventLoop();
   let popupState = await getPopupState();
   is(popupState.open, true, "Check popup is still open");
-  checkACForm(uname, "", pword, "prefilled");
+  checkACForm("", "prefilled");
 
   info("testing password field");
   synthesizeMouseAtCenter(pword, {});
   pword.select();
   popupState = await getPopupState();
   is(popupState.open, false, "Check popup closed since password field isn't empty");
   shownPromise = promiseACShown();
   synthesizeKey("KEY_Delete");
   await shownPromise;
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
 });
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete_formSubmitURL.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete_formSubmitURL.html
@@ -52,29 +52,36 @@ var pword = $_(1, "pword");
 
 // Restore the form to the default state.
 function restoreForm() {
   uname.value = "";
   pword.value = "";
   uname.focus();
 }
 
+// Check for expected username/password in form.
+function checkACForm(expectedUsername, expectedPassword) {
+  var formID = uname.parentNode.id;
+  is(uname.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
+  is(pword.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
+}
+
 function spinEventLoop() {
   return Promise.resolve();
 }
 
 add_task(async function setup() {
   listenForUnexpectedPopupShown();
 });
 
 add_task(async function test_form1_initial_empty() {
   await SimpleTest.promiseFocus(window);
 
   // Make sure initial form is empty.
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is initially closed");
 });
 
 /* For this testcase, the only login that exists for this origin
  * is one with a different formSubmitURL, so the login will appear
  * in the autocomplete popup.
  */
@@ -88,18 +95,18 @@ add_task(async function test_form1_menu_
 
   let popupState = await getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
   let expectedMenuItems = ["dfsu1"];
   checkAutoCompleteResults(results, expectedMenuItems, "example.com", "Check all menuitems are displayed correctly.");
 
   synthesizeKey("KEY_ArrowDown"); // first item
-  checkACForm(uname, "", pword, ""); // value shouldn't update just by selecting
+  checkACForm("", ""); // value shouldn't update just by selecting
 
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "dfsu1", pword, "dfsp1");
+  checkACForm("dfsu1", "dfsp1");
 });
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/mochitest/test_case_differences.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_case_differences.html
@@ -65,76 +65,82 @@ var pword = $_(1, "pword");
 
 // Restore the form to the default state.
 function restoreForm() {
   uname.value = "";
   pword.value = "";
   uname.focus();
 }
 
+// Check for expected username/password in form.
+function checkACForm(expectedUsername, expectedPassword) {
+  var formID = uname.parentNode.id;
+  is(uname.value, expectedUsername, "Checking " + formID + " username");
+  is(pword.value, expectedPassword, "Checking " + formID + " password");
+}
 
 add_task(async function test_empty_first_entry() {
   /* test 1 */
   // Make sure initial form is empty.
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   // Trigger autocomplete popup
   restoreForm();
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is initially closed");
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown");
   let results = await shownPromise;
   popupState = await getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected");
   checkAutoCompleteResults(results, ["name", "Name", "USER"], "example.com", "initial");
 
   // Check first entry
   let index0Promise = notifySelectedIndex(0);
   synthesizeKey("KEY_ArrowDown");
   await index0Promise;
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "name", pword, "pass");
+  checkACForm("name", "pass");
 });
 
 add_task(async function test_empty_second_entry() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_ArrowDown"); // second
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "Name", pword, "Pass");
+  checkACForm("Name", "Pass");
 });
 
 add_task(async function test_empty_third_entry() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_ArrowDown"); // second
   synthesizeKey("KEY_ArrowDown"); // third
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "USER", pword, "PASS");
+  checkACForm("USER", "PASS");
 });
 
 add_task(async function test_preserve_matching_username_case() {
   restoreForm();
   uname.value = "user";
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Check that we don't clobber user-entered text when tabbing away
   // (even with no autocomplete entry selected)
   synthesizeKey("KEY_Tab");
   await promiseFormsProcessed();
-  checkACForm(uname, "user", pword, "PASS");
+  checkACForm("user", "PASS");
 });
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/mochitest/test_insecure_form_field_autocomplete.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_insecure_form_field_autocomplete.html
@@ -113,16 +113,23 @@ var pword = $_(1, "pword");
 
 // Restore the form to the default state.
 function restoreForm() {
   uname.value = "";
   pword.value = "";
   uname.focus();
 }
 
+// Check for expected username/password in form.
+function checkACForm(expectedUsername, expectedPassword) {
+  var formID = uname.parentNode.id;
+  is(uname.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
+  is(pword.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
+}
+
 function sendFakeAutocompleteEvent(element) {
   var acEvent = document.createEvent("HTMLEvents");
   acEvent.initEvent("DOMAutoComplete", true, false);
   element.dispatchEvent(acEvent);
 }
 
 function spinEventLoop() {
   return Promise.resolve();
@@ -132,17 +139,17 @@ add_task(async function setup() {
   await SpecialPowers.pushPrefEnv({"set": [["security.insecure_field_warning.contextual.enabled", true]]});
   listenForUnexpectedPopupShown();
 });
 
 add_task(async function test_form1_initial_empty() {
   await SimpleTest.promiseFocus(window);
 
   // Make sure initial form is empty.
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is initially closed");
 });
 
 add_task(async function test_form1_warning_entry() {
   await SimpleTest.promiseFocus(window);
   // Trigger autocomplete popup
   restoreForm();
@@ -156,87 +163,87 @@ add_task(async function test_form1_warni
   let expectedMenuItems = ["This connection is not secure. Logins entered here could be compromised. Learn More",
                            "tempuser1",
                            "testuser2",
                            "testuser3",
                            "zzzuser4"];
   checkAutoCompleteResults(results, expectedMenuItems, "mochi.test", "Check all menuitems are displayed correctly.");
 
   synthesizeKey("KEY_ArrowDown"); // select insecure warning
-  checkACForm(uname, "", pword, ""); // value shouldn't update just by selecting
+  checkACForm("", ""); // value shouldn't update just by selecting
   synthesizeKey("KEY_Enter");
   await spinEventLoop(); // let focus happen
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
 });
 
 add_task(async function test_form1_first_entry() {
   await SimpleTest.promiseFocus(window);
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   let popupState = await getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   synthesizeKey("KEY_ArrowDown"); // first
-  checkACForm(uname, "", pword, ""); // value shouldn't update just by selecting
+  checkACForm("", ""); // value shouldn't update just by selecting
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "tempuser1", pword, "temppass1");
+  checkACForm("tempuser1", "temppass1");
 });
 
 add_task(async function test_form1_second_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_ArrowDown"); // second
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser2", pword, "testpass2");
+  checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_third_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_ArrowDown"); // second
   synthesizeKey("KEY_ArrowDown"); // third
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser3", pword, "testpass3");
+  checkACForm("testuser3", "testpass3");
 });
 
 add_task(async function test_form1_fourth_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_ArrowDown"); // second
   synthesizeKey("KEY_ArrowDown"); // third
   synthesizeKey("KEY_ArrowDown"); // fourth
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "zzzuser4", pword, "zzzpass4");
+  checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_wraparound_first_entry() {
   // Trigger autocomplete popup
   restoreForm();
   await spinEventLoop(); // let focus happen
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
@@ -248,47 +255,47 @@ add_task(async function test_form1_wrapa
   synthesizeKey("KEY_ArrowDown"); // third
   synthesizeKey("KEY_ArrowDown"); // fourth
   synthesizeKey("KEY_ArrowDown"); // footer
   synthesizeKey("KEY_ArrowDown"); // deselects
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "tempuser1", pword, "temppass1");
+  checkACForm("tempuser1", "temppass1");
 });
 
 add_task(async function test_form1_wraparound_up_last_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowUp"); // footer
   synthesizeKey("KEY_ArrowUp"); // last (fourth)
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "zzzuser4", pword, "zzzpass4");
+  checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_wraparound_down_up_up() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // select first entry
   synthesizeKey("KEY_ArrowUp"); // selects nothing!
   synthesizeKey("KEY_ArrowUp"); // selects footer
   synthesizeKey("KEY_ArrowUp"); // select last entry
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "zzzuser4", pword, "zzzpass4");
+  checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_wraparound_up_last() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
@@ -300,88 +307,88 @@ add_task(async function test_form1_wrapa
   synthesizeKey("KEY_ArrowUp");
   synthesizeKey("KEY_ArrowUp"); // skip insecure warning
   synthesizeKey("KEY_ArrowUp"); // first entry
   synthesizeKey("KEY_ArrowUp"); // deselects
   synthesizeKey("KEY_ArrowUp"); // footer
   synthesizeKey("KEY_ArrowUp"); // last entry
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "zzzuser4", pword, "zzzpass4");
+  checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_fill_username_without_autofill_right() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Set first entry w/o triggering autocomplete
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_ArrowRight");
   await spinEventLoop();
-  checkACForm(uname, "tempuser1", pword, ""); // empty password
+  checkACForm("tempuser1", ""); // empty password
 });
 
 add_task(async function test_form1_fill_username_without_autofill_left() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Set first entry w/o triggering autocomplete
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_ArrowLeft");
-  checkACForm(uname, "tempuser1", pword, ""); // empty password
+  checkACForm("tempuser1", ""); // empty password
 });
 
 add_task(async function test_form1_pageup_first() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // Check first entry (page up)
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_ArrowDown"); // second
   synthesizeKey("KEY_PageUp"); // first
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "tempuser1", pword, "temppass1");
+  checkACForm("tempuser1", "temppass1");
 });
 
 add_task(async function test_form1_pagedown_last() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   // test 13
   // Check last entry (page down)
   synthesizeKey("KEY_ArrowDown"); // first
   synthesizeKey("KEY_PageDown"); // last
   synthesizeKey("KEY_ArrowUp"); // skip footer
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "zzzuser4", pword, "zzzpass4");
+  checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_untrusted_event() {
   restoreForm();
   await spinEventLoop();
 
   // Send a fake (untrusted) event.
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   uname.value = "zzzuser4";
   sendFakeAutocompleteEvent(uname);
   await spinEventLoop();
-  checkACForm(uname, "zzzuser4", pword, "");
+  checkACForm("zzzuser4", "");
 });
 
 add_task(async function test_form1_delete() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
@@ -399,125 +406,125 @@ add_task(async function test_form1_delet
 
   let countChangedPromise = notifyMenuChanged(5);
   var deletionPromise = promiseStorageChanged(["removeLogin"]);
   // On OS X, shift-backspace and shift-delete work, just delete does not.
   // On Win/Linux, shift-backspace does not work, delete and shift-delete do.
   synthesizeKey("KEY_Delete", {shiftKey: true});
   await deletionPromise;
 
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   numLogins = LoginManager.countLogins("http://mochi.test:8888", "", null);
   is(numLogins, 4, "Correct number of logins after deleting one");
   await countChangedPromise;
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser2", pword, "testpass2");
+  checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_first_after_deletion() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   // Check the new first entry (of 3)
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser2", pword, "testpass2");
+  checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_delete_second() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   // Delete the second entry (of 3), "testuser3"
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_ArrowDown");
   let storageChanged = promiseStorageChanged(["removeLogin"]);
   synthesizeKey("KEY_Delete", {shiftKey: true});
   await storageChanged;
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let numLogins = LoginManager.countLogins("http://mochi.test:8888", "", null);
   is(numLogins, 3, "Correct number of logins after deleting one");
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "zzzuser4", pword, "zzzpass4");
+  checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_first_after_deletion2() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   // Check the new first entry (of 2)
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser2", pword, "testpass2");
+  checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_delete_last() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   // test 54
   // Delete the last entry (of 2), "zzzuser4"
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_ArrowDown");
   let storageChanged = promiseStorageChanged(["removeLogin"]);
   synthesizeKey("KEY_Delete", {shiftKey: true});
   await storageChanged;
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let numLogins = LoginManager.countLogins("http://mochi.test:8888", "", null);
   is(numLogins, 2, "Correct number of logins after deleting one");
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser2", pword, "testpass2");
+  checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_first_after_3_deletions() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   // Check the only remaining entry
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser2", pword, "testpass2");
+  checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_check_only_entry_remaining() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   // test 56
   // Delete the only remaining entry, "testuser2"
   synthesizeKey("KEY_ArrowDown");
   let storageChanged = promiseStorageChanged(["removeLogin", "removeLogin"]);
   synthesizeKey("KEY_Delete", {shiftKey: true});
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let numLogins = LoginManager.countLogins("http://mochi.test:8888", "", null);
   is(numLogins, 1, "Correct number of logins after deleting one");
 
   // remove the login that's not shown in the list.
   setupScript.sendSyncMessage("removeLogin", "login0");
   await storageChanged;
 });
 
@@ -532,133 +539,133 @@ add_task(async function test_form2() {
       <input  type="text"       name="uname">
       <input  type="password"   name="pword" autocomplete="off">
       <button type="submit">Submit</button>
     </form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
 
   // Turn our attention to form2
   uname = $_(2, "uname");
   pword = $_(2, "pword");
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
 
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   // Check first entry
   synthesizeKey("KEY_ArrowDown");
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form3() {
   await setFormAndWaitForFieldFilled(`
     <form id="form3" action="http://autocomplete2" onsubmit="return false;">
       <input  type="text"       name="uname" autocomplete="off">
       <input  type="password"   name="pword">
       <button type="submit">Submit</button>
     </form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
 
   uname = $_(3, "uname");
   pword = $_(3, "pword");
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   // Check first entry
   synthesizeKey("KEY_ArrowDown");
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form4() {
   await setFormAndWaitForFieldFilled(`
     <form id="form4" action="http://autocomplete2" onsubmit="return false;" autocomplete="off">
       <input  type="text"       name="uname">
       <input  type="password"   name="pword">
       <button type="submit">Submit</button>
     </form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
 
   uname = $_(4, "uname");
   pword = $_(4, "pword");
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   // Check first entry
   synthesizeKey("KEY_ArrowDown");
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form5() {
   await setFormAndWaitForFieldFilled(`
     <form id="form5" action="http://autocomplete2" onsubmit="return false;">
       <input  type="text"       name="uname" autocomplete="off">
       <input  type="password"   name="pword" autocomplete="off">
       <button type="submit">Submit</button>
     </form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
 
   uname = $_(5, "uname");
   pword = $_(5, "pword");
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   // Check first entry
   synthesizeKey("KEY_ArrowDown");
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form6() {
   await setFormAndWaitForFieldFilled(`
     <!-- control -->
     <form id="form6" action="http://autocomplete2" onsubmit="return false;">
       <input  type="text"       name="uname">
       <input  type="password"   name="pword">
       <button type="submit">Submit</button>
     </form>`, {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");
   pword = $_(6, "pword");
-  checkACForm(uname, "singleuser5", pword, "singlepass5");
+  checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form6_changeUsername() {
   // Test that the password field remains filled in after changing
   // the username.
   uname.focus();
   synthesizeKey("KEY_ArrowRight");
   synthesizeKey("X", {shiftKey: true});
   // Trigger the 'blur' event on uname
   pword.focus();
   await spinEventLoop();
-  checkACForm(uname, "singleuser5X", pword, "singlepass5");
+  checkACForm("singleuser5X", "singlepass5");
   uname.focus();
 
   let storageChanged = promiseStorageChanged(["removeLogin"]);
   setupScript.sendSyncMessage("removeLogin", "login5");
   await storageChanged;
 });
 
 add_task(async function test_form7() {
@@ -671,17 +678,17 @@ add_task(async function test_form7() {
     <form id="form7" action="http://autocomplete3" onsubmit="return false;">
       <input  type="text"       name="uname">
       <input  type="password"   name="pword">
       <button type="submit">Submit</button>
     </form>`, {fieldSelector: `input[name="uname"]`, fieldValue: ""});
 
   uname = $_(7, "uname");
   pword = $_(7, "pword");
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
 
   // Insert a new username field into the form. We'll then make sure
   // that invoking the autocomplete doesn't try to fill the form.
   var newField = document.createElement("input");
   newField.setAttribute("type", "text");
   newField.setAttribute("name", "uname2");
   pword.parentNode.insertBefore(newField, pword);
   is($_(7, "uname2").value, "", "Verifying empty uname2");
@@ -698,23 +705,23 @@ add_task(async function test_form7_2() {
   restoreForm();
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   // Check first entry
   synthesizeKey("KEY_ArrowDown");
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   synthesizeKey("KEY_Enter");
   // The form changes, so we expect the old username field to get the
   // selected autocomplete value, but neither the new username field nor
   // the password field should have any values filled in.
   await spinEventLoop();
-  checkACForm(uname, "form7user1", pword, "");
+  checkACForm("form7user1", "");
   is($_(7, "uname2").value, "", "Verifying empty uname2");
   restoreForm(); // clear field, so reloading test doesn't fail
 
   let storageChanged = promiseStorageChanged(["removeLogin"]);
   setupScript.sendSyncMessage("removeLogin", "login6A");
   await storageChanged;
 });
 
@@ -734,33 +741,33 @@ add_task(async function test_form8() {
       <input  type="text"       name="uname">
       <input  type="password"   name="pword">
       <button type="submit">Submit</button>
     </form>
     `, {fieldSelector: `#form8 input[name="uname"]`, fieldValue: "form8user"});
 
   uname = $_(8, "uname");
   pword = $_(8, "pword");
-  checkACForm(uname, "form8user", pword, "form8pass");
+  checkACForm("form8user", "form8pass");
   restoreForm();
 });
 
 add_task(async function test_form8_blur() {
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   // Focus the previous form to trigger a blur.
   $_(7, "uname").focus();
 });
 
 add_task(async function test_form8_2() {
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   restoreForm();
 });
 
 add_task(async function test_form8_3() {
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
 });
 
 add_task(async function test_form9_filtering() {
   let storageChanged = promiseStorageChanged(["removeLogin", "addLogin", "addLogin"]);
   setupScript.sendSyncMessage("removeLogin", "login7");
   setupScript.sendSyncMessage("addLogin", "login8A");
   setupScript.sendSyncMessage("addLogin", "login8B");
   await storageChanged;
@@ -786,33 +793,33 @@ add_task(async function test_form9_filte
   shownPromise = promiseACShown();
   sendString("form9userAB");
   results = await shownPromise;
   checkAutoCompleteResults(results,
                            ["This connection is not secure. Logins entered here could be compromised. Learn More", "form9userAB"],
                            "mochi.test",
                            "Check dropdown is showing login with only one 'A'");
 
-  checkACForm(uname, "form9userAB", pword, "");
+  checkACForm("form9userAB", "");
   uname.focus();
   synthesizeKey("KEY_ArrowLeft");
   shownPromise = promiseACShown();
   synthesizeKey("A", {shiftKey: true});
   results = await shownPromise;
 
-  checkACForm(uname, "form9userAAB", pword, "");
+  checkACForm("form9userAAB", "");
   checkAutoCompleteResults(results,
                            ["This connection is not secure. Logins entered here could be compromised. Learn More", "form9userAAB"],
                            "mochi.test",
                            "Check dropdown is updated after inserting 'A'");
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "form9userAAB", pword, "form9pass");
+  checkACForm("form9userAAB", "form9pass");
 });
 
 add_task(async function test_form9_autocomplete_cache() {
   // Note that this addLogin call will only be seen by the autocomplete
   // attempt for the synthesizeKey if we do not successfully cache the
   // autocomplete results.
   let storageChanged = promiseStorageChanged(["addLogin"]);
   setupScript.sendSyncMessage("addLogin", "login8C");
@@ -865,36 +872,36 @@ add_task(async function test_form11_reci
   pword = $_(11, "2");
 
   // First test DOMAutocomplete
   // Switch the password field to type=password so _fillForm marks the username
   // field for autocomplete.
   pword.type = "password";
   await promiseFormsProcessed();
   restoreForm();
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   synthesizeKey("KEY_ArrowDown");
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   synthesizeKey("KEY_Enter");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser10", pword, "testpass10");
+  checkACForm("testuser10", "testpass10");
 
   // Now test recipes with blur on the username field.
   restoreForm();
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   uname.value = "testuser10";
-  checkACForm(uname, "testuser10", pword, "");
+  checkACForm("testuser10", "");
   synthesizeKey("KEY_Tab");
   await promiseFormsProcessed();
-  checkACForm(uname, "testuser10", pword, "testpass10");
+  checkACForm("testuser10", "testpass10");
   await resetRecipes();
 });
 
 add_task(async function test_form12_formless() {
   // Test form-less autocomplete
   await setFormAndWaitForFieldFilled(`
     <!-- tests <form>-less autocomplete -->
     <div id="form12">
@@ -913,54 +920,54 @@ add_task(async function test_form12_form
   synthesizeKey("KEY_ArrowDown"); // open
   let results = await shownPromise;
 
   let expectedMenuItems = ["This connection is not secure. Logins entered here could be compromised. Learn More",
                            "testuser10"];
   checkAutoCompleteResults(results, expectedMenuItems, "mochi.test", "Check all menuitems are displayed correctly.");
   synthesizeKey("KEY_ArrowDown"); // skip insecure warning
   synthesizeKey("KEY_ArrowDown");
-  checkACForm(uname, "", pword, ""); // value shouldn't update
+  checkACForm("", ""); // value shouldn't update
   let processedPromise = promiseFormsProcessed();
   synthesizeKey("KEY_Enter");
   await processedPromise;
-  checkACForm(uname, "testuser10", pword, "testpass10");
+  checkACForm("testuser10", "testpass10");
 });
 
 add_task(async function test_form13_stays_open_upon_empty_search() {
   await setFormAndWaitForFieldFilled(`
     <!-- test not closing when the search string (.value) becomes empty -->
     <form id="form13" action="http://autocomplete:8888/formtest.js" onsubmit="return false;">
       <input  type="text"       name="uname" value="prefilled">
       <input  type="password"   name="pword" value="prefilled">
       <button type="submit">Submit</button>
     </form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "prefilled"});
 
   uname = $_(13, "uname");
   pword = $_(13, "pword");
-  checkACForm(uname, "prefilled", pword, "prefilled");
+  checkACForm("prefilled", "prefilled");
 
   uname.scrollIntoView();
   let shownPromise = promiseACShown();
   synthesizeMouseAtCenter(uname, {});
   await shownPromise;
   uname.select();
   synthesizeKey("KEY_Delete");
 
   await spinEventLoop();
   let popupState = await getPopupState();
   is(popupState.open, true, "Check popup is still open");
-  checkACForm(uname, "", pword, "prefilled");
+  checkACForm("", "prefilled");
 
   info("testing password field");
   synthesizeMouseAtCenter(pword, {});
   pword.select();
   popupState = await getPopupState();
   is(popupState.open, false, "Check popup closed since password field isn't empty");
   shownPromise = promiseACShown();
   synthesizeKey("KEY_Delete");
   await shownPromise;
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
 });
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/mochitest/test_insecure_form_field_no_saved_login.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_insecure_form_field_no_saved_login.html
@@ -48,29 +48,36 @@ let pword = $_(1, "pword");
 
 // Restore the form to the default state.
 function restoreForm() {
   uname.value = "";
   pword.value = "";
   uname.focus();
 }
 
+// Check for expected username/password in form.
+function checkACForm(expectedUsername, expectedPassword) {
+  let formID = uname.parentNode.id;
+  is(uname.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
+  is(pword.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
+}
+
 function spinEventLoop() {
   return Promise.resolve();
 }
 
 add_task(async function setup() {
   listenForUnexpectedPopupShown();
 });
 
 add_task(async function test_form1_initial_empty() {
   await SimpleTest.promiseFocus(window);
 
   // Make sure initial form is empty.
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is initially closed");
 });
 
 add_task(async function test_form1_warning_entry() {
   await SimpleTest.promiseFocus(window);
   // Trigger autocomplete popup
   restoreForm();
@@ -78,18 +85,18 @@ add_task(async function test_form1_warni
   synthesizeKey("KEY_ArrowDown"); // open
   await shownPromise;
 
   let popupState = await getPopupState();
   is(popupState.open, true, "Check popup is opened");
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
   synthesizeKey("KEY_ArrowDown"); // select insecure warning
-  checkACForm(uname, "", pword, ""); // value shouldn't update just by selecting
+  checkACForm("", ""); // value shouldn't update just by selecting
   synthesizeKey("KEY_Enter");
   await spinEventLoop(); // let focus happen
-  checkACForm(uname, "", pword, "");
+  checkACForm("", "");
 });
 
 </script>
 </pre>
 </body>
 </html>