Skip to content

backListCount()/forwardListCount() don't match the sizes of the backList() and forwardList() arrays#65158

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
beidson:eng/backListCount-forwardListCount-don-t-match-the-sizes-of-the-backList-and-forwardList-arrays
May 19, 2026
Merged

backListCount()/forwardListCount() don't match the sizes of the backList() and forwardList() arrays#65158
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
beidson:eng/backListCount-forwardListCount-don-t-match-the-sizes-of-the-backList-and-forwardList-arrays

Conversation

@beidson
Copy link
Copy Markdown
Contributor

@beidson beidson commented May 19, 2026

b8c7728

backListCount()/forwardListCount() don't match the sizes of the backList() and forwardList() arrays
rdar://176640408
https://bugs.webkit.org/show_bug.cgi?id=315072

Reviewed by Chris Dumez.

This broke with the "Skip back/forward items at the API level" changes in 311688@main and 311799@main

After those changes, the backList()/forwardList() would return arrays with skipped items, but the old
"get me the back/forward list count" APIs didn't do the skipping.

Some clients were mixing and matching those, and they were having a bad time.

This PR does some renaming for clarity, and makes the "count" methods just return the size of the
calculated array, ensuring the same calculations are used across the board.

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

* Source/WebKit/UIProcess/API/C/WKBackForwardListRef.cpp:
(WKBackForwardListGetBackListCount):
(WKBackForwardListGetForwardListCount):
* Source/WebKit/UIProcess/API/glib/WebKitBackForwardList.cpp:
(webkit_back_forward_list_get_length):
(webkit_back_forward_list_get_back_list):
(webkit_back_forward_list_get_forward_list):
* Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::traverseHistoryInBrowsingContext):
* Source/WebKit/UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::rawBackListEntryCount const):
(WebKit::WebBackForwardList::rawForwardListEntryCount const):
(WebKit::WebBackForwardList::backListCountForAPI const):
(WebKit::WebBackForwardList::forwardListCountForAPI const):
(WebKit::WebBackForwardList::counts const):
(WebKit::WebBackForwardList::backList const):
(WebKit::WebBackForwardList::forwardList const):
(WebKit::WebBackForwardList::backListAsAPIArrayWithLimit const):
(WebKit::WebBackForwardList::forwardListAsAPIArrayWithLimit const):
(WebKit::WebBackForwardListWrapper::backListCountForAPI const):
(WebKit::WebBackForwardListWrapper::forwardListCountForAPI const):
(WebKit::WebBackForwardListWrapper::backList const):
(WebKit::WebBackForwardListWrapper::forwardList const):
(WebKit::WebBackForwardList::backListCount const): Deleted.
(WebKit::WebBackForwardList::forwardListCount const): Deleted.
(WebKit::WebBackForwardListWrapper::backListCount const): Deleted.
(WebKit::WebBackForwardListWrapper::forwardListCount const): Deleted.
* Source/WebKit/UIProcess/WebBackForwardList.h:
* Source/WebKit/UIProcess/WebBackForwardList.swift:
(Direction.rawBackListEntryCount):
(Direction.rawForwardListEntryCount):
(Direction.backListCountForAPI):
(Direction.forwardListCountForAPI):
(Direction.counts):
(Direction.backListAsAPIArrayWithLimit(_:)):
(Direction.forwardListAsAPIArrayWithLimit(_:)):
(Direction.backListCount): Deleted.
(Direction.forwardListCount): Deleted.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKBackForwardListTests.mm:
(verifyBackForwardListCountsMatchArraySizes):
(setupBackForwardListWithItemsWithoutUserGesture):
(runBackForwardNavigationSkipsItemsWithoutUserGestureCheck):
(runJSHistoryBackDoesNotSkipItemsWithoutUserGestureCheck):

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

8e63770

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ✅ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 🧪 win-tests ⏳ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ⏳ 🛠 vision-apple
🧪 ios-wk2-wpt 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim ✅ 🧪 mac-site-isolation
✅ 🛠 watch
✅ 🛠 watch-sim

@beidson beidson requested review from a team, burg, carlosgcampos, cdumez and rr-codes as code owners May 19, 2026 03:28
@beidson beidson self-assigned this May 19, 2026
@webkit-ews-buildbot
Copy link
Copy Markdown
Collaborator

macOS Safer C++ Build #108210 (6945581)

❌ Found 1 failing file with 2 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming.
(cc @rniwa)

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label May 19, 2026
@webkit-ews-buildbot
Copy link
Copy Markdown
Collaborator

iOS Safer C++ Build #26801 (6945581)

❌ Found 1 failing file with 2 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming.
(cc @rniwa)

