Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f8b36c9289f3c027fce896b5637ebe6d15505c32
https://github.com/WebKit/WebKit/commit/f8b36c9289f3c027fce896b5637ebe6d15505c32
Author: Charlie Wolfe <[email protected]>
Date: 2024-10-06 (Sun, 06 Oct 2024)
Changed paths:
M Source/WebCore/history/BackForwardClient.h
M Source/WebCore/history/BackForwardController.cpp
M Source/WebCore/history/BackForwardController.h
M Source/WebCore/loader/EmptyClients.cpp
M Source/WebCore/loader/HistoryController.cpp
M Source/WebCore/page/Page.cpp
M Source/WebKit/Shared/SessionState.cpp
M Source/WebKit/Shared/SessionState.h
A Source/WebKit/Shared/WebBackForwardListFrameItem.cpp
A Source/WebKit/Shared/WebBackForwardListFrameItem.h
M Source/WebKit/Shared/WebBackForwardListItem.cpp
M Source/WebKit/Shared/WebBackForwardListItem.h
M Source/WebKit/Sources.txt
M Source/WebKit/UIProcess/API/C/WKBackForwardListItemRef.cpp
M Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListItem.mm
M Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
M Source/WebKit/UIProcess/ProvisionalPageProxy.h
M Source/WebKit/UIProcess/WebBackForwardList.cpp
M Source/WebKit/UIProcess/WebBackForwardList.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/WebPageProxy.messages.in
M Source/WebKit/UIProcess/WebProcessProxy.cpp
M Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm
M Source/WebKit/WebKit.xcodeproj/project.pbxproj
M Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp
M Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.h
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKitLegacy/mac/History/BackForwardList.h
M Source/WebKitLegacy/mac/History/BackForwardList.mm
M Source/WebKitLegacy/mac/History/WebBackForwardList.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm
Log Message:
-----------
Clean up logic to commit history state from multiple web processes to a
shared list in the UI process
https://bugs.webkit.org/show_bug.cgi?id=280876
rdar://137261520
Reviewed by Alex Christensen.
This change is a step towards having a more complete list of back/forward state
in the UI process with
site isolation. I added `WebBackForwardListFrameItem` and changed
`WebBackForwardListItem` to hold a
reference to it instead of `FrameState`. This will allow the UI process to
better manage history state by
frame, as web processes can no longer commit history state for the entire frame
tree. More details are
provided below.
* Source/WebCore/history/BackForwardClient.h:
* Source/WebCore/history/BackForwardController.cpp:
(WebCore::BackForwardController::backItem):
(WebCore::BackForwardController::currentItem):
(WebCore::BackForwardController::forwardItem):
(WebCore::BackForwardController::itemAtIndex):
These functions should not be able to request history items for the entire
frame tree. Instead, web
processes should only be given history items for the frames they host.
(WebCore::BackForwardController::setChildItem):
This function notifies the UI process when a frame embeds a local child frame.
* Source/WebCore/history/BackForwardController.h:
* Source/WebCore/loader/EmptyClients.cpp:
* Source/WebCore/loader/HistoryController.cpp:
(WebCore::HistoryController::goToItem):
(WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):
(WebCore::HistoryController::updateBackForwardListClippedAtTarget):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::goToItem):
Create and navigate history item trees starting from the root frame, as the
main frame may be
out-of-process.
* Source/WebKit/Shared/SessionState.cpp:
(WebKit::FrameState::stateForFrameID const): Deleted.
* Source/WebKit/Shared/SessionState.h:
This function has been replaced with
`WebBackForwardListFrameItem::childItemForFrameID`.
* Source/WebKit/Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::WebBackForwardListItem):
(WebKit::WebBackForwardListItem::~WebBackForwardListItem):
(WebKit::WebBackForwardListItem::itemIsInSameDocument const):
(WebKit::WebBackForwardListItem::itemIsClone):
(WebKit::WebBackForwardListItem::itemID const):
(WebKit::WebBackForwardListItem::setRootFrameState):
(WebKit::WebBackForwardListItem::rootFrameState const):
(WebKit::WebBackForwardListItem::originalURL const):
(WebKit::WebBackForwardListItem::url const):
(WebKit::WebBackForwardListItem::title const):
(WebKit::WebBackForwardListItem::wasCreatedByJSWithoutUserInteraction const):
(WebKit::WebBackForwardListItem::childItemForFrameID const): Deleted.
(WebKit::WebBackForwardListItem::childItemForProcessID const): Deleted.
These functions are replaced by
`WebBackForwardListFrameItem::childItemForFrameID`.
* Source/WebKit/Shared/WebBackForwardListItem.h:
(WebKit::WebBackForwardListItem::setNavigatedFrameID):
(WebKit::WebBackForwardListItem::navigatedFrameID const):
(WebKit::WebBackForwardListItem::mainFrameItem):
(WebKit::WebBackForwardListItem::setIsRemoteFrameNavigation):
(WebKit::WebBackForwardListItem::itemID const): Deleted.
(WebKit::WebBackForwardListItem::setMainFrameState): Deleted.
(WebKit::WebBackForwardListItem::mainFrameState const): Deleted.
(WebKit::WebBackForwardListItem::originalURL const): Deleted.
(WebKit::WebBackForwardListItem::url const): Deleted.
(WebKit::WebBackForwardListItem::title const): Deleted.
(WebKit::WebBackForwardListItem::wasCreatedByJSWithoutUserInteraction const):
Deleted.
(WebKit::WebBackForwardListItem::setFrameID): Deleted.
(WebKit::WebBackForwardListItem::frameID const): Deleted.
(WebKit::WebBackForwardListItem::addRootChildFrameItem): Deleted.
(WebKit::WebBackForwardListItem::setMainFrameItem): Deleted.
`m_rootChildFrameItems` is replaced by `m_mainFrameState`.
Also add `m_isRemoteFrameNavigation` to indicate when a back/forward item was
created by a navigation
from a process unable to construct history state for the main frame. This
change is necessary because
some functions on this object, such as `url()`, have callers that expect this
to return the URL for the
main frame.
* Source/WebKit/Sources.txt:
* Source/WebKit/UIProcess/API/C/WKBackForwardListItemRef.cpp:
(WKBackForwardListItemCopyURL):
(WKBackForwardListItemCopyTitle):
(WKBackForwardListItemCopyOriginalURL)
* Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListItem.mm:
(-[WKBackForwardListItem _scrollPosition]):
* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::backForwardAddItem):
* Source/WebKit/UIProcess/ProvisionalPageProxy.h:
* Source/WebKit/UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::itemForID):
(WebKit::WebBackForwardList::goToItem):
(WebKit::WebBackForwardList::backForwardListState const):
(WebKit::WebBackForwardList::filteredItemStates const):
(WebKit::WebBackForwardList::addRootChildFrameItem const): Deleted.
* Source/WebKit/UIProcess/WebBackForwardList.h:
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::setPendingChildBackForwardItem):
(WebKit::WebFrameProxy::takePendingChildBackForwardItem):
* Source/WebKit/UIProcess/WebFrameProxy.h:
(WebKit::WebFrameProxy::hasPendingChildBackForwardItem const):
(WebKit::WebFrameProxy::setHasPendingBackForwardItem): Deleted.
(WebKit::WebFrameProxy::hasPendingBackForwardItem): Deleted.
If a frame expects history state for a child frame to be committed from another
process, add the frame
item to `WebFrameProxy`, allowing it to later add the corresponding child item.
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::goForward):
(WebKit::WebPageProxy::goBack):
(WebKit::WebPageProxy::goToBackForwardItem):
Update this function to use state from the navigating frame item. The root
frame identifier needs to be
sent to the web process, as it is what will have been added to the history item
map in the web process.
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::backForwardAddItem):
(WebKit::WebPageProxy::backForwardAddItemShared):
Change the `WebProcessProxy` parameter to an `IPC::Connection` so we can use it
to know when the frame
that has navigated is remote.
(WebKit::WebPageProxy::backForwardSetChildItem):
(WebKit::WebPageProxy::backForwardItemAtIndex):
Return history state for the specified frame rather than sending the entire
frame tree.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::updateBackForwardItem):
* Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::beginSwipeGesture):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp:
(WebKit::WebBackForwardListProxy::setChildItem):
(WebKit::WebBackForwardListProxy::itemAtIndex):
* Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::goToBackForwardItem):
* Source/WebKitLegacy/mac/History/BackForwardList.h:
* Source/WebKitLegacy/mac/History/BackForwardList.mm:
(BackForwardList::itemAtIndex):
* Source/WebKitLegacy/mac/History/WebBackForwardList.mm:
(-[WebBackForwardList itemAtIndex:]):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST(SiteIsolation, NavigateFrameWithSiblingsBackForward)):
Add a test for `FIXME: This will not always select the correct child item if
there are multiple root
frames in the same process.` which this change resolves.
Canonical link: https://commits.webkit.org/284750@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