feat(libSceNKWebKit): implement DOMException::description, computeCurrentAge and the HTMLMediaElement media cache directory #19719
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19719"
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 B-Howell on 2026-11-13T21:32:21Z.
What
Implements four throwing libSceNKWebKit exports from the pinned PS5 WebKit source (neonmodder123/PS5-WebKit-11.x@80f77e9):
WebCore::DOMException::description(ExceptionCode)(9kGnP+jnLiI), from DOMException.cpp#L38-L82:if (ec < std::size(descriptions)) return descriptions[ec]; static const Description emptyDescription { { }, { }, 0 }; return emptyDescription;. The 32-row table is copied byte for byte, including the two messages with a leading space.Descriptionis{ const ASCIILiteral name; const ASCIILiteral message; LegacyCode legacyCode; }withLegacyCode = uint8_t, and the pinnedASCIILiteralholds onlyconst char* m_characters, sosrc/DOMExceptionAbi.hppstatic_asserts 24 bytes with fields at 0, 8 and 16. The export is declared in a newinclude/DOMExceptionExports.hpp.WebCore::computeCurrentAge(const ResourceResponse&, WallTime)(zFaau6WD5yo), from CacheValidation.cpp#L106-L117:max(apparentAge, age.value_or(0))plusWallTime::now() - responseTime, whereapparentAgeismax(0, responseTime - date)or 0 without a date. It reuses the existingResourceResponseBase::date,ResourceResponseBase::age(ResponseOptionalTime, static_asserted inResourceResponseAbi.hpp) andWTF::WallTime::nowexports, and goes intosrc/CacheControl.cpp, which is already derived from the same CacheValidation.cpp.WebCore::HTMLMediaElement::setMediaCacheDirectory(const String&)(eokEwsWT7zI) andmediaCacheDirectory()(u4uYkZNxIcg), from HTMLMediaElement.cpp#L7219-L7233: one never-destroyed sharedString; the setter assigns it and the getter returns a reference to it. The assignment uses the existingWtfAbi::Stringreference counting.The new source files carry the licence notices of DOMException.cpp and HTMLMediaElement.cpp. The debt file gets an entry for each, and only these four inventory rows are removed.
Tested
WSL Ubuntu, GCC, Release, Linux build:
Red, at
3a35d096800with the implementation removed (stubs from main restored, test kept):nkwebkit_webcorestatichelpers ... Subprocess abortedwith_ZN7WebCore12DOMException11descriptionENS_13ExceptionCodeE not implemented.Green:
ctest -R '^nkwebkit_webcorestatichelpers$'passed 3 of 3 runs at3a35d096800and again 3 of 3 at this head1b0a0f614ea, which only moves the declaration out ofWebCoreExports.hppto avoid conflicts with #14138 and #17917.nkwebkit_resourceresponse,nkwebkit_cachecontrol,nkwebkit_mediatimeandnkwebkit_basepassed, andctest -R '^public_headers'passed 65/65, at both heads.The test checks codes 0, 1, 10, 15, 22, 28 and 31 against the exact name, message and legacy code; codes 32, 37 and 0xffffffff return the same
{nullptr, nullptr, 0}record.computeCurrentAgeis checked with no headers, a futureresponseTime,Age: 100, aDatelater than, equal to and earlier thanresponseTime, anAgesmaller and larger than the apparent age, a negative and a fractionalAge, and unparsable headers; the resident time is bounded byWallTime::now()read before and after the call. The media cache directory starts null, shares the set string's impl with balanced reference counts, survives self-assignment, then takes an empty and a null string, and the returned reference stays the same object.tools/progress.py: libraries 15765/39340 (40.07%) on main to 15769/39340 (40.08%), done +4.@JJenkx, Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release,
1b0a0f614emerged onto main2e5253e9ac(report):nkwebkit_webcorestatichelperspassed 3/3, none skipped.2026-11-14: comment-only commit
820bb000c81rewrites eachDerived fromline asDerived from <path>@<40-character revision>, one line per source file (maintainer ruling, #19819 comment). No code changed, so no rebuild;tools/check_conventions.py --base origin/mainpasses andgit diff --checkis clean.Main merge
ee498826678: Windows 11, WinLibs GCC 15.2, Release, all 18 of our main merges from this round built together on main790e9a371cc:ctest -R nkwebkit116/116 passed,patched_librariespassed once the #19822 fix was in. Re-merged ontob9fb5ab5a32(no NKWebKit changes in between);check_conventionspassed.Debt fragment
cb9b668874: merged mainc3d38470e0cand moved this PR's debt edits intodocs/dev/debt/changes/claude-nkwebkit-domexception-cacheage-mediacache.md; the debt files match main, and the fragment applied to main gives the same debt lines as the previous head.debt_fold.py --checkandcheck_conventions.py --base origin/mainpass. Documentation only, no build.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 PrivacyOnion on 2026-11-18T09:33:31Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
cb9b668874:tools/check_conventions.pypassed.nkwebkit_webcorestatichelpers_testsbuilt cleanly.nkwebkit_webcorestatichelpers):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/CacheControlExports.hpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/MediaExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/CacheControl.cpp,core/libs/prx/libSceNKWebKit/src/DOMException.cpp,core/libs/prx/libSceNKWebKit/src/HTMLMediaElement.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me