Skip to content

Commit 475935e

Browse files
authored
chore: add todo for waitFor* / browser.disconnected event ordering (microsoft#2520)
1 parent 8b9bcdc commit 475935e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

playwright/_impl/_browser_type.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ def handle_transport_close(reason: Optional[str]) -> None:
231231
context._on_close()
232232
browser._on_close()
233233
connection.cleanup(reason)
234+
# TODO: Backport https://github.com/microsoft/playwright/commit/d8d5289e8692c9b1265d23ee66988d1ac5122f33
235+
# Give a chance to any API call promises to reject upon page/context closure.
236+
# This happens naturally when we receive page.onClose and browser.onClose from the server
237+
# in separate tasks. However, upon pipe closure we used to dispatch them all synchronously
238+
# here and promises did not have a chance to reject.
239+
# The order of rejects vs closure is a part of the API contract and our test runner
240+
# relies on it to attribute rejections to the right test.
234241

235242
transport.once("close", handle_transport_close)
236243

0 commit comments

Comments
 (0)