This repository has been archived by the owner on Jan 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify NavigateFrame and reduce chances of race conditions
The main change here to fix the `Page.goto()` race condition (see the example in #427) is removing the `waitForEvent` call after calling the CDP `Page.navigate`. We already waited for `NavigationEvent` to determine if it's a navigation within the same document (`chSameDoc`), but that's not necessary if we get an empty `newDocumentID` back (see the `loaderId` description in [1]), so we can return early in that case. It still doesn't eliminate race conditions entirely, as there's a minor chance we could miss the lifecycle event after we get the `NavigationEvent` and timeout waiting on `lifecycleEvtCh`, but I haven't run into that case during my stress testing. I chose not to call `frame.hasSubtreeLifecycleEventFired()` as that's racy/buggy itself and results in returning early due to not clearing previous lifecycle events on time (e.g. returning because 'load' fired for 'about:blank', but not for the current navigation). We should remove this and `Frame.recalculateLifecycle()` altogether... [1]: https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-navigate
- Loading branch information
Ivan Mirić
committed
Aug 4, 2022
1 parent
cd8b500
commit 9eecdd7
Showing
1 changed file
with
48 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters