feat(libSceNKWebKit): implement WKBackForwardList and item getters #15157

Merged
nicolasabosch merged 6 commits from upstream-pr/15157 into main 2026-11-07 02:54:11 +00:00
nicolasabosch commented 2026-11-02 19:30:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nicolasabosch on 2026-11-02T19:30:39Z.


What

Implements the nine WKBackForwardList functions (Clear, GetCurrentItem, GetBackItem, GetForwardItem, GetItemAtIndex, GetBackListCount, GetForwardListCount, CopyBackListWithLimit, CopyForwardListWithLimit) and the three WKBackForwardListItem getters (CopyURL, CopyTitle, CopyOriginalURL) in libSceNKWebKit, following the pinned WKBackForwardListRef.cpp, WKBackForwardListItemRef.cpp and WebBackForwardList.cpp. The list holds its items, a current index and an attached flag standing for the page pointer; a detached list or one without a current item returns null and zero, GetItemAtIndex range-checks without arithmetic on the index, and Clear keeps only the current item. A null or wrong-type reference throws as for the other WK* objects.

The 7439 total on line 30 of docs/dev/debt/libSceNKWebKit.md becomes 7427; the other open libSceNKWebKit PRs edit the same line, so whichever merges second needs that number rebased.

Tested

Windows, MinGW GCC Release build of nkwebkit_base_tests: passes, including a new test of normal, empty, out-of-range, null and wrong-type inputs. python tools/check_conventions.py --base upstream/main passes. public_headers hit its 90 s timeout on this machine and was not run on main, so it is unconfirmed. No title was run.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5126190509 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15157). Originally posted by [nicolasabosch](https://github.com/nicolasabosch) on 2026-11-02T19:30:39Z. --- ### What Implements the nine `WKBackForwardList` functions (`Clear`, `GetCurrentItem`, `GetBackItem`, `GetForwardItem`, `GetItemAtIndex`, `GetBackListCount`, `GetForwardListCount`, `CopyBackListWithLimit`, `CopyForwardListWithLimit`) and the three `WKBackForwardListItem` getters (`CopyURL`, `CopyTitle`, `CopyOriginalURL`) in `libSceNKWebKit`, following the pinned [WKBackForwardListRef.cpp](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebKit/UIProcess/API/C/WKBackForwardListRef.cpp), [WKBackForwardListItemRef.cpp](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebKit/UIProcess/API/C/WKBackForwardListItemRef.cpp) and [WebBackForwardList.cpp](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebKit/UIProcess/WebBackForwardList.cpp). The list holds its items, a current index and an attached flag standing for the page pointer; a detached list or one without a current item returns null and zero, `GetItemAtIndex` range-checks without arithmetic on the index, and `Clear` keeps only the current item. A null or wrong-type reference throws as for the other `WK*` objects. The `7439` total on line 30 of `docs/dev/debt/libSceNKWebKit.md` becomes `7427`; the other open `libSceNKWebKit` PRs edit the same line, so whichever merges second needs that number rebased. ### Tested Windows, MinGW GCC Release build of `nkwebkit_base_tests`: passes, including a new test of normal, empty, out-of-range, null and wrong-type inputs. `python tools/check_conventions.py --base upstream/main` passes. `public_headers` hit its 90 s timeout on this machine and was not run on `main`, so it is unconfirmed. No title was run. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
BunnyFl commented 2026-11-02 20:18:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T20:18:31Z.

Review: APPROVED


Matches the pinned WebBackForwardList.cpp function by function:

  • currentItem, backItem, forwardItem, backListCount and forwardListCount with attached standing for m_page.
  • itemAtIndex's range checks without arithmetic on the index (the 64-bit negation also avoids -INT_MIN).
  • clear keeping only the current item, or emptying the list when there is none.
  • backListAsAPIArrayWithLimit taking the last min(backCount, limit) entries before the current one and forwardListAsAPIArrayWithLimit the first min(forwardCount, limit) after it, with an empty array when there's no current item.

CurrentIndex also returns no index when the stored one is past the end, where WebKit only asserts. That's a harmless extra guard.

Tested on Windows 11, WinLibs GCC 15.2.0, with this head merged onto main: nkwebkit_base and public_headers pass (nothing skipped). With main's Export.cpp, InventoryExports.hpp and WebKitValueExports.hpp, the new test doesn't build against the old declarations.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5742763655 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15157#pullrequestreview-5742763655). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-02T20:18:31Z. **Review:** APPROVED --- Matches the pinned [WebBackForwardList.cpp](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebKit/UIProcess/WebBackForwardList.cpp) function by function: - `currentItem`, `backItem`, `forwardItem`, `backListCount` and `forwardListCount` with `attached` standing for `m_page`. - `itemAtIndex`'s range checks without arithmetic on the index (the 64-bit negation also avoids `-INT_MIN`). - `clear` keeping only the current item, or emptying the list when there is none. - `backListAsAPIArrayWithLimit` taking the last `min(backCount, limit)` entries before the current one and `forwardListAsAPIArrayWithLimit` the first `min(forwardCount, limit)` after it, with an empty array when there's no current item. `CurrentIndex` also returns no index when the stored one is past the end, where WebKit only asserts. That's a harmless extra guard. Tested on Windows 11, WinLibs GCC 15.2.0, with this head merged onto `main`: `nkwebkit_base` and `public_headers` pass (nothing skipped). With `main`'s `Export.cpp`, `InventoryExports.hpp` and `WebKitValueExports.hpp`, the new test doesn't build against the old declarations.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!15157
No description provided.