Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1085dea9ba4113642ffc393e3f9ac06a778ff26c
https://github.com/WebKit/WebKit/commit/1085dea9ba4113642ffc393e3f9ac06a778ff26c
Author: Charlie Wolfe <[email protected]>
Date: 2024-05-22 (Wed, 22 May 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/WebCore/page/Page.h
M Source/WebKit/Shared/WebBackForwardListItem.h
M Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
M Source/WebKit/UIProcess/ProvisionalPageProxy.h
M Source/WebKit/UIProcess/WebBackForwardList.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/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 Source/WebKitLegacy/mac/WebView/WebView.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm
Log Message:
-----------
[Site Isolation] Begin to fix the back forward list for same-origin iframe
navigations
https://bugs.webkit.org/show_bug.cgi?id=274419
rdar://128420789
Reviewed by Alex Christensen.
Some back forward list state for child frames is currently stored only in the
web process. This needs to
change with site isolation because web processes can only have history items
corresponding to frames they
are hosting or have embedded. With this patch, whenever a root child frame is
embedded, we add a separate
item to the back forward list in the UI process. This way, when navigating back
or forward, iframe
processes can request history items containing state about same-origin frames
that have been embedded by
another process without receiving information about the entire frame tree. We
also need to keep track of
which back forward items correspond to initial root child frame loads. This is
necessary to determine
which item to navigate an isolated iframe to, while also ignoring these items
when the main frame is
moved back or forward.
Further work is required to make the back forward list behave correctly after
cross-origin iframe
navigations. More details below.
* Source/WebCore/history/BackForwardClient.h:
* Source/WebCore/history/BackForwardController.cpp:
(WebCore::BackForwardController::addItem):
* Source/WebCore/history/BackForwardController.h:
* Source/WebCore/loader/EmptyClients.cpp:
* Source/WebCore/loader/HistoryController.cpp:
(WebCore::HistoryController::goToItem):
(WebCore::HistoryController::updateBackForwardListClippedAtTarget):
(WebCore::HistoryController::pushState):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::goToItem):
* Source/WebCore/page/Page.h:
Update `addItem` to include a FrameIdentifier parameter so the UI process knows
which frame is being
targeted. Also remove several unneeded local frame downcasts.
* Source/WebKit/Shared/WebBackForwardListItem.h:
(WebKit::WebBackForwardListItem::setIsRootChildFrameItem):
(WebKit::WebBackForwardListItem::isRootChildFrameItem const):
Add `m_isRootChildFrameItem` to indicate when a back forward item was created
by an initial root child
frame load.
* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::backForwardAddItem):
* Source/WebKit/UIProcess/ProvisionalPageProxy.h:
* Source/WebKit/UIProcess/WebBackForwardList.cpp:
(WebKit::itemSkippingBackForwardItemsAddedByJSWithoutUserGesture):
Skip root child frame items to avoid targeting initial child frame loads when
trying to move the main
frame back/forward. This logic probably still isn’t correct when going
back/forward between
cross-origin iframes.
* Source/WebKit/UIProcess/WebFrameProxy.h:
(WebKit::WebFrameProxy::setHasPendingBackForwardItem):
(WebKit::WebFrameProxy::takeHasPendingBackforwardItem):
Add `m_hasPendingBackForwardItem` to indicate when a root frame is waiting for
its initial back forward
item to be created.
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::goToBackForwardItem):
Change this function to send back forward list items corresponding to isolated
iframes to the process
that navigated. `m_lastProcessIdentifier` on `WebBackForwardListItem` is
already used for process
selection for PSON. It will initially be the identifier of the web process that
constructed the object,
so we can use it for iframe isolation too.
(WebKit::WebPageProxy::didChangeBackForwardList):
Do not call `didChangeBackForwardList` delegates or `setCanGoBack/Forward` for
root child frame items to
keep the same behavior as without site isolation.
(WebKit::WebPageProxy::continueNavigationInNewProcess):
Set `m_hasPendingBackForwardItem` to true when creating a new root child frame.
(WebKit::WebPageProxy::backForwardAddItem):
(WebKit::WebPageProxy::backForwardAddItemShared):
When a back forward list item is created set `m_isRootChildFrameItem` and reset
`m_hasPendingBackForwardItem`.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp:
(WebKit::WebBackForwardListProxy::addItem):
* 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::addItem):
* Source/WebKitLegacy/mac/History/WebBackForwardList.mm:
(-[WebBackForwardList addItem:]):
* Source/WebKitLegacy/mac/WebView/WebView.mm:
(-[WebView _loadBackForwardListFromOtherView:]):
(-[WebBackForwardList setToMatchDictionaryRepresentation:]):
WebKitLegacy is not supported with site isolation, so we can always just pass
the main frame id.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST(SiteIsolation, NavigateIframeBackForward)):
Add a test that navigates an isolated iframe same-origin and verifies that
`goBack` and `goForward`
behave correctly.
Canonical link: https://commits.webkit.org/279152@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