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

  Changed paths:
    M Source/WebCore/loader/HistoryController.cpp
    M Source/WebKit/Shared/WebBackForwardListFrameItem.cpp
    M Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListInternal.h
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKBackForwardListTests.mm

  Log Message:
  -----------
  Browser back/forward button skipping some pages on github
rdar://176231638
https://bugs.webkit.org/show_bug.cgi?id=314156

Reviewed by Abrar Rahman Protyasha.

Github does the following when clicking certain types of links on some pages:
1 - Prevent's default on the link click
2 - Performs a `fetch` for the resource instead
3 - In the fetch callback, sometimes replaces the content inline and changes 
URL with `pushState`
4 - Other times in the fetch callback, navigates by setting `location.href`

In the (4) case, the fact that the navigation is logically the direct result of 
a user click is lost.
This means that when the back/forward item for that navigation is created, it 
is incorrectly
flagged as "created by JS without user gesture".

As of 311615@main we started hiding some of these items from clients at the 
WebKit API level,
leading to a confusing back/forward button experience at github.

This patch extends the 10-second "last transient activation" mechanism to the 
history update,
allowing items created within this span to be considered user created.

Also committing some drive by fixes I noticed while I was debugging the issue

Claude helped come up with this test.

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

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

* Source/WebKit/Shared/WebBackForwardListFrameItem.cpp:
(WebKit::WebBackForwardListFrameItem::loggingStringAtIndent):
* Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListInternal.h:

* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKBackForwardListTests.mm:
(TEST(WKBackForwardList, 
CrossDocumentNavigationWithRecentUserGestureNotFlagged)):

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



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

Reply via email to