feat(libSceNKWebKit): implement OpaqueJSString::tryCreate #23826
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23826"
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 Callimann8 on 2026-11-19T18:08:27Z.
What
Implements both
OpaqueJSString::tryCreateoverloads in libSceNKWebKit. Both were throwing stubs inExport.cpp:OpaqueJSString::tryCreate(const WTF::String&)(_ZN14OpaqueJSString9tryCreateERKN3WTF6StringE, NIDPVV6vSXtXwE)OpaqueJSString::tryCreate(WTF::String&&)(_ZN14OpaqueJSString9tryCreateEON3WTF6StringE, NIDmcOkVwJvgME)They are in the new
src/OpaqueJSString.cppand follow the pinned WebKit OpaqueJSString.cpp:WTF::Stringreturns a nullRefPtr<OpaqueJSString>.GuestJSStringas theOpaqueJSStringbehindJSStringRef(its reference count is at offset 0, and~OpaqueJSStringis exported for it). So the 8-bit or 16-bit characters are copied into aGuestJSString, and the result works withJSStringRetain,JSStringReleaseand the otherJSString*calls.String&&overload leaves the source string null, as the upstream move does.RefPtr<OpaqueJSString>is not trivially copyable, so the guest gets it through a hidden return pointer. The newOpaqueJSStringPtrinsrc/JscApi.hpphas the same shape (one pointer, non-trivial destructor) to keep that ABI.include/JscExports.hppdeclares both functions, and the two placeholders are dropped fromInventoryExports.hpp. The debt fragment adds the entry and drops both names from the callable-exports table.OpaqueJSString::string()is left alone because #23758 implements it.Tested
Linux (Ubuntu 24.04, GCC 13), no title. New test
nkwebkit_opaquejsstring_tests(picked up by thetests/*.cppglob) checks null, empty, Latin-1 and UTF-16 (with a surrogate pair) strings, the reference count, retain and release, the moved-from source and a null argument. Built it andnkwebkit_jsc_testsin the full CMake build and ran both with ctest: they pass. Also builtOpaqueJSString.cppwith the new test by itself under ASan and UBSan and ran it with no errors.python3 tools/debt_fold.py --checkpasses.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-19T18:26:48Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
a354e64577:tools/check_conventions.pypassed.nkwebkit_opaquejsstring_testsbuilt cleanly.nkwebkit_opaquejsstring):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/JscExports.hpp,core/libs/prx/libSceNKWebKit/src/JscApi.hpp,core/libs/prx/libSceNKWebKit/src/OpaqueJSString.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me