mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(chromium): fix a race when intialization does not finish before page close (#6975)
This is exposed by the flaky "should report new window downloads" test. In this test a new page is created, initialized and closed before initialization finishes. If `lifecycleEventsEnabled` fails with "Target closed error", we correctly ignore the initialization failure, but a single usage of the failed promise with `.then` fails anyway.
This commit is contained in:
parent
52e75cf13e
commit
6eeafc171b
@ -482,7 +482,7 @@ class FrameSession {
|
||||
// Ignore lifecycle events for the initial empty page. It is never the final page
|
||||
// hence we are going to get more lifecycle updates after the actual navigation has
|
||||
// started (even if the target url is about:blank).
|
||||
lifecycleEventsEnabled.then(() => {
|
||||
lifecycleEventsEnabled.catch(e => {}).then(() => {
|
||||
this._eventListeners.push(helper.addEventListener(this._client, 'Page.lifecycleEvent', event => this._onLifecycleEvent(event)));
|
||||
});
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user