Bug 1619498 - Add missing await in passwordmgr mochitests. r=sfoster

Also simplify checkAutoCompleteResults.

Depends on D66887

Differential Revision: https://phabricator.services.mozilla.com/D67087

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matthew Noorenberghe 2020-03-17 22:54:50 +00:00
Родитель 4042a500db
Коммит e03985c57d
4 изменённых файлов: 20 добавлений и 16 удалений

Просмотреть файл

@ -76,24 +76,28 @@ function recreateTree(element) {
* *labels* are being shown correctly as items in the popup. * *labels* are being shown correctly as items in the popup.
*/ */
function checkAutoCompleteResults(actualValues, expectedValues, hostname, msg) { 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) { if (hostname === null) {
checkArrayValues(actualValues, expectedValues, msg); checkArrayValues(actualValues, expectedValues, msg);
return; 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) { if (actualValues.length == 1) {
is( is(
expectedValues.length, expectedValues.length,

Просмотреть файл

@ -83,7 +83,7 @@ async function setup(formUrl) {
await promiseFormsProcessed(); await promiseFormsProcessed();
hostname = SpecialPowers.spawn(getIframeBrowsingContext(window), [], function() { hostname = await SpecialPowers.spawn(getIframeBrowsingContext(window), [], function() {
return this.content.document.documentURIObject.host; return this.content.document.documentURIObject.host;
}); });
} }

Просмотреть файл

@ -81,7 +81,7 @@ async function setup(formUrl = HTTPS_FORM_URL) {
await promiseFormsProcessed(); await promiseFormsProcessed();
hostname = SpecialPowers.spawn(getIframeBrowsingContext(window), [], function() { hostname = await SpecialPowers.spawn(getIframeBrowsingContext(window), [], function() {
return this.content.document.documentURIObject.host; return this.content.document.documentURIObject.host;
}); });
} }

Просмотреть файл

@ -60,7 +60,7 @@ add_task(async function setup() {
await promiseFormsProcessed(); await promiseFormsProcessed();
hostname = SpecialPowers.spawn(getIframeBrowsingContext(window), [], function() { hostname = await SpecialPowers.spawn(getIframeBrowsingContext(window), [], function() {
return this.content.document.documentURIObject.host; return this.content.document.documentURIObject.host;
}); });