Skip to content

Commit

Permalink
Move HistoryController from FrameLoader to Frame
Browse files Browse the repository at this point in the history
rdar://127331154
https://bugs.webkit.org/show_bug.cgi?id=273529

Reviewed by Alex Christensen.

Move HistoryController to Frame so that it can be accessed on remote frames. This is work towards making
the back forward list work with site isolation.

* Source/WebCore/history/BackForwardCache.cpp:
(WebCore::canCacheFrame):
* Source/WebCore/loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::willSendRequest):
* Source/WebCore/loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::begin):
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::FrameLoader):
(WebCore::FrameLoader::setDefersLoading):
(WebCore::FrameLoader::closeURL):
(WebCore::FrameLoader::didBeginDocument):
(WebCore::FrameLoader::loadURLIntoChildFrame):
(WebCore::FrameLoader::loadInSameDocument):
(WebCore::FrameLoader::loadURL):
(WebCore::FrameLoader::load):
(WebCore::FrameLoader::loadWithDocumentLoader):
(WebCore::FrameLoader::stopAllLoaders):
(WebCore::FrameLoader::commitProvisionalLoad):
(WebCore::FrameLoader::transitionToCommitted):
(WebCore::FrameLoader::clientRedirected):
(WebCore::FrameLoader::dispatchDidFailProvisionalLoad):
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
(WebCore::FrameLoader::restoreScrollPositionAndViewStateNowIfNeeded):
(WebCore::FrameLoader::frameLoadCompleted):
(WebCore::FrameLoader::detachFromParent):
(WebCore::FrameLoader::receivedMainResourceError):
(WebCore::FrameLoader::scrollToFragmentWithParentBoundary):
(WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
(WebCore::FrameLoader::shouldTreatURLAsSameAsCurrent const):
(WebCore::FrameLoader::loadSameDocumentItem):
(WebCore::FrameLoader::loadDifferentDocumentItem):
(WebCore::FrameLoader::loadItem):
(WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad):
(WebCore::FrameLoader::updateNavigationAPIEntries):
(WebCore::FrameLoader::checkedHistory const): Deleted.
* Source/WebCore/loader/FrameLoader.h:
* Source/WebCore/loader/HistoryController.cpp:
(WebCore::HistoryController::HistoryController):
(WebCore::HistoryController::saveScrollPositionAndViewStateToItem):
(WebCore::HistoryController::protectedFrame const):
(WebCore::HistoryController::restoreScrollPositionAndViewState):
(WebCore::HistoryController::saveDocumentState):
(WebCore::HistoryController::saveDocumentAndScrollState):
(WebCore::HistoryController::restoreDocumentState):
(WebCore::HistoryController::invalidateCurrentItemCachedPage):
(WebCore::HistoryController::goToItem):
(WebCore::HistoryController::updateForBackForwardNavigation):
(WebCore::HistoryController::updateForReload):
(WebCore::HistoryController::updateForStandardLoad):
(WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):
(WebCore::HistoryController::updateForClientRedirect):
(WebCore::HistoryController::updateForCommit):
(WebCore::HistoryController::recursiveUpdateForCommit):
(WebCore::HistoryController::updateForSameDocumentNavigation):
(WebCore::HistoryController::recursiveUpdateForSameDocumentNavigation):
(WebCore::HistoryController::clearPreviousItem):
(WebCore::HistoryController::initializeItem):
(WebCore::HistoryController::createItemTree):
(WebCore::HistoryController::recursiveSetProvisionalItem):
(WebCore::HistoryController::recursiveGoToItem):
(WebCore::HistoryController::updateBackForwardListClippedAtTarget):
(WebCore::HistoryController::updateCurrentItem):
(WebCore::HistoryController::pushState):
(WebCore::HistoryController::replaceState):
* Source/WebCore/loader/HistoryController.h:
* Source/WebCore/page/Frame.cpp:
(WebCore::Frame::Frame):
(WebCore::Frame::checkedHistory const):
* Source/WebCore/page/Frame.h:
(WebCore::Frame::history const):
* Source/WebCore/page/History.cpp:
(WebCore::History::scrollRestoration const):
(WebCore::History::setScrollRestoration):
(WebCore::History::stateInternal const):
(WebCore::History::stateObjectAdded):
* Source/WebCore/page/NavigationHistoryEntry.cpp:
(WebCore::NavigationHistoryEntry::sameDocument const):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::clearPreviousItemFromAllPages):
(WebCore::Page::goToItem):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::formControlStateOfPreviousHistoryItem):
(WebCore::Internals::setFormControlStateOfPreviousHistoryItem):
(WebCore::Internals::getReferencedFilePaths const):
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::restoreViewState):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::suspendForProcessSwap):
(WebKit::WebPage::tryRestoreScrollPosition):
(WebKit::WebPage::pageStoppedScrolling):
(WebKit::WebPage::setCurrentHistoryItemForReattach):
(WebKit::WebPage::visibilityDidChange):
* Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::restoreViewState):
* Source/WebKitLegacy/mac/WebView/WebFrame.mm:
(-[WebFrame _saveViewState]):
* Source/WebKitLegacy/mac/WebView/WebView.mm:
(-[WebView _replaceCurrentHistoryItem:]):
(-[WebView _loadBackForwardListFromOtherView:]):

