feat(libSceNKWebKit): implement WTF file-system representation and path joining #19106
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19106"
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 KernelPanicNT on 2026-11-12T19:43:29Z.
What
Implements three
WTF::FileSystemImplhelpers inlibSceNKWebKitthat threw throughNotImplemented_nid_no_patch. They are insrc/WtfString.cpp, next toencodeForFileName,decodeFromFilenameandlastComponentOfPathIgnoringTrailingSlash.fileSystemRepresentation(const String&)sxavOcVMOFApath.utf8(), i.e. the tree'sString::utf8in lenient mode (unpaired surrogates become 3-byte sequences); a nullStringgives an empty, non-nullCStringstringFromFileSystemRepresentation(const char*)Q5IWykchiD8String, otherwise the tree'sString::fromUTF8(invalid UTF-8 -> nullString)pathByAppendingComponents(StringView, const Vector<StringView>&)k73D+1jaJZ0path, then'/'and each component, built as WebKit'sStringBuilderdoes!USE(CF)) POSIX paths of the pinned source. No guest-to-host path mapping happens here. The representation is only the byte string WebKit would pass to its own POSIX calls, and the new debt entry says so.pathByAppendingComponentskeeps WebKit's 8-bit/16-bit result:append(StringView)keeps the builder 8-bit for 8-bit text, an empty view, or a single Latin-1 code unit from a 16-bit view. Any other 16-bit path upconverts.append('/', component)goes throughappendFromAdapters, which upconverts whenever the component view is 16-bit, even an empty one.reifyString).RELEASE_ASSERTintoString, and here they throwstd::length_error. A nullStringorVectorreference, and null characters with a nonzero length, throw where WebKit faults.include/WtfValueExports.hppdeclares the three exports, next to the otherVector-taking WTF exports. They leaveExport.cppandInventoryExports.hpp, and their three rows leave the Additional callable exports table. The table's count is left as it is, since the debt file keeps historical inventory counts.Overlap: #14931 and #14949 (w4rc0n) implement the file-handle, path and directory operations. They show these three declarations only as diff context and implement none of them. The PRs share
Export.cpp,InventoryExports.hppand the debt file, so whichever lands second needs a trivial rebase.Source of the behaviour (WebKit
c55364d53f97; the only source)pathByAppendingComponents), #L406-L419 (stringFromFileSystemRepresentation,fileSystemRepresentation)utf8()is lenient), #L886-L891 (fromUTF8(const LChar*))append(StringView)), #L394-L417 (appendFromAdapters), StringBuilder.cpp#L274-L297 (upconvert), #L325-L345 (appendCharacters(const UChar*, unsigned)), #L42-L68 (reifyString)Tested
Linux x86-64 (Ubuntu 24.04, GCC 14), on
main09ab49de9649.nkwebkit_wtfgetsTestFileSystemRepresentations:String; a null reference.stringFromFileSystemRepresentation.Vector.Results:
ctest -R '^nkwebkit_(wtf|wtftext_allocation)$'passed in 2 of 2 runs.nkwebkit_wtftext_allocationcompilesWtfString.cppon its own.NotImplemented_nid_no_patch,nkwebkit_wtfaborts.tools/progress.py --compare: +3 implemented.tools/check_conventions.py --base origin/mainpasses.Not tested on a device or with 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 PrivacyOnion on 2026-11-13T18:32:08Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
1abf20f6c1:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_wtf_testsbuilt cleanly.nkwebkit_wtf):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WtfValueExports.hpp,core/libs/prx/libSceNKWebKit/src/WtfString.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me