Closed Bug 1658696 Opened 4 years ago Closed 4 years ago

ensureWindow for reftests has to wait until page of added browser element has been loaded

Categories

(Remote Protocol :: Marionette, defect, P1)

Default
defect

Tracking

(firefox82 fixed)

RESOLVED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

Details

(Whiteboard: [marionette-fission-mvp])

Attachments

(2 files)

Right now the setupWindow method in reftest.js adds a new browser element but doesn't wait for the containing page to be loaded, and returns immediately:

https://searchfox.org/mozilla-central/rev/8df04ff073d0fa70f692935c5dcddc0e23cb0117/testing/marionette/reftest.js#178-210

That means there is a chance of overlapping navigation requests causing trouble with the page load events for the initial page load in loadTestUrl().

Blocks: 1589102

Actually another problem is that we do not correctly initialize this.lastURL. By default it is null, whereby we always have a default page. For desktop it is about:blank, and for GeckoView based browsers we currently have about:newtab and as such to trigger a navigation to about:blank until bug 1533058 is fixed. Nevertheless initializing this.lastURL to the browser's current URL would make sense.

Note that initializing lastURL based on the current URL doesn't work because this.driver.curBrowser.contentBrowser returns null for it but only on mobile. So in case of mobile I will just hard-code about:blank given that we have to load it anyway right before.

Here an initial try build:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=37d26c811bae2522aeb29613782a0fb3ef4a0639

Actually the necessary changes have to happen in ensureWindow().

Summary: setupWindow for reftests has to wait until page of added browser element has been loaded → ensureWindow for reftests has to wait until page of added browser element has been loaded
Blocks: 1612831

When the first test URL is "about:blank" the reftest window
needs to refresh its location and not trigger a new navigation.
Only by doing that proper page load events will occur.

By correctly initializing the lastURL property, "loadTestURL"
will be able to determine the right command to execute, and not
always trigger a navigation.

Without waiting for the initial navigation to "about:blank" to
complete, there is a risk for a race condition given that the
navigation to the test URL happens immediately.

Depends on D86966

Depends on: 1658928

Anny, can you please check if those patches make it work for you? Thanks

Flags: needinfo?(agakhokidze)

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+2] from comment #2)

Here an initial try build:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=37d26c811bae2522aeb29613782a0fb3ef4a0639

Win7 debug reftests have again some flaky test results. I will have to check if those are similar to the font ones we experienced on bug 1651297.

These patches work for me (tests on linux64 & android pass).

Flags: needinfo?(agakhokidze)

With the dependency fixed now, I've updated the patches and pushed a new try build:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=c26b2a8676b46025fbcee7068b27f73e9014f3a9

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+2] from comment #9)

With the dependency fixed now, I've updated the patches and pushed a new try build:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=c26b2a8676b46025fbcee7068b27f73e9014f3a9

We seem to have more broken font tests on Windows 7 (similar to bug 1650866).

I just triggered another try build for those failing tests with the Marionette log level set to trace:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=142dc412cc1ca70efb77e62c50ad5db941f3b3cc

For the last try build the number of failures are actually low. So I don't think marking intermittently failing tests as known to be failing makes sense on this bug.

Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2125e2962dcb
[marionette] Properly initialize lastURL for reftests. r=marionette-reviewers,jgraham,maja_zf
https://hg.mozilla.org/integration/autoland/rev/c8a6c4e4fb9f
[marionette] Wait for initial navigation to "about:blank" to complete on Android. r=marionette-reviewers,jgraham,maja_zf

The fault here is in the first patch. We cannot access this.driver.currentURL before the switch to the newly opened reftest window has happened. Moving this line behind the following line will fix it:

await this.driver.setWindowHandle(found, true);

Flags: needinfo?(hskupin)
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fdf1d97d31b5
[marionette] Properly initialize lastURL for reftests. r=marionette-reviewers,jgraham,maja_zf
https://hg.mozilla.org/integration/autoland/rev/171372ddeac4
[marionette] Wait for initial navigation to "about:blank" to complete on Android. r=marionette-reviewers,jgraham,maja_zf
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
See Also: → 1661332
Whiteboard: [marionette-fission-mvp]
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: