Skip to content

Commit

Permalink
chore: waitForNavigation should fail if navigation aborts or fails (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jrandolf-2 authored Feb 15, 2024
1 parent 634d5b8 commit bd4d0fe
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/puppeteer-core/src/bidi/Frame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,19 @@ export class BidiFrame extends Frame {
fromEmitterEvent(this.browsingContext, 'navigation').pipe(
switchMap(({navigation}) => {
return this.#waitForLoad$(options).pipe(
raceWith(fromEmitterEvent(navigation, 'fragment')),
raceWith(
fromEmitterEvent(navigation, 'fragment'),
fromEmitterEvent(navigation, 'failed').pipe(
map(({url}) => {
throw new Error(`Navigation failed: ${url}`);
})
),
fromEmitterEvent(navigation, 'aborted').pipe(
map(({url}) => {
throw new Error(`Navigation aborted: ${url}`);
})
)
),
map(() => {
return navigation;
})
Expand Down

0 comments on commit bd4d0fe

Please sign in to comment.