feat(libSceNKWebKit): implement HTML integer, CORP header and line ending exports #15516

Merged
Jawschamp merged 4 commits from upstream-pr/15516 into main 2026-11-07 07:49:06 +00:00
Jawschamp commented 2026-11-03 17:10:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Jawschamp on 2026-11-03T17:10:09Z.


What

Implements 5 libSceNKWebKit exports that threw NotImplemented_nid_no_patch as parameterless placeholders: WebCore::parseHTMLInteger, WebCore::parseCrossOriginResourcePolicyHeader, and WTF::normalizeLineEndingsToLF, normalizeLineEndingsToCRLF and normalizeLineEndingsToNative. Their placeholders leave Export.cpp and include/InventoryExports.hpp, and docs/dev/debt/libSceNKWebKit.md goes from 7437 to 7432 additional exports and loses their 5 table rows. Declarations with real signatures are in the new include/WebCoreParsersExports.hpp, the code in src/WebCoreParsers.cpp.

  • Behaviour follows the pinned PS5-WebKit-11.x sources HTMLParserIdioms.cpp, HTTPParsers.cpp and LineEnding.cpp.
  • parseHTMLInteger returns Expected<int, HTMLIntegerParsingError>, an 8-byte trivially copyable value returned in rax; this layout (value in the low 4 bytes, flag at byte 4) is asserted at compile time but assumed from the pinned Expected.h, not seen in a console binary.
  • The line-ending functions take and return Vector<unsigned char> by move ({buffer, capacity, size}); a vector's buffer is assumed to come from fastMalloc. normalizeLineEndingsToNative is LF, as for non-Windows builds of the pinned source.
  • A StringView with a null pointer and a non-zero length throws.
  • Not included: parseHTMLNonNegativeInteger and defaultMIMEType, which open PRs #15241 and #15213 already implement.

Tested

Linux x86_64, GCC 14.2 (g++ extracted from Debian trixie packages), -DBUILD_TESTING=ON. Hardware and titles: not tested.

  • New test nkwebkit_webcoreparsers (auto-registered from tests/WebCoreParsers.cpp) runs in well under a second. The integer cases are generated from the 20 success and 22 failure cases in the pinned TestWebKitAPI HTMLParserIdioms test, run for 8-bit and 16-bit strings, and the line-ending cases port the pinned TestWebKitAPI LineEnding test; the header cases are derived by hand from the pinned source, because native WebKit cannot be run for a differential test. ctest -R nkwebkit passes all 12 tests.
  • tools/check_conventions.py --base origin/main, tools/check_test_registration.py and core/libs/tests/test_public_headers.py --audit-only pass.
  • tools/pr_overlap.py --branch fix/nkwebkit-html-http-parsers-v2 reports no open PR with the same new files. Its only same-exports hit is #13486, a stacked draft relinker PR whose own diff is 3 relinker files and none of these exports. It reports textual overlap with the docs/dev/debt/libSceNKWebKit.md count line of many open libSceNKWebKit PRs, and could not compare #13486, #13515, #14138, #14152, #14212, #14259, #14999, #15011, #15173, #15175, #15184, #15213, #15216, #15217, #15218 and #15224 because they conflict with main; their diffs (checked with gh pr diff) add none of the 5 exports.
  • Not run: the rest of the suite, Windows and the PS5 behaviour of these exports.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5141421235 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15516). Originally posted by [Jawschamp](https://github.com/Jawschamp) on 2026-11-03T17:10:09Z. --- ### What Implements 5 libSceNKWebKit exports that threw `NotImplemented_nid_no_patch` as parameterless placeholders: `WebCore::parseHTMLInteger`, `WebCore::parseCrossOriginResourcePolicyHeader`, and `WTF::normalizeLineEndingsToLF`, `normalizeLineEndingsToCRLF` and `normalizeLineEndingsToNative`. Their placeholders leave `Export.cpp` and `include/InventoryExports.hpp`, and `docs/dev/debt/libSceNKWebKit.md` goes from 7437 to 7432 additional exports and loses their 5 table rows. Declarations with real signatures are in the new `include/WebCoreParsersExports.hpp`, the code in `src/WebCoreParsers.cpp`. - Behaviour follows the pinned [PS5-WebKit-11.x](https://github.com/neonmodder123/PS5-WebKit-11.x/tree/80f77e94c63ee7202eec3d4b5b1a021dd89011ba) sources `HTMLParserIdioms.cpp`, `HTTPParsers.cpp` and `LineEnding.cpp`. - `parseHTMLInteger` returns `Expected<int, HTMLIntegerParsingError>`, an 8-byte trivially copyable value returned in `rax`; this layout (value in the low 4 bytes, flag at byte 4) is asserted at compile time but assumed from the pinned `Expected.h`, not seen in a console binary. - The line-ending functions take and return `Vector<unsigned char>` by move (`{buffer, capacity, size}`); a vector's buffer is assumed to come from `fastMalloc`. `normalizeLineEndingsToNative` is LF, as for non-Windows builds of the pinned source. - A `StringView` with a null pointer and a non-zero length throws. - Not included: `parseHTMLNonNegativeInteger` and `defaultMIMEType`, which open PRs #15241 and #15213 already implement. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Linux x86_64, GCC 14.2 (g++ extracted from Debian trixie packages), `-DBUILD_TESTING=ON`. Hardware and titles: not tested. - New test `nkwebkit_webcoreparsers` (auto-registered from `tests/WebCoreParsers.cpp`) runs in well under a second. The integer cases are generated from the 20 success and 22 failure cases in the pinned TestWebKitAPI `HTMLParserIdioms` test, run for 8-bit and 16-bit strings, and the line-ending cases port the pinned TestWebKitAPI `LineEnding` test; the header cases are derived by hand from the pinned source, because native WebKit cannot be run for a differential test. `ctest -R nkwebkit` passes all 12 tests. - `tools/check_conventions.py --base origin/main`, `tools/check_test_registration.py` and `core/libs/tests/test_public_headers.py --audit-only` pass. - `tools/pr_overlap.py --branch fix/nkwebkit-html-http-parsers-v2` reports no open PR with the same new files. Its only same-exports hit is #13486, a stacked draft relinker PR whose own diff is 3 relinker files and none of these exports. It reports textual overlap with the `docs/dev/debt/libSceNKWebKit.md` count line of many open libSceNKWebKit PRs, and could not compare #13486, #13515, #14138, #14152, #14212, #14259, #14999, #15011, #15173, #15175, #15184, #15213, #15216, #15217, #15218 and #15224 because they conflict with `main`; their diffs (checked with `gh pr diff`) add none of the 5 exports. - Not run: the rest of the suite, Windows and the PS5 behaviour of these exports. ### 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) - [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
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!15516
No description provided.