Canonical link: https://commits.webkit.org/278217@main
  • Loading branch information
charliewolfe committed May 1, 2024
1 parent a56e420 commit 86923db
Show file tree
Hide file tree
Showing 18 changed files with 204 additions and 152 deletions.
2 changes: 1 addition & 1 deletion Source/WebCore/history/BackForwardCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static bool canCacheFrame(LocalFrame& frame, DiagnosticLoggingClient& diagnostic
logBackForwardCacheFailureDiagnosticMessage(diagnosticLoggingClient, DiagnosticLoggingKeys::httpsNoStoreKey());
isCacheable = false;
}
if (frame.isMainFrame() && !frameLoader->history().currentItem()) {
if (frame.isMainFrame() && !frame.history().currentItem()) {
PCLOG(" -Main frame has no current history item");
logBackForwardCacheFailureDiagnosticMessage(diagnosticLoggingClient, DiagnosticLoggingKeys::noCurrentHistoryItemKey());
isCacheable = false;
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/loader/DocumentLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ void DocumentLoader::willSendRequest(ResourceRequest&& newRequest, const Resourc

// FIXME: Add a load type check.
auto& policyChecker = frameLoader()->policyChecker();
RELEASE_ASSERT(!isBackForwardLoadType(policyChecker.loadType()) || frameLoader()->history().provisionalItem());
RELEASE_ASSERT(!isBackForwardLoadType(policyChecker.loadType()) || m_frame->history().provisionalItem());
policyChecker.checkNavigationPolicy(WTFMove(newRequest), redirectResponse, WTFMove(navigationPolicyCompletionHandler));
}

Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/loader/DocumentWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ bool DocumentWriter::begin(const URL& urlReference, bool dispatch, Document* own
contentSecurityPolicy->setInsecureNavigationRequestsToUpgrade(ownerContentSecurityPolicy->takeNavigationRequestsToUpgrade());
} else if (url.protocolIsAbout() || url.protocolIsData()) {
// https://html.spec.whatwg.org/multipage/origin.html#determining-navigation-params-policy-container
RefPtr currentHistoryItem = frameLoader->history().currentItem();
RefPtr currentHistoryItem = frame->history().currentItem();

if (currentHistoryItem && currentHistoryItem->policyContainer()) {
const auto& policyContainerFromHistory = currentHistoryItem->policyContainer();
Expand Down
109 changes: 52 additions & 57 deletions Source/WebCore/loader/FrameLoader.cpp

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions Source/WebCore/loader/FrameLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class FormState;
class FormSubmission;
class FrameLoadRequest;
class FrameNetworkingContext;
class HistoryController;
class HistoryItem;
class LocalFrameLoaderClient;
class NavigationAction;
Expand Down Expand Up @@ -118,8 +117,6 @@ class FrameLoader final : public CanMakeCheckedPtr<FrameLoader> {
class PolicyChecker;
PolicyChecker& policyChecker() const { return *m_policyChecker; }

HistoryController& history() const { return *m_history; }
CheckedRef<HistoryController> checkedHistory() const;
ResourceLoadNotifier& notifier() const { return m_notifier; }

class SubframeLoader;
Expand Down Expand Up @@ -462,7 +459,6 @@ class FrameLoader final : public CanMakeCheckedPtr<FrameLoader> {
UniqueRef<LocalFrameLoaderClient> m_client;

const std::unique_ptr<PolicyChecker> m_policyChecker;
const std::unique_ptr<HistoryController> m_history;
mutable ResourceLoadNotifier m_notifier;
const std::unique_ptr<SubframeLoader> m_subframeLoader;
mutable FrameLoaderStateMachine m_stateMachine;
Expand Down
170 changes: 109 additions & 61 deletions Source/WebCore/loader/HistoryController.cpp

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions Source/WebCore/loader/HistoryController.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

namespace WebCore {

class Frame;
class HistoryItem;
class HistoryItemClient;
class LocalFrame;
Expand All @@ -50,7 +51,7 @@ class HistoryController final : public CanMakeCheckedPtr<HistoryController> {
public:
enum HistoryUpdateType { UpdateAll, UpdateAllExceptBackForwardList };

explicit HistoryController(LocalFrame&);
explicit HistoryController(Frame&);
~HistoryController();

WEBCORE_EXPORT void saveScrollPositionAndViewStateToItem(HistoryItem*);
Expand Down Expand Up @@ -111,9 +112,9 @@ class HistoryController final : public CanMakeCheckedPtr<HistoryController> {
void updateBackForwardListClippedAtTarget(bool doClip);
void updateCurrentItem();

Ref<LocalFrame> protectedFrame() const;
Ref<Frame> protectedFrame() const;

WeakRef<LocalFrame> m_frame;
WeakRef<Frame> m_frame;

RefPtr<HistoryItem> m_currentItem;
RefPtr<HistoryItem> m_previousItem;
Expand Down
7 changes: 7 additions & 0 deletions Source/WebCore/page/Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "Frame.h"

#include "HTMLFrameOwnerElement.h"
#include "HistoryController.h"
#include "NavigationScheduler.h"
#include "Page.h"
#include "RemoteFrame.h"
Expand Down Expand Up @@ -56,6 +57,7 @@ Frame::Frame(Page& page, FrameIdentifier frameID, FrameType frameType, HTMLFrame
, m_frameType(frameType)
, m_navigationScheduler(makeUniqueRef<NavigationScheduler>(*this))
, m_opener(opener)
, m_history(makeUniqueRef<HistoryController>(*this))
{
if (parent)
parent->tree().appendChild(*this);
Expand Down Expand Up @@ -190,4 +192,9 @@ bool Frame::hasOpenedFrames() const
return !m_openedFrames.isEmptyIgnoringNullReferences();
}

CheckedRef<HistoryController> Frame::checkedHistory() const
{
return m_history.get();
}

} // namespace WebCore
5 changes: 5 additions & 0 deletions Source/WebCore/page/Frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class FrameView;
class FrameLoaderClient;
class FrameLoadRequest;
class HTMLFrameOwnerElement;
class HistoryController;
class NavigationScheduler;
class Page;
class RenderWidget;
Expand Down Expand Up @@ -90,6 +91,9 @@ class Frame : public ThreadSafeRefCounted<Frame, WTF::DestructionThread::Main>,
CheckedRef<NavigationScheduler> checkedNavigationScheduler() const;
WEBCORE_EXPORT void takeWindowProxyFrom(Frame&);

HistoryController& history() const { return m_history.get(); }
WEBCORE_EXPORT CheckedRef<HistoryController> checkedHistory() const;

virtual void frameDetached() = 0;
virtual bool preventsParentFromBeingComplete() const = 0;
virtual void changeLocation(FrameLoadRequest&&) = 0;
Expand Down Expand Up @@ -127,6 +131,7 @@ class Frame : public ThreadSafeRefCounted<Frame, WTF::DestructionThread::Main>,
mutable UniqueRef<NavigationScheduler> m_navigationScheduler;
WeakPtr<Frame> m_opener;
WeakHashSet<Frame> m_openedFrames;
mutable UniqueRef<HistoryController> m_history;
};

} // namespace WebCore
10 changes: 5 additions & 5 deletions Source/WebCore/page/History.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ExceptionOr<History::ScrollRestoration> History::scrollRestoration() const
if (!isDocumentFullyActive(frame))
return documentNotFullyActive();

auto* historyItem = frame->loader().history().currentItem();
auto* historyItem = frame->history().currentItem();
if (!historyItem)
return ScrollRestoration::Auto;

Expand All @@ -100,7 +100,7 @@ ExceptionOr<void> History::setScrollRestoration(ScrollRestoration scrollRestorat
if (!isDocumentFullyActive(frame))
return documentNotFullyActive();

auto* historyItem = frame->loader().history().currentItem();
auto* historyItem = frame->history().currentItem();
if (historyItem)
historyItem->setShouldRestoreScrollPosition(scrollRestoration == ScrollRestoration::Auto);

Expand All @@ -121,7 +121,7 @@ SerializedScriptValue* History::stateInternal() const
auto* frame = this->frame();
if (!frame)
return nullptr;
auto* historyItem = frame->loader().history().currentItem();
auto* historyItem = frame->history().currentItem();
if (!historyItem)
return nullptr;
return historyItem->stateObject();
Expand Down Expand Up @@ -300,10 +300,10 @@ ExceptionOr<void> History::stateObjectAdded(RefPtr<SerializedScriptValue>&& data
frame->protectedDocument()->updateURLForPushOrReplaceState(fullURL);

if (stateObjectType == StateObjectType::Push) {
frame->loader().history().pushState(WTFMove(data), fullURL.string());
frame->checkedHistory()->pushState(WTFMove(data), fullURL.string());
frame->loader().client().dispatchDidPushStateWithinPage();
} else if (stateObjectType == StateObjectType::Replace) {
frame->loader().history().replaceState(WTFMove(data), fullURL.string());
frame->checkedHistory()->replaceState(WTFMove(data), fullURL.string());
frame->loader().client().dispatchDidReplaceStateWithinPage();
}

Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/page/NavigationHistoryEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ bool NavigationHistoryEntry::sameDocument() const
RefPtr document = dynamicDowncast<Document>(scriptExecutionContext());
if (!document || !document->frame())
return false;
RefPtr currentItem = document->frame()->loader().history().currentItem();
RefPtr currentItem = document->frame()->checkedHistory()->currentItem();
if (!currentItem)
return false;
return currentItem->documentSequenceNumber() == *m_documentSequenceNumber;
Expand Down
6 changes: 3 additions & 3 deletions Source/WebCore/page/Page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ void Page::clearPreviousItemFromAllPages(HistoryItem* item)
if (!localMainFrame)
return;

CheckedRef controller = localMainFrame->loader().history();
CheckedRef controller = localMainFrame->history();
if (item == controller->previousItem()) {
controller->clearPreviousItem();
return;
Expand Down Expand Up @@ -760,12 +760,12 @@ void Page::goToItem(HistoryItem& item, FrameLoadType type, ShouldTreatAsContinui
if (!localMainFrame)
return;

if (localMainFrame->loader().checkedHistory()->shouldStopLoadingForHistoryItem(item)) {
if (localMainFrame->checkedHistory()->shouldStopLoadingForHistoryItem(item)) {
if (localMainFrame)
localMainFrame->checkedLoader()->stopAllLoadersAndCheckCompleteness();
}

localMainFrame->loader().checkedHistory()->goToItem(item, type, shouldTreatAsContinuingLoad);
localMainFrame->checkedHistory()->goToItem(item, type, shouldTreatAsContinuingLoad);
}

void Page::setGroupName(const String& name)
Expand Down
8 changes: 4 additions & 4 deletions Source/WebCore/testing/Internals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1629,7 +1629,7 @@ void Internals::selectColorInColorChooser(HTMLInputElement& element, const Strin

ExceptionOr<Vector<AtomString>> Internals::formControlStateOfPreviousHistoryItem()
{
HistoryItem* mainItem = frame()->loader().history().previousItem();
HistoryItem* mainItem = frame()->history().previousItem();
if (!mainItem)
return Exception { ExceptionCode::InvalidAccessError };
auto uniqueName = frame()->tree().uniqueName();
Expand All @@ -1640,7 +1640,7 @@ ExceptionOr<Vector<AtomString>> Internals::formControlStateOfPreviousHistoryItem

ExceptionOr<void> Internals::setFormControlStateOfPreviousHistoryItem(const Vector<AtomString>& state)
{
HistoryItem* mainItem = frame()->loader().history().previousItem();
HistoryItem* mainItem = frame()->history().previousItem();
if (!mainItem)
return Exception { ExceptionCode::InvalidAccessError };
auto uniqueName = frame()->tree().uniqueName();
Expand Down Expand Up @@ -3940,8 +3940,8 @@ Ref<MemoryInfo> Internals::memoryInfo() const

Vector<String> Internals::getReferencedFilePaths() const
{
frame()->loader().history().saveDocumentAndScrollState();
return FormController::referencedFilePaths(frame()->loader().history().currentItem()->documentState());
frame()->history().saveDocumentAndScrollState();
return FormController::referencedFilePaths(frame()->history().currentItem()->documentState());
}

ExceptionOr<void> Internals::startTrackingRepaints()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ void WebLocalFrameLoaderClient::restoreViewState()
{
#if PLATFORM(IOS_FAMILY)
auto& frame = *m_frame->coreLocalFrame();
auto* currentItem = frame.loader().history().currentItem();
auto* currentItem = frame.history().currentItem();
if (auto* view = frame.view()) {
if (m_frame->isMainFrame())
m_frame->page()->restorePageState(*currentItem);
Expand All @@ -1412,7 +1412,7 @@ void WebLocalFrameLoaderClient::restoreViewState()
}
#else
// Inform the UI process of the scale factor.
double scaleFactor = m_frame->coreLocalFrame()->loader().history().currentItem()->pageScaleFactor();
double scaleFactor = m_frame->coreLocalFrame()->history().currentItem()->pageScaleFactor();

// A scale factor of 0 means the history item has the default scale factor, thus we do not need to update it.
if (scaleFactor)
Expand Down
10 changes: 5 additions & 5 deletions Source/WebKit/WebProcess/WebPage/WebPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1939,7 +1939,7 @@ void WebPage::suspendForProcessSwap()
};

// FIXME: Make this work if the main frame is not a LocalFrame.
RefPtr currentHistoryItem = m_mainFrame->coreLocalFrame()->loader().history().currentItem();
RefPtr currentHistoryItem = m_mainFrame->coreLocalFrame()->history().currentItem();
if (!currentHistoryItem) {
failedToSuspend();
return;
Expand Down Expand Up @@ -2260,7 +2260,7 @@ void WebPage::goToBackForwardItemWaitingForProcessLaunch(GoToBackForwardItemPara
void WebPage::tryRestoreScrollPosition()
{
if (RefPtr localMainFrame = dynamicDowncast<LocalFrame>(m_page->mainFrame()))
localMainFrame->loader().history().restoreScrollPositionAndViewState();
localMainFrame->checkedHistory()->restoreScrollPositionAndViewState();
}

WebPage* WebPage::fromCorePage(Page& page)
Expand Down Expand Up @@ -3210,7 +3210,7 @@ void WebPage::pageStoppedScrolling()
{
// Maintain the current history item's scroll position up-to-date.
if (RefPtr frame = m_mainFrame->coreLocalFrame())
frame->loader().history().saveScrollPositionAndViewStateToItem(frame->loader().history().currentItem());
frame->checkedHistory()->saveScrollPositionAndViewStateToItem(frame->history().currentItem());
}

void WebPage::setHasActiveAnimatedScrolls(bool hasActiveAnimatedScrolls)
Expand Down Expand Up @@ -3734,7 +3734,7 @@ void WebPage::setCurrentHistoryItemForReattach(WebKit::BackForwardListItemState&
auto& historyItemRef = historyItem.get();
static_cast<WebBackForwardListProxy&>(corePage()->backForward().client()).addItemFromUIProcess(itemState.identifier, WTFMove(historyItem), m_identifier, WebBackForwardListProxy::OverwriteExistingItem::Yes);
if (auto* localMainFrame = dynamicDowncast<WebCore::LocalFrame>(corePage()->mainFrame()))
localMainFrame->loader().history().setCurrentItem(historyItemRef);
localMainFrame->checkedHistory()->setCurrentItem(historyItemRef);
}

void WebPage::requestFontAttributesAtSelectionStart(CompletionHandler<void(const WebCore::FontAttributes&)>&& completionHandler)
Expand Down Expand Up @@ -4065,7 +4065,7 @@ void WebPage::visibilityDidChange()
// We save the document / scroll state when backgrounding a tab so that we are able to restore it
// if it gets terminated while in the background.
if (RefPtr frame = m_mainFrame->coreLocalFrame())
frame->loader().history().saveDocumentAndScrollState();
frame->checkedHistory()->saveDocumentAndScrollState();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ static void addRedirectURL(WebHistoryItem *item, const String& url)

void WebFrameLoaderClient::restoreViewState()
{
WebCore::HistoryItem* currentItem = core(m_webFrame.get())->loader().history().currentItem();
WebCore::HistoryItem* currentItem = core(m_webFrame.get())->history().currentItem();
ASSERT(currentItem);

// FIXME: As the ASSERT attests, it seems we should always have a currentItem here.
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKitLegacy/mac/WebView/WebFrame.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@ - (void)_saveViewState
{
ASSERT(!WebThreadIsEnabled() || WebThreadIsLocked());
auto& frameLoader = _private->coreFrame->loader();
auto* item = frameLoader.history().currentItem();
auto* item = _private->coreFrame->history().currentItem();
if (item)
frameLoader.client().saveViewStateToItem(*item);
}
Expand Down
4 changes: 2 additions & 2 deletions Source/WebKitLegacy/mac/WebView/WebView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,7 @@ - (void)_replaceCurrentHistoryItem:(WebHistoryItem *)item
{
auto* frame = [self _mainCoreFrame];
if (frame)
frame->loader().history().replaceCurrentItem(core(item));
frame->history().replaceCurrentItem(core(item));
}

+ (void)willEnterBackgroundWithCompletionHandler:(void(^)(void))handler
Expand Down Expand Up @@ -2776,7 +2776,7 @@ - (void)_loadBackForwardListFromOtherView:(WebView *)otherView
// since that might have changed since loading and it is normally not saved
// until we leave that page.
if (auto* localMainFrame = dynamicDowncast<WebCore::LocalFrame>(otherView->_private->page->mainFrame()))
localMainFrame->loader().history().saveDocumentAndScrollState();
localMainFrame->history().saveDocumentAndScrollState();
}
Ref<WebCore::HistoryItem> newItem = otherBackForward.itemAtIndex(i)->copy();
if (i == 0)
Expand Down

0 comments on commit 86923db

Please sign in to comment.