Closed Bug 2082321 Opened 1 month ago Closed 1 month ago

[wpt-sync] Sync PR 63669 - WebMCP: Re-check document activity after serializing `inputSchema`

Categories

(Testing :: web-platform-tests, task, P4)

task

Tracking

(firefox160 fixed)

RESOLVED FIXED
160 Branch
Tracking Status
firefox160 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 63669 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/63669
Details from upstream follow.

Dominic Farolino <dom@chromium.org> wrote:

WebMCP: Re-check document activity after serializing inputSchema

ModelContext::registerTool() checks that its document is active up
front, but then serializes inputSchema, which can run script via a
toJSON() method. If that script makes the document inactive, e.g., by
removing its iframe, registerTool() carries on and dereferences the
document's now-null frame (and would then call into its reset
ModelContextHost remote), crashing the renderer:

iframe.contentDocument.modelContext.registerTool({
name: 'tool',
description: 'desc',
inputSchema: {toJSON() { iframe.remove(); return {}; }},
execute: () => {},
}); // Crash.

This CL checks again after serialization, and rejects with the same
InvalidStateError as the up-front check. This matches the re-check
added to the spec in
https://github.com/webmachinelearning/webmcp/pull/345.

R=khushalsagar

Bug: 573671121
Change-Id: I9afb20dfa0d23d6aa54d34b568e17461b88d39db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8582224
Reviewed-by: Khushal Sagar \<khushalsagar@chromium.org>
Commit-Queue: Dominic Farolino \<dom@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1719223}

CI Results

Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 48 tests

Status Summary

Firefox

OK : 36
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 : 103
TIMEOUT: 1
ERROR : 6

Chrome

CRASH : 1

Safari

TIMEOUT: 1

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Tests Disabled in Gecko Infrastructure

Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 160 Branch
You need to log in before you can comment on or make changes to this bug.