feat(libSceNKWebKit): implement WKSecurityOrigin values #14925

Merged
w4rc0n merged 1 commit from upstream-pr/14925 into main 2026-11-04 08:32:28 +00:00
w4rc0n commented 2026-11-02 01:32:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by w4rc0n on 2026-11-02T01:32:20Z.


What

All of the WKSecurityOrigin functions except WKSecurityOriginGetTypeID were NotImplemented stubs, so a title using the WebKit C API couldn't create an origin or read one. Five of them now follow the pinned PS5 WebKit 11.x WKSecurityOriginRef.cpp:

  • WKSecurityOriginCreate stores the protocol, host and port exactly as given, as API::SecurityOrigin::create does. It doesn't parse a URL or normalize default ports.
    • A port of 0 or above 65535 means no port.
    • A negative port is narrowed to 16 bits, as in the C function.
  • WKSecurityOriginCopyProtocol, CopyHost, GetPort and CopyToString follow SecurityOriginData:
    • file gives file://;
    • an empty origin gives a null string;
    • the port appears only when one is set.

Three functions stay NotImplemented, and the debt entry records why:

  • WKSecurityOriginCopyDatabaseIdentifier needs FileSystemImpl::encodeForFileName, which #14858 implements.
  • WKSecurityOriginCreateFromString needs URL parsing.
  • WKSecurityOriginCreateFromDatabaseIdentifier drops default ports through WTF::isDefaultPortForProtocol, which #13766 implements.

tools/pr_overlap.py on this head: no open PR changes these exports or adds the same files. These open PRs conflict on text only, in the inventory count line of docs/dev/debt/libSceNKWebKit.md, neighbouring stubs in Export.cpp and InventoryExports.hpp, or adjacent debt entries: #13766, #13930, #13947, #13992, #14138, #14164, #14172, #14303, #14345, #14387, #14391, #14479, #14607, #14858, #14860, #14865. Whichever merges later keeps both sides. #13515, #14152 and #14212 conflict with main, so the tool couldn't compare them; read by hand, none of them changes these exports.

Tested

