Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2d96909cecf46a07f4ee5aa6fe8caa8b163a3f76
      
https://github.com/WebKit/WebKit/commit/2d96909cecf46a07f4ee5aa6fe8caa8b163a3f76
  Author: Alex Christensen <[email protected]>
  Date:   2025-05-27 (Tue, 27 May 2025)

  Changed paths:
    A LayoutTests/http/tests/site-isolation/frame-index-expected.txt
    A LayoutTests/http/tests/site-isolation/frame-index.html
    A LayoutTests/http/tests/site-isolation/resources/reply-query.html
    M Source/WebCore/loader/FrameLoader.cpp
    M Source/WebCore/loader/HistoryController.cpp
    M Source/WebCore/page/Frame.cpp
    M Source/WebCore/page/Frame.h
    M Source/WebCore/page/FrameTree.cpp
    M Source/WebCore/page/FrameTree.h
    M Source/WebCore/page/LocalFrame.cpp
    M Source/WebCore/page/LocalFrame.h
    M Source/WebCore/page/RemoteFrame.cpp
    M Source/WebCore/page/RemoteFrame.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
    M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm

  Log Message:
  -----------
  window.frames index shouldn't change after navigation with site isolation 
enabled
https://bugs.webkit.org/show_bug.cgi?id=293512

Reviewed by Charlie Wolfe.

Before this change, with site isolation on, when we navigate a frame and it 
swaps between
being represented in the frame tree by a LocalFrame and a RemoteFrame, we 
append a
new Frame of the new type to the end of the list of child frames.  This caused 
two issues
that were observable by web content.  First, the index of the frames shuffles 
around
when a frame navigates.  Second, during a provisional load between when the 
request
is sent and the response is received, JavaScript will see an extra frame in 
window.length.

To fix these issues, we don't add a provisional frame to the frame tree until 
it commits,
at which time we replace the existing frame in the frame tree at the same 
location.
A few other changes are needed to keep all the tests working in a world where a 
provisional
frame can exist and begin loading outside of a frame tree.

* LayoutTests/http/tests/site-isolation/frame-index-expected.txt: Added.
* LayoutTests/http/tests/site-isolation/frame-index.html: Added.
* LayoutTests/http/tests/site-isolation/resources/reply-query.html: Added.
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::checkLoadComplete):
(WebCore::FrameLoader::detachFromParent):
* Source/WebCore/loader/HistoryController.cpp:
(WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):
(WebCore::HistoryController::updateBackForwardListClippedAtTarget):
* Source/WebCore/page/Frame.cpp:
(WebCore::Frame::Frame):
* Source/WebCore/page/Frame.h:
* Source/WebCore/page/FrameTree.cpp:
(WebCore::FrameTree::replaceChild):
(WebCore::FrameTree::traverseNext const):
(WebCore::FrameTree::top const):
* Source/WebCore/page/FrameTree.h:
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::rootFrame):
(WebCore::LocalFrame::LocalFrame):
(WebCore::LocalFrame::createMainFrame):
(WebCore::LocalFrame::createProvisionalSubframe):
* Source/WebCore/page/LocalFrame.h:
* Source/WebCore/page/Page.cpp:
(WebCore::createMainFrame):
(WebCore::Page::removeRootFrame):
* Source/WebCore/page/RemoteFrame.cpp:
(WebCore::RemoteFrame::createSubframe):
(WebCore::RemoteFrame::createSubframeWithContentsInAnotherProcess):
(WebCore::RemoteFrame::RemoteFrame):
* Source/WebCore/page/RemoteFrame.h:
* Source/WebKit/UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::itemAtIndex const):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
* Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::createRemoteSubframe):
(WebKit::WebFrame::loadDidCommitInAnotherProcess):
(WebKit::WebFrame::createProvisionalFrame):
(WebKit::WebFrame::destroyProvisionalFrame):
(WebKit::WebFrame::commitProvisionalFrame):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::(SiteIsolation, FramesDuringProvisionalNavigation)):

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



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

Reply via email to