Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion playwright/_impl/_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,13 @@ async def _race_with_page_close(self, future: Coroutine) -> None:
# When page closes or crashes, we catch any potential rejects from this Route.
# Note that page could be missing when routing popup's initial request that
# does not have a Page initialized just yet.
fut = asyncio.create_task(future)
await asyncio.wait(
[asyncio.create_task(future), page._closed_or_crashed_future],
[fut, page._closed_or_crashed_future],
return_when=asyncio.FIRST_COMPLETED,
)
if page._closed_or_crashed_future.done():
Comment thread
mxschmitt marked this conversation as resolved.
await asyncio.gather(fut, return_exceptions=True)
Comment thread
mxschmitt marked this conversation as resolved.
else:
await future

Expand Down