[webkit-changes] [WebKit/WebKit] 6fb0e8: Back button needs to be pressed twice to go back o...

Chris Dumez noreply at github.com
Fri Aug 25 11:09:55 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6fb0e85b7be0f97a9adf9d9051eba6b9561fbab0
      https://github.com/WebKit/WebKit/commit/6fb0e85b7be0f97a9adf9d9051eba6b9561fbab0
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-08-25 (Fri, 25 Aug 2023)

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

  Log Message:
  -----------
  Back button needs to be pressed twice to go back on https://www.liveilpalazzoapartments.com
https://bugs.webkit.org/show_bug.cgi?id=260682
rdar://113772385

Reviewed by Brent Fulgham.

WebKit normally ignores history entries added by the JavaScript without user
interaction when navigating back or forward.

Here, the site is adding a history entry using `history.pushState()`, without
user interaction but it was incorrectly not getting ignored when navigating
back.

The reason for this is that they are calling `history.pushState()` from a
subframe. Navigations in subframes still create a top-level back/forward
list item. However, we had a bug in HistoryController::pushState() where
we would set the `wasCreatedByJSWithoutUserInteraction` flag on m_currentItem
instead of topItem. topItem and m_currentItem are the same when
`history.pushState()` gets called on the main frame but not in this case.

* Source/WebCore/loader/HistoryController.cpp:
(WebCore::FrameLoader::HistoryController::pushState):
* Tools/TestWebKitAPI/Tests/WebKit/WKBackForwardListTests.mm:
(TEST):

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




More information about the webkit-changes mailing list