feat(libSceNKWebKit): implement PasteboardCustomData #26752
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/26752"
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 Sanjaysrinivas on 2026-11-24T19:17:58Z.
What
Replace all 22
WebCore::PasteboardCustomDataandEntrystubs in libSceNKWebKit with construction, copy/move assignment, destruction, and custom clipboard-data persistence. Preserve origin and ordered types, the last value for duplicate types, null/empty strings, 8/16-bit text, and platform-data ownership. Platform data is deliberately excluded from the custom-data wire format, following WebKit.Based on PasteboardCustomData.cpp at 80f77e94 and its persistence coders. Reuse the existing WTF string, vector, hash-map, encoder and checksum implementation, plus SharedBuffer from #20326. The debt fragment removes the 22 stub inventory rows and records the remaining object-layout and calling-convention verification.
The name check reports #24322, #24910 and #24917; their bodies remain
NotImplemented_nid_no_patch. The branch check required manual comparisons because other pending PRs conflict in the shared export inventories. Compared all 89 reported branches against the clipboard exports and new files, and inspected the three changes to WtfValues.cpp (#22470, #22472 and #26396): none implements these 22 exports or changes the SHA-1 update helper used here. Other SharedBuffer overlaps are inherited from the declared #20326 dependency and its follow-ups.Tested
Linux (Ubuntu under WSL2), GCC 13.3.0, Release, full project configuration with BUILD_TESTING=ON. Built and linked libSceNKWebKit and the four focused test targets.
nkwebkit_pasteboardcustomdata,nkwebkit_sharedbuffer,nkwebkit_wtfvalues,nkwebkit_jscpersistencebridge: 4/4 passed (0.24 s total).The WSL build used temporary LF normalization for SDL patch inputs and SQLite Tcl scripts; all submodule files were restored afterward.
Captured focused CTest results (Linux/WSL2, commit
fe0e122b11)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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by kripotker on 2026-11-24T19:34:58Z.
Review: APPROVED
Review: feat(libSceNKWebKit): implement PasteboardCustomData
Approve. I reviewed the PasteboardCustomData part. The SharedBuffer files are byte-identical to the declared dependency #20326 (
SharedBuffer.cpp,SharedBufferAbi.hpp,SharedBufferExports.hpp,tests/SharedBuffer.cppandfeat-webcore-shared-buffer.md), so they belong to that PR's review.Compared with upstream
I compared against
neonmodder123/PS5-WebKit-11.x@80f77e94(PasteboardCustomData.cpp/.h,PersistentCoders.cpp/.h,PersistentDecoder.cpp,PersistentEncoder.h).createSharedBuffer. It encodes the same sequence as upstream: version1, the origin, thesameOriginCustomStringData()map, thenorderedTypes(). Building the map withset, so the last value wins for a duplicate type, matches upstream'scustomData.set(entry.type, entry.customData).fromPersistenceDecoder.!add(...).isNewEntry), returning an empty object.writeStringInCustomData/addOrMoveEntryToEnd, because decoded entries only carrytypeandcustomData.Encoder::Salt: 11 foruint32_t, 3 forbool, 13 foruint64_t, 101 for fixed-length data. A zero-length read still adds the salt, asbufferPointerForDirectRead(0)does.CanReadbeforeCreateUninitialized, likedecodeStringText. The null-string marker0xFFFFFFFFis handled.GuestCopyIn_nid_no_patch, andCanReadalso refuses a position outside the buffer.Non-blocking notes
PasteboardPlatformDatamodelsstd::variant<String, Ref<SharedBuffer>>with a 1-bytesigned char indexat offset 8.std::__1namespace (_ZNSt3__1…,_ZNKSt3__1…throughoutcore/libs/prx), which is ABI v1. In ABI v1, libc++ makes the variant index anunsigned intunless_LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATIONis defined, and that is only on by default from ABI v2.index == -1) into index 0 with a null string, and the test pins that (tests/PasteboardCustomData.cpp:249-252).std::variantwould copy it as valueless.-fno-exceptions, so a valueless platform variant can't arise legitimately. Throwing here, as is already done for other unknown indices, would follow the "throw when behaviour is unknown" rule more closely than inventing index 0.is8Bitbyte above 1 is stricter than upstream, which loads the byte into abool(undefined behaviour). The debt entry already says so.Sabotage check
system,popen,exec*,CreateProcess,fopen, streams,getenv, sockets andstd::filesystem.What I ran
Windows 11, MSYS2 UCRT64 GCC 16.2.0, Release/Ninja,
BUILD_TESTING=ON, PR headfe0e122b11:check_conventions.py:All conventions checks passed.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T02:41:37Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change based on the source reviewed; the author-reported tests and the console ABI layout remain unverified here.
What I ran
Reviewed head
fe0e122b11ccaae02c75f3f7b16e9a5142922423using the prepared diff and the pinned repository reader (repo_read.py). No commands or tests were run. The description reports a clean merge preview against currentmain; that result was not independently checked.Results
Findings
Blocking
None.
Non-blocking
Decoderstructure’sbufferSize, pointers, and SHA-1 state supplied by the caller.CanReadchecks the declared span, whileReadchecks that the guest source is readable, but neither establishes that the declared span is within the actual allocation. Confirm that callers provide a valid bounded decoder before relying on this path (PasteboardCustomData.cpp:180-194).Not verified
Export.cppwas excluded from the prepared full-text bundle because it exceeded the review-folder limit; only its diff hunk was inspected.InventoryExports.hppandLegacyExports.hppwere present in the bundle but their full text was not read. All other changed files listed in the manifest’sfilesarray were read in full. No paths were listed as excluded by thefiles.jsonreference; that filename was not available through the reader.To get this to a good state
Nothing is required. Optional: confirm decoder span validity at the call boundary and verify ABI layout and calling convention against a console module.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T20:50:25Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: make
SharedBuffer::appendsafe when the source and destination are the same object and appending requires reallocation.What I ran
9764f9f73eaf887dbda18327f497aa55d13d6921using the prepared diff and pinned repository reader (repo_read.py).Results
Findings
Blocking
core/libs/prx/libSceNKWebKit/src/SharedBuffer.cpp:320: self-appending a buffer with multiple segments can invalidatesource.segments.bufferwhenReservereallocates the destination array. The subsequent loop reads through that stale pointer, causing invalid access and incorrect behavior. Preserve the source entries before reserving, or otherwise handleself == data; add coverage for self-append when the segment list is already heap-backed.Non-blocking
None.
Not verified
PasteboardCustomData.cpp,SharedBuffer.cpp,PasteboardCustomDataAbi.hpp,SharedBufferAbi.hpp,PasteboardCustomDataExports.hpp, andSharedBufferExports.hpp; also readlibSceNKWebKit.hpp,WtfPersistenceChecksum.hpp, the first five lines ofWtfValues.cpp, and the first 100 lines oftests/PasteboardCustomData.cpp.diff.patchandreview/README.md.Export.cppordocs/dev/debt/libSceNKWebKit.md, or every changed line in the other files. The diff contains 16 changed files; this was not a complete file-by-file review.To get this to a good state
Handle self-append across segment-array reallocation and add a regression test for a heap-backed segment list. Then rerun the focused SharedBuffer tests and the reported full four-target CTest set on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-29T20:58:52Z.
Review: COMMENTED
Actionable comments posted: 4
6f740e05-0751-490e-b4ae-cc2a24b7d312Reviewing files that changed from the base of the PR and between
1f27e2abfaand9764f9f73e.core/libs/prx/libSceNKWebKit/Export.cppcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppcore/libs/prx/libSceNKWebKit/include/LegacyExports.hppcore/libs/prx/libSceNKWebKit/include/PasteboardCustomDataExports.hppcore/libs/prx/libSceNKWebKit/include/SharedBufferExports.hppcore/libs/prx/libSceNKWebKit/libSceNKWebKit.hppcore/libs/prx/libSceNKWebKit/src/PasteboardCustomData.cppcore/libs/prx/libSceNKWebKit/src/PasteboardCustomDataAbi.hppcore/libs/prx/libSceNKWebKit/src/SharedBuffer.cppcore/libs/prx/libSceNKWebKit/src/SharedBufferAbi.hppcore/libs/prx/libSceNKWebKit/src/WtfPersistenceChecksum.hppcore/libs/prx/libSceNKWebKit/src/WtfValues.cppcore/libs/prx/libSceNKWebKit/tests/PasteboardCustomData.cppcore/libs/prx/libSceNKWebKit/tests/SharedBuffer.cppdocs/dev/debt/changes/feat-nkwebkit-pasteboard-custom-data.mddocs/dev/debt/changes/feat-webcore-shared-buffer.mddocs/dev/debt/libSceNKWebKit.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T08:51:52Z.
Review: COMMENTED
Both
PasteboardCustomDataandSharedBufferpassed on Linux with the exact changed translation units. I checked the reader and writer together with the fixture's checksum and data/reference checks, including theSharedBufferownership path used by the encoded data.AI-assisted: yes.
Pull request closed