Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 608b8e3a70180aee6452e93d029920e31f56275a
      
https://github.com/WebKit/WebKit/commit/608b8e3a70180aee6452e93d029920e31f56275a
  Author: Brady Eidson <[email protected]>
  Date:   2026-04-28 (Tue, 28 Apr 2026)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListItem.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h
    M Source/WebKit/UIProcess/WebBackForwardList.cpp
    M Source/WebKit/UIProcess/WebBackForwardList.h
    M Source/WebKit/UIProcess/WebBackForwardList.swift
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKBackForwardListTests.mm

  Log Message:
  -----------
  Back button not enabled in JS created windows when it should be
rdar://175516150
https://bugs.webkit.org/show_bug.cgi?id=313487

Reviewed by Richard Robinson.

Say JavaScript creates a new window.
That window starts out with a session history for items the user has never 
interacted with.

Once the user clicks a link on that document, we push a new session history 
entry that *does*
have user interaction. But when analyzing the back list we notice the previous 
item had no
interaction, and therefore don't reveal it to the API back/forward list.

The intention is that once the user makes a new entry by interacting, a series 
of non-interacted-with
items in the back list are coalesced into one logical step in the list.

311615@main accidentally broke that logic if the series of interaction-free 
items was at the
start of the list (as in the new window case)

This PR fixes that and gives progressions on some other API tests that had some 
back counts wrong.

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

* Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListItem.mm:
(-[WKBackForwardListItem _loggingStringForTesting]):
* Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h:
* Source/WebKit/UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::itemStartingAtIndexSkippingItemsAddedByJSWithoutUserGesture
 const):
(WebKit::WebBackForwardList::loggingString const):
(WebKit::WebBackForwardList::loggingString): Deleted.
* Source/WebKit/UIProcess/WebBackForwardList.h:
* Source/WebKit/UIProcess/WebBackForwardList.swift:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKBackForwardListTests.mm:
(runBackForwardNavigationSkipsItemsWithoutUserGestureTest):
(TEST(WKBackForwardList, BackNavigationHijacking)):
(TEST(WKBackForwardList, ForwardSkipIteratesThroughLeadingConsecutiveJSItems)):
(TEST(WKBackForwardList, 
BackForwardNavigationSkipsPromiseRedirectWithoutUserInteraction)):
(TEST(WKBackForwardList, BackButtonWorksAfterUserClickFromJSCreatedPage)):

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



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

Reply via email to