feat(libSceNKWebKit): recognize JavaScript and HTTP-family URL schemes #13772

Closed
hyvvs wants to merge 1 commit from upstream-pr/13772 into main
hyvvs commented 2026-10-31 05:16:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hyvvs on 2026-10-31T05:16:39Z.


What

Implement two libSceNKWebKit exports with matching by-value WTF::StringView ABI and complete scalar, allocation-free behavior from Sony PS5 WebKit 11.x Source/WTF/wtf/URL.cpp:

  • WTF::protocolIsJavaScript(StringView): case-insensitive javascript: scheme; trim leading C0 controls/spaces, skip internal TAB/CR/LF during the scheme check, and reject incomplete, malformed or non-ASCII schemes.
  • WTF::protocolIsInHTTPFamily(StringView): case-insensitive http: / https: prefix at offset 0, without parsing or constructing a URL.

The 16-byte LP64 StringView has pointer at offset 0, unsigned length at offset 8 and 8-bit flag at offset 12. Both take it by value and return bool; no guest allocation or ownership is introduced. The two throwing stubs are removed, API declarations corrected, and a separate CMake regression target covers 8-bit/UTF-16 strings, prefix and suffix handling, controls, mixed case, explicit lengths and null/invalid pointers. All 8,851 other exports are unchanged. Progress: 11 -> 13 implemented of 8,853 (+2).

Tested

  • WSL GCC -std=c++20 -O1 -g -Wall -Wextra -Werror -fsanitize=address,undefined: new regression executable passes, including invalid-null handling, no sanitizer findings.
  • Windows MinGW -std=c++20 -O0 -Wall -Wextra -Werror -static: native regression executable passes for all valid cases; invalid-null exception-catch test stays Linux-only because MinGW standalone SEH cannot unwind a thrown exception across APS5_VABI (recorded in debt).
  • MinGW -fsyntax-only for implementation and test: pass.
  • python -m unittest discover -s tools/tests -p test_progress.py -q: 56 tests pass.
  • Broader progress test suite: 96 tests pass (two Windows-specific skips).
  • python tools/progress.py --module libSceNKWebKit: 13/8853 implemented, +2 over this branch's base.
  • git diff --check: pass; new files are UTF-8 without BOM.
  • PS5 hardware/title: not tested; console ABI specifics remain documented as debt.

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; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (not applicable: no third-party code added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none verified
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5094814594 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13772). Originally posted by [hyvvs](https://github.com/hyvvs) on 2026-10-31T05:16:39Z. --- ### What Implement two `libSceNKWebKit` exports with matching by-value `WTF::StringView` ABI and **complete scalar, allocation-free** behavior from [Sony PS5 WebKit 11.x `Source/WTF/wtf/URL.cpp`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WTF/wtf/URL.cpp): - `WTF::protocolIsJavaScript(StringView)`: case-insensitive `javascript:` scheme; trim leading C0 controls/spaces, skip internal TAB/CR/LF during the scheme check, and reject incomplete, malformed or non-ASCII schemes. - `WTF::protocolIsInHTTPFamily(StringView)`: case-insensitive `http:` / `https:` prefix at offset 0, without parsing or constructing a URL. The 16-byte LP64 `StringView` has pointer at offset 0, unsigned length at offset 8 and 8-bit flag at offset 12. Both take it **by value** and return `bool`; no guest allocation or ownership is introduced. The two throwing stubs are removed, API declarations corrected, and a separate CMake regression target covers 8-bit/UTF-16 strings, prefix and suffix handling, controls, mixed case, explicit lengths and null/invalid pointers. All 8,851 other exports are unchanged. Progress: **11 -> 13 implemented of 8,853** (+2). ### Tested - WSL GCC `-std=c++20 -O1 -g -Wall -Wextra -Werror -fsanitize=address,undefined`: new regression executable **passes**, including invalid-null handling, no sanitizer findings. - Windows MinGW `-std=c++20 -O0 -Wall -Wextra -Werror -static`: native regression executable **passes** for all valid cases; invalid-null exception-catch test stays Linux-only because MinGW standalone SEH cannot unwind a thrown exception across `APS5_VABI` (recorded in debt). - MinGW `-fsyntax-only` for implementation and test: pass. - `python -m unittest discover -s tools/tests -p test_progress.py -q`: **56 tests pass**. - Broader progress test suite: **96 tests pass (two Windows-specific skips)**. - `python tools/progress.py --module libSceNKWebKit`: **13/8853** implemented, +2 over this branch's base. - `git diff --check`: pass; new files are UTF-8 **without BOM**. - PS5 hardware/title: **not tested**; console ABI specifics remain documented as debt. ### 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 - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (not applicable: no third-party code added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none verified - [x] GPUs tested: n/a - [x] AI-assisted: yes
jotitadev commented 2026-10-31 06:23:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-31T06:23:49Z.

Review: COMMENTED


Linux run of head 5da95d33aa, merged (--no-commit) onto main 6a691f69ee. Ubuntu 26.04 (kernel 7.0), GCC 15.2.0, CMake 4.2.3, Ninja, Release, BUILD_TESTING=ON, i7-8700.

  • guest_nkwebkit_url_protocols: passes 3/3.
  • Full build ok. Related subset nkwebkit: 3/3.
  • public_headers: 65/65.
  • Red: throwing at the top of both predicates makes the test abort 3/3.
  • The #ifndef _WIN32 InvalidArguments() block, which the description says only runs on Linux, does run here and passes: the null-data/non-zero-length cases are caught as std::invalid_argument across APS5_VABI. With the Validate throw changed to a plain return, the test crashes (SEGFAULT) 3/3, so that block protects the check.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5721622504 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13772#pullrequestreview-5721622504). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-31T06:23:49Z. **Review:** COMMENTED --- Linux run of head `5da95d33aa`, merged (`--no-commit`) onto `main` `6a691f69ee`. Ubuntu 26.04 (kernel 7.0), GCC 15.2.0, CMake 4.2.3, Ninja, Release, `BUILD_TESTING=ON`, i7-8700. - `guest_nkwebkit_url_protocols`: passes 3/3. - Full build ok. Related subset `nkwebkit`: 3/3. - `public_headers`: 65/65. - Red: throwing at the top of both predicates makes the test abort 3/3. - The `#ifndef _WIN32` `InvalidArguments()` block, which the description says only runs on Linux, does run here and passes: the null-data/non-zero-length cases are caught as `std::invalid_argument` across `APS5_VABI`. With the `Validate` throw changed to a plain `return`, the test crashes (SEGFAULT) 3/3, so that block protects the check. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

Pull request closed

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!13772
No description provided.