Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 523b810325c4ddb180cca01c35a0f8981a9eed77
      
https://github.com/WebKit/WebKit/commit/523b810325c4ddb180cca01c35a0f8981a9eed77
  Author: Brady Eidson <[email protected]>
  Date:   2026-05-24 (Sun, 24 May 2026)

  Changed paths:
    M Source/WebCore/loader/FrameLoader.cpp
    M Source/WebCore/loader/HistoryController.cpp
    M Source/WebCore/loader/HistoryController.h
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKBackForwardListTests.mm

  Log Message:
  -----------
  Back button not enabled on sciencedirect.com to support Safari's "Close and 
return to ..." feature for new windows
rdar://177792841
https://bugs.webkit.org/show_bug.cgi?id=315440

Reviewed by Richard Robinson.

Before this change, we add new history items to the back/forward list in one 
step, then flag them as
"created by JS without user interaction" in a separate step.

The first step performs a delegate callback to notify the app that the bf-list 
changed.
The app then runs some code based on the bf-list change.

Then the second step updates the items flag, which can change the presentation 
of the bf-list,
notably by making it shorter by hiding some items.

But the app saw the "incorrect" list already, and already ran code, which 
might've been destructive.

This patch sets the flag upon initial creation of the history item which 
removes this interstitial gap.

This allows the app to make its decisions based on an always accurate 
presentation of the bf-list.

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKBackForwardListTests.mm

* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadInSameDocument):
* Source/WebCore/loader/HistoryController.cpp:
(WebCore::HistoryController::updateBackForwardListForFragmentScroll):
(WebCore::HistoryController::updateForStandardLoad):
(WebCore::HistoryController::updateBackForwardListClippedAtTarget):
(WebCore::HistoryController::updateBackForwardListForReplaceState):
* Source/WebCore/loader/HistoryController.h:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKBackForwardListTests.mm:
(-[ItemAddedRecordingDelegate webView:didFinishNavigation:]):
(-[ItemAddedRecordingDelegate _webView:navigation:didSameDocumentNavigation:]):
(-[ItemAddedRecordingDelegate _webView:backForwardListItemAdded:removed:]):
(TEST(WKBackForwardList, 
ItemAddedDelegateObservesUserGestureFlagAtCallbackTime)):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to