Closed Bug 2089390 Opened 13 days ago Closed 4 days ago

[wpt-sync] Sync PR 64428 - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=324610

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Cameron McCormack <heycam@apple.com> wrote:

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=324610

WebKit export from bug: http/<!---->wpt/<!---->css/<!---->css-<!---->view-<!---->transitions/<!---->navigation/<!---->old_<!---->vt_<!---->promises_<!---->bfcache.<!---->html fails with Site Isolation enabled

<pre>
[Site Isolation] Make noopener windows eligible for the bfcache

With Site Isolation enabled, noopener windows are not eligible for the
bfcache, but they should be.

A window opened with noopener has openedByDOM() set, so
ProvisionalPageProxy reuses its main frame across a process swap. Since
<a href="https://commits.webkit.org/321195@main">321195@main</a>, suspendCurrentPageIfPossible declines to suspend a page
when the provisional page is committing into that page's main frame.
Such a window is therefore never suspended, and a cross-site navigation
does not use the bfcache.

Reusing the main frame keeps a window reference held in another process
valid across the swap. Only a page in the same browsing context group
can hold such a reference, so condition the reuse on the group holding
more than one page. openedByDOM() was the wrong check, since it stays
set whether or not anything can still reach the window. The new
condition mirrors the browsing context group check in
suspendCurrentPageIfPossible.

A noopener window opened at a same-site URL was getting the opener's
browsing context group because createNewPage set relatedPage on its
configuration, and preferredBrowsingContextGroup returns the related
page's group. relatedPage was set there so that the window would load in
the process of the window that opened it. Sharing a process and sharing
a browsing context group are separate concerns, so createNewPage records
the opener's process on the configuration instead, and createWebPage
uses that process when the two pages are able to share a process.
_setRelatedWebView: still sets relatedPage, so the behavior added in
<a href="https://commits.webkit.org/306438@main">306438@main</a> is unchanged.

createNewPage copies the opening page's configuration, so it clears any
process recorded there before deciding whether to record one for the new
window. Otherwise a window opened from a window that was itself opened
same-site with noopener would inherit a process from further up the
chain, which placed a cross-site noopener window in the wrong process,
and without Site Isolation placed a window opened with an opener outside
its opener's process.

processForNavigationInternal decided whether to keep a noopener window
in the opener's process by comparing the navigation target against the
related page's current URL. It now compares the target against the site
the window was opened at.

canShareProcessWithOpener declines the opener's process when that
process is the browsing context group's shared process. A shared process
only hosts subframes, and creating a FrameProcess for it in a group that
does not have one would dedicate it to a single site. A window opened
from a frame in the shared process therefore loads in a process of its
own. CrossSiteIframeOpenWindowWithBlobURL expected such a window to
share the shared process with the frame that opened it, and now expects
three distinct processes.

To test these changes, we use the historical agent cluster key map.
The browsing context group a noopener window lands in is observable with
or without Site Isolation: before these changes, a same-origin noopener
window was inheriting the opener's origin-keying decision rather than
making its own. noopener-opener-no-openee-yes-same.https.html is added
to test this, modeled on other tests in its directory.

window-noopener-failure.https.html and window-opener-success.https.html
test the agent cluster requirement for SharedArrayBuffer, which we were
already correctly doing before these changes (but were written during
patch development and seemed worth keeping).

hasPageOpenedByMainFrame() had no other callers and is removed.

The http/wpt copy of old_vt_promises_bfcache.html, whose failure
prompted this investigation, is removed. It existed so that
UsesBackForwardCache could be applied to it, and <a href="https://commits.webkit.org/300920@main">300920@main</a> turned the
bfcache on by default in WebKitTestRunner and deleted other similar
copies, but missed this one. Because http/wpt tests are served from
localhost rather than the WPT server's browser_host, its
originSameOrigin put pageB on another site, which is why it was failing.
The imported test under
runs and has been passing with and without Site Isolation.

The two SharedArrayBuffer tests are skipped on GLib, which skips the
other window-* tests in that directory too.

WebKit-Bug: <a href="https://bugs.webkit.org/show_bug.cgi?id=324610">https://bugs.webkit.org/show_bug.cgi?id=324610</a>
WebKit-Canonical-Link: <a href="https://commits.webkit.org/321634@main">https://commits.webkit.org/321634@main</a>
</pre>

Whiteboard: [wptsync downstream] → [wptsync downstream error]
Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core
Whiteboard: [wptsync downstream error] → [wptsync downstream]

CI Results

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

Total 36 tests and 16 subtests

Status Summary

Firefox

OK : 3[GitHub] 10[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] 32[Gecko-windows11-64-25h2-debug] 33[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-opt]
PASS : 4[GitHub] 38[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] 100[Gecko-windows11-64-25h2-debug] 102[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-opt]
FAIL : 4

Chrome

OK : 1
PASS : 1
FAIL : 1
TIMEOUT: 4

Safari

OK : 3
PASS : 4

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: 4 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.