feat(libSceNKWebKit): implement WTF::mimeTypeFromDataURL and URL::stringCenterEllipsizedToLength #14479
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14479"
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 ashwin280802 on 2026-11-01T15:07:58Z.
What
Implements two
libSceNKWebKitWTF exports that wereNotImplemented_nid_no_patchstubs:WTF::mimeTypeFromDataURL(StringView)WTF::URL::stringCenterEllipsizedToLength(unsigned) constBoth follow the pinned PS5 WebKit
URL.cppL1053-L1079:mimeTypeFromDataURLlooks for;from index 5, then,. Neither found returns a non-null empty string (nottext/plain, as the source's FIXME notes). A separator at index 5 returnstext/plain. Otherwise it returns the ASCII-lowercased text before the separator, keeping the input's 8/16-bit width.stringCenterEllipsizedToLengthreturns the same string when it already fits. Otherwise it joinsleft(length / 2 - 1),"..."andright(length / 2 - 2)with WebKit's unsigned wrap-around, so lengths 0 and 1 give the whole URL plus"..."and lengths 2 and 3 give"...".Differences from WebKit: the
ASSERTthat the input starts withdata:is not reproduced (release builds drop it), and a concatenated length aboveINT32_MAXthrowsstd::length_errorwhere WebKit crashes. The debt file rows and count are updated.No open PR implements either function. Other open NKWebKit PRs edit the same debt-count line and nearby code in
Export.cpp,WtfString.cppandtests/Wtf.cpp, so whichever merges second needs a rebase. Behaviour is taken from source, not measured on a console.Tested
Windows 11, MinGW-w64 GCC 15.2.0 (winlibs, ucrt), Release,
build-full, atdd166cdd67:nkwebkit_wtfnow covers 8-bit URLs at lengths 0 to 6, 10, 11, 28 to 30, 40 and0xFFFFFFFF, 16-bit URLs at lengths 1, 3, 10 and 21, null and empty strings, a nullself, the shared-string reference count, and the data-URL cases above (case folding, empty type, semicolon before comma, no separator, null view, 16-bit and non-ASCII input).Conventions check: passed.
I changed 15 conditions and statements one at a time and the test failed on 13; one does not build, and the last (the length check in the concatenation helper) is equivalent below 2^32 characters because
NewImplrejects any oversize result with the samestd::length_error.The full suite also ran on Windows and on Linux (Docker, lavapipe) before rebasing onto the current
main, and did not pass on this machine. On Linux,guest_mmap_executableaborts atGuestMemory.cpp:3436,guest_http_uri_localeandsavedata_memory_growth_read_failureare skipped, andpublic_headersandagc_driver_pipeline_journaltake over 30 s; these reproduce onorigin/main(f1a7b02028). On Windowsguest_fopen_errorsis skipped (not run onmain).public_headerspasses at this commit and onmain; I did not investigate why the others fail on this machine.Not verified: behaviour on a console or a retail binary, or that the retail module matches this WebKit revision. Not covered by a test: concatenated lengths above 2^32 characters.
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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:47:05Z.
Review: COMMENTED
Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (
Unblocks: noneis allowed), and it contained no code review.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T05:18:20Z.
Review: COMMENTED
Reviewed — no blocking findings
Two WTF exports leave the not-implemented stubs:
mimeTypeFromDataURLandURL::stringCenterEllipsizedToLength. The code follows its own description, and the hosted Windows run passednkwebkit_wtf(the newtests/Wtf.cpp). One behaviour question is raised below against WebKit, which I did not re-read.What I ran
dd166cdd67d00a6bb7cbc8fdc1840b63e8c840e8; basee4501451406e4d3516c5b0eaa854d6ec1a28082d(the PR's own base). 6 files, +129/-13:Export.cpp(two stubs removed),include/InventoryExports.hpp(two declarations removed),include/WtfExports.hpp(two typed declarations),src/WtfString.cpp(+51),tests/Wtf.cpp(+75) anddocs/dev/debt/libSceNKWebKit.md(two lines).WtfString.cpp:FindUnit,ConcatViews,mimeTypeFromDataURLandstringCenterEllipsizedToLength, and the test's helpers.nkwebkit_wtfis Passed, along with the other NKWebKit cases.Results
stringCenterEllipsizedToLength(length split and join)mimeTypeFromDataURLwith no;or,nkwebkit_wtf(hosted)Read-only check output
Precheck was not run: no PR-head code is run here. Conventions: passed. Hosted:
gh api repos/boykopovar/AnyPS5/commits/dd166cdd67d00a6bb7cbc8fdc1840b63e8c840e8/check-runs.Negative control
Not run here. A negative control needs a build, and code from this head is not run here.
Findings
Blocking
None.
Non-blocking
mimeTypeFromDataURLreturns an empty string when neither;nor,followsdata:. Please confirm against WebKit's implementation that this case is empty rather than the default MIME type, and add a test for it if it is not covered.Sources
github.com/boykopovar/AnyPS5@dd166cdd67/core/libs/prx/libSceNKWebKit/src/WtfString.cppgithub.com/boykopovar/AnyPS5@dd166cdd67/core/libs/prx/libSceNKWebKit/tests/Wtf.cppNot verified
To get this to a good state