feat(libSceNKWebKit): implement WebCore::HistoryItem field accessors and mutators #15230
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15230"
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 simnJS on 2026-11-02T21:25:13Z.
What
Implements 28
WebCore::HistoryItemexports inlibSceNKWebKit: the accessorsurlString,originalURLString,title,alternateTitle,referrer,target,scrollPosition,pageScaleFactor,isTargetItem,shouldRestoreScrollPosition,shouldOpenExternalURLsPolicy,documentState,children,hasChildren,formData,formContentTypeandhasCachedPageExpired, and the matching mutators.They follow
Source/WebCore/history/HistoryItem.hand.cppof the PS5 11.x WebKit snapshot neonmodder123/PS5-WebKit-11.x at 80f77e9, the snapshot #13992 uses.formContentTypereturns aStringby value, asHistoryItem.hdeclares it, unlike the reference-returning accessors.hasCachedPageExpiredwith a cached page,url,originalURL,copy, the constructors and the destructors stayNotImplemented_nid_no_patch. The object layout comes from those sources and is not verified against the console module; the debt file records it and the build assumptions.Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release:
nkwebkit_historyitempasses (strings and reference counts, scalars, containers, null arguments). Only this test was run, not the full suite. Not run on Linux or on a title.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)Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-04T00:02:33Z.
Review: APPROVED
@simnJS approved at
fdfb6ef10f. I checked your layout against the console module, and every offset I could reach matches.What I ran: this head merged onto
main(merge06a6a07b7a), Windows 11, WinLibs GCC, Release.nkwebkit_historyitem,nkwebkit_baseandpublic_headerspass (3 of 3).tools/check_conventions.py --base upstream/main --headon this head: all checks pass.urlStringreturningoriginalURLString,nkwebkit_historyitemfails at line 60 (1 of 1).Layout against firmware 13.42
system_ex/common_ex/lib/libSceNKWebKit.sprx(sha256e63acdc164592330a287cf6914c265336b27a357098a449c1609f8f82e104409), read from disassembly, not run. Each accessor reads the offset yourstatic_assertgives:urlString0x99440lea 0x8(%rdi),%raxoriginalURLString0x1aceb0lea 0x10(%rdi),%raxreferrer0x1bf890lea 0x18(%rdi),%raxtarget0x2d88e0lea 0x20(%rdi),%raxtitle0xe5680lea 0x28(%rdi),%raxalternateTitle0x27adb0lea 0x30(%rdi),%rax(yourdisplayTitle)scrollPosition0xc6990lea 0x38(%rdi),%raxpageScaleFactor0x3a7550vmovss 0x40(%rdi),%xmm0documentState0x210d10lea 0x48(%rdi),%raxshouldOpenExternalURLsPolicy0x120770movzbl 0x58(%rdi),%eaxchildrenconst0x18dca0lea 0x60(%rdi),%raxhasChildren0x15cb0cmpl $0x0,0x6c(%rdi)(the vector's size at 0x60 + 12)isTargetItem0x2f6140movzbl 0x71(%rdi),%eaxshouldRestoreScrollPosition0xb9ce0movzbl 0x74(%rdi),%eaxformData0x2d88f0mov 0x90(%rdi),%raxformContentType0xf2f10mov 0x98(%rsi),%rcx, with the result object inrdi, so by value, as you have ithasCachedPageExpired0x365360mov 0xa0(%rdi),%rbx; returns false when it's null, otherwise compares a time with0x8(%rbx)setScrollPosition(0x6da50) stores 8 bytes at0x38, andsetIsTargetItem(0xe3c00) a byte at0x71.setTitle(0x1f5bb0) andsetURLString(0x112580) add 2 to the new string's refcount, swap it into0x28or0x8, and release the old one. That is yourAssign, with the+= 2step ofWtfStringAbi.hpp:57.hasCachedPageExpiredthrowing once a cached page is set matches what's left: the firmware calls out for the current time there.The
notifyChangedyou note in the debt entry: after the swap,setTitleloads a function pointer from0x33649a8and calls it through a range check (from1f5bf0). That fits WebKit'snotifyHistoryItemChangedhook. Leaving it out is fine while nothing in AnyPS5 installs that hook.With the table above, the debt entry could cite these firmware offsets instead of "is not checked against the PS5 module". Not blocking.
Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-06T17:52:14Z.
Review: APPROVED
@simnJS thanks for adding the hook line to the debt entry. Re-checked at
cfa34bca05, and the approval stands.Since my approval at
fdfb6ef10f, the PR's own code changed in two places (fromgit diffof the PR's +/- lines at both heads, listed below).HistoryItem.cppgained theDerived from Source/WebCore/history/HistoryItem.cpp@80f77e94c63ee7202eec3d4b5b1a021dd89011baline in its licence header. TheHistoryItemExports.hppinclude inlibSceNKWebKit.hppmoved from afterApi.hppto the line after#pragma once, from the merge resolution. The +/- lines of the other six code and test files are identical tofdfb6ef10f's. The rest is twomainmerges pluscfa34bca05, which adds theTL1XjYe1xLosentence word for word. The branch merges cleanly withmainagain.What I ran
Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0, Release, this head merged onto current
main(merge03d7febac1):nkwebkit_historyitem,nkwebkit_baseandpublic_headers: 3 of 3 pass.bc1ae70375): withurlStringreturningoriginalURLString,nkwebkit_historyitemaborts (0xc0000409), 0 of 1 pass.tools/check_conventions.py --base upstream/main --headon this head: all checks pass.tools/pr_overlap.py --branch: the line conflicts it confirms are all indocs/dev/debt/libSceNKWebKit.md, at the entry list (L49) and the "Additional callable exports" count line (L63), with #14607, #15212, #15214, #15246, #15249, #15260, #15326, #16041, #16066, #16261 and #16383. #15212, #15249 and #15260 also conflict at the include list oflibSceNKWebKit.hpp(L1). The same-exports row it prints for #13486 isn't real: that PR's GitHub file list is three relinker files.One wording point, non-blocking
The entry still says the layout "is not checked against the PS5 module". My approval table at
fdfb6ef10fchecked the offset of every accessor this PR implements against firmware 13.42'slibSceNKWebKit.sprx(sha256e63acdc164592330a287cf6914c265336b27a357098a449c1609f8f82e104409, disassembly only). It also checked the stores ofsetScrollPosition,setIsTargetItem,setTitleandsetURLString, and my follow-up comment above quotessetShouldRestoreScrollPositionstoring at0x74. I didn't check which offsets the other setters store to. With that table (in my approval above), the clause could be narrowed to what's still open. For example: "the offsets the accessors read, and thosesetScrollPosition,setIsTargetItem,setTitle,setURLStringandsetShouldRestoreScrollPositionwrite, match firmware 13.42 (read from disassembly, not run); the other setters and the rest of the layout, which the constructors, destructor andcopywould use, are not checked."AI-assisted: yes (Claude Code)