feat: support AbortSignal on server-side methods#41141
Open
Skn0tt wants to merge 2 commits into
Open
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Skn0tt
commented
Jun 5, 2026
dgozman
reviewed
Jun 5, 2026
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
dgozman
reviewed
Jun 16, 2026
|
|
||
| async scrollIntoViewIfNeeded(options: channels.ElementHandleScrollIntoViewIfNeededOptions & TimeoutOptions = {}) { | ||
| await this._elementChannel.scrollIntoViewIfNeeded({ ...options, timeout: this._frame._timeout(options) }); | ||
| await this._elementChannel.scrollIntoViewIfNeeded({ ...options, timeout: this._frame._timeout(options), signal: options.signal }); |
Collaborator
There was a problem hiding this comment.
In theory, can we replace timeouts with client-side signals that abort on timeout? Worth an experiment?
Member
Author
There was a problem hiding this comment.
I think we could, yes! I'll try it out.
a782655 to
c7b916c
Compare
Threads an AbortSignal through the client as a required second argument on channel methods (mirroring progress on the dispatcher side), so server-side calls can be cancelled.
c7b916c to
07a7b5c
Compare
Member
Author
|
Rebased onto #41321. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Aborting a channel call now rejects with an AbortError (mirroring Node.js abort-aware operations), preserving the original abort reason as cause instead of rethrowing the raw reason. This guarantees Playwright never throws a non-Error value when aborted with a string reason, in both the in-flight and already-aborted cases.
fe1c16f to
1b21b1d
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Contributor
Test results for "MCP"7354 passed, 1122 skipped Merge workflow run. |
Contributor
Test results for "tests 1"4 flaky39622 passed, 744 skipped Merge workflow run. |
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.
Summary
signal?: AbortSignaloption next to every existingtimeoutoption on action, getter and navigation methods.__cancel__wire message that aborts the dispatcher'sProgressController; a pre-aborted signal throwssignal.reasonsynchronously.progressworks on the dispatcher side. That way the compiler enforces we forward it everywhere, rather than letting it hide in a params field.AbortSignalsupport to client-side Waiter methods #41136 (Waiter-basedwaitFor*methods), which is excluded here as it already has signal support.Not included (follow-ups)
expectassertions (toBeVisible, etc.) — deferred to a separate PR.ElementHandle.inputValue— intentionally left out. UnlikeLocator/Page/Frame.inputValue(which route through theFrame.inputValueprotocol method that carriestimeout), theElementHandle.inputValueprotocol method (packages/protocol/spec/handles.yml) declares no parameters, so thetimeoutoption the public types have long advertised there is silently dropped by the wire validator. Addingsignalwould require a signature change and inherit that broken-timeout behavior. Fixing it is a separate change: addtimeout/signalto theinputValueentry inhandles.yml.Refs #40578