We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6b64fb8 commit 1cce06aCopy full SHA for 1cce06a
playwright/_impl/_network.py
@@ -285,10 +285,13 @@ async def _race_with_page_close(self, future: Coroutine) -> None:
285
# When page closes or crashes, we catch any potential rejects from this Route.
286
# Note that page could be missing when routing popup's initial request that
287
# does not have a Page initialized just yet.
288
+ fut = asyncio.create_task(future)
289
await asyncio.wait(
- [asyncio.create_task(future), page._closed_or_crashed_future],
290
+ [fut, page._closed_or_crashed_future],
291
return_when=asyncio.FIRST_COMPLETED,
292
)
293
+ if page._closed_or_crashed_future.done():
294
+ await asyncio.gather(fut, return_exceptions=True)
295
else:
296
await future
297
0 commit comments