[wpt-sync] Sync PR 64012 - WebMCP: Fix ModelContextUserData lifetime for replacement navigations
Categories
(Testing :: web-platform-tests, task, P4)
Tracking
(firefox162 fixed)
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Sync web-platform-tests PR 64012 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/64012
Details from upstream follow.
Khushal Sagar <khushalsagar@chromium.org> wrote:
WebMCP: Fix ModelContextUserData lifetime for replacement navigations
The result of a javascript: URL, of an XSLT transform, or of discarding a
frame replaces the renderer's Document without a navigation that commits
in the browser. This means that DocumentUserData tied to the old
Document persist even after the Document in the renderer has changed.
This lifetime mismatch is likely an issue for all uses of
DocumentUserData, including ModelContextUserData used by WebMCP: when
the new Document used document.modelContext, its ModelContextHost bind
found the old Document's ModelContextUserData and the browser killed the
renderer with RFHI_WEBMCP_DUPLICATE_BIND.This change adds an IPC for the renderer to notify the browser when a
replacement navigation commits in the renderer. The notification is used
to reset ModelContextUserData. A separate CL should look into resetting
all DocumentUserData for these navigations (crbug.com/576419973).The new Document binds ModelContextHost through the frame's
BrowserInterfaceBroker, which isn't ordered with this IPC, so the bind
can still race it (crbug.com/576011705). The same race exists for the
first commit after the initial empty Document when its window is reused.Bug: 555173199
Change-Id: I5713c6d09cbb84d4c5fabe19c01a3430bdce093a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8595641
Commit-Queue: Khushal Sagar \<khushalsagar@chromium.org>
Reviewed-by: Dave Tapuska \<dtapuska@chromium.org>
Reviewed-by: Mark Foltz \<mfoltz@chromium.org>
Auto-Submit: Khushal Sagar \<khushalsagar@chromium.org>
Reviewed-by: Dominic Farolino \<dom@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1724372}
| Assignee | ||
Comment 1•1 month ago
|
||
Pushed to try (stability) https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=111038
| Assignee | ||
Comment 2•27 days ago
|
||
CI Results
Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI
Total 50 tests and 4 subtests
Status Summary
Firefox
OK : 1[GitHub] 37[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS : 2[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 4[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
FAIL : 1[GitHub] 101[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
TIMEOUT: 2
ERROR : 6
Chrome
CRASH : 1
Safari
OK : 1
FAIL : 1
Links
Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base
Details
New Tests That Don't Pass
- /webmcp/imperative/abort-signal-after-iframe-removal-crash.https.html [wpt.fyi]:
TIMEOUT - /webmcp/imperative/register-tool-input-schema-removes-iframe-crash.https.html [wpt.fyi]:
TIMEOUT - /webmcp/imperative/exposedTo-cross-origin-child.https.html [wpt.fyi]:
SKIP - /webmcp/imperative/exposedTo-multiple-children.https.html [wpt.fyi]:
SKIP - /webmcp/imperative/permissions-policy.https.html [wpt.fyi]:
SKIP - /webmcp/imperative/detached-frame-executeTool.https.html [wpt.fyi]:
ERROR- executeTool() throws
InvalidStateErrorin detached frame:FAIL
- executeTool() throws
- /webmcp/imperative/detached-frame-getTools.https.html [wpt.fyi]
- getTools() throws
InvalidStateErrorin detached frame:FAIL
- getTools() throws
- /webmcp/imperative/detached-frame-modelContext.https.html [wpt.fyi]
- document.modelContext in detached frame:
FAIL
- document.modelContext in detached frame:
- /webmcp/imperative/detached-frame-registerTool.https.html [wpt.fyi]
- registerTool() rejects
InvalidStateErrorin detached frame:FAIL
- registerTool() rejects
- /webmcp/imperative/duplicate_tool_registration.https.html [wpt.fyi]
- duplicate tool registration is invalid.:
FAIL
- duplicate tool registration is invalid.:
- /webmcp/imperative/executeTool-abort.https.html [wpt.fyi]:
ERROR- executeTool() provides a non-aborted default AbortSignal when called without options:
FAIL - caller abort propagates to tool callback options.signal:
FAIL - executeTool() with already-aborted tool synchronously rejects:
FAIL - executeTool() promise remains rejected even if tool callback resolves after abort:
FAIL - concurrent executions of the same tool have independent AbortSignals:
FAIL - tool synchronously self-cancelling via caller AbortSignal aborts options.signal and fires toolcancel:
FAIL - tool asynchronously self-cancelling via caller AbortSignal aborts options.signal and fires toolcancel:
FAIL
- executeTool() provides a non-aborted default AbortSignal when called without options:
- /webmcp/imperative/executeTool-across-trees.https.html [wpt.fyi]
- executeTool() rejects when the tool is hosted in another frame tree:
FAIL
- executeTool() rejects when the tool is hosted in another frame tree:
- /webmcp/imperative/executeTool-caller-navigate-abort.https.html [wpt.fyi]:
ERROR- executeTool() aborts target signal and fires toolcancel when the invoker document (same-origin) navigates away:
FAIL - executeTool() aborts target signal and fires toolcancel when the invoker frame (same-origin) is detached from the DOM:
FAIL - executeTool() aborts target signal and fires toolcancel when the invoker document (cross-origin) navigates away:
FAIL - executeTool() aborts target signal and fires toolcancel when the invoker frame (cross-origin) is detached from the DOM:
FAIL
- executeTool() aborts target signal and fires toolcancel when the invoker document (same-origin) navigates away:
- /webmcp/imperative/executeTool-detach-toolactivated.https.html [wpt.fyi]
- toolactivated is not dispatched when a tool execute callback from another realm detaches the tool document:
FAIL - toolactivated is not dispatched when a tool execute callback detaches its own document:
FAIL
- toolactivated is not dispatched when a tool execute callback from another realm detaches the tool document:
- /webmcp/imperative/executeTool-detach-toolcancel.https.html [wpt.fyi]
- toolcancel is not dispatched when a tool abort handler from another realm detaches the tool document:
FAIL - toolcancel is not dispatched when a tool abort handler detaches its own document:
FAIL
- toolcancel is not dispatched when a tool abort handler from another realm detaches the tool document:
- /webmcp/imperative/executeTool-error-window-onerror.https.html [wpt.fyi]
- Failed tool execution does not trigger window.onerror:
FAIL - Tool execution returning circular object rejects and does not trigger window.onerror:
FAIL
- Failed tool execution does not trigger window.onerror:
- /webmcp/imperative/executeTool-events.https.html [wpt.fyi]
- toolactivated and toolcancel events are dispatched on document.modelContext during tool execution and cancellation:
FAIL - toolactivated is dispatched at the ModelContext of the tool target document:
FAIL - toolcancel is dispatched at the ModelContext of the tool target document:
FAIL
- toolactivated and toolcancel events are dispatched on document.modelContext during tool execution and cancellation:
- /webmcp/imperative/executeTool-invalid-dictionary.https.html [wpt.fyi]
- executeTool() rejects with TypeError when passed an object that is not a Tool:
FAIL - executeTool() rejects with TypeError for invalid JSON arguments:
FAIL
- executeTool() rejects with TypeError when passed an object that is not a Tool:
- /webmcp/imperative/executeTool-reentrant-cancellation.https.html [wpt.fyi]:
ERROR- caller signal abort cascades through re-entrant executeTool() when outer tool forwards options.signal:
FAIL - inner tool self-cancelling the outer caller AbortController aborts both nested executions and fires toolcancel:
FAIL - detaching inner target frame during re-entrant executeTool() rejects inner and outer tool executions:
FAIL
- caller signal abort cascades through re-entrant executeTool() when outer tool forwards options.signal:
- /webmcp/imperative/executeTool-signal-cross-origin.https.html [wpt.fyi]:
ERROR- caller abort in parent document propagates to options.signal in cross-origin iframe tool:
FAIL - caller abort in cross-origin iframe propagates to options.signal in parent document tool:
FAIL - other frame aborting an AbortController passed to executeTool() cancels target execution and fires toolcancel:
FAIL
- caller abort in parent document propagates to options.signal in cross-origin iframe tool:
- /webmcp/imperative/executeTool-target-detachment.https.html [wpt.fyi]:
ERROR- executeTool() rejects when target frame is detached before execution:
FAIL - executeTool() rejects when target frame is detached mid-execution:
FAIL - executeTool() rejects cleanly when tool callback synchronously detaches its own frame:
FAIL - executeTool() abort cleanly handles synchronous frame detachment inside options.signal abort listener:
FAIL
- executeTool() rejects when target frame is detached before execution:
- /webmcp/imperative/executeTool-target-navigation.https.html [wpt.fyi]
- executeTool() rejects when target document navigates away:
FAIL
- executeTool() rejects when target document navigates away:
- /webmcp/imperative/executeTool-unregister-resolution-race.https.html [wpt.fyi]
- executeTool resolves successfully even when tool is unregistered synchronously after its promise resolves:
FAIL
- executeTool resolves successfully even when tool is unregistered synchronously after its promise resolves:
- /webmcp/imperative/exposedTo-defaults-cross-origin.https.html [wpt.fyi]
- Parent tool with no exposedTo array is not visible to cross-origin iframe:
FAIL - Parent tool with empty exposedTo array is not visible to cross-origin iframe:
FAIL - Cross-origin iframe tool with default exposure is not visible to parent:
FAIL - Cross-origin iframe tool with empty exposedTo array is not visible to parent:
FAIL
- Parent tool with no exposedTo array is not visible to cross-origin iframe:
- /webmcp/imperative/exposedTo-defaults-same-origin.https.html [wpt.fyi]
- Parent tool with missing
exposedToarray is visible to same-origin iframe:FAIL - Parent tool with empty
exposedToarray is visible to same-origin iframe:FAIL - Same-origin iframe tool with default exposure is visible to parent:
FAIL - Same-origin iframe tool with empty exposedTo array is visible to parent:
FAIL
- Parent tool with missing
- /webmcp/imperative/exposedTo-invalid-origins.https.html [wpt.fyi]
- registerTool() throws SecurityError for invalid or non-potentially-trustworthy origins like / in exposedTo:
FAIL - registerTool() throws SecurityError for invalid or non-potentially-trustworthy origins like * in exposedTo:
FAIL - registerTool() throws SecurityError for invalid or non-potentially-trustworthy origins like https://example:bogus in exposedTo:
FAIL - registerTool() throws SecurityError for invalid or non-potentially-trustworthy origins like https://U+d800.com in exposedTo:
FAIL - registerTool() throws SecurityError for invalid or non-potentially-trustworthy origins like http://example.com in exposedTo:
FAIL - registerTool() throws SecurityError for invalid or non-potentially-trustworthy origins like ftp://example.com in exposedTo:
FAIL - registerTool() throws SecurityError for invalid or non-potentially-trustworthy origins like about:blank in exposedTo:
FAIL - registerTool() throws SecurityError for invalid or non-potentially-trustworthy origins like about:srcdoc in exposedTo:
FAIL - registerTool() throws SecurityError for invalid or non-potentially-trustworthy origins like https://example.com in exposedTo:
FAIL - registerTool() throws SecurityError for invalid or non-potentially-trustworthy origins like http://localhost:3000 in exposedTo:
FAIL - registerTool() with abort signal reason because signal is processed before
exposedTo:FAIL - Aborting a signal from a rejected registration must not unregister a later valid tool with the same name:
FAIL
- registerTool() throws SecurityError for invalid or non-potentially-trustworthy origins like / in exposedTo:
- /webmcp/imperative/exposedTo-window-open.https.html [wpt.fyi]
- Tools are scoped to a frame tree, and are not exposed across opener boundaries.:
FAIL
- Tools are scoped to a frame tree, and are not exposed across opener boundaries.:
- /webmcp/imperative/getTools-filtering.https.html [wpt.fyi]
- getTools() correctly filters returned tools by fromOrigins origins while preserving same-origin tools:
FAIL - getTools() rejects with SecurityError if an insecure origin is supplied in fromOrigins:
FAIL
- getTools() correctly filters returned tools by fromOrigins origins while preserving same-origin tools:
- /webmcp/imperative/getTools-imperative-annotations.https.html [wpt.fyi]
- Test that getTools() returns explicit annotations for an imperative tool:
FAIL - Test that getTools() populates default values for omitted annotation properties:
FAIL - Test that getTools() returns default values when annotations object is empty:
FAIL - Test that getTools() returns null annotations when omitted at registration:
FAIL
- Test that getTools() returns explicit annotations for an imperative tool:
- /webmcp/imperative/getTools-imperative-schema.https.html [wpt.fyi]
- Test that getTools() returns the correct inputSchema for an imperative tool:
FAIL
- Test that getTools() returns the correct inputSchema for an imperative tool:
- /webmcp/imperative/getTools.https.html [wpt.fyi]
- getTools should return all tools sorted in lexicographical order:
FAIL
- getTools should return all tools sorted in lexicographical order:
- /webmcp/imperative/initial-about-blank-shared-tool.https.html [wpt.fyi]
- tools registered with the initial about:blank Document do not survive navigation:
FAIL
- tools registered with the initial about:blank Document do not survive navigation:
- /webmcp/imperative/javascript-url-document-replacement.https.html [wpt.fyi]
- A document that replaces another via a javascript: URL can register tools:
FAIL(Safari:FAIL)
- A document that replaces another via a javascript: URL can register tools:
- /webmcp/imperative/model_context.https.html [wpt.fyi]
- document.modelContext instanceof ModelContext:
FAIL - createHTMLDocument().modelContext rejects tool operations with InvalidStateError, with active document first:
FAIL - createHTMLDocument().modelContext rejects tool operations with InvalidStateError, with inactive document first:
FAIL
- document.modelContext instanceof ModelContext:
- /webmcp/imperative/object-arguments.https.html [wpt.fyi]
- tool execution requires a JSON Object input argument; and Arrays are Objects:
FAIL
- tool execution requires a JSON Object input argument; and Arrays are Objects:
- /webmcp/imperative/opaque-origin-tools.https.html [wpt.fyi]
- An opaque origin document can register but not execute its own tools:
FAIL - executeTool() rejects synchronously for origin "null" that fails to parse as a URL:
FAIL
- An opaque origin document can register but not execute its own tools:
- /webmcp/imperative/register-tool-title.https.html [wpt.fyi]
- Tool title is preserved when provided:
FAIL - Missing tool title in registration is exposed as empty string:
FAIL - Tool title with unpaired surrogate is fixed up by USVString:
FAIL
- Tool title is preserved when provided:
- /webmcp/imperative/register_tool_invalid_json_schema.https.html [wpt.fyi]
- registerTool rejects when inputSchema.toJSON() returns undefined:
FAIL - registerTool rejects when inputSchema contains a circular reference:
FAIL - registerTool rejects when inputSchema contains non-serializable types (BigInt):
FAIL - registerTool rejects on invalid schema even if an aborted signal was provided:
FAIL
- registerTool rejects when inputSchema.toJSON() returns undefined:
- /webmcp/imperative/register_tool_name_validation.https.html [wpt.fyi]
- Valid tool names are accepted.:
FAIL - Invalid tool names throw InvalidStateError.:
FAIL
- Valid tool names are accepted.:
- /webmcp/imperative/register_tool_no_schema.https.html [wpt.fyi]
- register tool with only required params:
FAIL
- register tool with only required params:
- /webmcp/imperative/register_tool_signal.https.html [wpt.fyi]
- register tool promise rejects with AbortError when signal gets aborted:
FAIL - register tool promise rejects with error when signal gets aborted:
FAIL - register tool promise rejects when signal is already aborted:
FAIL - aborting signal unregister tool:
FAIL
- register tool promise rejects with AbortError when signal gets aborted:
- /webmcp/imperative/register_tool_toolchange.https.html [wpt.fyi]
- registerTool triggers toolchange before promise resolves:
FAIL
- registerTool triggers toolchange before promise resolves:
- /webmcp/imperative/register_tool_with_empty_annotation.https.html [wpt.fyi]
- register tool with empty annotations:
FAIL
- register tool with empty annotations:
- /webmcp/imperative/register_tool_with_schema.https.html [wpt.fyi]
- register and unregister script tool:
FAIL - registerTool succeeds when inputSchema.toJSON() returns 'undefined':
FAIL
- register and unregister script tool:
- /webmcp/imperative/same-origin-iframe-registerTool-regression.https.html [wpt.fyi]
- registerTool() does not reject in connected same-origin iframe navigated away of about:blank:
FAIL
- registerTool() does not reject in connected same-origin iframe navigated away of about:blank:
- /webmcp/imperative/tool-re-registration-race.https.html [wpt.fyi]
- executeTool() rejects for a Tool that was unregistered and whose name was subsequently reused by a different tool:
FAIL
- executeTool() rejects for a Tool that was unregistered and whose name was subsequently reused by a different tool:
- /webmcp/imperative/unregister-during-executeTool.https.html [wpt.fyi]
- Pending executeTool() Promise resolves successfully when the target cross-origin tool is unregistered mid-execution:
FAIL - Pending executeTool() Promise resolves successfully when target same-document tool is unregistered mid-execution:
FAIL - executeTool() cancellation propagates to options.signal even when tool synchronously unregistered itself inside execute():
FAIL - unregistering both outer and inner imperative tools during re-entrant executeTool() allows in-flight executions to settle:
FAIL
- Pending executeTool() Promise resolves successfully when the target cross-origin tool is unregistered mid-execution:
Tests Disabled in Gecko Infrastructure
Comment 4•24 days ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/fe3345015842
https://hg.mozilla.org/mozilla-central/rev/51ee08f8a3a2
Description
•