Closed Bug 2085502 Opened 1 month ago Closed 24 days ago

[wpt-sync] Sync PR 64012 - WebMCP: Fix ModelContextUserData lifetime for replacement navigations

Categories

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

task

Tracking

(firefox162 fixed)

RESOLVED FIXED
162 Branch
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}

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

Tests Disabled in Gecko Infrastructure

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