Bug 1607984 - P6. Fix test. r=MattN

Following the changes to DocumentChannel the test was failing.
With DC, a load may take a few event loops to start. This current test was only waiting for the load to start to the URL about:preferences#privacy-logins and would immediately tear down the window.
However, this URL redirects to about:preferences#privacy ; destroying the window midway could cause XML parsing error.

So now we wait for the page to fully load, and make sure we've been through both addresses.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2020-04-15 08:57:28 +00:00
Родитель 69ca0e9e57
Коммит fbbf9522c0
1 изменённых файлов: 20 добавлений и 1 удалений

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

@ -12,9 +12,28 @@ add_task(async function setup() {
});
add_task(async function test_open_preferences() {
// We want to make sure we visit about:preferences#privacy-logins , as that is
// what causes us to scroll to and highlight the "logins" section. However,
// about:preferences will redirect the URL, so the eventual load event will happen
// on about:preferences#privacy . The `wantLoad` parameter we pass to
// `waitForNewTab` needs to take this into account:
let seenFirstURL = false;
let promiseNewTab = BrowserTestUtils.waitForNewTab(
gBrowser,
"about:preferences#privacy-logins"
url => {
if (url == "about:preferences#privacy-logins") {
seenFirstURL = true;
return true;
} else if (url == "about:preferences#privacy") {
ok(
seenFirstURL,
"Must have seen an onLocationChange notification for the privacy-logins hash"
);
return true;
}
return false;
},
true
);
let browser = gBrowser.selectedBrowser;