Debian 12, GCC 12.2, Linux 6.18, Release, at the head a92710859c1afdfebbeb85b75a1cbf55d040e1a3, no local changes:

  • nkwebkit_base, nkwebkit_config, nkwebkit_jsc, nkwebkit_preferences, nkwebkit_webcoregeometry, nkwebkit_wtf, guest_nkwebkit_dates, guest_nkwebkit_numbers, nkwebkit_constants, nkwebkit_fastbitvector and public_headers pass.
  • The new nkwebkit_base cases cover:
    • origins with and without a port, port 0, and out-of-range and negative ports;
    • file in both cases, empty and null strings, and hosts with reserved characters;
    • each copy getting its own reference count;
    • the origin's type ID.
  • tools/progress.py: the five exports count as implemented (libSceNKWebKit 1299, 1294 on main).
  • tools/check_conventions.py passes.
  • Windows (GitHub-hosted CI in the author's fork): run 41376675517 built this branch's previous head 417ba136d43687938f47d0a9bffa9d4d6a0aefce. It is AnyPS5's Build workflow, dispatched in the author's fork with select=true: the branch merged into main at 93dbd0f82aea684e95f15f06e7d42c0064af18cf, built on windows-latest with WinLibs GCC 15.2 (MinGW-w64, UCRT). None of the 672 selected tests failed; 6 AGC tests were skipped, which check_skips.py accepts. That includes the nine NKWebKit tests, public_headers and patched_libraries. The rebase onto main at 7feb37ee3e30e10139b483fb4df689d5b5b69ab8 after #14479 changed only docs/dev/debt/libSceNKWebKit.md, so git range-diff shows the code and tests under test are the same as at that run. A fork-internal pull request existed only to give the workflow a number.

Not built or run: macOS. No title or homebrew 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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5113586193 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14925). Originally posted by [w4rc0n](https://github.com/w4rc0n) on 2026-11-02T01:32:20Z. --- ### What All of the `WKSecurityOrigin` functions except `WKSecurityOriginGetTypeID` were `NotImplemented` stubs, so a title using the WebKit C API couldn't create an origin or read one. Five of them now follow the pinned PS5 WebKit 11.x [`WKSecurityOriginRef.cpp`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebKit/Shared/API/c/WKSecurityOriginRef.cpp): - `WKSecurityOriginCreate` stores the protocol, host and port exactly as given, as [`API::SecurityOrigin::create`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebKit/Shared/API/APISecurityOrigin.h#L41-L44) does. It doesn't parse a URL or normalize default ports. - A port of 0 or above 65535 means no port. - A negative port is narrowed to 16 bits, as in the C function. - `WKSecurityOriginCopyProtocol`, `CopyHost`, `GetPort` and `CopyToString` follow [`SecurityOriginData`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebCore/page/SecurityOriginData.cpp#L40-L54): - `file` gives `file://`; - an empty origin gives a null string; - the port appears only when one is set. Three functions stay `NotImplemented`, and the debt entry records why: - `WKSecurityOriginCopyDatabaseIdentifier` needs `FileSystemImpl::encodeForFileName`, which #14858 implements. - `WKSecurityOriginCreateFromString` needs URL parsing. - `WKSecurityOriginCreateFromDatabaseIdentifier` drops default ports through `WTF::isDefaultPortForProtocol`, which #13766 implements. `tools/pr_overlap.py` on this head: no open PR changes these exports or adds the same files. These open PRs conflict on text only, in the inventory count line of `docs/dev/debt/libSceNKWebKit.md`, neighbouring stubs in `Export.cpp` and `InventoryExports.hpp`, or adjacent debt entries: #13766, #13930, #13947, #13992, #14138, #14164, #14172, #14303, #14345, #14387, #14391, #14479, #14607, #14858, #14860, #14865. Whichever merges later keeps both sides. #13515, #14152 and #14212 conflict with `main`, so the tool couldn't compare them; read by hand, none of them changes these exports. ### 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. --> Debian 12, GCC 12.2, Linux 6.18, Release, at the head `a92710859c1afdfebbeb85b75a1cbf55d040e1a3`, no local changes: - `nkwebkit_base`, `nkwebkit_config`, `nkwebkit_jsc`, `nkwebkit_preferences`, `nkwebkit_webcoregeometry`, `nkwebkit_wtf`, `guest_nkwebkit_dates`, `guest_nkwebkit_numbers`, `nkwebkit_constants`, `nkwebkit_fastbitvector` and `public_headers` pass. - The new `nkwebkit_base` cases cover: - origins with and without a port, port 0, and out-of-range and negative ports; - `file` in both cases, empty and null strings, and hosts with reserved characters; - each copy getting its own reference count; - the origin's type ID. - `tools/progress.py`: the five exports count as implemented (libSceNKWebKit 1299, 1294 on `main`). - `tools/check_conventions.py` passes. - **Windows (GitHub-hosted CI in the author's fork):** [run 41376675517](https://github.com/w4rc0n/AnyPS5/actions/runs/41376675517) built this branch's previous head `417ba136d43687938f47d0a9bffa9d4d6a0aefce`. It is AnyPS5's `Build` workflow, dispatched in the author's fork with `select=true`: the branch merged into `main` at `93dbd0f82aea684e95f15f06e7d42c0064af18cf`, built on `windows-latest` with WinLibs GCC 15.2 (MinGW-w64, UCRT). None of the 672 selected tests failed; 6 AGC tests were skipped, which `check_skips.py` accepts. That includes the nine NKWebKit tests, `public_headers` and `patched_libraries`. The rebase onto `main` at `7feb37ee3e30e10139b483fb4df689d5b5b69ab8` after #14479 changed only `docs/dev/debt/libSceNKWebKit.md`, so `git range-diff` shows the code and tests under test are the same as at that run. A fork-internal pull request existed only to give the workflow a number. Not built or run: macOS. No title or homebrew was run. ### 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
BunnyFl commented 2026-11-02 03:38:31 +00:00 (Migrated from github.com)

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

Review: APPROVED


Windows 11, WinLibs GCC 15.2.0 r7, Release. Head 417ba136d4 merged into upstream/main 93dbd0f82a:

  • nkwebkit_base, nkwebkit_wtf, nkwebkit_config, nkwebkit_jsc, nkwebkit_preferences, nkwebkit_webcoregeometry, guest_nkwebkit_dates, guest_nkwebkit_numbers, nkwebkit_constants and public_headers: 10/10 pass.
  • Mutation check: with the port && condition dropped from WKSecurityOriginCreate, a port of 0 is stored, and nkwebkit_base fails in the origin-string check (CheckOriginString, line 56).

Checked against the pinned WKSecurityOriginRef.cpp:

  • WKSecurityOriginCreate sets validPort only for port && port <= numeric_limits<uint16_t>::max(), assigning the int, so a negative port narrows to 16 bits as you describe;
  • GetPort is port().value_or(0);
  • CopyToString goes through SecurityOriginData::toString.

The three exports left throwing, with their dependencies on #14858 and #13766 recorded, seem like the right cut.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5731852931 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14925#pullrequestreview-5731852931). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-02T03:38:31Z. **Review:** APPROVED --- Windows 11, WinLibs GCC 15.2.0 r7, Release. Head 417ba136d4 merged into upstream/main 93dbd0f82a: - `nkwebkit_base`, `nkwebkit_wtf`, `nkwebkit_config`, `nkwebkit_jsc`, `nkwebkit_preferences`, `nkwebkit_webcoregeometry`, `guest_nkwebkit_dates`, `guest_nkwebkit_numbers`, `nkwebkit_constants` and `public_headers`: 10/10 pass. - Mutation check: with the `port &&` condition dropped from `WKSecurityOriginCreate`, a port of 0 is stored, and `nkwebkit_base` fails in the origin-string check (`CheckOriginString`, line 56). Checked against the pinned `WKSecurityOriginRef.cpp`: - `WKSecurityOriginCreate` sets `validPort` only for `port && port <= numeric_limits<uint16_t>::max()`, assigning the `int`, so a negative port narrows to 16 bits as you describe; - `GetPort` is `port().value_or(0)`; - `CopyToString` goes through `SecurityOriginData::toString`. The three exports left throwing, with their dependencies on #14858 and #13766 recorded, seem like the right cut.
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!14925
No description provided.