Skip to content

Commit d55a7ed

Browse files
authored
chore: do not crash when a crash emit was emitted (#1249)
1 parent bfb2869 commit d55a7ed

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

playwright/_impl/_page.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,16 @@ def __init__(
210210
)
211211
self._closed_or_crashed_future: asyncio.Future = asyncio.Future()
212212
self.on(
213-
Page.Events.Close, lambda _: self._closed_or_crashed_future.set_result(True)
213+
Page.Events.Close,
214+
lambda _: self._closed_or_crashed_future.set_result(True)
215+
if not self._closed_or_crashed_future.done()
216+
else None,
214217
)
215218
self.on(
216-
Page.Events.Crash, lambda _: self._closed_or_crashed_future.set_result(True)
219+
Page.Events.Crash,
220+
lambda _: self._closed_or_crashed_future.set_result(True)
221+
if not self._closed_or_crashed_future.done()
222+
else None,
217223
)
218224

219225
def __repr__(self) -> str:

0 commit comments

Comments
 (0)