feat: allow evaluate_script to skip the stable DOM wait#2346
Open
thomasbachem wants to merge 1 commit into
Open
feat: allow evaluate_script to skip the stable DOM wait#2346thomasbachem wants to merge 1 commit into
thomasbachem wants to merge 1 commit into
Conversation
hotrod6531-sudo
approved these changes
Jul 12, 2026
Lightning00Blade
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the PR, I left some small comments.
thomasbachem
force-pushed
the
feat/evaluate-script-wait-for-stable-dom
branch
from
July 13, 2026 15:56
68e7034 to
c9dab9d
Compare
Lightning00Blade
force-pushed
the
feat/evaluate-script-wait-for-stable-dom
branch
from
July 14, 2026 09:02
c9dab9d to
5397c2f
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2338
Adds a
waitForStableDomparameter toevaluate_script(defaulttrue). Passingfalseskips just the stable DOM wait inwaitForEventsAfterAction()– the navigation probe and dialog handling stay, so a script that unexpectedly navigates is still awaited (and the navigation reported), and analert()is still auto-handled. The page path passes the flag through, and service worker evals now always skip the stable DOM wait (workers can't interact with the DOM – thanks @Lightning00Blade).Read-only evals drop from ~205ms to ~103ms on quiet pages, and from ~3.1s to ~103ms on pages that never go quiet – numbers and repro in #2338.
This is the branch the issue promised – I see #2344 beat me to posting, so take whichever is easier to review. Differences here: complete
npm run genartifacts (tool_call_metrics.json+chrome-devtools-cli-options.ts, so check-docs passes), a skip test that spiesWaitForHelper.prototype.waitForStableDom(fails if the helper ignores the flag, not only if the option isn't passed through), and a test pinning the safety property – a script that navigates with the flag off still gets its navigation awaited and reported.