feat(libSceNKWebKit): implement 85 WebKit member accessors and constructors #23755
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23755"
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-19T15:58:48Z.
What
Implements 85
libSceNKWebKitexports that throwNotImplementedonmain: field getters and setters, flag tests, state checks and small constructors. This replaces the earlier version of this PR, which translated the module's instructions. None of that code remains.Each export is written from the WebKit member function it names, and reads or writes named members. Sources are WebKit
e12a212a(May 2021). Three exports (JSCell::getObject,RuntimeMethod::createPrototype,RuntimeObject::createPrototype) use PS5-WebKit-11.x80f77e94, because the 2021ObjectTypevalue andJSGlobalObjectoffsets disagreed with the module. Every source file starts with itsDerived fromlines and the upstream licence notices.DomState.cppNode,DOMWindow,ContextDestructionObserver,NamedNodeMap,CSSComputedStyleDeclaration,CSSRule,MouseRelatedEvent,MessagePort,CachedResourceHandleBase,BackForwardItemIdentifier,SimpleRangeEditingValueState.cppEditor::Command,VisibleSelection,PasteboardCustomData,PathInspectorState.cppConsoleMessage,InspectorDebuggerAgent,RemoteControllableTarget,RemoteInspectionTargetJscRuntimeState.cppMarkedBlock,FuzzerAgent,JSCell,RuntimeMethod,RuntimeObjectPageLoaderState.cppFrameLoader,FrameLoaderClient,FrameLoaderStateMachine,FrameView,InspectorFrontendHost,ScrollingCoordinatorRenderingPlatformState.cppRenderLayerCompositor,CoordinatedGraphicsLayer,GraphicsLayer,Widget,ResourceHandle,DisplayList::FillRectWithGradient,MessagePortChannelRegistry,LibWebRTCProvider,JSNodeTextureMapperLayerState.cppTextureMapperLayerWtfThreadState.cppAutomaticThread,AutomaticThreadCondition,StringView::GraphemeClusters::IteratorLayouts: member offsets are
offsetofvalues compiled from the pinned headers, with a configuration based on JSCOnly plus the PlayStation port's option values. The bit-fields (Debuggerflags,Position,VisibleSelection) come from the compiler's output for a store to the member.Differences from the translated version: the memory-emulation helpers are gone, so the review point about their address check no longer applies. A null object pointer throws
std::invalid_argument; other invalid pointers fault.106 exports left out (they stay stubs):
Page,HTMLInputElement,HTMLMediaElement,HTMLImageElementandTextureMapperLayerflags. The likely cause is that the console's classes differ from the May 2021 tree there. The code was removed, not adjusted to the module.HitTestLocation/HitTestResultconstructors: not attempted.GraphicsContexttransparency layer functions: they call platform graphics code.SampleMap::empty: thestd::maplayout could not be pinned.Overlap: #26752 (opened after this PR) also implements 6 of these exports, the
PasteboardCustomDataones. Whichever PR merges second should drop its copy of them.Debt:
docs/dev/debt/changes/feat-nkwebkit-lifted-leaf-functions.mdhas one entry and removes 74 inventory rows. The branch and fragment keep their old name.How it was checked
Offline, not in the repository: the module's own bytes for each of the 85 functions ran next to this C++ on the same randomized memory and registers, comparing the return value, memory writes and whether it faulted (a null-object throw counts as a fault). Module:
libSceNKWebKit.sprx, SHA-2563af992253665387feeb5df90ff27dff683e3aa270cc4d92a0535b46ab18fa20d. 20000 trials per function: 85 pass, 0 mismatches. Limits: pointer arguments never overlap, andboolmembers are given only 0 or 1. This compares behaviour on random memory; it does not exercise objects created by the module.Tested
Linux Mint 22.3, GCC 13.3, Release:
nkwebkitpass.tools/check_conventions.pyand the public header audit pass.-fsyntax-onlywith WinLibs GCC 15.2 under Wine on the 8 sources and 8 tests, no errors. Not built or run on Windows.Checklist
main; no other open PR implements the same functions (see Overlap above for #26752)NotImplemented_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
New Features
Tests
Documentation
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T16:11:38Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
930bfd7715:tools/check_conventions.pypassed.nkwebkit_liftedleaffunctions_testsbuilt cleanly.nkwebkit_liftedleaffunctions):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/Api.hpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/LiftedLeafFunctions.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T16:14:37Z.
Review: COMMENTED
Reviewed — comments
This review is incomplete because
Export.cppandInventoryExports.hppwere excluded from the review folder, so I could not verify all changed lines or confirm how the new exports are wired into the library.What I ran
Reviewed head
930bfd7715fec4bc20fe5c9ca58038ea5c23a25fusing the prepared diff and readerrepo_read.py. No build or tests were run.Results
Findings
Blocking
None verified.
Non-blocking
None.
Not verified
core/libs/prx/libSceNKWebKit/Export.cppandcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppwere excluded because they were too large for the review folder. I did not inspect their changed lines through the reader, so I cannot confirm the replacements and inventory updates for all 193 exports. The author reports successful Linux tests and differential checks; those results were not run by me. Other changed files were read:Api.hpp,LegacyExports.hpp,LiftedLeafFunctionsExports.hpp,libSceNKWebKit.hpp,LiftedAbi.hpp,LiftedLeafFunctions.cpp,tests/LiftedLeafFunctions.cpp, and the debt change entry.To get this to a good state
Nothing is required. Please share the excluded files’ changed ranges for a complete review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T19:58:28Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; optional follow-up is to add direct edge-case coverage for address overflow in the memory helpers.
What I ran
Reviewed head
30e644f4c969363051ac7c7708ce1cd15de8e78dfrom the prepared patch and source reader. No build or tests were run by this review. I readdescription.md,commits.md,manifest.json,diff.patch,LiftedAbi.hpp, the first 100 lines ofLiftedLeafFunctions.cpp, the first 220 lines ofLiftedLeafFunctions.cpptests, andLiftedLeafFunctionsExports.hpp.Export.cppandInventoryExports.hppwere excluded from the review folder due to size and were not read from the pinned source.Results
Findings
Blocking
None identified in the inspected code.
Non-blocking
CheckAddressvalidates only the starting address. An address near the top of the address space can wrap on pointer arithmetic or span beyond the mapped address range. Consider rejecting ranges whose end overflows beforememcpy. Changed line:core/libs/prx/libSceNKWebKit/src/LiftedAbi.hpp:14.Not verified
Export.cppandInventoryExports.hppwere not read; their full text was excluded for size. Their diff hunks and wiring claims were not comprehensively verified.LiftedLeafFunctions.cppandtests/LiftedLeafFunctions.cppwere not read. The generated translations and replay suite were only sampled.To get this to a good state
Nothing is required. Optional: add boundary-range checks in the memory helpers and tests for overflowing addresses.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T22:11:46Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected code implements the described leaf exports and adds a replay test; the review is incomplete because two changed files were excluded from the review folder and the tests were not run here.
What I ran
Read the prepared diff and changed-file excerpts using the review reader. No build or tests were run. The exact head is
670dfb2dcb81edf66214da1cfe34b76de5aed9c0.Results
Findings
Blocking
None found in the files inspected.
Non-blocking
None.
Sources
Inspected
LiftedAbi.hpp,LiftedLeafFunctions.cpp,LiftedLeafFunctionsExports.hpp, the beginning ofLiftedLeafFunctions.cpptests,libSceNKWebKit.hpp, the PR description, and the prepared diff. Behavior claims are limited to these excerpts.Not verified
Export.cppandInventoryExports.hppwere excluded because they are too large for the review folder; their relevant excerpts were not read. The full 1,560-line implementation, 1,213-line test, and remaining changed files were not fully read. No checks were run on this head. The author reports Linux Mint/GCC test results, which I did not independently verify.To get this to a good state
Nothing is required. Optional: complete review of the excluded files and run the reported checks on this head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T03:39:07Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: make the low-address fault check account for the full width of each memory access.
What I ran
Reviewed head
90547b7d6c988f3bb84f3ba129404a432d03db7cfrom the prepared diff and repository reader. No build or tests were run. Author-reported checks are listed separately in Results.Results
Findings
Blocking
core/libs/prx/libSceNKWebKit/src/LiftedAbi.hpp:2890checks only the starting address before copyingsizeof(T)orNbytes. An access beginning below0x10000can cross the boundary and read or write mapped memory without throwing, contrary to the stated fault emulation. Check the entire accessed range inRead,Write,ReadBytes, andWriteBytes(including address overflow), and add a boundary case to the test.Non-blocking
None.
Not verified
core/libs/prx/libSceNKWebKit/Export.cppandcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppwere excluded from the review bundle as too large; their changed hunks were present indiff.patch, but their head files were not read.diff.patch; the full head text was not separately read.To get this to a good state
Update the memory helpers to reject any access whose full byte range begins below
0x10000, and cover accesses that straddle the boundary. Rerun the focused test and the reported NKWebKit suite on the new head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T18:04:13Z.
Review: COMMENTED
Reviewed — no blocking findings
The targeted review found no verified blocking defect, but the review is incomplete because not all changed files or the full export registry were inspected.
What I ran
Reviewed prepared diff at head
971f31a333370bb56026fed24a84219fc982a7f1. Read the PR description, commit list, manifest, diff, and selected source and test-file excerpts; no tests or build commands were run.Results
Negative control
Not run; the reported negative control is author-supplied.
Findings
Blocking
None verified in the code inspected.
Non-blocking
Sources
Not verified
Export.cppwas excluded from the review folder because it exceeded the size limit; its full text was not inspected through the reader.files.json; I did not inspect the remaining files or the full contents of those 11 files. The manifest marks no files as excluded by rule.To get this to a good state
Nothing is required. Optional: resolve the noted export overlap with PR #26752.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T18:09:02Z.
Review: COMMENTED
Architecture findings (2)
Advisory architecture findings (2)
537f2174-cfea-4653-ad0c-a600dad0e308Reviewing files that changed from the base of the PR and between
eb100e6121and971f31a333.core/libs/prx/libSceNKWebKit/Export.cppcore/libs/prx/libSceNKWebKit/include/Api.hppcore/libs/prx/libSceNKWebKit/include/DomStateExports.hppcore/libs/prx/libSceNKWebKit/include/EditingValueStateExports.hppcore/libs/prx/libSceNKWebKit/include/InspectorStateExports.hppcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppcore/libs/prx/libSceNKWebKit/include/JscRuntimeStateExports.hppcore/libs/prx/libSceNKWebKit/include/LegacyExports.hppcore/libs/prx/libSceNKWebKit/include/PageLoaderStateExports.hppcore/libs/prx/libSceNKWebKit/include/RenderingPlatformStateExports.hppcore/libs/prx/libSceNKWebKit/include/TextureMapperLayerStateExports.hppcore/libs/prx/libSceNKWebKit/include/WtfThreadStateExports.hppcore/libs/prx/libSceNKWebKit/libSceNKWebKit.hppcore/libs/prx/libSceNKWebKit/src/DomState.cppcore/libs/prx/libSceNKWebKit/src/EditingValueState.cppcore/libs/prx/libSceNKWebKit/src/InspectorState.cppcore/libs/prx/libSceNKWebKit/src/JscRuntimeState.cppcore/libs/prx/libSceNKWebKit/src/LayerGeometry.hppcore/libs/prx/libSceNKWebKit/src/PageLoaderState.cppcore/libs/prx/libSceNKWebKit/src/RenderingPlatformState.cppcore/libs/prx/libSceNKWebKit/src/TextureMapperLayerState.cppcore/libs/prx/libSceNKWebKit/src/WebKitMember.hppcore/libs/prx/libSceNKWebKit/src/WtfThreadState.cppcore/libs/prx/libSceNKWebKit/tests/DomState.cppcore/libs/prx/libSceNKWebKit/tests/EditingValueState.cppcore/libs/prx/libSceNKWebKit/tests/GuestObject.hppcore/libs/prx/libSceNKWebKit/tests/InspectorState.cppcore/libs/prx/libSceNKWebKit/tests/JscRuntimeState.cppcore/libs/prx/libSceNKWebKit/tests/PageLoaderState.cppcore/libs/prx/libSceNKWebKit/tests/RenderingPlatformState.cppcore/libs/prx/libSceNKWebKit/tests/TextureMapperLayerState.cppcore/libs/prx/libSceNKWebKit/tests/WtfThreadState.cppdocs/dev/debt/changes/feat-nkwebkit-lifted-leaf-functions.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-03T12:52:08Z.
Review: COMMENTED
Built the branch’s WebKit sources against the existing Linux runtime libraries. The DomState, EditingValueState, InspectorState, JscRuntimeState, PageLoaderState, RenderingPlatformState, TextureMapperLayerState, and WtfThreadState fixtures all passed.
AI-assisted: yes.
Pull request closed