Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a69e1109cc6b20bef9dcd85a6b36e5289cd1b534
      
https://github.com/WebKit/WebKit/commit/a69e1109cc6b20bef9dcd85a6b36e5289cd1b534
  Author: Anthony Tarbinian <[email protected]>
  Date:   2026-06-05 (Fri, 05 Jun 2026)

  Changed paths:
    M LayoutTests/platform/ios-site-isolation/TestExpectations
    M LayoutTests/platform/mac-site-isolation/TestExpectations
    M Source/WebCore/loader/LocalFrameLoaderClient.cpp
    M Source/WebCore/loader/LocalFrameLoaderClient.h
    M Source/WebCore/page/LocalFrame.cpp
    M Source/WebCore/page/LocalFrame.h
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.messages.in
    M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in

  Log Message:
  -----------
  [Site Isolation] iframe memory monitor test fails
https://bugs.webkit.org/show_bug.cgi?id=316222
rdar://178647828

Reviewed by Sihui Liu.

This bug targets 
http/tests/iframe-memory-monitor/media-video-autoplay-in-frames.html
or any tests which use window.internals.lowerAllFrameMemoryMonitorLimits();

This is a similar bug to https://bugs.webkit.org/show_bug.cgi?id=315664
which affected network resource loading limits, whereas this one is
for memory usage limits.

In LocalFrame::showMemoryMonitorError, the misbehaving iframe is
attempted to be unloaded via setting the srcdoc attribute on the
iframe's ownerElement (Frame::m_ownerElement). With site isolation,
the owner element can be in a different process which leaves
m_ownerElement as null.

The same bug was previously fixed for the network
ResourceMonitor in 314057@main with a 3-hop IPC: child WebProcess ->
UIProcess -> parent WebProcess. This patch reuses that mechanism for
the memory monitor and folds the two parallel chains into a single
IPC parameterized by an IFrameUnloadReason enum, so the next monitor
type added does not duplicate the chain again:

Unlike 314057@main, this patch does NOT need to lift internals.* JS
calls out into webkit-test-runner header preferences. The
ResourceMonitor used a process-global singleton
(WebCore::ResourceMonitorChecker::singleton), so a threshold set via
JS in one process did not propagate to whichever process hosted the
iframe at trigger time. FrameMemoryMonitor is per-Document state
(Document::m_frameMemoryMonitor); the test's JS call
internals.lowerAllFrameMemoryMonitorLimits() runs inside
video-iframe.html, mutates that exact iframe's Document-owned monitor,
and the same monitor is later consulted by HTMLMediaElement::footPrint
-> FrameMemoryMonitor::setUsage in the same process. Sender, mutated
state, and consumer all coexist in one Document in one process,
so no migration to header preferences is needed.

This patch fixes 
http/tests/iframe-memory-monitor/media-video-autoplay-in-frames.html
with --site-isolation.

* LayoutTests/platform/ios-site-isolation/TestExpectations:
* LayoutTests/platform/mac-site-isolation/TestExpectations:
* Source/WebCore/loader/LocalFrameLoaderClient.cpp:
(WebCore::LocalFrameLoaderClient::applyMonitorUnloadToOwnerFrame):
(WebCore::LocalFrameLoaderClient::applyResourceMonitorUnloadToOwnerFrame): 
Deleted.
* Source/WebCore/loader/LocalFrameLoaderClient.h:
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::showResourceMonitoringError):
(WebCore::LocalFrame::applyMemoryMonitorErrorToIFrameElement):
          Shared helper which performs the placeholder iframe swap and
          is used in both the local and remote case.
(WebCore::LocalFrame::showMemoryMonitorError):
          Fall through to loader().client().applyMonitorUnloadToOwnerFrame
          when ownerElement is null.
* Source/WebCore/page/LocalFrame.h:
* Source/WebKit/Scripts/webkit/messages.py:
(headers_for_type):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::applyMonitorUnloadToFrameOwner):
(WebKit::WebPageProxy::applyResourceMonitorUnloadToFrameOwner): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::applyMonitorUnloadToOwnerFrame):
(WebKit::WebLocalFrameLoaderClient::applyResourceMonitorUnloadToOwnerFrame): 
Deleted.
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::applyMonitorUnloadToIFrameElement):
          Resolve the parent-process <iframe> element via
          RemoteFrame::ownerElement and dispatch on reason to the
          matching static helper. The ResourceMonitor case is gated on
          ENABLE(CONTENT_EXTENSIONS) since FrameMemoryMonitor is
          unconditional but the network ResourceMonitor lives entirely
          under that flag.
(WebKit::WebPage::applyResourceMonitorUnloadToIFrameElement): Deleted.
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:

Canonical link: https://commits.webkit.org/314646@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to