diff --git a/packages/puppeteer-core/src/common/bidi/Frame.ts b/packages/puppeteer-core/src/common/bidi/Frame.ts index d687d904..85d8b1cf 100644 --- a/packages/puppeteer-core/src/common/bidi/Frame.ts +++ b/packages/puppeteer-core/src/common/bidi/Frame.ts @@ -226,19 +226,19 @@ export class Frame extends BaseFrame { getWaitUntilSingle(waitUntil) ) as string; - const [info] = await Promise.all([ + const [info] = await Deferred.race([ // TODO(lightning00blade): Should also keep tack of // navigationAborted and navigationFailed - waitForEvent( - this.#context, - waitUntilEvent, - () => { - return true; - }, - timeout, - this.#abortDeferred.valueOrThrow() - ), - Deferred.race([ + Promise.all([ + waitForEvent( + this.#context, + waitUntilEvent, + () => { + return true; + }, + timeout, + this.#abortDeferred.valueOrThrow() + ), waitForEvent( this.#context, Bidi.ChromiumBidi.BrowsingContext.EventNames.NavigationStarted, @@ -248,16 +248,18 @@ export class Frame extends BaseFrame { timeout, this.#abortDeferred.valueOrThrow() ), - waitForEvent( - this.#context, - Bidi.ChromiumBidi.BrowsingContext.EventNames.FragmentNavigated, - () => { - return true; - }, - timeout, - this.#abortDeferred.valueOrThrow() - ), ]), + waitForEvent( + this.#context, + Bidi.ChromiumBidi.BrowsingContext.EventNames.FragmentNavigated, + () => { + return true; + }, + timeout, + this.#abortDeferred.valueOrThrow() + ).then(info => { + return [info, undefined]; + }), ]); return this.#page.getNavigationResponse(info.navigation); diff --git a/test/TestExpectations.json b/test/TestExpectations.json index 40e04e8f..87a73c02 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -1055,30 +1055,6 @@ "parameters": ["chrome", "webDriverBiDi"], "expectations": ["PASS"] }, - { - "testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with clicking on anchor links", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["TIMEOUT"] - }, - { - "testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with DOM history.back()/history.forward()", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["FAIL", "TIMEOUT"] - }, - { - "testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with history.pushState()", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["TIMEOUT"] - }, - { - "testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with history.replaceState()", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["TIMEOUT"] - }, { "testIdPattern": "[network.spec] network Network Events Page.Events.RequestFinished", "platforms": ["darwin", "linux", "win32"], @@ -1895,18 +1871,18 @@ "parameters": ["cdp", "firefox"], "expectations": ["FAIL"] }, - { - "testIdPattern": "[elementhandle.spec] ElementHandle specs ElementHandle.boundingBox should force a layout", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["FAIL"] - }, { "testIdPattern": "[dialog.spec] Page.Events.Dialog should allow accepting prompts", "platforms": ["darwin", "linux", "win32"], "parameters": ["chrome", "webDriverBiDi"], "expectations": ["FAIL"] }, + { + "testIdPattern": "[elementhandle.spec] ElementHandle specs ElementHandle.boundingBox should force a layout", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"] + }, { "testIdPattern": "[elementhandle.spec] ElementHandle specs ElementHandle.boundingBox should handle nested frames", "platforms": ["darwin", "linux", "win32"], @@ -2813,24 +2789,48 @@ "parameters": ["firefox", "webDriverBiDi"], "expectations": ["TIMEOUT"] }, + { + "testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with clicking on anchor links", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"] + }, { "testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with DOM history.back()/history.forward()", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], "expectations": ["FAIL"] }, + { + "testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with DOM history.back()/history.forward()", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"] + }, { "testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with history.pushState()", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], "expectations": ["SKIP"] }, + { + "testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with history.pushState()", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"] + }, { "testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with history.replaceState()", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], "expectations": ["SKIP"] }, + { + "testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with history.replaceState()", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"] + }, { "testIdPattern": "[network.spec] network \"after all\" hook in \"network\"", "platforms": ["darwin", "linux", "win32"], @@ -3191,6 +3191,12 @@ "parameters": ["cdp", "firefox"], "expectations": ["SKIP"] }, + { + "testIdPattern": "[page.spec] Page Page.close should run beforeunload if asked for", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome", "webDriverBiDi"], + "expectations": ["PASS"] + }, { "testIdPattern": "[page.spec] Page Page.close should terminate network waiters", "platforms": ["darwin", "linux", "win32"], @@ -3952,11 +3958,5 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "chrome", "headless"], "expectations": ["FAIL", "PASS"] - }, - { - "testIdPattern": "[page.spec] Page Page.close should run beforeunload if asked for", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["chrome", "webDriverBiDi"], - "expectations": ["PASS"] } ]