Repository navigation
[Navigation API] Fix 16% PLT regression by removing Sync IPC - #50566
Merged
webkit-commit-queue merged 1 commit intoSep 11, 2025
Merged
Conversation
Collaborator
|
EWS run on previous version of this PR (hash 5acbd63) Details |
charliewolfe
approved these changes
Sep 10, 2025
charliewolfe
marked this pull request as ready for review
September 10, 2025 21:37
RupinMittal
force-pushed
the
eng/RemoveNavigationAPISyncIPC
branch
from
September 11, 2025 02:11
5acbd63 to
15dd4f2
Compare
Collaborator
|
EWS run on previous version of this PR (hash 15dd4f2) Details |
RupinMittal
force-pushed
the
eng/RemoveNavigationAPISyncIPC
branch
from
September 11, 2025 07:06
15dd4f2 to
fcc157a
Compare
Collaborator
|
EWS run on current version of this PR (hash fcc157a) Details |
Contributor
Author
|
The Apple Internal failures are unrelated. |
https://bugs.webkit.org/show_bug.cgi?id=298498 rdar://160000632 Reviewed by Charlie Wolfe. When a new Document is created, its Navigation object's list of history entries must be initialized. In the initial implementation of the Navigation API in 273532@main, this was done by making a sync IPC to the UI Process to get each item in the b/f list. (The calls to itemAtIndex()). 298922@main changed this so the whole list is retrieved in just one sync IPC call (The call to itemsForFrame()). Then, the list would be filtered to keep only the items that this frame could reach via the Navigation API. So enabling the Navigation API means that every time a new Document is created, a new sync IPC is sent. This is terrible for performance. It's a ~16% PLT regression. To fix this, this patch removes this extra sync IPC. Instead of getting this list via IPC, we get the list from the previous Document. There are three situations to handle: 1. If the previous Document is of the same origin, then it will have list we need. It will not have the new entry that triggered this navigation, but we can add this. Since the previous list only contains items reachable via the Navigation API, we do not need to filter out any items. 2. If the previous Document is not of the same origin, it means we don't need the entries of it's list. The only entry in the new Document's list should be the entry that triggered this navigation. So we can initialize the new list with just this entry. These two situations are handled. 3. If we are creating this Document as a result of a back/forward navigation that is cross-origin, then the previous Document's entries are not needed. But we must restore the entries that this Document used to have. For example, imagine we do the following navigations in the same frame: google.com google.com#1 google.com#2 webkit.org go back Then navigation.entries() should contain three entries: (google.com, google.com#1, google.com#2). Currently, it will (wrongly) contain only the last. This wrong behavior predates this patch. Since this patch simply aims to remove the sync IPC, it does not fix this behavior. A bug has been filed: https://bugs.webkit.org/show_bug.cgi?id=298683. * Source/WebCore/history/BackForwardController.cpp: (WebCore::BackForwardController::itemsForFrame): Deleted. * Source/WebCore/history/BackForwardController.h: * Source/WebCore/page/Navigation.cpp: (WebCore::getEntryIndexOfHistoryItem): (WebCore::Navigation::initializeForNewWindow): - Get the previous Document's list regardless of if the previous Document was in the main frame or a subframe. - No need for the filtering since we aren't getting the entire unfiltered b/f list from the UI Process but rather the previous Document's already filtered list. - Add the entry that triggered this navigation. (WebCore::Navigation::updateForReactivation): This patch initially causes the https-in-page-cache.html test to fail. That's because in this situation, the second location change is a RedirectWithLockedBackForwardList with the history handling set to Push. The UI Process does a replace but the Navigation API spec expects a Push operation--a second item to be added to b/f list (https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-location-interface:location-object-navigate). Now that we are getting the list from the previous window instead of the UI Process, we end up two items with the same itemID in updateForReactivation. So instead of comparing with the itemID, we must compare with itemSequenceNumber. Canonical link: https://commits.webkit.org/299858@main
webkit-commit-queue
force-pushed
the
eng/RemoveNavigationAPISyncIPC
branch
from
September 11, 2025 17:08
fcc157a to
c0ca2b2
Compare
Collaborator
|
Committed 299858@main (c0ca2b2): https://commits.webkit.org/299858@main Reviewed commits have been landed. Closing PR #50566 and removing active labels. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
c0ca2b2
fcc157a