feat(libSceNKWebKit): implement WKContext URL scheme registration #18831

Merged
adriaespii merged 6 commits from upstream-pr/18831 into main 2026-11-14 23:28:49 +00:00
adriaespii commented 2026-11-12 11:56:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriaespii on 2026-11-12T11:56:52Z.


What

Implements WKContextRegisterURLSchemeAsBypassingContentSecurityPolicy, WKContextRegisterURLSchemeAsCachePartitioned, WKContextRegisterURLSchemeAsCanDisplayOnlyIfCanRequest, WKContextRegisterURLSchemeAsEmptyDocument, and WKContextRegisterURLSchemeAsSecure in libSceNKWebKit (ContextURLSchemes.cpp), recording registered URL schemes on NKWebKit::ProcessPool and adding unit tests in tests/ContextURLSchemes.cpp.

Tested

  • Local: python tools/check_conventions.py --base upstream/main passed.
  • Host C++ build/test deferred to GitHub Actions CI (no local C++ toolchain on Windows host).

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:5276945178 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18831). Originally posted by [adriaespii](https://github.com/adriaespii) on 2026-11-12T11:56:52Z. --- ### What Implements `WKContextRegisterURLSchemeAsBypassingContentSecurityPolicy`, `WKContextRegisterURLSchemeAsCachePartitioned`, `WKContextRegisterURLSchemeAsCanDisplayOnlyIfCanRequest`, `WKContextRegisterURLSchemeAsEmptyDocument`, and `WKContextRegisterURLSchemeAsSecure` in `libSceNKWebKit` (`ContextURLSchemes.cpp`), recording registered URL schemes on `NKWebKit::ProcessPool` and adding unit tests in `tests/ContextURLSchemes.cpp`. ### Tested - Local: `python tools/check_conventions.py --base upstream/main` passed. - Host C++ build/test deferred to GitHub Actions CI (no local C++ toolchain on Windows host). ### 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](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
PrivacyOnion commented 2026-11-12 12:05:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-12T12:05:56Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 67a97dec4c:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_contexturlschemes_tests failed to build.
    core/libs/prx/libSceNKWebKit/src/Configuration.hpp:18:7: error: redefinition of ‘class NKWebKit::Preferences’
    
  • Note: the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5874169983 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18831#pullrequestreview-5874169983). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-12T12:05:56Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `67a97dec4c`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_contexturlschemes_tests` failed to build. ``` core/libs/prx/libSceNKWebKit/src/Configuration.hpp:18:7: error: redefinition of ‘class NKWebKit::Preferences’ ``` - Note: the AI-assisted checkbox can stay. Requesting changes for the points above.
PrivacyOnion commented 2026-11-12 13:02:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-12T13:02:09Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 89fa294706:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_contexturlschemes_tests failed to build.
    core/libs/prx/libSceNKWebKit/src/Configuration.hpp:18:7: error: redefinition of ‘class NKWebKit::Preferences’
    
  • Note: the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5874893269 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18831#pullrequestreview-5874893269). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-12T13:02:09Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `89fa294706`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_contexturlschemes_tests` failed to build. ``` core/libs/prx/libSceNKWebKit/src/Configuration.hpp:18:7: error: redefinition of ‘class NKWebKit::Preferences’ ``` - Note: the AI-assisted checkbox can stay. Requesting changes for the points above.
PrivacyOnion commented 2026-11-12 22:04:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-12T22:04:21Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 9680b2df98:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_contexturlschemes_tests failed to build.
    core/libs/prx/libSceNKWebKit/src/Configuration.hpp:18:7: error: redefinition of ‘class NKWebKit::Preferences’
    
  • Note: the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5882725646 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18831#pullrequestreview-5882725646). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-12T22:04:21Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `9680b2df98`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_contexturlschemes_tests` failed to build. ``` core/libs/prx/libSceNKWebKit/src/Configuration.hpp:18:7: error: redefinition of ‘class NKWebKit::Preferences’ ``` - Note: the AI-assisted checkbox can stay. Requesting changes for the points above.
PrivacyOnion commented 2026-11-13 03:44:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-13T03:44:23Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 9513bf2a74:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_contexturlschemes_tests built cleanly.
  • CTest (nkwebkit_contexturlschemes):
    1/1 Test #3817: nkwebkit_contexturlschemes .......   Passed    0.12 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/WebKitValueExports.hpp, core/libs/prx/libSceNKWebKit/src/Configuration.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified core/libs/prx/libSceNKWebKit/src/ContextURLSchemes.cpp: RegisterScheme safely validates contextRef and urlSchemeRef via NKWebKit::CastNKWebKit::ProcessPool and NKWebKit::CastNKWebKit::String, throwing std::invalid_argument on nullptr or type-tag mismatch.
    • Verified core/libs/prx/libSceNKWebKit/src/ContextURLSchemes.cpp: RegisterScheme guards against duplicate scheme registrations using std::find before push_back across all five ProcessPool scheme vectors.
    • Verified core/libs/prx/libSceNKWebKit/tests/ContextURLSchemes.cpp: line 2 includes WebKitValueExports.hpp instead of libSceNKWebKit.hpp per maintainer instruction, eliminating the NKWebKit::Preferences redefinition conflict with Configuration.hpp.
    • Verified core/libs/prx/libSceNKWebKit/tests/ContextURLSchemes.cpp: unit test exercises registration, deduplication, and invalid-argument exception paths for all exports, properly releasing all resources with WKRelease.
    • Verified core/libs/prx/libSceNKWebKit/Export.cpp and InventoryExports.hpp: clean removal of stubs and corresponding updates in docs/dev/debt/libSceNKWebKit.md documenting host ProcessPool recording without network enforcement.
    • Verified core/libs/prx/libScePosixForWebKit/TemporaryFile.cpp and core/libs/tests/GuestPosixFilesystem.cpp: removal of NotImplemented_nid_no_patch for SCE_KERNEL_O_DIRECT in mkostemp_nid_postfix correctly allows the flag and aligns with documented debt.
  • Note: the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5885673288 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18831#pullrequestreview-5885673288). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-13T03:44:23Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `9513bf2a74`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_contexturlschemes_tests` built cleanly. - **CTest** (`nkwebkit_contexturlschemes`): ``` 1/1 Test #3817: nkwebkit_contexturlschemes ....... Passed 0.12 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/WebKitValueExports.hpp`, `core/libs/prx/libSceNKWebKit/src/Configuration.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified core/libs/prx/libSceNKWebKit/src/ContextURLSchemes.cpp: RegisterScheme safely validates contextRef and urlSchemeRef via NKWebKit::Cast<NKWebKit::ProcessPool> and NKWebKit::Cast<NKWebKit::String>, throwing std::invalid_argument on nullptr or type-tag mismatch. - Verified core/libs/prx/libSceNKWebKit/src/ContextURLSchemes.cpp: RegisterScheme guards against duplicate scheme registrations using std::find before push_back across all five ProcessPool scheme vectors. - Verified core/libs/prx/libSceNKWebKit/tests/ContextURLSchemes.cpp: line 2 includes WebKitValueExports.hpp instead of libSceNKWebKit.hpp per maintainer instruction, eliminating the NKWebKit::Preferences redefinition conflict with Configuration.hpp. - Verified core/libs/prx/libSceNKWebKit/tests/ContextURLSchemes.cpp: unit test exercises registration, deduplication, and invalid-argument exception paths for all exports, properly releasing all resources with WKRelease. - Verified core/libs/prx/libSceNKWebKit/Export.cpp and InventoryExports.hpp: clean removal of stubs and corresponding updates in docs/dev/debt/libSceNKWebKit.md documenting host ProcessPool recording without network enforcement. - Verified core/libs/prx/libScePosixForWebKit/TemporaryFile.cpp and core/libs/tests/GuestPosixFilesystem.cpp: removal of NotImplemented_nid_no_patch for SCE_KERNEL_O_DIRECT in mkostemp_nid_postfix correctly allows the flag and aligns with documented debt. - Note: the AI-assisted checkbox can stay. Looks Good To Me
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!18831
No description provided.