feat(libSceNKWebKit): implement the WebCore::Position anchor constructors and containerNode exports #24350
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24350"
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:55:59Z.
What
Implements 5
libSceNKWebKitexports ofWebCore::Position. All five throwNotImplementedonmaintoday.Position(Node* anchorNode, AnchorType)andPosition(Node* anchorNode, unsigned offset, AnchorType), each in its C1 and C2 form: store the anchor node and take a reference on it, store the offset (0 for the first form) and the anchor type, and clear the legacy editing flag.containerNode() const: the anchor node for offset, before-children and after-children positions, its parent node for before-anchor and after-anchor positions, and null when there is no anchor node.Source: the
libSceNKWebKit.sprxwith SHA-2563af992253665387feeb5df90ff27dff683e3aa270cc4d92a0535b46ab18fa20d. The logic follows the pinned WebKitPosition.cpp(licence notice kept). The layout comes from the module's own code and matches the pinnedPosition.h: the anchor node at0, the offset at0x8, the anchor type in the low three bits of the byte at0xcand the legacy flag in bit 3 (the constructors keep the upper four bits of that byte as they were), and a node reference is the+2on the node's reference word at0x18already modelled inNodeAbi.hpp. They live in the newsrc/PositionAbi.hpp. Like the merged exports, an unreadable pointer throws, before anything is written, instead of faulting.Only the fields these functions use were checked against the module. The constructor taking a legacy editing flag (it calls a virtual function of the node) and
offsetForPositionAfterAnchor(a tail call to an unnamed function) are not part of this PR.Debt: the fragment
docs/dev/debt/changes/feat-nkwebkit-position-anchor.mdadds the Functional entry and removes the five inventory rows.Overlap: no open PR matches these names (all 174 open PRs touching
libSceNKWebKitwere diffed againstmain), and on currentorigin/mainall five are still only theNotImplementedstubs.How it was checked
Offline, against the module's own code (none of it is in the repository): the function bodies were disassembled and their bytes run against this implementation in a harness.
containerNode, comparing the whole position buffer, the node's reference word and the returned pointer, 0 mismatches.In the repository, the new
nkwebkit_positionanchortest checks all five exports: every anchor type, null anchors, the reference increments, the preserved upper bits and the cleared legacy bit, everycontainerNodetype value, and null or unreadable pointers. It also checks that a position on a read-only page throws with the node's reference word unchanged, and that a position straddling a writable and a read-only page keeps the anchor node store and the reference increment and then throws at the offset store.Tested
Linux Mint 22.3, GCC 13.3, Release:
nkwebkit_positionanchorpasses (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:26:16Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
285accab1a:tools/check_conventions.pypassed.nkwebkit_positionanchor_testsbuilt cleanly.nkwebkit_positionanchor):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/PositionAnchor.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-20T15:52:34Z.
Review: COMMENTED
Reviewed — comments
The review covers head
285accab1abd1f8d78656e87849936c6b0c6745a; one failure path in the constructor can leave the anchor’s reference count incremented after construction throws.What I ran
No commands were run. I inspected the prepared diff and targeted source files at the pinned head. The PR description reports Linux tests and checks, but I did not run them.
Results
Findings
Blocking
None.
Non-blocking
PositionAnchor.cpp:48:Constructincrements the anchor’s reference count before attempting to write the updated position at line 50. Ifselfis readable but unwritable,WriteGuestthrows after the increment, leaving a reference that the failed construction cannot release. Consider validating that the destination is writable before changing the node, or rolling back the increment if writing the position fails.Not verified
I did not run the test suite or build checks. The full text of
Export.cppandInventoryExports.hppwas excluded from the review bundle; I inspected their relevant hunks in the prepared diff only. Other changed files were read in full. I did not independently verify the module disassembly or the author-reported random-case harness results.To get this to a good state
Nothing is required. The optional constructor failure-path point is listed above.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T21:12:57Z.
Review: COMMENTED
Reviewed — comments
Changes are required before merge: the declared export signatures do not match the repository’s established ABI for exported functions.
What I ran
Reviewed head
5769f15be9137b9c6dcb1495be1683dbda941b27using the prepared diff and the pinned repository reader. No commands or tests were run by me; test results below are author-reported.Results
Findings
Blocking
None verified.
Non-blocking
voidfor constructors, while the existing export inventory declares the same constructor symbols as returningint.PositionAnchorExports.hppdeclaresvoidfor all four constructor exports (lines 10–13), andPositionAnchor.cppdefines them with the same return type (lines 61–75). Because these areextern "C"symbols, the C++ return type does not alter the symbol name, but it does determine the function type seen by callers that include the header. Update both declarations and definitions to match the establishedint APS5_VABIconstructor export convention and return the appropriate value. This is a compatibility concern; I did not verify runtime call sites or whether the return value is consumed. (core/libs/prx/libSceNKWebKit/include/PositionAnchorExports.hpp:10,core/libs/prx/libSceNKWebKit/src/PositionAnchor.cpp:61.)Not verified
core/libs/prx/libSceNKWebKit/Export.cppandcore/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, were not read through the pinned reader. Their relevant removals are visible indiff.patch.To get this to a good state
Nothing is required. Consider matching constructor declarations and definitions to the existing integer-returning export convention; this point is optional pending verification of caller expectations.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T18:13:06Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the implementation and included changed lines support merging.
What I ran
Reviewed head
47956f8715d43c8ee219c058fce32457f1bf77ec. No commands or tests were run in this review; the description reports Linux test and convention checks, Windows syntax checking, and a clean merge-tree result.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Export.cppwas excluded from the prepared review folder and was read only around the modified stub locations.InventoryExports.hpphad no added lines; only its edited declaration areas were checked. No tests, builds, module disassembly, or physical console behavior were independently verified. Included changed lines were read forPositionAnchorExports.hpp,libSceNKWebKit.hpp,PositionAbi.hpp,PositionAnchor.cpp,tests/PositionAnchor.cpp, and the debt change note.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-26T23:26:47Z.
Review: COMMENTED
Actionable comments posted: 1
e78de05b-4115-4f3e-8d17-a8ec5e5b732eReviewing files that changed from the base of the PR and between
460d3ece6fandc6705abd3d.core/libs/prx/libSceNKWebKit/Export.cppcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppcore/libs/prx/libSceNKWebKit/include/PositionAnchorExports.hppcore/libs/prx/libSceNKWebKit/libSceNKWebKit.hppcore/libs/prx/libSceNKWebKit/src/PositionAbi.hppcore/libs/prx/libSceNKWebKit/src/PositionAnchor.cppcore/libs/prx/libSceNKWebKit/tests/PositionAnchor.cppdocs/dev/debt/changes/feat-nkwebkit-position-anchor.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T23:44:41Z.
Review: COMMENTED
Reviewed — no blocking findings
The implementation and all included changed files were reviewed at head
c6705abd3dad60617c48a01327e54153c5c4988f; no verified blocking defect was found, thoughExport.cppwas excluded from the review bundle and was inspected only around the affected stubs.What I ran
No commands or tests were run. The author reports Linux Mint 22.3/GCC 13.3 tests and a Windows syntax-only check in the PR description; these were not independently run.
Results
Export.cppfull text omittedFindings
Blocking
None.
Non-blocking
None.
Not verified
The full changed
core/libs/prx/libSceNKWebKit/Export.cppwas excluded because it was too large for the review bundle. Only its nearby stub region was read throughrepo_read.py; integration elsewhere in that file was not verified. No test or build was run in this review. The reported disassembly comparison and test results were not independently verified.Files read:
review/description.md,review/commits.md,review/manifest.json,review/diff.patch; changed filescore/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/PositionAnchorExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/PositionAbi.hpp,core/libs/prx/libSceNKWebKit/src/PositionAnchor.cpp,core/libs/prx/libSceNKWebKit/tests/PositionAnchor.cpp, anddocs/dev/debt/changes/feat-nkwebkit-position-anchor.md; targeted contextcore/libs/prx/libSceNKWebKit/src/NodeAbi.hppand the relevant stub region ofcore/libs/prx/libSceNKWebKit/Export.cpp. Excluded: full text ofcore/libs/prx/libSceNKWebKit/Export.cpp.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T03:55:39Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the implementation and tests support the described anchor constructors and
containerNodebehavior.What I ran
Reviewed head
b19ddce8815fa11b753ca877e4e411b6357cc67eusing the prepareddiff.patchandmanifest.json, then read targeted source files throughrepo_read.py. No commands or tests were run in this review.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The report’s offline module harness, Linux test run, conventions check, header audit and Windows syntax check were not independently run.
Export.cppwas listed as excluded for size, so its full text was not reviewed; the removed stub hunks are visible in the prepared diff. Other files listed in the manifest were reviewed:InventoryExports.hpp,PositionAnchorExports.hpp,libSceNKWebKit.hpp,PositionAbi.hpp,PositionAnchor.cpp,tests/PositionAnchor.cpp, andfeat-nkwebkit-position-anchor.md.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T18:25:42Z.
Review: COMMENTED
Reviewed — no blocking findings
The implementation covers the five exports; one optional edge case remains around reads from partially mapped guest objects.
What I ran
Reviewed head
114febbb0f8f31f65b01683ad5ff10c9175a46cdagainstmain. I inspected the prepared diff and targeted source ranges withrepo_read.pyand the review-folder files. No tests or builds were run.Results
Findings
Blocking
None.
Non-blocking
PositionAnchor.cpp:74,83:containerNode()copies the completePositionand, for before/after-anchor cases, the completeNode, though it only uses the anchor pointer, type byte, and parent pointer. If those needed fields are readable while other bytes cross an unmapped page, these full-struct reads can reject the call. Consider reading only the fields used. The module’s exact read behavior was not independently verified.Sources
Not verified
Reviewed changed regions in
core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/PositionAnchorExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/PositionAbi.hpp,core/libs/prx/libSceNKWebKit/src/PositionAnchor.cpp,core/libs/prx/libSceNKWebKit/tests/PositionAnchor.cpp, anddocs/dev/debt/changes/feat-nkwebkit-position-anchor.md. No files are listed as excluded infiles.json; the fullExport.cpptext was omitted from the folder because of its size, so its changed regions were read through the pinned reader. The reported module disassembly, harness comparisons, and test results were not independently confirmed. Windows and console behavior were not tested.To get this to a good state
Nothing is required. Optionally, narrow
containerNode()guest reads to the fields it uses.Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T12:46:52Z.
Review: COMMENTED
Built the branch’s changed sources and ran
PositionAnchoron Linux against the existing runtime libraries. The test run passed and covered the position constructors and the anchor-to-container lookup.AI-assisted: yes.
Pull request closed