[webkit-changes] [WebKit/WebKit] b1554a: Terminate iframe processes when navigating away

Alex Christensen noreply at github.com
Mon Sep 25 13:56:31 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b1554a5e8100282183d8f91d79bfce23bab54241
      https://github.com/WebKit/WebKit/commit/b1554a5e8100282183d8f91d79bfce23bab54241
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2023-09-25 (Mon, 25 Sep 2023)

  Changed paths:
    M Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp
    M Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
    M Source/WebKit/UIProcess/ProvisionalPageProxy.h
    M Source/WebKit/UIProcess/RemotePageProxy.cpp
    M Source/WebKit/UIProcess/SuspendedPageProxy.cpp
    M Source/WebKit/UIProcess/SuspendedPageProxy.h
    M Source/WebKit/UIProcess/WebFrameProxy.cpp
    M Source/WebKit/UIProcess/WebFrameProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebProcessProxy.cpp
    M Source/WebKit/UIProcess/WebProcessProxy.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm

  Log Message:
  -----------
  Terminate iframe processes when navigating away
https://bugs.webkit.org/show_bug.cgi?id=262056
rdar://116004705

Reviewed by Pascoe.

While deciding what to do about all the processes that are currently being kept alive
by the back/forward cache with site isolation on, I investigated and found that Chrome
and Firefox both terminate iframe processes immediately after navigating away from a
page.  This can be seen by going to a site with many third-party iframes then opening
example.com

To accomplish this in WebKit, instead of keeping the domain-to-remote-page map on the
SuspendedPageProxy, we remove all RemotePageProxy objects from all frames going into
the back/forward cache when a SuspendedPageProxy is created.

To get the process to actually terminate, I needed to change the WebProcessProxy's
conditions for not shutting down from watching its ProvisionalFrameProxy and
WebFrameProxy-with-remote-page count to just watching its RemotePageProxy count.
This simplifies things, makes them easier to keep track of, and reflects the progression
of how site isolation has developed: we started by having frames manage process lifetimes
more and progressed to having the RemotePageProxy be in charge.

* Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp:
(WebKit::ProvisionalFrameProxy::ProvisionalFrameProxy):
(WebKit::ProvisionalFrameProxy::~ProvisionalFrameProxy): Deleted.
* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
(WebKit::ProvisionalPageProxy::takeRemotePageMap): Deleted.
* Source/WebKit/UIProcess/ProvisionalPageProxy.h:
(WebKit::ProvisionalPageProxy::provisionalURL const):
* Source/WebKit/UIProcess/RemotePageProxy.cpp:
(WebKit::RemotePageProxy::RemotePageProxy):
(WebKit::RemotePageProxy::~RemotePageProxy):
* Source/WebKit/UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::SuspendedPageProxy):
(WebKit::SuspendedPageProxy::takeRemotePageMap): Deleted.
* Source/WebKit/UIProcess/SuspendedPageProxy.h:
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::commitProvisionalFrame):
(WebKit::WebFrameProxy::removeRemotePagesForSuspension):
* Source/WebKit/UIProcess/WebFrameProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::swapToProvisionalPage):
(WebKit::WebPageProxy::takeRemotePageMap): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::addRemotePageProxy):
(WebKit::WebProcessProxy::removeRemotePageProxy):
(WebKit::WebProcessProxy::canTerminateAuxiliaryProcess):
(WebKit::WebProcessProxy::addProvisionalFrameProxy): Deleted.
(WebKit::WebProcessProxy::removeProvisionalFrameProxy): Deleted.
(WebKit::WebProcessProxy::provisionalFrameCommitted): Deleted.
(WebKit::WebProcessProxy::removeFrameWithRemoteFrameProcess): Deleted.
* Source/WebKit/UIProcess/WebProcessProxy.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::processStillRunning):
(TestWebKitAPI::TEST):

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




More information about the webkit-changes mailing list