fix: apply timeout to waiting for a response (#12142)

This commit is contained in:
Alex Rudenko 2024-03-25 09:44:11 +01:00 committed by GitHub
parent 00fa75ec9e
commit ac1767da0b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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();
}