8000 Rework on webdriver wait for navigation complete by longvatrong111 · Pull Request #38234 · servo/servo · GitHub
[go: up one dir, main page]

Skip to content

Conversation

longvatrong111
Copy link
Contributor
@longvatrong111 longvatrong111 commented Jul 23, 2025

For current implementation, when a command may trigger a navigation, webdriver only waits for document readiness state.
However, not all navigations make change in document.
This PR handles more cases for waiting for a navigation, and apply to element_click.

  • Before sending a command which may trigger a navigation, webdriver sets load status send to embedder, constelltation and script thread to listen to navigation events.
  • Webdriver check if there is a navigation with script thread.
  • If the navigation is loading a new url, webdriver checks if the request is approved with constellation, then waits for document readiness state.
  • If the navigation is a hashchange, webdriver waits untill all new generated dom events have been processed.

Testing:
tests/wpt/tests/webdriver/tests/classic/element_click/navigate.py
tests/wpt/tests/webdriver/tests/classic/element_click/user_prompts.py
https://github.com/longvatrong111/servo/actions/runs/16488690749

cc: @xiaochengh

Copy link
Contributor
@xiaochengh xiaochengh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After thinking more about navigation to fragment, I'm not sure if waiting for dom events is the right approach. It feels like a hacky heuristic to me. And I'm not even sure if we should wait for those if events if the navigation triggers any.

At a lower level, in the current solution, we are adding tasks that are not dom manipulations to the dom manipulation task source. And it's hard to infer when exactly this will be complete.

Is there a more idiomatic solution where we can identify the completion of a navigation to fragment, and send the completion event from there?

@longvatrong111 longvatrong111 force-pushed the webdriver-sync branch 3 times, most recently from 0459399 to e8e595d Compare July 29, 2025 08:19
Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
@xiaochengh xiaochengh added this pull request to the merge queue Jul 30, 2025
Merged via the queue into servo:main with commit 37ac4ff Jul 30, 2025
21 checks passed
@longvatrong111 longvatrong111 deleted the webdriver-sync branch July 30, 2025 07:54
minghuaw pushed a commit to minghuaw/servo that referenced this pull request Aug 1, 2025
For current implementation, when a command may trigger a navigation,
webdriver only waits for document readiness state.
However, not all navigations make change in document.
This PR handles more cases for waiting for a navigation, and apply to
`element_click`.

- Before sending a command which may trigger a navigation, `webdriver`
sets `load status send` to `embedder`, `constelltation` and `script
thread` to listen to `navigation events`.
- Webdriver check if there is a navigation with `script thread`.
- If the navigation is loading a new url, webdriver checks if the
request is approved with `constellation`, then waits for document
readiness state.
- If the navigation is a hashchange, webdriver waits untill all new
generated dom events have been processed.

Testing: 
`tests/wpt/tests/webdriver/tests/classic/element_click/navigate.py`
`tests/wpt/tests/webdriver/tests/classic/element_click/user_prompts.py`
https://github.com/longvatrong111/servo/actions/runs/16488690749

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0