Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 96d6f336d4e2eee88e3448fac2ec63bb6a72be91
      
https://github.com/WebKit/WebKit/commit/96d6f336d4e2eee88e3448fac2ec63bb6a72be91
  Author: Brady Eidson <[email protected]>
  Date:   2026-05-23 (Sat, 23 May 2026)

  Changed paths:
    M Source/WebKit/UIProcess/WebBackForwardList.cpp
    M Source/WebKit/UIProcess/WebBackForwardList.swift
    M 
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/RestoreSessionStateWithoutNavigation.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKBackForwardListTests.mm

  Log Message:
  -----------
  Can no longer "Close and return to ..." after opening a new window in Safari
rdar://177655022
https://bugs.webkit.org/show_bug.cgi?id=315433

Reviewed by Simon Fraser.

When a website opens a new tab in Safari (window.open(), target="_blank", etc), 
Safari inserts a placeholder
"parent-tab://" entry into the start of the back/forward list of the new tab.

This enables the feature in Safari where the back button is enabled, and it 
provides a "Close and return to..."
item which - when activated - causes Safari to close the new tab and refocus 
the originating window.

During the "filter some items from the API representation of the back/forward 
list" work that's been going on,
we inadvertently filtered this item out in a common case. This left the back 
button disabled for most new
windows, and breaking this convenience.

This PR implements a small tweak to the filtering algorithm to let this item 
peek through.

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

* Source/WebKit/UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::itemStartingAtIndexSkippingItemsAddedByJSWithoutUserGesture
 const):
* Source/WebKit/UIProcess/WebBackForwardList.swift:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKBackForwardListTests.mm:
(TEST(WKBackForwardList, BackForwardNavigationLandsOnInitialItemPastJSChain)):

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



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

Reply via email to