Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 84d2d4884a37bd9f3639f0b3bc34d27d1629433c
      
https://github.com/WebKit/WebKit/commit/84d2d4884a37bd9f3639f0b3bc34d27d1629433c
  Author: Alex Christensen <achristen...@apple.com>
  Date:   2024-05-15 (Wed, 15 May 2024)

  Changed paths:
    M Source/WebCore/page/Frame.cpp
    M Source/WebCore/page/Frame.h
    M Source/WebCore/page/LocalFrame.cpp
    M Source/WebCore/page/Page.cpp
    M Source/WebKit/UIProcess/WebFrameProxy.cpp
    M 
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm
    M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm

  Log Message:
  -----------
  [Site Isolation] Handle more cases of provisional navigations cancelling 
other provisional navigations
https://bugs.webkit.org/show_bug.cgi?id=274179
rdar://128083411

Reviewed by Sihui Liu.

In order to get more tests to work correctly, a few changes were needed:

1. The accounting for whether a frame identifier is a root frame identifier 
needed to be more robust
for the assertion to be correct near the time when a root frame was 
transitioning to or from being local.
I introduced the debug-only class FrameLifetimeVerifier for this.  Instead of 
keeping track of just the
most recently created Frame with a given identifier, keep track of both the 
most recently created LocalFrame
and the most recently created RemoteFrame.  Then we can strengthen our 
assertions to make sure that
Frame existence is exactly as we expect: there should only be one except during 
the time of transitioning
from one type to the other.

2. If Frame::detachFromPage is ever called before destruction of a Frame, then 
we would be unable to
inform the Page of the destruction of a root frame.  To make this work, move 
that informing to
Frame::detachFromPage and have the root frame collections contain all the root 
frames that are attached
to a Page instead of all the root frames that haven't been destroyed.

3. WebFrameProxy::prepareForProvisionalLoadInProcess was missing a case when 
there is a ProvisionalFrameProxy
but it's from a provisional navigation to a different process that we are now 
cancelling.  In that case,
we do need to make a new ProvisionalFrameProxy representing the navigation to 
the new process.

4. WebFrame::loadDidCommitInAnotherProcess was missing a call to 
FrameLoader::detachFromParent which is needed
to drop all strong references to the LocalFrame so it can be destroyed so we 
don't have multiple LocalFrames
in the same process with the same identifier.

I also updated checkFrameTreesInProcesses to copy the expected results so they 
print out correctly if
they don't match the actual results in a place in the frame tree that is not 
the beginning.

* Source/WebCore/page/Frame.cpp:
(WebCore::FrameLifetimeVerifier::singleton):
(WebCore::FrameLifetimeVerifier::frameCreated):
(WebCore::FrameLifetimeVerifier::frameDestroyed):
(WebCore::FrameLifetimeVerifier::isRootFrameIdentifier):
(WebCore::Frame::Frame):
(WebCore::Frame::~Frame):
(WebCore::Frame::detachFromPage):
(WebCore::Frame::isRootFrameIdentifier):
(WebCore::allFrames): Deleted.
* Source/WebCore/page/Frame.h:
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::~LocalFrame):
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::prepareForProvisionalLoadInProcess):
* 
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::addRootFrame):
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::loadDidCommitInAnotherProcess):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::checkFrameTreesInProcesses):
(TestWebKitAPI::TEST(SiteIsolation, CancelProvisionalLoad)):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to