Skip to content

Commit 1cce06a

Browse files
x0daymxschmitt
andauthored
fix: Task exception was never retrieved when continue_ race with page closed event (microsoft#1167)
closes microsoft#1165 Co-authored-by: Max Schmitt <max@schmitt.mx>
1 parent 6b64fb8 commit 1cce06a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

playwright/_impl/_network.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,13 @@ async def _race_with_page_close(self, future: Coroutine) -> None:
285285
# When page closes or crashes, we catch any potential rejects from this Route.
286286
# Note that page could be missing when routing popup's initial request that
287287
# does not have a Page initialized just yet.
288+
fut = asyncio.create_task(future)
288289
await asyncio.wait(
289-
[asyncio.create_task(future), page._closed_or_crashed_future],
290+
[fut, page._closed_or_crashed_future],
290291
return_when=asyncio.FIRST_COMPLETED,
291292
)
293+
if page._closed_or_crashed_future.done():
294+
await asyncio.gather(fut, return_exceptions=True)
292295
else:
293296
await future
294297

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy