Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 530b62a6cfaafc2c3611bb429317196f06930664
      
https://github.com/WebKit/WebKit/commit/530b62a6cfaafc2c3611bb429317196f06930664
  Author: Rupin Mittal <[email protected]>
  Date:   2025-09-26 (Fri, 26 Sep 2025)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/navigate-replace-cross-document-expected.txt
    M Source/WebCore/history/BackForwardCache.cpp
    M Source/WebCore/loader/FrameLoader.cpp
    M Source/WebCore/loader/FrameLoaderTypes.h
    M Source/WebCore/loader/HistoryController.cpp
    M Source/WebCore/page/Page.cpp
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKitLegacy/mac/WebView/WebFrame.mm

  Log Message:
  -----------
  [Navigation API] Replace wrongly adds a new item to the UI Process b/f list
https://bugs.webkit.org/show_bug.cgi?id=298465
rdar://159962421

Reviewed by Basuke Suzuki.

The test navigate-replace-cross-document.html fails because the replace
operation adds a new item to the UI Process b/f list instead of replacing the
current one as it should.

The issue is that once the new URL is loaded, we call
HistoryController::updateForStandardLoad (which creates a new item and
appends this to the UI Process b/f list) instead of
HistoryController::updateForReloadOrReplace which will replace the
current item.

To fix this, we introduce a new FrameLoadType called NavigationAPIReplace.
FrameLoader::loadFrameRequest will set this as the load type on a Navigation API
replace operation. And on this load type, FrameLoader::transitionToCommitted 
will
call HistoryController::updateForReloadOrReplace.

* 
LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/navigate-replace-cross-document-expected.txt:
* Source/WebCore/history/BackForwardCache.cpp:
(WebCore::canCachePage):
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::isBackForwardLoadType):
(WebCore::isReload):
(WebCore::determineNavigationType):
(WebCore::FrameLoader::loadFrameRequest):

If the NavigationHistoryBehavior is Replace, this is a Navigation API
Replace operation, set the loadType to NavigationAPIReplace.

(WebCore::FrameLoader::transitionToCommitted):

If the FrameLoadType is NavigationAPIReplace, call
HistoryController::updateForReloadOrReplace.

(WebCore::FrameLoader::subresourceCachePolicy const):
(WebCore::FrameLoader::loadDifferentDocumentItem):
* Source/WebCore/loader/FrameLoaderTypes.h:

New FrameLoadType called NavigationAPIReplace.

* Source/WebCore/loader/HistoryController.cpp:
(WebCore::HistoryController::restoreDocumentState):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::logNavigation):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKitLegacy/mac/WebView/WebFrame.mm:
(toWebFrameLoadType):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to