feat(libSceNKWebKit): implement WebCore::SecurityOrigin and SecurityOriginData origin queries #22751
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22751"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by opxdelwin on 2026-11-18T07:02:44Z.
What
Implements 11
libSceNKWebKitexports for WebKit's origin model, ported from the pinned PS5 WebKit source neonmodder123/PS5-WebKit-11.x@80f77e94c63e (SecurityOrigin.cpp/.h,SecurityOriginData.cpp/.h,OriginAccessEntry.cpp, andURL::hasSpecialSchemefromWTF/wtf/URL.cpp):WebCore::SecurityOrigin::create(const URL&),toString,toRawString,isolatedCopy,equal,isSameOriginAs,domainForCachePartition,isMatchingRegistrableDomainSuffixWebCore::SecurityOriginData::toString,databaseIdentifier,securityOriginChanges:
src/SecurityOriginAbi.hpp(new) models the release-build layout ofSecurityOrigin(64 bytes) andSecurityOriginData(32 bytes, astd::variantof tuple and opaque data), taken from the pinnedSecurityOrigin.h,SecurityOriginData.handProcessQualified.h.static_asserts pin every offset and both sizes.include/SecurityOriginExports.hppholds the typed declarations. The stubs are removed fromExport.cpp, and the declarations fromInventoryExports.hpp.src/Mime.cppgets two small accessors over the existing no-access and cache-partitioned scheme registries.src/WtfString.cppexposes the existing URL port helper.Paths that still throw
NotImplemented_nid_no_patch, all recorded in the debt fragment:create(URL)forblob:URLs, because there is no blob origin cache;SecurityOriginData::securityOriginfor local schemes other thanfile, because there is no URL parser.The fragment also records the layout assumption that libc++'s
std::variantindex is 32 bits.Known nit, left for review: raw URL bit masks could be a named helper.
Note on overlap:
tools/pr_overlap.py --branchreports a textual conflict with #19636 insrc/Mime.cpp(L711-712 on main). Both PRs append new code at the end of the file, so the conflict is trivial to resolve and neither PR changes the other's code. The tool could not compare 29 other PRs (#13515, #14138, #14164, #14259, #14860, #16510, #17550, #17569, #17695, #17771, #17793, #17805, #17922, #17927, #17933, #18395, #18797, #18802, #19105, #19823, #20304, #20314, #20327, #21957, #22454, #22555, #22556, #22557, #22674), because each conflicts withmain. They share onlyExport.cpp/InventoryExports.hppwith this PR. I checked their diffs by hand: none adds, edits or removes any of the exports this PR implements.Tested
Not tested with a title or homebrew. Unit tests only, on Linux (Docker, Ubuntu image).
The build targets were
libSceNKWebKit nkwebkit_securityorigin_tests nkwebkit_forwarding_tests nkwebkit_symbolset_tests, run withctest -R '^(nkwebkit_securityorigin|nkwebkit_forwarding|nkwebkit_symbolset|public_headers.*)$':64da1641bd: 68 of 68 tests pass.nkwebkit_securityorigin,nkwebkit_forwardingandnkwebkit_symbolsetpass. Four tests fail:public_headers_compile_1/16/29/39, on-Winvalid-offsetofforRegioninRegionExports.hpp, a file this PR does not touch. Unmodifiedmain(324cc9554d) built with Clang fails the same four tests (4 of 67), so they fail before this PR too.New tests cover:
fileorigins;equal,isSameOriginAsanddocument.domainhandling;isolatedCopy(deep string copies, every flag, refcounts);domainForCachePartition, including a registered scheme;isMatchingRegistrableDomainSuffix(public suffixes, IP address vs domain);SecurityOriginData::toString,databaseIdentifierandsecurityOrigin;NotImplementedpaths, a valueless variant and null-pointer throws.A scratch program built with both g++ and clang++ checked the layout offsets against the
static_asserts.Also passed:
tools/check_conventions.py --base upstream/mainandtools/debt_fold.py --check.Not run: the Windows (MSYS2) build, and the Clang tests after the rebase. None of the commits the rebase took in touch
libSceNKWebKit.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-18T07:12:09Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
b4446230cf:tools/check_conventions.pypassed.nkwebkit_securityorigin_testsbuilt cleanly.nkwebkit_securityorigin):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/SecurityOriginExports.hpp,core/libs/prx/libSceNKWebKit/src/Mime.cpp,core/libs/prx/libSceNKWebKit/src/SecurityOrigin.cpp,core/libs/prx/libSceNKWebKit/src/WtfString.cpp,core/libs/prx/libSceNKWebKit/src/WtfStringAbi.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me