Comment thread Source/WebKit/UIProcess/WebBackForwardList.cpp Outdated
Comment thread Source/WebKit/UIProcess/WebBackForwardList.cpp Outdated
Comment thread Source/WebKit/UIProcess/WebBackForwardList.cpp Outdated
Comment thread Source/WebKit/UIProcess/WebBackForwardList.cpp Outdated
@beidson beidson removed the merging-blocked Applied to prevent a change from being merged label May 19, 2026
@beidson beidson force-pushed the eng/backListCount-forwardListCount-don-t-match-the-sizes-of-the-backList-and-forwardList-arrays branch from 6945581 to 3a46c44 Compare May 19, 2026 13:55
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label May 19, 2026
@webkit-ews-buildbot
Copy link
Copy Markdown
Collaborator

macOS Safer C++ Build #108484 (3a46c44)

❌ Found 1 failing file with 2 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming.
(cc @rniwa)

@webkit-ews-buildbot
Copy link
Copy Markdown
Collaborator

iOS Safer C++ Build #27082 (3a46c44)

❌ Found 1 failing file with 2 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming.
(cc @rniwa)

@beidson beidson removed the merging-blocked Applied to prevent a change from being merged label May 19, 2026
@beidson beidson force-pushed the eng/backListCount-forwardListCount-don-t-match-the-sizes-of-the-backList-and-forwardList-arrays branch from 3a46c44 to b2b4ea9 Compare May 19, 2026 17:30
@beidson beidson force-pushed the eng/backListCount-forwardListCount-don-t-match-the-sizes-of-the-backList-and-forwardList-arrays branch from b2b4ea9 to 8e63770 Compare May 19, 2026 18:56
@beidson beidson added the merge-queue Applied to send a pull request to merge-queue label May 19, 2026
…ist() and forwardList() arrays

rdar://176640408
https://bugs.webkit.org/show_bug.cgi?id=315072

Reviewed by Chris Dumez.

This broke with the "Skip back/forward items at the API level" changes in 311688@main and 311799@main

After those changes, the backList()/forwardList() would return arrays with skipped items, but the old
"get me the back/forward list count" APIs didn't do the skipping.

Some clients were mixing and matching those, and they were having a bad time.

This PR does some renaming for clarity, and makes the "count" methods just return the size of the
calculated array, ensuring the same calculations are used across the board.

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

* Source/WebKit/UIProcess/API/C/WKBackForwardListRef.cpp:
(WKBackForwardListGetBackListCount):
(WKBackForwardListGetForwardListCount):
* Source/WebKit/UIProcess/API/glib/WebKitBackForwardList.cpp:
(webkit_back_forward_list_get_length):
(webkit_back_forward_list_get_back_list):
(webkit_back_forward_list_get_forward_list):
* Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::traverseHistoryInBrowsingContext):
* Source/WebKit/UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::rawBackListEntryCount const):
(WebKit::WebBackForwardList::rawForwardListEntryCount const):
(WebKit::WebBackForwardList::backListCountForAPI const):
(WebKit::WebBackForwardList::forwardListCountForAPI const):
(WebKit::WebBackForwardList::counts const):
(WebKit::WebBackForwardList::backList const):
(WebKit::WebBackForwardList::forwardList const):
(WebKit::WebBackForwardList::backListAsAPIArrayWithLimit const):
(WebKit::WebBackForwardList::forwardListAsAPIArrayWithLimit const):
(WebKit::WebBackForwardListWrapper::backListCountForAPI const):
(WebKit::WebBackForwardListWrapper::forwardListCountForAPI const):
(WebKit::WebBackForwardListWrapper::backList const):
(WebKit::WebBackForwardListWrapper::forwardList const):
(WebKit::WebBackForwardList::backListCount const): Deleted.
(WebKit::WebBackForwardList::forwardListCount const): Deleted.
(WebKit::WebBackForwardListWrapper::backListCount const): Deleted.
(WebKit::WebBackForwardListWrapper::forwardListCount const): Deleted.
* Source/WebKit/UIProcess/WebBackForwardList.h:
* Source/WebKit/UIProcess/WebBackForwardList.swift:
(Direction.rawBackListEntryCount):
(Direction.rawForwardListEntryCount):
(Direction.backListCountForAPI):
(Direction.forwardListCountForAPI):
(Direction.counts):
(Direction.backListAsAPIArrayWithLimit(_:)):
(Direction.forwardListAsAPIArrayWithLimit(_:)):
(Direction.backListCount): Deleted.
(Direction.forwardListCount): Deleted.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKBackForwardListTests.mm:
(verifyBackForwardListCountsMatchArraySizes):
(setupBackForwardListWithItemsWithoutUserGesture):
(runBackForwardNavigationSkipsItemsWithoutUserGestureCheck):
(runJSHistoryBackDoesNotSkipItemsWithoutUserGestureCheck):

Canonical link: https://commits.webkit.org/313516@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/backListCount-forwardListCount-don-t-match-the-sizes-of-the-backList-and-forwardList-arrays branch from 8e63770 to b8c7728 Compare May 19, 2026 20:35
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 313516@main (b8c7728): https://commits.webkit.org/313516@main

Reviewed commits have been landed. Closing PR #65158 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit b8c7728 into WebKit:main May 19, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants