feat(libSceNKWebKit): implement public suffix classification #20516

Merged
Mcm190 merged 1 commit from upstream-pr/20516 into main 2026-11-16 01:28:08 +00:00
Mcm190 commented 2026-11-15 08:02:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mcm190 on 2026-11-15T08:02:36Z.


What

Implements the formerly throwing WebCore::isPublicSuffix(const WTF::String&) export (_ZN7WebCore14isPublicSuffixERKN3WTF6StringE). It lowercases through the existing locale-independent WTF/ICU path, converts to UTF-8, and queries the already bundled libpsl with PSL_TYPE_ANY | PSL_TYPE_NO_STAR_RULE. Empty/null WTF strings return false. Both ICANN and private suffixes participate; implicit wildcard fallback for unknown suffixes is disabled.

Adapted from WebKit PublicSuffixCurl.cpp at c55364d53f971f63a709976f168d932d558b8909, whose copyright/license is retained verbatim at the top of the new source file. libpsl is an existing submodule built from source by the existing CMake helper. The guest prototype becomes typed and its old parameterless declaration/stub is removed.

The console's suffix dataset, libpsl version and binary object layouts remain unmeasured; the debt fragment records those limits. This uses the repository's existing WTF String ownership, case conversion and UTF-8 helpers. No new pointer-safety guarantee is claimed for malformed non-null WTF objects.

Coverage against current main: libSceNKWebKit 3,114/11,259 (27.66%) -> 3,115/11,259 (27.67%), exactly one additional implemented export. This is export coverage, not console compatibility.

Overlap: the full name lookup found no open PR implementing this export. The final branch check flagged 33 PRs sharing the large WebKit export/header/build files, including PRs that cannot merge with main; it failed closed. Inspected their shared-file patches and export bodies: 29 retain the unchanged throwing stub and four older PR trees do not yet contain the export. None changes public-suffix code or libpsl integration. Shared inventory/CMake/header hunks may need reconciliation as those PRs land; no automated all-clear is claimed. No dependency on those PRs.

Tested

Linux x86-64 (Fedora, GCC 16, Release), rebased onto main 70b4f2b3cc:

  • Built the actual shared library and nkwebkit_publicsuffix_tests, nkwebkit_wtf_tests, nkwebkit_wtftext_tests.
  • nkwebkit_publicsuffix, nkwebkit_wtf, nkwebkit_wtftext, public_headers, export_gap, progress_report: 6/6 pass.
  • New test: 47 queries covering empty strings, 8-bit and UTF-16 storage, case normalization including non-ASCII uppercase, IDN Unicode/punycode, ICANN and private suffixes, wildcard/exception behavior, unknown suffixes with the implicit star rule disabled, embedded NULs, an unpaired surrogate, string reference-count preservation, and null outer-pointer rejection.
  • Throwing-export negative control using a preloaded replacement for the same exported symbol: the shared-library-linked test fails with the expected not-implemented exception (exit -6).
  • tools/check_conventions.py --base origin/main, debt folding and git diff --check pass.
  • tools/progress.py --compare reports exactly +1 implemented export with no new exports declared.

Not tested on Windows, with a title or on a console. No performance claim.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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:5320781154 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20516). Originally posted by [Mcm190](https://github.com/Mcm190) on 2026-11-15T08:02:36Z. --- ### What Implements the formerly throwing `WebCore::isPublicSuffix(const WTF::String&)` export (`_ZN7WebCore14isPublicSuffixERKN3WTF6StringE`). It lowercases through the existing locale-independent WTF/ICU path, converts to UTF-8, and queries the already bundled libpsl with `PSL_TYPE_ANY | PSL_TYPE_NO_STAR_RULE`. Empty/null WTF strings return false. Both ICANN and private suffixes participate; implicit wildcard fallback for unknown suffixes is disabled. Adapted from [WebKit PublicSuffixCurl.cpp at c55364d53f971f63a709976f168d932d558b8909](https://github.com/WebKit/WebKit/blob/c55364d53f971f63a709976f168d932d558b8909/Source/WebCore/platform/network/curl/PublicSuffixCurl.cpp#L34-L42), whose copyright/license is retained verbatim at the top of the new source file. libpsl is an existing submodule built from source by the existing CMake helper. The guest prototype becomes typed and its old parameterless declaration/stub is removed. The console's suffix dataset, libpsl version and binary object layouts remain unmeasured; the debt fragment records those limits. This uses the repository's existing WTF String ownership, case conversion and UTF-8 helpers. No new pointer-safety guarantee is claimed for malformed non-null WTF objects. Coverage against current main: libSceNKWebKit 3,114/11,259 (27.66%) -> 3,115/11,259 (27.67%), exactly one additional implemented export. This is export coverage, not console compatibility. Overlap: the full name lookup found no open PR implementing this export. The final branch check flagged 33 PRs sharing the large WebKit export/header/build files, including PRs that cannot merge with main; it failed closed. Inspected their shared-file patches and export bodies: 29 retain the unchanged throwing stub and four older PR trees do not yet contain the export. None changes public-suffix code or libpsl integration. Shared inventory/CMake/header hunks may need reconciliation as those PRs land; no automated all-clear is claimed. No dependency on those PRs. ### Tested Linux x86-64 (Fedora, GCC 16, Release), rebased onto main `70b4f2b3cc`: - Built the actual shared library and `nkwebkit_publicsuffix_tests`, `nkwebkit_wtf_tests`, `nkwebkit_wtftext_tests`. - `nkwebkit_publicsuffix`, `nkwebkit_wtf`, `nkwebkit_wtftext`, `public_headers`, `export_gap`, `progress_report`: 6/6 pass. - New test: 47 queries covering empty strings, 8-bit and UTF-16 storage, case normalization including non-ASCII uppercase, IDN Unicode/punycode, ICANN and private suffixes, wildcard/exception behavior, unknown suffixes with the implicit star rule disabled, embedded NULs, an unpaired surrogate, string reference-count preservation, and null outer-pointer rejection. - Throwing-export negative control using a preloaded replacement for the same exported symbol: the shared-library-linked test fails with the expected not-implemented exception (exit -6). - `tools/check_conventions.py --base origin/main`, debt folding and `git diff --check` pass. - `tools/progress.py --compare` reports exactly +1 implemented export with no new exports declared. Not tested on Windows, with a title or on a console. No performance claim. <!-- 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. --> ### 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) and the licence notice of code adapted from upstream (see AGENTS.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
MarcZX10 commented 2026-11-15 08:21:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T08:21:47Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this change; the review is incomplete because the full text of Export.cpp was excluded from the review folder.

What I ran

Reviewed head d6f976d9a4c758aa0719e3d843be6de48a494143, with base main as recorded in the prepared review materials. I read the description, commit list, diff, manifest, README, and the changed code available through repo_read.py. No tests or build commands were run; reported test results below are author-supplied.

Results

Check Result Note
Changed code review not run Export.cpp full text excluded
Tests and build not run Linux results supplied by author
Changed-line coverage not run Available added code was inspected

Findings

Blocking

None verified in the code read. Export.cpp was not fully read, so this is not a complete review.

Non-blocking

None.

Not verified

  • Full Export.cpp (excluded by review-folder size limit); its removal hunk was visible in diff.patch.
  • Windows, console ABI and behavior, and the console suffix dataset, as also noted in the description.
  • Tests, build, and prechecks reported in the description were not run by me.
  • Files read: description.md, commits.md, manifest.json, README.md, diff.patch; changed code: CMakeLists.txt, Export.cpp lines 3980–4000, LegacyExports.hpp diff hunk, PublicSuffixExports.hpp, libSceNKWebKit.hpp diff hunk, PublicSuffix.cpp, tests/PublicSuffix.cpp, and the debt fragment. Excluded: full Export.cpp.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5909815193 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20516#pullrequestreview-5909815193). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-15T08:21:47Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this change; the review is incomplete because the full text of `Export.cpp` was excluded from the review folder. ## What I ran Reviewed head `d6f976d9a4c758aa0719e3d843be6de48a494143`, with base `main` as recorded in the prepared review materials. I read the description, commit list, diff, manifest, README, and the changed code available through `repo_read.py`. No tests or build commands were run; reported test results below are author-supplied. ## Results | Check | Result | Note | |---|---|---| | Changed code review | not run | `Export.cpp` full text excluded | | Tests and build | not run | Linux results supplied by author | | Changed-line coverage | not run | Available added code was inspected | ## Findings ### Blocking None verified in the code read. `Export.cpp` was not fully read, so this is not a complete review. ### Non-blocking None. ## Not verified - Full `Export.cpp` (excluded by review-folder size limit); its removal hunk was visible in `diff.patch`. - Windows, console ABI and behavior, and the console suffix dataset, as also noted in the description. - Tests, build, and prechecks reported in the description were not run by me. - Files read: `description.md`, `commits.md`, `manifest.json`, `README.md`, `diff.patch`; changed code: `CMakeLists.txt`, `Export.cpp` lines 3980–4000, `LegacyExports.hpp` diff hunk, `PublicSuffixExports.hpp`, `libSceNKWebKit.hpp` diff hunk, `PublicSuffix.cpp`, `tests/PublicSuffix.cpp`, and the debt fragment. Excluded: full `Export.cpp`. ## To get this to a good state Nothing is required.
PrivacyOnion commented 2026-11-15 08:30:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T08:30:01Z.

Review: APPROVED


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

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_publicsuffix_tests built cleanly.
  • CTest (nkwebkit_publicsuffix):
    1/1 Test #4108: nkwebkit_publicsuffix ............   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp, core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified null and empty string handling in core/libs/prx/libSceNKWebKit/src/PublicSuffix.cpp: nullptr domain safely throws std::invalid_argument, while null or empty domain->impl safely returns false without invalid memory access.
    • Verified libpsl integration and error handling in core/libs/prx/libSceNKWebKit/src/PublicSuffix.cpp: validated that null psl_builtin() and null utf8.buffer throw std::runtime_error, and classification properly enforces PSL_TYPE_ANY | PSL_TYPE_NO_STAR_RULE.
    • Verified locale-independent case normalization in core/libs/prx/libSceNKWebKit/src/PublicSuffix.cpp via _ZNK3WTF6String31convertToLowercaseWithoutLocaleEv, preserving reference counts and properly lowercasing ASCII and non-ASCII IDN domains.
    • Verified build and dependency configuration in core/libs/prx/libSceNKWebKit/CMakeLists.txt: psl is privately linked to libSceNKWebKit via cmake/LibPsl.cmake, and nkwebkit_publicsuffix_tests is correctly built and configured.
    • Verified unit test rigor in core/libs/prx/libSceNKWebKit/tests/PublicSuffix.cpp: 47 query assertions thoroughly exercise ICANN/private suffixes, unlisted TLDs, IDN Unicode, UTF-16 wide storage, unpaired surrogates, embedded NULs, and null pointer rejection.
    • Verified strict AGENTS.md compliance across all added files: no comments in code except the verbatim upstream BSD license header and pinned commit link in PublicSuffix.cpp, with technical debt properly documented in docs/dev/debt/changes/feat-nkwebkit-public-suffix.md.
  • Note: the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5909853332 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20516#pullrequestreview-5909853332). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-15T08:30:01Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `d6f976d9a4`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_publicsuffix_tests` built cleanly. - **CTest** (`nkwebkit_publicsuffix`): ``` 1/1 Test #4108: nkwebkit_publicsuffix ............ Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp`, `core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified null and empty string handling in core/libs/prx/libSceNKWebKit/src/PublicSuffix.cpp: nullptr domain safely throws std::invalid_argument, while null or empty domain->impl safely returns false without invalid memory access. - Verified libpsl integration and error handling in core/libs/prx/libSceNKWebKit/src/PublicSuffix.cpp: validated that null psl_builtin() and null utf8.buffer throw std::runtime_error, and classification properly enforces PSL_TYPE_ANY | PSL_TYPE_NO_STAR_RULE. - Verified locale-independent case normalization in core/libs/prx/libSceNKWebKit/src/PublicSuffix.cpp via _ZNK3WTF6String31convertToLowercaseWithoutLocaleEv, preserving reference counts and properly lowercasing ASCII and non-ASCII IDN domains. - Verified build and dependency configuration in core/libs/prx/libSceNKWebKit/CMakeLists.txt: psl is privately linked to libSceNKWebKit via cmake/LibPsl.cmake, and nkwebkit_publicsuffix_tests is correctly built and configured. - Verified unit test rigor in core/libs/prx/libSceNKWebKit/tests/PublicSuffix.cpp: 47 query assertions thoroughly exercise ICANN/private suffixes, unlisted TLDs, IDN Unicode, UTF-16 wide storage, unpaired surrogates, embedded NULs, and null pointer rejection. - Verified strict AGENTS.md compliance across all added files: no comments in code except the verbatim upstream BSD license header and pinned commit link in PublicSuffix.cpp, with technical debt properly documented in docs/dev/debt/changes/feat-nkwebkit-public-suffix.md. - 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!20516
No description provided.