feat(libSceNKWebKit): implement the JSDocument, JSElement, JSEvent and JSNode toWrapped exports #24347
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24347"
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 RiverWhy on 2026-11-20T14:42:57Z.
What
Implements 4
libSceNKWebKitexports:WebCore::JSDocument::toWrapped,JSElement::toWrapped,JSEvent::toWrappedandJSNode::toWrapped((JSC::VM&, JSC::JSValue)). All four throwNotImplementedonmaintoday.Each returns the wrapped DOM object of a JS value that is a DOM wrapper cell of the right class, and null for anything else: a JS value that is not a cell, or a cell of another JSType.
JSDocument: the cell's JSType byte is exactly0xf9.JSElement: exactly0xf1.JSEvent: exactly0xef.JSNode: any byte from0xf0to0xff(every node wrapper).Source: the
libSceNKWebKit.sprxwith SHA-2563af992253665387feeb5df90ff27dff683e3aa270cc4d92a0535b46ab18fa20d. The logic follows thetoWrappedthe pinned WebKitCodeGeneratorJS.pmgenerates (jsDynamicCast, then&wrapper->wrapped()), with the JSType values of the pinnedJSDOMWrapper.handJSNodeCustom.h(licence notice kept). The module's own code matches them: a value with a bit of0xfffe000000000002set is not a cell, the JSType byte is at+0x5of the cell and the wrapped pointer at+0x18(after the cell header, the butterfly andJSDestructibleObject::m_classInfo). TheVMargument is unused. They live in the newsrc/JSDOMWrapperAbi.hpp. Like the merged exports, a null or unreadable cell throws instead of faulting.Only the fields the four functions read were checked against the module; the other wrapper fields are not compared with a console module. The other
toWrappedexports (185 bytes or more, with globals) are not part of this PR.The lifted branching functions PR (#23757) leaves these four out because random memory rarely produces the exact JSType; this PR covers them by hand.
Debt: the fragment
docs/dev/debt/changes/feat-nkwebkit-dom-wrapper-to-wrapped.mdadds the Functional entry and removes the four inventory rows.Overlap: no open PR implements these names (all 172 open PRs touching
libSceNKWebKitwere diffed againstmain), and on currentorigin/mainall four are still only theNotImplementedstubs.How it was checked
Offline, against the module's own code (none of it is in the repository): the four function bodies were disassembled and their bytes run against this implementation in a harness.
0xf9,0xf1,0xefand the range around0xf0, all four exports called on each, 0 mismatches, comparing the returned pointer (each class matched about 2 million times,JSNodeabout 5.5 million times).OtherTagbit, the wrong pointer returned) are all caught: six give between 10,723 and 1,141,245 mismatches per 2,000,000 runs, and the cell-test mutant crashes the harness.In the repository, the new
nkwebkit_jsdomwrappertest calls all four exports for every one of the 256 JSType values, checks the returned pointers (aJSNodeaccepts documents, elements and text nodes but not events), non-cell values, and null or unreadable cells.Tested
Linux Mint 22.3, GCC 13.3, Release:
nkwebkit_jsdomwrapperpasses (100% of the 1 test selected).tools/check_conventions.pypasses.core/libs/tests/test_public_headers.py --audit-onlypasses.git merge-treeagainst currentorigin/mainis clean.-fsyntax-onlywith WinLibs GCC 15.2.0 on the new source and test, 0 errors; the test itself was not run on Windows.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 PrivacyOnion on 2026-11-20T15:15:04Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
027ab18799:tools/check_conventions.pypassed.nkwebkit_jsdomwrapper_testsbuilt cleanly.nkwebkit_jsdomwrapper):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/JSDOMWrapper.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T16:45:59Z.
Review: COMMENTED
Reviewed — comments
Changes are required before merge: resolve the ABI concern and confirm it against the target module.
What I ran
Reviewed head
027ab187996db97173fdb8f5a14c28d1793c9d13. No commands or tests were run; the author reports Linux tests and Windows syntax checks in the PR description.Results
Findings
Blocking
None verified.
Non-blocking
core/libs/prx/libSceNKWebKit/src/JSDOMWrapperAbi.hpp:44modelsJSDOMWrapperas a singlewrappedpointer at offset0x18. The description says that only fields read by these functions were compared with the module, but no module or disassembly was available for independent confirmation here. The added tests use the same ABI model, so they establish consistency with that model rather than confirming it against the target. Please attach or cite reproducible evidence for the target layout before relying on these exports.Sources
JSDOMWrapper.cpp,JSDOMWrapperAbi.hpp, andtests/JSDOMWrapper.cppat the reviewed head.Not verified
Export.cppandInventoryExports.hppfull text were excluded as too large; their changed hunks were reviewed indiff.patch.review/description.md,review/commits.md,review/manifest.json,review/diff.patch,review/README.md, and the includedJSDOMWrapperExports.hpp,libSceNKWebKit.hpp,JSDOMWrapper.cpp,JSDOMWrapperAbi.hpp,tests/JSDOMWrapper.cpp, and debt entry. Targeted context read fromCMakeLists.txt,NodeAbi.hpp,General.cpp,Export.cpp, andInventoryExports.hpp.To get this to a good state
Nothing is required. The ABI evidence request is optional review feedback.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T21:13:47Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the checked implementation follows the described type filters and wrapped pointer extraction.
What I ran
Reviewed head
ffc28896ce7b9b463bb6ddca55e46a072e7895b2using the prepared diff andrepo_read.pyat that pinned head. No commands or tests were run by me; test results below are author-reported.Results
nkwebkit_jsdomwrapperFindings
Blocking
None.
Non-blocking
None.
Not verified
I read all files listed in the manifest.
Export.cppandinclude/InventoryExports.hppwere excluded from the prepared full-text files due to size; I checked their relevant symbol context in the diff and the export source context through the reader. I did not run tests, conventions, header audit, or a merge preview, and did not independently verify the module disassembly or author-reported harness results. Console behavior and the other wrapper fields are not verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T18:14:02Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the reviewed implementation and its added tests support merging.
What I ran
Reviewed head
0957605ea65145b084cc9919975149a1045da52f. No commands or tests were run during this review; the description reports Linux testing and Windows syntax checks, which I did not independently verify.Results
Export.cppsrc/*.cppglob; test bytests/*.cppglobFindings
Blocking
None.
Non-blocking
None.
Not verified
core/libs/prx/libSceNKWebKit/Export.cppwas excluded from the review folder because it was too large and was not read. Its diff only removes the four stub definitions. I also did not independently verify the module disassembly, ABI offsets, test results, or console behavior.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-26T23:23:31Z.
Review: COMMENTED
Actionable comments posted: 1
d04bcd31-f625-44ab-b779-9f120c38c666Reviewing files that changed from the base of the PR and between
460d3ece6fandfce7b263b2.core/libs/prx/libSceNKWebKit/Export.cppcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppcore/libs/prx/libSceNKWebKit/include/JSDOMWrapperExports.hppcore/libs/prx/libSceNKWebKit/libSceNKWebKit.hppcore/libs/prx/libSceNKWebKit/src/JSDOMWrapper.cppcore/libs/prx/libSceNKWebKit/src/JSDOMWrapperAbi.hppcore/libs/prx/libSceNKWebKit/tests/JSDOMWrapper.cppdocs/dev/debt/changes/feat-nkwebkit-dom-wrapper-to-wrapped.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T23:47:17Z.
Review: APPROVED
Reviewed — looks good
The implementation matches the stated wrapper type checks and offsets; the review covered all changed files except the oversized
Export.cppfull text, whose changed hunks were inspected in the prepared diff.What I ran
Reviewed head
fce7b263b2926457031dc9a3d05f3b06b617c958. No commands or tests were run;repo_read.pywas used to inspect the prepared review bundle and pinned repository files.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full
core/libs/prx/libSceNKWebKit/Export.cppwas excluded from the review folder because it is too large; its four relevant removal hunks were read indiff.patch. Tests and the author-reported harness results were not run or independently verified. The reviewed files werecore/libs/prx/libSceNKWebKit/Export.cpp(changed hunks only),core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/JSDOMWrapperExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/JSDOMWrapper.cpp,core/libs/prx/libSceNKWebKit/src/JSDOMWrapperAbi.hpp,core/libs/prx/libSceNKWebKit/tests/JSDOMWrapper.cpp, anddocs/dev/debt/changes/feat-nkwebkit-dom-wrapper-to-wrapped.md. Build registration incore/libs/prx/libSceNKWebKit/CMakeLists.txt,NodeAbi.hpp, andGeneral.hppwas also read. No changed files were excluded entirely from review.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T06:43:14Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the reviewed code and supplied checks support merging.
What I ran
Reviewed head
defc979f5eec36d029e37ec14c5e311053a5b61fusingrepo_read.pyto inspect the prepared diff and targeted source. I did not run commands or tests; test results below are author-reported.Results
nkwebkit_jsdomwrapperpassed.Findings
Blocking
None.
Non-blocking
None.
Not verified
Did not independently run the tests or verify the module disassembly, reported random-value harness, or Windows syntax check. Read the changed implementation, ABI header, test, and relevant diff;
Export.cppwas excluded from the review bundle because it was too large, and its changed lines only remove the four stubs.files.jsonwas not available through the reader, so its reviewed/excluded listing was not independently checked.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T18:06:20Z.
Review: COMMENTED
Architecture findings (1)
Advisory architecture findings (1)
a5a06530-9cea-429b-84e8-1f1cb97339e3Reviewing files that changed from the base of the PR and between
defc979f5eandf3a2358164.core/libs/prx/libSceNKWebKit/src/JSDOMWrapper.cppcore/libs/prx/libSceNKWebKit/tests/JSDOMWrapper.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T18:22:36Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
f3a2358164781fc94a9fe27d0bbba20cee1f0c31. I inspected the prepared diff and changed code, plus targeted reader context forGuestCopyIn_nid_no_patch, CMake test discovery, and the export area. The reader displayed the requested content but then failed while trying to write its read log in the read-only review folder. I did not run tests or builds.Commands used included:
Results
Findings
Blocking
None.
Non-blocking
Sources
Not verified
reviewedinfiles.json. For the oversizedExport.cpp, I inspected its changed hunks and nearby reader context rather than the full file.files.jsonlists no excluded files.To get this to a good state
Nothing is required. Optionally, include a reproducible artifact for the module-derived ABI observations noted above.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T12:46:54Z.
Review: COMMENTED
Built the branch’s changed sources and ran
JSDOMWrapperon Linux against the existing runtime libraries. The test run passed and covered the wrapper export return values for document, element, event, and node.AI-assisted: yes.
Pull request closed