diff --git a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js index 144776cb2773..04eb22558e39 100644 --- a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js +++ b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js @@ -76,24 +76,28 @@ function recreateTree(element) { * *labels* are being shown correctly as items in the popup. */ function checkAutoCompleteResults(actualValues, expectedValues, hostname, msg) { - if (hostname !== null) { - isnot( - actualValues.length, - 0, - "There should be items in the autocomplete popup: " + - JSON.stringify(actualValues) - ); - - // Check the footer first. - let footerResult = actualValues[actualValues.length - 1]; - is(footerResult, "View Saved Logins", "the footer text is shown correctly"); - } - if (hostname === null) { checkArrayValues(actualValues, expectedValues, msg); return; } + is( + typeof hostname, + "string", + "checkAutoCompleteResults: hostname must be a string" + ); + + isnot( + actualValues.length, + 0, + "There should be items in the autocomplete popup: " + + JSON.stringify(actualValues) + ); + + // Check the footer first. + let footerResult = actualValues[actualValues.length - 1]; + is(footerResult, "View Saved Logins", "the footer text is shown correctly"); + if (actualValues.length == 1) { is( expectedValues.length, diff --git a/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_https_downgrade.html b/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_https_downgrade.html index f6b11cfdcdc6..bc9e79ff0e8d 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_https_downgrade.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_https_downgrade.html @@ -83,7 +83,7 @@ async function setup(formUrl) { await promiseFormsProcessed(); - hostname = SpecialPowers.spawn(getIframeBrowsingContext(window), [], function() { + hostname = await SpecialPowers.spawn(getIframeBrowsingContext(window), [], function() { return this.content.document.documentURIObject.host; }); } diff --git a/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_https_upgrade.html b/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_https_upgrade.html index 91d14a33412f..79999dbe2da5 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_https_upgrade.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_https_upgrade.html @@ -81,7 +81,7 @@ async function setup(formUrl = HTTPS_FORM_URL) { await promiseFormsProcessed(); - hostname = SpecialPowers.spawn(getIframeBrowsingContext(window), [], function() { + hostname = await SpecialPowers.spawn(getIframeBrowsingContext(window), [], function() { return this.content.document.documentURIObject.host; }); } diff --git a/toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html b/toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html index df661a0dff9b..856bde1411ac 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html @@ -60,7 +60,7 @@ add_task(async function setup() { await promiseFormsProcessed(); - hostname = SpecialPowers.spawn(getIframeBrowsingContext(window), [], function() { + hostname = await SpecialPowers.spawn(getIframeBrowsingContext(window), [], function() { return this.content.document.documentURIObject.host; });