feat(libSceNKWebKit): implement Inspector::ContentSearchUtilities::createRegularExpressionForSearchString and countRegularExpressionMatches #25170
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/25170"
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 XFlawless1 on 2026-11-21T18:29:12Z.
What
Implements two Inspector content-search exports that throw today, on top of the existing libregexp-backed
JSC::Yarr::RegularExpressionexports.Inspector::ContentSearchUtilities::createRegularExpressionForSearchString(WTF::String const&, bool, SearchStringType)RegularExpressionbuilt in the caller's result slot:Regexuses the string as the pattern,ExactStringis^+ escaped +$,ContainsStringis the escaped string, where escaping puts\before each of[](){}+-*.,?\^$|(and U+0000, as upstream'sstrchrdoes); case-insensitive setsIgnoreCase; an unknown type throwsInspector::ContentSearchUtilities::countRegularExpressionMatches(JSC::Yarr::RegularExpression const&, WTF::String const&)matchone past each match position (overlapping), 0 for null or empty contentLayouts:
RegularExpressionis the one-pointerRefPtr<Private> dfrom RegularExpression.h#L34-L52, modelled by the existingJsc::YarrAbi::RegularExpressionthat libSceNKWebKit already uses for its destructor andoperator=; its user-provided copy constructor and destructor makecreateRegularExpressionForSearchStringreturn through the hidden result pointer.WTF::String const&points at oneStringImpl*.SearchStringTypeis the plainenum class { Regex, ExactString, ContainsString }of ContentSearchUtilities.h#L42, passed as anint. All layouts are unverified against a console module. The escaped pattern is handed to libSceJsc as a temporary host string. libSceJsc exports its regex constructor andmatchonly under their NIDs once the libraries are patched, so libSceNKWebKit calls two new libSceJsc helpers,JscRegularExpressionConstruct_nid_no_patchandJscRegularExpressionMatch_nid_no_patch, which forward to them, in the same way it already usesJscRegularExpressionRelease_nid_no_patch; regex semantics are those of the existing libregexp model, not Yarr. An unknownSearchStringType(upstream compiles a null pattern), null result, regex, search-string or content pointers, and a string with null data and a nonzero length throwstd::invalid_argument.Tested
Windows 11, MinGW GCC 15.2, Release.
nkwebkit_inspectorcontentsearchregexpasses, using the real libSceJsc regex engine and a tracking application heap:ContainsString/ExactString/Regexwitha.b(escaped dot vs wildcard, anchors), case-sensitive and insensitive searches, each of the 17 special characters alone and all together, a 16-bit search string, an 8-bit Latin-1 one matched against 16-bit text, and null search strings (empty pattern,^$);ainbanana= 3, overlappingaainaaa= 2 and inaaaa= 3,a*inbaaa= 3 (empty matches not counted),$inab= 0, case-insensitiveANinbanana= 2, escaped.ina.b.c= 2, a 16-bit pattern = 3, an invalid regex = 0, null and empty content = 0;.from the special characters.main,patched_librariespasses (the patchedlibSceNKWebKit.prxloads; calling the mangled libSceJsc exports directly failed it with error 127), alljsc_yarr_*andnkwebkit_*tests pass, as do theregistration|conventions_pr_template|pr_overlap_exports|conventions_unknown_nidstests and everypublic_headers_compile_*batch (the new header compiles on its own).python tools/check_conventions.py --base origin/mainpasses.python tools/debt_fold.py --checkcurrently fails onmainitself (fix-libkernel-clock-id-15.mdanddocs-libkernel-clock-gettime-1360-divergence.mdchange the same libkernel entry); with that pre-existing pair set aside, it passes and folds this fragment.Not tested on a console.
Overlap (
python tools/pr_overlap.py --namesand--branch feat/nkwebkit-inspector-content-search-regex):YarrRegularExpressionfiles.RegularExpression::matchedLengthandRegularExpression(const RegularExpression&)are left alone: #23755, #23757 and others implement them.searchInTextByLinesstays a stub (it needs the Inspector protocol JSON objects).ContentSearchUtilities::findStylesheetSourceMapURL, also mine) deletes a stub next to these inExport.cppandInventoryExports.hpp, so whichever merges second gets a textual conflict there; the resolution keeps both deletions.mainand shareExport.cpp,InventoryExports.hpporlibSceNKWebKit.hpp; the--namessearch covers every open PR's changes and finds these exports only in the refactors.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 PrivacyOnion on 2026-11-21T18:35:41Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
cd9cc88b9e:tools/check_conventions.pypassed.nkwebkit_inspectorcontentsearchregex_testsbuilt cleanly.nkwebkit_inspectorcontentsearchregex):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/InspectorContentSearchRegex.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-22T06:04:25Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected implementation has no verified blocking defect, but ABI compatibility remains unconfirmed and two changed files were excluded from full-text review.
What I ran
Reviewed head
08da9a0774aa2ecc313abdf3d6af1fc2135145fb. I did not run tests or build commands; the test results in the PR description are author-reported. I read the prepared description, commit summary, manifest, and diff, and inspected the implementation and related declarations withrepo_read.py.Results
Findings
Blocking
None verified in the inspected code.
Non-blocking
SearchStringTypevalues. Host tests do not establish those details; confirm them against a console module before treating the exports as console-verified.Not verified
core/libs/prx/libSceNKWebKit/Export.cppandcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppwas excluded as too large; their relevant deletion hunks were inspected in the diff.Files read from the prepared review bundle:
description.md,commits.md,manifest.json, anddiff.patch. Changed files whose added or relevant hunks were inspected:core/libs/prx/libSceJsc/include/YarrRegularExpressionExports.hpp,core/libs/prx/libSceJsc/src/YarrRegularExpression.cpp,core/libs/prx/libSceNKWebKit/Export.cpp(diff hunk only),core/libs/prx/libSceNKWebKit/include/InspectorContentSearchRegexExports.hpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp(diff hunk only),core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/InspectorContentSearchRegex.cpp,core/libs/prx/libSceNKWebKit/tests/InspectorContentSearchRegex.cpp(diff), anddocs/dev/debt/changes/feat-nkwebkit-inspector-content-search-regex.md(diff).To get this to a good state
Nothing is required. Optional: confirm the ABI against a console module before claiming console compatibility.