Skip to content

Commit

Permalink
Remove unneeded code in HistoryController::createItemTree
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=273790
rdar://127621115

Reviewed by Pascoe.

This code was added 16 years ago in 24907@main. It was intended to fix an issue where reloading would
create a history item for an <object> element that might not have loaded. Today, history items are not
created upon reloading. With site isolation, we are not always able to check if a child frame has loaded,
so we should just remove this code.

The test that was added in 24907@main still passes:
http/tests/navigation/fallback-anchor-reload.html

* Source/WebCore/loader/HistoryController.cpp:
(WebCore::HistoryController::createItemTree):

Canonical link: https://commits.webkit.org/278433@main
  • Loading branch information
charliewolfe committed May 7, 2024
1 parent f7fb91f commit 1be8c36
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions Source/WebCore/loader/HistoryController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,20 +757,8 @@ Ref<HistoryItem> HistoryController::createItemTree(HistoryItemClient& client, Lo
item->setDocumentSequenceNumber(previousItem->documentSequenceNumber());
}

for (auto* child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) {
RefPtr localChild = dynamicDowncast<LocalFrame>(child);
if (!localChild)
continue;
CheckedRef childLoader = localChild->loader();
bool hasChildLoaded = childLoader->frameHasLoaded();

// If the child is a frame corresponding to an <object> element that never loaded,
// we don't want to create a history item, because that causes fallback content
// to be ignored on reload.

if (!(!hasChildLoaded && localChild->ownerElement() && is<HTMLObjectElement>(localChild->ownerElement())))
item->addChildItem(localChild->checkedHistory()->createItemTree(client, targetFrame, clipAtTarget));
}
for (RefPtr child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling())
item->addChildItem(child->checkedHistory()->createItemTree(client, targetFrame, clipAtTarget));
}
// FIXME: Eliminate the isTargetItem flag in favor of itemSequenceNumber.
if (m_frame.ptr() == &targetFrame)
Expand Down

0 comments on commit 1be8c36

Please sign in to comment.