feat(libSceNKWebKit): implement the WebCore::SettingsBase member exports #22903

Merged
FinleyLaempe merged 7 commits from upstream-pr/22903 into main 2026-11-24 04:43:06 +00:00
FinleyLaempe commented 2026-11-18 13:34:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by FinleyLaempe on 2026-11-18T13:34:08Z.


What

Implements 17 WebCore::SettingsBase member exports in libSceNKWebKit — the seven set*FontFamily(const WTF::AtomString&, UScriptCode) setters, the seven matching *FontFamily(UScriptCode) getters, setMinimumDOMTimerInterval(WTF::Seconds) and both setMediaContentTypesRequiringHardwareSupport overloads — replacing their NotImplemented stubs in Export.cpp.

  • Behaviour follows the pinned SettingsBase.cpp and FontGenericFamilies.cpp, with the table hash and vector growth from pinned HashTable.h and Vector.h. The new src/SettingsBase.cpp carries the upstream notices.
  • Guest layouts: fontGenericFamilies() at vtable slots 0 and 1 with the seven HashMap<int, String> maps at offsets 0–48; WeakPtr<Page> at 8, Seconds at 16, a 48-byte Timer, and the media vector at 72, per the pinned SettingsBase.h member order, checked by static_asserts in the new src/SettingsBaseAbi.hpp. Not compared with a console module.
  • Getters look the script up in the guest hash tables with the pinned integer hash and probing; script 17 (Han) falls back to 73/74 via the new NKWebKit::UserPrefersSimplifiedChinese_nid_no_patch(), then to script 0 (Common), else to the shared empty String. Getters go through the const vtable slot.
  • UserPrefersSimplifiedChinese_nid_no_patch (in src/WtfLanguage.cpp) checks the preferred-languages override for zh-tw/zh-cn and otherwise reads SYSTEM_LANGUAGE as libScePosixForWebKit's getenv_np does, through a new GetenvNp_nid_no_patch helper that getenv_np now wraps (another library cannot import the NID-patched getenv_np export on Windows); libScePosixForWebKit is newly linked as a private dependency in CMakeLists.txt; it recomputes on every call instead of caching, as the debt entry records.
  • Setters are no-ops when the entry already matches, or when an empty family meets no entry; otherwise they throw NotImplemented_nid_no_patch before touching the map, because the unmodelled FontCascadeCache invalidation and per-page style recalculation cannot run, and because upstream mutations with script -2 (the table's empty-bucket sentinel) corrupt the map's key count.
  • setMinimumDOMTimerInterval stores the Seconds value at offset 16 and throws NotImplemented_nid_no_patch first when the WeakPtr<Page> at offset 8 is non-null, since the unmodelled adjustMinimumDOMTimerInterval page-frame walk cannot run.
  • The String media overload splits on ':' skipping empty entries and appends ContentTypes into the stored WTF::Vector with the pinned growth policy; the Vector overload shrinks or grows the stored vector and copy-assigns element-wise, with a self-assignment guard. Storage goes through WTF::fastMalloc/fastFree and WTF::StringImpl::create.
  • Null this, AtomString, String or Vector arguments throw std::invalid_argument before anything is modified; the tests cover each case. Reuses the existing _ZN3WTF5equalEPKNS_10StringImplES2_, StringImpl::create and fastMalloc/fastFree exports, the WtfAbi String/AtomString/Vector guest types and ContentTypeAbi.hpp; new headers src/SettingsBaseAbi.hpp, src/WtfLanguageAbi.hpp and include/SettingsBaseExports.hpp are included from libSceNKWebKit.hpp.
  • Beyond stub removal in Export.cpp, the matching declarations are dropped from include/InventoryExports.hpp and include/LegacyExports.hpp, src/WtfLanguage.cpp gains the language helper, CMakeLists.txt links libScePosixForWebKit, and libScePosixForWebKit gains the GetenvNp_nid_no_patch helper that getenv_np now wraps.
  • Debt: new docs/dev/debt/changes/feat-nkwebkit-settings-base.md adds three Functional entries (font family layout, font family changes, timer and media content types — each "not compared with a console module") and removes the ten NID inventory rows for the getters and the timer/media exports.
  • New tests/SettingsBase.cpp exercises the exports against guest-layout stand-ins: argument checks, lookup fallbacks including Han and the sentinel scripts, the setter no-op/throw split, the page-null timer path and both media overloads.

Tested

Arch Linux x86-64, GCC 16.2.1, Release build with -DBUILD_TESTING=ON: the new nkwebkit_settingsbase test and every other nkwebkit_* test, 143 of 143 passed. python3 tools/check_conventions.py --base upstream/main passes. Not tested on a console or on Windows.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5376991498 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22903). Originally posted by [FinleyLaempe](https://github.com/FinleyLaempe) on 2026-11-18T13:34:08Z. --- ### What Implements 17 `WebCore::SettingsBase` member exports in libSceNKWebKit — the seven `set*FontFamily(const WTF::AtomString&, UScriptCode)` setters, the seven matching `*FontFamily(UScriptCode)` getters, `setMinimumDOMTimerInterval(WTF::Seconds)` and both `setMediaContentTypesRequiringHardwareSupport` overloads — replacing their `NotImplemented` stubs in `Export.cpp`. - Behaviour follows the pinned [`SettingsBase.cpp`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebCore/page/SettingsBase.cpp) and [`FontGenericFamilies.cpp`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebCore/platform/graphics/FontGenericFamilies.cpp), with the table hash and vector growth from pinned [`HashTable.h`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WTF/wtf/HashTable.h) and [`Vector.h`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WTF/wtf/Vector.h). The new `src/SettingsBase.cpp` carries the upstream notices. - Guest layouts: `fontGenericFamilies()` at vtable slots 0 and 1 with the seven `HashMap<int, String>` maps at offsets 0–48; `WeakPtr<Page>` at 8, `Seconds` at 16, a 48-byte `Timer`, and the media vector at 72, per the pinned [`SettingsBase.h`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebCore/page/SettingsBase.h) member order, checked by `static_assert`s in the new `src/SettingsBaseAbi.hpp`. Not compared with a console module. - Getters look the script up in the guest hash tables with the pinned integer hash and probing; script 17 (Han) falls back to 73/74 via the new `NKWebKit::UserPrefersSimplifiedChinese_nid_no_patch()`, then to script 0 (Common), else to the shared empty `String`. Getters go through the const vtable slot. - `UserPrefersSimplifiedChinese_nid_no_patch` (in `src/WtfLanguage.cpp`) checks the preferred-languages override for `zh-tw`/`zh-cn` and otherwise reads `SYSTEM_LANGUAGE` as libScePosixForWebKit's `getenv_np` does, through a new `GetenvNp_nid_no_patch` helper that `getenv_np` now wraps (another library cannot import the NID-patched `getenv_np` export on Windows); libScePosixForWebKit is newly linked as a private dependency in `CMakeLists.txt`; it recomputes on every call instead of caching, as the debt entry records. - Setters are no-ops when the entry already matches, or when an empty family meets no entry; otherwise they throw `NotImplemented_nid_no_patch` before touching the map, because the unmodelled `FontCascadeCache` invalidation and per-page style recalculation cannot run, and because upstream mutations with script -2 (the table's empty-bucket sentinel) corrupt the map's key count. - `setMinimumDOMTimerInterval` stores the `Seconds` value at offset 16 and throws `NotImplemented_nid_no_patch` first when the `WeakPtr<Page>` at offset 8 is non-null, since the unmodelled `adjustMinimumDOMTimerInterval` page-frame walk cannot run. - The `String` media overload splits on `':'` skipping empty entries and appends `ContentType`s into the stored `WTF::Vector` with the pinned growth policy; the `Vector` overload shrinks or grows the stored vector and copy-assigns element-wise, with a self-assignment guard. Storage goes through `WTF::fastMalloc`/`fastFree` and `WTF::StringImpl::create`. - Null `this`, `AtomString`, `String` or `Vector` arguments throw `std::invalid_argument` before anything is modified; the tests cover each case. Reuses the existing `_ZN3WTF5equalEPKNS_10StringImplES2_`, `StringImpl::create` and `fastMalloc`/`fastFree` exports, the `WtfAbi` `String`/`AtomString`/`Vector` guest types and `ContentTypeAbi.hpp`; new headers `src/SettingsBaseAbi.hpp`, `src/WtfLanguageAbi.hpp` and `include/SettingsBaseExports.hpp` are included from `libSceNKWebKit.hpp`. - Beyond stub removal in `Export.cpp`, the matching declarations are dropped from `include/InventoryExports.hpp` and `include/LegacyExports.hpp`, `src/WtfLanguage.cpp` gains the language helper, `CMakeLists.txt` links libScePosixForWebKit, and libScePosixForWebKit gains the `GetenvNp_nid_no_patch` helper that `getenv_np` now wraps. - Debt: new `docs/dev/debt/changes/feat-nkwebkit-settings-base.md` adds three Functional entries (font family layout, font family changes, timer and media content types — each "not compared with a console module") and removes the ten NID inventory rows for the getters and the timer/media exports. - New `tests/SettingsBase.cpp` exercises the exports against guest-layout stand-ins: argument checks, lookup fallbacks including Han and the sentinel scripts, the setter no-op/throw split, the page-null timer path and both media overloads. ### Tested Arch Linux x86-64, GCC 16.2.1, Release build with `-DBUILD_TESTING=ON`: the new `nkwebkit_settingsbase` test and every other `nkwebkit_*` test, 143 of 143 passed. `python3 tools/check_conventions.py --base upstream/main` passes. Not tested on a console or on Windows. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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) and the licence notice of code adapted from upstream (see AGENTS.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
copilot-pull-request-reviewer[bot] commented 2026-11-18 13:34:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-18T13:34:16Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5957644070 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22903#pullrequestreview-5957644070). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-11-18T13:34:16Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
PrivacyOnion commented 2026-11-18 13:40:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-18T13:40:24Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 4109e891a8:

  • Conventions: tools/check_conventions.py passed.
  • Build: nkwebkit_settingsbase_tests built cleanly.
  • CTest (nkwebkit_settingsbase):
    1/1 Test #4577: nkwebkit_settingsbase ............   Passed    0.03 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp, core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp, core/libs/prx/libSceNKWebKit/src/WtfLanguage.cpp, core/libs/prx/libSceNKWebKit/src/SettingsBase.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified null checks for 'self', 'family', 'contentTypes' across all 17 WebCore::SettingsBase exports in core/libs/prx/libSceNKWebKit/src/SettingsBase.cpp and checked that std::invalid_argument is thrown appropriately.
    • Verified WebCore::SettingsBase offset calculations, vtable layout (slot 0/1 for fontGenericFamilies), and structure sizes matching SettingsBaseAbi.hpp and static_asserts.
    • Verified media content types parsing and vector operations in setMediaContentTypesRequiringHardwareSupport (delimiter handling, allocation, size/capacity management, shrink/clear/reserve, and self-assignment guard).
    • Verified font family lookup, quadratic probing hashtable logic, fallback chains (Han -> Simplified/Traditional Han -> Common -> Empty), and that mutations throwing NotImplemented_nid_no_patch comply with debt documentation and AGENTS.md.
    • Verified thread-safety in WtfLanguage.cpp (UserPrefersSimplifiedChinese_nid_no_patch mutex locking and SYSTEM_LANGUAGE fallback) and memory management of temporary WTF::String instances.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5957763882 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22903#pullrequestreview-5957763882). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-18T13:40:24Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `4109e891a8`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `nkwebkit_settingsbase_tests` built cleanly. - **CTest** (`nkwebkit_settingsbase`): ``` 1/1 Test #4577: nkwebkit_settingsbase ............ Passed 0.03 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp`, `core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp`, `core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp`, `core/libs/prx/libSceNKWebKit/src/WtfLanguage.cpp`, `core/libs/prx/libSceNKWebKit/src/SettingsBase.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified null checks for 'self', 'family', 'contentTypes' across all 17 WebCore::SettingsBase exports in core/libs/prx/libSceNKWebKit/src/SettingsBase.cpp and checked that std::invalid_argument is thrown appropriately. - Verified WebCore::SettingsBase offset calculations, vtable layout (slot 0/1 for fontGenericFamilies), and structure sizes matching SettingsBaseAbi.hpp and static_asserts. - Verified media content types parsing and vector operations in setMediaContentTypesRequiringHardwareSupport (delimiter handling, allocation, size/capacity management, shrink/clear/reserve, and self-assignment guard). - Verified font family lookup, quadratic probing hashtable logic, fallback chains (Han -> Simplified/Traditional Han -> Common -> Empty), and that mutations throwing NotImplemented_nid_no_patch comply with debt documentation and AGENTS.md. - Verified thread-safety in WtfLanguage.cpp (UserPrefersSimplifiedChinese_nid_no_patch mutex locking and SYSTEM_LANGUAGE fallback) and memory management of temporary WTF::String instances. Looks Good To Me
MarcZX10 commented 2026-11-19 22:58:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T22:58:08Z.

Review: COMMENTED


Reviewed — comments

The review is incomplete because several included changed files and the full text of two excluded files were not read, so a formal approval is not justified.

What I ran

Reviewed the prepared diff for head f6ec3364aa7be9f0036906caf4067e94a7ed192a and targeted source excerpts through repo_read.py. No tests or builds were run.

Results

Check Result Note
Diff review passed Prepared diff inspected
Tests and build not run Author reports 143 tests passed
Complete source review not run Several files not read

Findings

Blocking

None verified.

Non-blocking

None.

Not verified

Read: description.md, commits.md, manifest.json, diff.patch; source excerpts from SettingsBase.cpp, SettingsBaseAbi.hpp, WtfLanguage.cpp, WtfStringAbi.hpp, and libScePosixForWebKit/Export.cpp; and the changed-file listing.

Did not read the complete text of every included changed file. In particular, Export.cpp and InventoryExports.hpp were excluded from the review folder, and their full text was not read through the reader. Console and Windows behavior were not verified. Test results in the description are author-reported, not runs performed in this review.

To get this to a good state

Nothing is required. Optional: complete the source review, including the excluded files, before making a formal approval decision.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5984769003 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22903#pullrequestreview-5984769003). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-19T22:58:08Z. **Review:** COMMENTED --- # Reviewed — comments The review is incomplete because several included changed files and the full text of two excluded files were not read, so a formal approval is not justified. ## What I ran Reviewed the prepared diff for head `f6ec3364aa7be9f0036906caf4067e94a7ed192a` and targeted source excerpts through `repo_read.py`. No tests or builds were run. ## Results | Check | Result | Note | |---|---|---| | Diff review | passed | Prepared diff inspected | | Tests and build | not run | Author reports 143 tests passed | | Complete source review | not run | Several files not read | ## Findings ### Blocking None verified. ### Non-blocking None. ## Not verified Read: `description.md`, `commits.md`, `manifest.json`, `diff.patch`; source excerpts from `SettingsBase.cpp`, `SettingsBaseAbi.hpp`, `WtfLanguage.cpp`, `WtfStringAbi.hpp`, and `libScePosixForWebKit/Export.cpp`; and the changed-file listing. Did not read the complete text of every included changed file. In particular, `Export.cpp` and `InventoryExports.hpp` were excluded from the review folder, and their full text was not read through the reader. Console and Windows behavior were not verified. Test results in the description are author-reported, not runs performed in this review. ## To get this to a good state Nothing is required. Optional: complete the source review, including the excluded files, before making a formal approval decision.
MarcZX10 commented 2026-11-20 21:39:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T21:39:33Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks merging; the notes below are optional.

What I ran

Reviewed head 9afbb526478b33f1787b04838bffdf350799c4cf and the prepared diff against main. No commands or tests were run. The author reports 143 of 143 tests passed on Arch Linux x86-64 with GCC 16.2.1; this was not independently verified.

Results

Check Result Note
Source review passed Read implementation and tests
Test execution not run Author-reported results only
Console and Windows behavior not run No hardware verification

Findings

Blocking

None.

Non-blocking

  • The vector setter only checks whether the source and target are the same vector object. If distinct vectors share the same backing buffer, ClearMediaVector can free storage still referenced by the source before copying (especially when source size exceeds target capacity). Consider handling shared-buffer aliasing or documenting that such aliasing is outside the API contract. Changed line: core/libs/prx/libSceNKWebKit/src/SettingsBase.cpp:313.

Not verified

Did not run the reported tests or convention check, compare behavior on a console, or verify Windows behavior. The full text of core/libs/prx/libSceNKWebKit/Export.cpp and core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp was excluded as too large; their relevant removals were visible in the prepared diff. Read the other changed files listed as included in the manifest, including the full implementation, ABI header, language helper, POSIX export changes, tests, and debt entry.

To get this to a good state

Nothing is required. Optional: cover or constrain distinct vector objects that share a backing allocation in the media-vector setter tests.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5999758915 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22903#pullrequestreview-5999758915). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T21:39:33Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks merging; the notes below are optional. ## What I ran Reviewed head `9afbb526478b33f1787b04838bffdf350799c4cf` and the prepared diff against `main`. No commands or tests were run. The author reports 143 of 143 tests passed on Arch Linux x86-64 with GCC 16.2.1; this was not independently verified. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Read implementation and tests | | Test execution | not run | Author-reported results only | | Console and Windows behavior | not run | No hardware verification | ## Findings ### Blocking None. ### Non-blocking - The vector setter only checks whether the source and target are the same vector object. If distinct vectors share the same backing buffer, `ClearMediaVector` can free storage still referenced by the source before copying (especially when source size exceeds target capacity). Consider handling shared-buffer aliasing or documenting that such aliasing is outside the API contract. Changed line: `core/libs/prx/libSceNKWebKit/src/SettingsBase.cpp:313`. ## Not verified Did not run the reported tests or convention check, compare behavior on a console, or verify Windows behavior. The full text of `core/libs/prx/libSceNKWebKit/Export.cpp` and `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp` was excluded as too large; their relevant removals were visible in the prepared diff. Read the other changed files listed as included in the manifest, including the full implementation, ABI header, language helper, POSIX export changes, tests, and debt entry. ## To get this to a good state Nothing is required. Optional: cover or constrain distinct vector objects that share a backing allocation in the media-vector setter tests.
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!22903
No description provided.