Repository navigation
[WIP] Reject executeTool() failures with the draft's DOMException names - #12
Draft
Kulikowski wants to merge 1 commit into
Draft
Kulikowski wants to merge 1 commit into
Kulikowski wants to merge 1 commit into
Conversation
Kulikowski
force-pushed
the
kulikowski/execution-errors
branch
from
October 13, 2026 22:12
f7bcce6 to
cbfab42
Compare
Draft b206dae replaced UnknownError with NotFoundError, DataError, OperationError, AbortError, and InvalidStateError, and eada13b rejects a target without a navigable with InvalidStateError. Frames now carry the failure name in their error replies, and the draft pin moves to eada13b. Pinned WPT still expects, and Chromium still throws, UnknownError (crbug.com/509555636), so six subtests become expected failures and one detachment case passes.
Kulikowski
force-pushed
the
kulikowski/execution-errors
branch
from
October 13, 2026 22:53
cbfab42 to
5a3e74c
Compare
beaufortfrancois
requested changes
Oct 14, 2026
| | --- | ---: | | ||
| | PASS | 92 | | ||
| | Expected FAIL | 52 | | ||
| | PASS | 87 | |
| still tests them. | ||
| - **Draft differences:** results are JSON-serialized; some pinned tests expect raw | ||
| strings. Omitted or `undefined` input becomes `{}`; `null` and primitives reject. | ||
| - **Execution errors:** failures reject with the draft's `NotFoundError`, `DataError`, |
Collaborator
There was a problem hiding this comment.
You may want to wait until https://chromium-review.googlesource.com/c/chromium/src/+/8546218 is merged so that we can check the polyfill works as intended.
Author
There was a problem hiding this comment.
I think it is a good idea to wait for Chromium changes here
|
|
||
| `executeTool()` accepts an object and returns a JSON-serialized result. Omitted or `undefined` input defaults to a fresh empty object. Callbacks must validate their inputs; schema inference provides TypeScript checks only. | ||
|
|
||
| A failed execution rejects with the draft's `DOMException` name: `NotFoundError` when the target has no such tool exposed to the caller, `DataError` when the input does not parse to an object, `OperationError` when the callback throws, rejects, or returns an unserializable result, `AbortError` when the target document unloads during the call, and `InvalidStateError` when the target frame was already removed or is in another frame tree. The callback's own error stays in its frame. |
Collaborator
There was a problem hiding this comment.
It may be a bit much in this README. WDYT?
Comment on lines
+794
to
+801
| const executionFailures = { | ||
| NotFoundError: "The tool is not registered in the target document", | ||
| DataError: "The tool input could not be parsed", | ||
| OperationError: "The tool failed or returned an unserializable result", | ||
| AbortError: "The target document was unloaded", | ||
| InvalidStateError: "The target document is detached or in another frame tree", | ||
| NotAllowedError: "WebMCP is disabled by Permissions Policy", | ||
| } as const; |
Collaborator
There was a problem hiding this comment.
You can look at https://chromium-review.googlesource.com/c/chromium/src/+/8546218/6/third_party/blink/renderer/core/script_tools/model_context.cc for Chromium error messages
Collaborator
|
Changes have just landed: https://chromiumdash.appspot.com/commit/0b6fe2677649e16ed923849bb9ab70dd77c1a7c7 |
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.
The spec now gives each
executeTool()failure its own error name instead ofUnknownError(webmcp#339), and rejects a call to an already-removed frame withInvalidStateError(webmcp#337). This PR does the same, and TESTING.md now tracks spec versioneada13b.UnknownErrorNotFoundErrorUnknownErrorDataErrorUnknownErrorOperationErrorUnknownErrorAbortErrorUnknownErrorInvalidStateErrorTBD