Skip to content

Commit

Permalink
fix: apply timeout to waiting for a response (#12142)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Mar 25, 2024
1 parent 00fa75e commit ac1767d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/puppeteer-core/src/cdp/Frame.ts
Expand Up @@ -230,7 +230,13 @@ export class CdpFrame extends Frame {
if (error) {
throw error;
}
return await watcher.navigationResponse();
const result = await Deferred.race<
Error | HTTPResponse | null | undefined
>([watcher.terminationPromise(), watcher.navigationResponse()]);
if (result instanceof Error) {
throw error;
}
return result || null;
} finally {
watcher.dispose();
}
Expand Down

0 comments on commit ac1767d

Please sign in to comment.