feat(libSceNKWebKit): implement the JSC::JSPromise status, result and isHandled exports #24339
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24339"
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:29:39Z.
What
Implements 3
libSceNKWebKitexports ofJSC::JSPromise. All three throwNotImplementedonmaintoday.status(VM&) const: the promise state,Pending(0),Fulfilled(1) orRejected(2), taken from the low two bits of the flags internal field.isHandled(VM&) const: whether theisHandledbit (4) of the flags is set.result(VM&) const:undefinedwhile the promise is pending, otherwise the result or reason (the second internal field).Source: the
libSceNKWebKit.sprxwith SHA-2563af992253665387feeb5df90ff27dff683e3aa270cc4d92a0535b46ab18fa20d. The logic follows the pinned WebKitJSPromise.cpp(licence notice kept), includingJSValue::asUInt32AsAnyIntfor the flags (anint32with the number tag, otherwise the double encoding with the1 << 49offset, so a negativeint32takes the double path). The offsets come from the module's own code and match the pinnedJSPromise.handJSInternalFieldObjectImpl.h: the flags at0x10and the reactions or result at0x18, after the cell header and the butterfly. TheVMargument is unused. They live in the newsrc/JSPromiseAbi.hpp. Like the merged exports, a null or unreadable promise pointer throws instead of faulting.Only the fields the three functions read were checked against the module; the cell header and butterfly are not compared with a console module.
Debt: the fragment
docs/dev/debt/changes/feat-nkwebkit-promise-state.mdadds the Functional entry and removes the three inventory rows.Overlap: no open PR matches these names (all 171 open PRs touching
libSceNKWebKitwere diffed againstmain), and on currentorigin/mainall three are still only theNotImplementedstubs.How it was checked
Offline, against the module's own code (none of it is in the repository): the three function bodies were disassembled and their bytes run against this implementation in a harness.
int32encodings with positive and negative values, and double encodings including fractions, NaN, infinities and values outside theint64range; random result field and header), 0 mismatches, comparing the status as 32 bits,isHandledas a byte and the result as 64 bits.int32path, negativeint32treated as anint32, no double offset, result returned while pending, a wrong state mask, a wrongisHandledbit, a wrong out-of-range conversion) give between 140,656 and 870,305 mismatches per 2,000,000 runs, so the harness does tell the behaviours apart.In the repository, the new
nkwebkit_jspromisestatetest builds promise cells and checks all three exports for every state and handled combination,int32and double flags, a pending promise with a stored value, negative flags, and null or unreadable pointers.Tested
Linux Mint 22.3, GCC 13.3, Release:
nkwebkit_jspromisestatepasses (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 MarcZX10 on 2026-11-20T14:37:25Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the implementation and test logic I inspected support the stated behavior, while integration evidence for two excluded files was unavailable.
What I ran
Reviewed head
d0c663477c5c3c2306adbeea90b3b365f146ecc3using the prepared diff and pinned repository reader. No commands or tests were run. Readdescription.md,commits.md,manifest.json,diff.patch, and the full text ofJSPromiseStateExports.hpp,JSPromiseAbi.hpp,JSPromiseState.cpp,tests/JSPromiseState.cpp, the debt change note, and the existing NKWebKitCMakeLists.txt.Export.cppandinclude/InventoryExports.hppwere excluded by the bundle size rule.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The contents of
Export.cppandinclude/InventoryExports.hppwere not read, so their export and inventory edits are not verified. No tests, build, convention checks, or merge-preview check were run by me; results in the PR description are author-reported. The PS5 module field layout and console behavior were not independently confirmed.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T14:41:52Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
d0c663477c:tools/check_conventions.pypassed.nkwebkit_jspromisestate_testsbuilt cleanly.nkwebkit_jspromisestate):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/JSPromiseState.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-21T03:04:18Z.
Review: COMMENTED
Reviewed — comments
The prepared diff and available source context show no concrete blocking defect; automated checks were not run in this review.
What I ran
Reviewed head
5ced9a57b4fe074bb15ec9b9b55dd49221bd1697using the prepared diff and repository reader. No commands or tests were run.Results
Findings
Blocking
None identified in the inspected changes.
Non-blocking
None.
Not verified
The author-reported Linux tests, convention/header audits, and Windows syntax check were not independently run. The full text of
Export.cppandinclude/InventoryExports.hppwas excluded by the prepared review; their removals are visible in the diff. The included changed files and added test/debt entry were reviewed from the diff; relevant CMake test discovery was read. Runtime behavior on console hardware was 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:54Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the reviewed code supports merging, and the author-reported checks are consistent with the inspected implementation.
What I ran
Reviewed head
a0f432c89510f15dec6c49ae62b6ac687a1baedfusing the prepared diff and pinned repository reader. No commands or tests were run in this review.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full text of
core/libs/prx/libSceNKWebKit/Export.cppwas excluded from the review folder; only its changed hunk was available in the prepared diff, and its repository text was not inspected.core/libs/prx/libSceNKWebKit/include/InventoryExports.hpphas no added lines, so its full text was not read. No tests, builds, prechecks, merge preview, Windows run, or physical-console behavior were verified. The author's reported Linux test, convention check, header audit, merge-tree check, Windows syntax check, disassembly, and harness results were not run by this reviewer.Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-26T23:23:30Z.
Review: COMMENTED
Actionable comments posted: 1
e6603c88-bdc9-41da-a16b-556369e7010aReviewing files that changed from the base of the PR and between
460d3ece6fandd0d4a6a39a.core/libs/prx/libSceNKWebKit/Export.cppcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppcore/libs/prx/libSceNKWebKit/include/JSPromiseStateExports.hppcore/libs/prx/libSceNKWebKit/libSceNKWebKit.hppcore/libs/prx/libSceNKWebKit/src/JSPromiseAbi.hppcore/libs/prx/libSceNKWebKit/src/JSPromiseState.cppcore/libs/prx/libSceNKWebKit/tests/JSPromiseState.cppdocs/dev/debt/changes/feat-nkwebkit-promise-state.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T23:48:16Z.
Review: APPROVED
Reviewed — looks good
Nothing in the inspected implementation blocks merging; the description’s module validation and test results are author-reported and were not independently run here.
What I ran
Reviewed head
d0d4a6a39ad9d29f58c0453dec4aaecb6f6da117using the prepared diff and pinned reader. No commands or tests were run.Results
Findings
Blocking
None identified in the inspected implementation.
Non-blocking
None.
Not verified
core/libs/prx/libSceNKWebKit/Export.cppwas excluded from the review folder because it is too large; its changed lines were visible indiff.patch, and the corresponding head section was read through the reader.core/libs/prx/libSceNKWebKit/include/InventoryExports.hpphad no added lines; only the relevant surrounding lines were read. The fullExport.cppwas not read, so duplicate or conflicting export definitions elsewhere in it were not verified. Build, tests, conventions, audit, Windows syntax check, merged preview, console behavior, and the author-reported offline module harness were not run or independently confirmed.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T03:33:53Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the reviewed implementation and tests support merging.
What I ran
Reviewed head
d64fd60bdc127e37be0ac966b4e1adb5340bf814. No commands or tests were run;repo_read.pywas unavailable as an executable command in this review interface. The author reports Linux tests and a clean merge-tree check; those results were not independently run here.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Export.cppwas excluded from the review bundle because it was too large, and I did not read it throughrepo_read.py. The header, implementation, test, and debt note were read. The complete contents ofInventoryExports.hppwere included, but its 5,509 lines were not read. The module disassembly, console layout, harness runs, and author-reported build/test results were not independently verified. The review bundle did not exposefiles.json; the manifest lists seven changed files, six with full text included, andExport.cppexcluded.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T12:46:59Z.
Review: COMMENTED
Built the branch’s changed sources and ran
JSPromiseStateon Linux against the existing runtime libraries. The test run passed and covered status decoding and the result and handled accessors.AI-assisted: yes.
Pull request closed