feat(libSceNKWebKit): implement WTF::mimeTypeFromDataURL and URL::stringCenterEllipsizedToLength #14479

Merged
ashwin280802 merged 1 commit from upstream-pr/14479 into main 2026-11-02 22:37:49 +00:00
ashwin280802 commented 2026-11-01 15:07:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ashwin280802 on 2026-11-01T15:07:58Z.


What

Implements two libSceNKWebKit WTF exports that were NotImplemented_nid_no_patch stubs:

  • WTF::mimeTypeFromDataURL(StringView)
  • WTF::URL::stringCenterEllipsizedToLength(unsigned) const

Both follow the pinned PS5 WebKit URL.cpp L1053-L1079:

  • mimeTypeFromDataURL looks for ; from index 5, then ,. Neither found returns a non-null empty string (not text/plain, as the source's FIXME notes). A separator at index 5 returns text/plain. Otherwise it returns the ASCII-lowercased text before the separator, keeping the input's 8/16-bit width.
  • stringCenterEllipsizedToLength returns the same string when it already fits. Otherwise it joins left(length / 2 - 1), "..." and right(length / 2 - 2) with WebKit's unsigned wrap-around, so lengths 0 and 1 give the whole URL plus "..." and lengths 2 and 3 give "...".

Differences from WebKit: the ASSERT that the input starts with data: is not reproduced (release builds drop it), and a concatenated length above INT32_MAX throws std::length_error where WebKit crashes. The debt file rows and count are updated.

No open PR implements either function. Other open NKWebKit PRs edit the same debt-count line and nearby code in Export.cpp, WtfString.cpp and tests/Wtf.cpp, so whichever merges second needs a rebase. Behaviour is taken from source, not measured on a console.

Tested

Windows 11, MinGW-w64 GCC 15.2.0 (winlibs, ucrt), Release, build-full, at dd166cdd67:

ctest --test-dir build-full -R nkwebkit
100% tests passed out of 9

nkwebkit_wtf now covers 8-bit URLs at lengths 0 to 6, 10, 11, 28 to 30, 40 and 0xFFFFFFFF, 16-bit URLs at lengths 1, 3, 10 and 21, null and empty strings, a null self, the shared-string reference count, and the data-URL cases above (case folding, empty type, semicolon before comma, no separator, null view, 16-bit and non-ASCII input).

Conventions check: passed.

I changed 15 conditions and statements one at a time and the test failed on 13; one does not build, and the last (the length check in the concatenation helper) is equivalent below 2^32 characters because NewImpl rejects any oversize result with the same std::length_error.

The full suite also ran on Windows and on Linux (Docker, lavapipe) before rebasing onto the current main, and did not pass on this machine. On Linux, guest_mmap_executable aborts at GuestMemory.cpp:3436, guest_http_uri_locale and savedata_memory_growth_read_failure are skipped, and public_headers and agc_driver_pipeline_journal take over 30 s; these reproduce on origin/main (f1a7b02028). On Windows guest_fopen_errors is skipped (not run on main). public_headers passes at this commit and on main; I did not investigate why the others fail on this machine.

Not verified: behaviour on a console or a retail binary, or that the retail module matches this WebKit revision. Not covered by a test: concatenated lengths above 2^32 characters.

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:5108609595 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14479). Originally posted by [ashwin280802](https://github.com/ashwin280802) on 2026-11-01T15:07:58Z. --- ### What Implements two `libSceNKWebKit` WTF exports that were `NotImplemented_nid_no_patch` stubs: - `WTF::mimeTypeFromDataURL(StringView)` - `WTF::URL::stringCenterEllipsizedToLength(unsigned) const` Both follow the pinned PS5 WebKit [`URL.cpp` L1053-L1079](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WTF/wtf/URL.cpp#L1053-L1079): - `mimeTypeFromDataURL` looks for `;` from index 5, then `,`. Neither found returns a non-null empty string (not `text/plain`, as the source's FIXME notes). A separator at index 5 returns `text/plain`. Otherwise it returns the ASCII-lowercased text before the separator, keeping the input's 8/16-bit width. - `stringCenterEllipsizedToLength` returns the same string when it already fits. Otherwise it joins `left(length / 2 - 1)`, `"..."` and `right(length / 2 - 2)` with WebKit's unsigned wrap-around, so lengths 0 and 1 give the whole URL plus `"..."` and lengths 2 and 3 give `"..."`. Differences from WebKit: the `ASSERT` that the input starts with `data:` is not reproduced (release builds drop it), and a concatenated length above `INT32_MAX` throws `std::length_error` where WebKit crashes. The debt file rows and count are updated. No open PR implements either function. Other open NKWebKit PRs edit the same debt-count line and nearby code in `Export.cpp`, `WtfString.cpp` and `tests/Wtf.cpp`, so whichever merges second needs a rebase. Behaviour is taken from source, not measured on a console. ### Tested Windows 11, MinGW-w64 GCC 15.2.0 (winlibs, ucrt), Release, `build-full`, at dd166cdd67: ``` ctest --test-dir build-full -R nkwebkit 100% tests passed out of 9 ``` `nkwebkit_wtf` now covers 8-bit URLs at lengths 0 to 6, 10, 11, 28 to 30, 40 and `0xFFFFFFFF`, 16-bit URLs at lengths 1, 3, 10 and 21, null and empty strings, a null `self`, the shared-string reference count, and the data-URL cases above (case folding, empty type, semicolon before comma, no separator, null view, 16-bit and non-ASCII input). Conventions check: passed. I changed 15 conditions and statements one at a time and the test failed on 13; one does not build, and the last (the length check in the concatenation helper) is equivalent below 2^32 characters because `NewImpl` rejects any oversize result with the same `std::length_error`. The full suite also ran on Windows and on Linux (Docker, lavapipe) before rebasing onto the current `main`, and did not pass on this machine. On Linux, `guest_mmap_executable` aborts at `GuestMemory.cpp:3436`, `guest_http_uri_locale` and `savedata_memory_growth_read_failure` are skipped, and `public_headers` and `agc_driver_pipeline_journal` take over 30 s; these reproduce on `origin/main` (`f1a7b02028`). On Windows `guest_fopen_errors` is skipped (not run on `main`). `public_headers` passes at this commit and on `main`; I did not investigate why the others fail on this machine. Not verified: behaviour on a console or a retail binary, or that the retail module matches this WebKit revision. Not covered by a test: concatenated lengths above 2^32 characters. ### 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 🤖 Generated with [Claude Code](https://claude.com/claude-code)
CnRJay commented 2026-11-01 19:47:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:47:05Z.

Review: COMMENTED


Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (Unblocks: none is allowed), and it contained no code review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729914402 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14479#pullrequestreview-5729914402). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-11-01T19:47:05Z. **Review:** COMMENTED --- Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (`Unblocks: none` is allowed), and it contained no code review.
MarcZX10 commented 2026-11-02 05:18:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T05:18:20Z.

Review: COMMENTED


Reviewed — no blocking findings

Two WTF exports leave the not-implemented stubs: mimeTypeFromDataURL and URL::stringCenterEllipsizedToLength. The code follows its own description, and the hosted Windows run passed nkwebkit_wtf (the new tests/Wtf.cpp). One behaviour question is raised below against WebKit, which I did not re-read.

What I ran

  • Head dd166cdd67d00a6bb7cbc8fdc1840b63e8c840e8; base e4501451406e4d3516c5b0eaa854d6ec1a28082d (the PR's own base). 6 files, +129/-13: Export.cpp (two stubs removed), include/InventoryExports.hpp (two declarations removed), include/WtfExports.hpp (two typed declarations), src/WtfString.cpp (+51), tests/Wtf.cpp (+75) and docs/dev/debt/libSceNKWebKit.md (two lines).
  • Read the new functions in WtfString.cpp: FindUnit, ConcatViews, mimeTypeFromDataURL and stringCenterEllipsizedToLength, and the test's helpers.
  • Read-only checks from the trusted main checkout (precheck not run: no PR-head code is run here): diff check and conventions passed; the ABI audit is not applicable (no export added without a declaration; the two removed stubs are replaced by typed declarations).
  • Hosted: the Windows CTest run passed 2594 of 2594 cases; nkwebkit_wtf is Passed, along with the other NKWebKit cases.
  • No MarcZX10 review at this head.

Results

Check Result Note
Diff check passed
Conventions and PR template passed conventions check from the main checkout
Mergeability and dependencies passed depends on none; the stack check passed
stringCenterEllipsizedToLength (length split and join) passed read; the test covers it
mimeTypeFromDataURL with no ; or , question returns an empty string (non-blocking; see Findings)
nkwebkit_wtf (hosted) passed in the Windows CTest run
Agreement with WebKit's sources not verified the WebKit source was not re-read here
ABI audit (main-checkout tool) not applicable the two new exports have typed declarations
Build and runtime tests (Linux) not run the hosted Windows run covers the test
Negative controls not run no local build
Hosted CI passed windows passed (2594/2594); linux and relinkers skipped
Read-only check output

Precheck was not run: no PR-head code is run here. Conventions: passed. Hosted: gh api repos/boykopovar/AnyPS5/commits/dd166cdd67d00a6bb7cbc8fdc1840b63e8c840e8/check-runs.

Negative control

Not run here. A negative control needs a build, and code from this head is not run here.

Findings

Blocking

None.

Non-blocking

  • mimeTypeFromDataURL returns an empty string when neither ; nor , follows data:. Please confirm against WebKit's implementation that this case is empty rather than the default MIME type, and add a test for it if it is not covered.

Sources

Not verified

  • WebKit's source was not re-read for either function.
  • The debt entry's counts and NID claims were not checked.

To get this to a good state

  • Nothing blocking. Confirm the empty-string case against WebKit.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5732373576 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14479#pullrequestreview-5732373576). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T05:18:20Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Two WTF exports leave the not-implemented stubs: `mimeTypeFromDataURL` and `URL::stringCenterEllipsizedToLength`. The code follows its own description, and the hosted Windows run passed `nkwebkit_wtf` (the new `tests/Wtf.cpp`). One behaviour question is raised below against WebKit, which I did not re-read. ## What I ran - Head `dd166cdd67d00a6bb7cbc8fdc1840b63e8c840e8`; base `e4501451406e4d3516c5b0eaa854d6ec1a28082d` (the PR's own base). 6 files, +129/-13: `Export.cpp` (two stubs removed), `include/InventoryExports.hpp` (two declarations removed), `include/WtfExports.hpp` (two typed declarations), `src/WtfString.cpp` (+51), `tests/Wtf.cpp` (+75) and `docs/dev/debt/libSceNKWebKit.md` (two lines). - Read the new functions in `WtfString.cpp`: `FindUnit`, `ConcatViews`, `mimeTypeFromDataURL` and `stringCenterEllipsizedToLength`, and the test's helpers. - Read-only checks from the trusted main checkout (precheck not run: no PR-head code is run here): diff check and conventions passed; the ABI audit is not applicable (no export added without a declaration; the two removed stubs are replaced by typed declarations). - Hosted: the Windows CTest run passed 2594 of 2594 cases; `nkwebkit_wtf` is Passed, along with the other NKWebKit cases. - No MarcZX10 review at this head. ## Results | Check | Result | Note | | --- | --- | --- | | Diff check | passed | | | Conventions and PR template | passed | conventions check from the main checkout | | Mergeability and dependencies | passed | depends on none; the stack check passed | | `stringCenterEllipsizedToLength` (length split and join) | passed | read; the test covers it | | `mimeTypeFromDataURL` with no `;` or `,` | question | returns an empty string (non-blocking; see Findings) | | `nkwebkit_wtf` (hosted) | passed | in the Windows CTest run | | Agreement with WebKit's sources | not verified | the WebKit source was not re-read here | | ABI audit (main-checkout tool) | not applicable | the two new exports have typed declarations | | Build and runtime tests (Linux) | not run | the hosted Windows run covers the test | | Negative controls | not run | no local build | | Hosted CI | passed | windows passed (2594/2594); linux and relinkers skipped | <details><summary>Read-only check output</summary> Precheck was not run: no PR-head code is run here. Conventions: passed. Hosted: `gh api repos/boykopovar/AnyPS5/commits/dd166cdd67d00a6bb7cbc8fdc1840b63e8c840e8/check-runs`. </details> ## Negative control Not run here. A negative control needs a build, and code from this head is not run here. ## Findings **Blocking** None. **Non-blocking** - `mimeTypeFromDataURL` returns an empty string when neither `;` nor `,` follows `data:`. Please confirm against WebKit's implementation that this case is empty rather than the default MIME type, and add a test for it if it is not covered. ## Sources - New functions: https://github.com/boykopovar/AnyPS5/blob/dd166cdd67d00a6bb7cbc8fdc1840b63e8c840e8/core/libs/prx/libSceNKWebKit/src/WtfString.cpp - Test: https://github.com/boykopovar/AnyPS5/blob/dd166cdd67d00a6bb7cbc8fdc1840b63e8c840e8/core/libs/prx/libSceNKWebKit/tests/Wtf.cpp ## Not verified - WebKit's source was not re-read for either function. - The debt entry's counts and NID claims were not checked. ## To get this to a good state - Nothing blocking. Confirm the empty-string case against WebKit.
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!14479
No description provided.