File tree Expand file tree Collapse file tree 2 files changed +13
-16
lines changed
testing/mochitest/BrowserTestUtils Expand file tree Collapse file tree 2 files changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -16,27 +16,20 @@ add_task(async function test_alt_fixup_middle_click() {
16
16
link . textContent = "Me, me, click me!" ;
17
17
content . document . body . append ( link ) ;
18
18
} ) ;
19
- let newTabPromise = BrowserTestUtils . waitForNewTab ( gBrowser ) ;
19
+ let newTabPromise = BrowserTestUtils . waitForNewTab (
20
+ gBrowser ,
21
+ /* wantLoad = */ null ,
22
+ /* waitForLoad = */ true ,
23
+ /* waitForAnyTab = */ false ,
24
+ /* maybeErrorPage = */ true
25
+ ) ;
20
26
await BrowserTestUtils . synthesizeMouseAtCenter (
21
27
"a[href]" ,
22
28
{ button : 1 } ,
23
29
browser
24
30
) ;
25
31
let tab = await newTabPromise ;
26
32
let { browsingContext } = tab . linkedBrowser ;
27
- // Account for the possibility of a race, where the error page has already loaded:
28
- if (
29
- ! browsingContext . currentWindowGlobal ?. documentURI . spec . startsWith (
30
- "about:neterror"
31
- )
32
- ) {
33
- await BrowserTestUtils . browserLoaded (
34
- tab . linkedBrowser ,
35
- false ,
36
- null ,
37
- true
38
- ) ;
39
- }
40
33
// TBH, if the test fails, we probably force-crash because we try to reach
41
34
// *www.* example.com, which isn't proxied by the test infrastructure so
42
35
// will forcibly abort the test. But we need some asserts so they might as
Original file line number Diff line number Diff line change @@ -738,6 +738,8 @@ export var BrowserTestUtils = {
738
738
* @param {boolean } [waitForAnyTab = false]
739
739
* True to wait for the url to be loaded in any new tab, not just the next
740
740
* one opened.
741
+ * @param {boolean } [maybeErrorPage = false]
742
+ * See ``browserLoaded`` function.
741
743
*
742
744
* @return {Promise }
743
745
* @resolves With the {xul:tab} when a tab is opened and its location changes
@@ -750,7 +752,8 @@ export var BrowserTestUtils = {
750
752
tabbrowser ,
751
753
wantLoad = null ,
752
754
waitForLoad = false ,
753
- waitForAnyTab = false
755
+ waitForAnyTab = false ,
756
+ maybeErrorPage = false
754
757
) {
755
758
let urlMatches ;
756
759
if ( wantLoad && typeof wantLoad == "function" ) {
@@ -779,7 +782,8 @@ export var BrowserTestUtils = {
779
782
result = BrowserTestUtils . browserLoaded (
780
783
newBrowser ,
781
784
false ,
782
- urlMatches
785
+ urlMatches ,
786
+ maybeErrorPage
783
787
) . then ( ( ) => newTab ) ;
784
788
} else {
785
789
// If not waiting for load, just resolve with the new tab.
You can’t perform that action at this time.
0 commit comments