Bug 1605807 followup. Fix more polling flakiness in this test. r=test-only

I tested this by using delay(1) instead of delay(100), which reliably gives me
the "Is on an error page initially" failure without these changes and reliably
passs with them.

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

--HG--
extra : histedit_source : e1c31b6183b569d7474af0de09292cc51635af5d
This commit is contained in:
Boris Zbarsky 2020-01-18 06:35:29 +02:00
parent 6cb1f49f29
commit 69f068dde7

View File

@ -31,10 +31,21 @@ async function assignToken(tokenToAssign) {
async function pollForPage(win) {
while (true) {
try {
var pageToken = await SpecialPowers.spawn(w, [],
() => this.content.token);
// When we do our navigation, there may be an interstitial about:blank
// page if the navigation involves a process switch. That about:blank
// will exist between the new process's docshell being created and the
// actual page that's being loaded loading (which can happen async from
// the docshell creation). We want to avoid treating the initial
// about:blank as a new page.
//
// We could conceivably expose Document::IsInitialDocument() as a
// ChromeOnly thing and use it here, but let's just filter out all
// about:blank, since we don't expect any in this test.
var haveNewPage = await SpecialPowers.spawn(w, [token],
currentToken => this.content.token != currentToken &&
this.content.location.href != "about:blank");
if (pageToken != token) {
if (haveNewPage) {
++token;
assignToken(token);
break;