Closed Bug 1852963 Opened 8 months ago Closed 8 months ago

Some tests await on BrowserTestUtils.loadURIString, that doesn't wait for load

Categories

(Firefox :: Address Bar, defect)

defect

Tracking

()

RESOLVED FIXED
119 Branch
Tracking Status
firefox119 --- fixed

People

(Reporter: mak, Assigned: mak)

References

Details

Attachments

(3 files)

This is quite confusing, BrowserTestUtils.loadURIString() doesn't wait for load, but the javadoc is unclear about that, and some tests are awaiting on it.

I initially thought to make it wait, and then consumers could optionally use the promise... through awaiting requires to add listeners that potentially may remain at the end of the test, if the test doesn't await for the promise, and that could cause other intermittents.
Different tests have different needs so just awaiting is not good for all of them.

Thus, I'm thinking to rename BrowserTestUtils.loadURIString() to BrowserTestUtils.startLoadingURIString(), that should make a bit clearer it's only starting the load, not awaiting for its completion... plus updating its javadoc.

This is actually causing intermittents, like bug 1775820.

BrowserTestUtils.loadURIString() is not async, nor returning a promise, it's
effectively not awaiting for the page to be loaded.

BrowserTestUtils.browserLoaded() wants a tabbrowser-tab as input, most of it will
also work passing gBrowser, and indeed some tests ended up doing that.
Unfortunately some parts of it are skipped in that case.
Since it's confusing anyway, let's make it more lenient on its input.

Depends on D188211

This should make a bit clearer that it is only starting the load, not waiting
for its completion.

Depends on D188212

Pushed by mak77@bonardo.net:
https://hg.mozilla.org/integration/autoland/rev/34357750f69c
Fix tests awaiting on BrowserTestUtils.loadURIString(). r=dao,webdriver-reviewers,devtools-reviewers,whimboo
https://hg.mozilla.org/integration/autoland/rev/edf1527c9a99
BrowserTestUtils.browserLoaded() should also accept gBrowser as input. r=dao
https://hg.mozilla.org/integration/autoland/rev/98de7bc404c3
Rename BrowserTestUtils.loadURIString() to .startLoadingURIString(). r=dao
Pushed by mak77@bonardo.net:
https://hg.mozilla.org/integration/autoland/rev/5f3627b190cf
Fix tests awaiting on BrowserTestUtils.loadURIString(). r=dao,webdriver-reviewers,devtools-reviewers,whimboo
https://hg.mozilla.org/integration/autoland/rev/f4052dc7a73a
BrowserTestUtils.browserLoaded() should also accept gBrowser as input. r=dao
https://hg.mozilla.org/integration/autoland/rev/6b4b7a682e7a
Rename BrowserTestUtils.loadURIString() to .startLoadingURIString(). r=dao
Flags: needinfo?(mak)
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 119 Branch
See Also: → 1853491
Pushed by smolnar@mozilla.com:
https://hg.mozilla.org/mozilla-central/rev/39d188918af5
Fix typo in browser_tab_close_last_tab.js. a=merge
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: