feat(libSceNKWebKit): implement WebCore::ResourceResponse construction, copy and setters #23056
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23056"
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 FinleyLaempe on 2026-11-18T17:02:27Z.
What
Implements the default, field and copy constructors, the destructor, the copy assignment operator and the
setMimeType,setTextEncodingName,setHTTPStatusTextandsetHTTPVersionsetters ofWebCore::ResourceResponseBaseandWebCore::ResourceResponse, plusWebCore::ResourceResponse::platformSuggestedFilename, in libSceNKWebKit, replacing theirNotImplemented_nid_no_patchstubs inExport.cpp.ResourceResponseBaseconstructors (ResourceResponseBase.cpp) and setters (L272-L410), withResourceResponseas the curl-port subclass (ResourceResponse.h);platformSuggestedFilenamefollows ResourceResponseCurl.cpp overfilenameFromHTTPContentDisposition.ResourceResponsestruct inResourceResponseAbi.hpp(not compared with a console module), pinned withstatic_asserts and the pinned header's member order (ResourceResponseBase.h): main's 112-byteResourceResponseBaseas itshead, then theBox<NetworkLoadMetrics>pointer, the PlayStationCertificateInfooptional, the status code, the state and parsed flag bytes, the markedage/date/expires/lastModifiedtimes,ParsedContentRangeandCacheControlDirectives.ResourceResponseBaseitself is unchanged, soResourceResponseStatusLayout(#26408) keeps its 112-bytehead; the tests check that both putnetworkLoadMetrics,certificateInfoandhttpStatusCodeat the same offsets. TheResourceResponseBaseconstructors and the setters that clear the null flag reach the rest of the object from theheadpointer.WtfAbi::Vector(WtfVector.hpp),ParsedContentRange(ParsedContentRangeAbi.hpp),CacheControlDirectives(CacheControlAbi.hpp) andHTTPHeaderMap(HttpHeaderMapAbi.hpp) guest models, plus theFilename,HeaderandWtfAbi::Releasehelpers already inResourceResponse.cpp.Box<NetworkLoadMetrics>refcount is shared.m_initLevelis zeroed where the curl constructors leave it indeterminate; the pinnedlazyInitignores it, and these exports assume curl's no-op lazy initialization.const String&per the module signatures, not the pinned header'sAtomStringones (ResourceResponseBase.h). The console assigns throughAtomStringImpl::add, so the setters and field constructors throwNotImplemented_nid_no_patchunless the impl is null or already an atom (s_hashFlagStringKindIsAtom); an empty non-atom string, which the console maps to the shared empty atom, also throws.Box<NetworkLoadMetrics>last release that would reach 0 throws when the payload at offset 8 is non-null, before changing anything, because the console runs~NetworkLoadMetricsbeforefastFree; a real guest box stores the payload inline and always throws, only a zeroed payload frees.cfURLResponsestays a stub: the symbol is only in the older 3.20 inventory and the pinned 11.x source has no such member, so its return type is unknown.selforotherpointers throwstd::invalid_argument; header vectors with size over capacity or non-null size with null buffer, and vectors above the unsigned length limit, throw before any allocation.CheckedinResourceResponse.cppgained a name parameter so these errors nameWebCore::ResourceResponse, not just the base.ResourceResponseAbi.hpp(the newResponseCertificateInfo/ResponseOptionalCertificateInfostructs and theResourceResponsestruct, all added after main's definitions) and theCheckedname parameter;Export.cpp,InventoryExports.hppandLegacyExports.hpponly lose the stubs, whose declarations move toResourceResponseExports.hpp.docs/dev/debt/changes/feat-nkwebkit-resource-response.md): new entries record theResourceResponselifetime andplatformSuggestedFilenamepaths, both not compared with a console module. Change entries extendResourceResponseBase(the fullResourceResponseguest layout and header ordinals unverified on console; cache and date getters parse live headers without writing the marked times and parsed flags upstream keeps) and the time and filename getters (six legacy time returns follow the historicalWTF::Optionalindirect return, unverified on console).ResourceResponseBasefield constructors (xacsaU-hKOE,28-zrObSsN8).Tested
Arch Linux x86-64, GCC 16.2.1, Release build with
-DBUILD_TESTING=ON: the extendednkwebkit_resourceresponsetest and every othernkwebkit_*test, 329 of 329 passed on head6013d03298(main at5ff6ec4365merged in).python3 tools/check_conventions.py --base upstream/mainpasses. Not tested on a console or on Windows.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-18T17:02:36Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-18T17:04:37Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
920eea6f85:tools/check_conventions.pypassed.nkwebkit_resourceresponse_testsbuilt cleanly.nkwebkit_resourceresponse):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/include/ResourceResponseExports.hpp,core/libs/prx/libSceNKWebKit/src/ResourceResponse.cpp,core/libs/prx/libSceNKWebKit/src/ResourceResponseAbi.hppreverted 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-21T08:12:59Z.
Review: COMMENTED
Reviewed — comments
The source implementation and targeted context were reviewed at head
5623557a574adc504fda13f8e9f05856070fbebf; no concrete blocking defect was verified, but this review is incomplete because the test suite was not run and two changed files were excluded from the review bundle.What I ran
Read the prepared description, commits, manifest, diff, and available changed-file contents, plus targeted source context through the pinned reader. No tests or build commands were run.
Results
Findings
Blocking
None verified in the code read.
Non-blocking
None.
Not verified
Export.cppandinclude/InventoryExports.hppwere listed as excluded because they were too large; their full contents were not read. The targeted changed files read wereinclude/LegacyExports.hpp,include/ResourceResponseExports.hpp,src/ResourceResponse.cpp,src/ResourceResponseAbi.hpp, andtests/ResourceResponse.cpp.docs/dev/debt/changes/feat-nkwebkit-resource-response.mdwas listed as included but not read. No build or tests were run, and console and Windows behavior were not verified.To get this to a good state
Nothing is required. The optional follow-up is to run the reported build and test checks and review the excluded files before relying on a complete review.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T12:52:36Z.
Review: COMMENTED
Built the branch’s changed sources and ran ResourceResponse on Linux against the existing runtime libraries. The test run passed and covered the ResourceResponse construction, copying, and setter cases.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-03T23:42:11Z.
Review: COMMENTED
Actionable comments
9c2c81bb-6654-4a81-9c2e-4de8813af8d1Reviewing files that changed from the base of the PR and between
5ff6ec4365andb95ea19b1b.core/libs/prx/libSceNKWebKit/Export.cppcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppcore/libs/prx/libSceNKWebKit/include/LegacyExports.hppcore/libs/prx/libSceNKWebKit/include/ResourceResponseExports.hppcore/libs/prx/libSceNKWebKit/src/ResourceResponse.cppcore/libs/prx/libSceNKWebKit/src/ResourceResponseAbi.hppcore/libs/prx/libSceNKWebKit/tests/ResourceResponse.cppdocs/dev/debt/changes/feat-nkwebkit-resource-response.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T00:25:58Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: the
ResourceResponseBasefield constructor and setters treat a 112-byte base object as a 280-byteResourceResponse, which can overwrite memory past the object.What I ran
Reviewed head
b95ea19b1bef8e966acac033825a2619a4788dcf. I inspected the prepared diff and targeted source ranges; no compiler or test tool was run.The first reader call returned its requested source range; a later call could not complete because the reader attempted to write its log in the read-only review folder.
Results
Negative control
Not run; no tests were run in this review.
Findings
Blocking
ResourceResponseBaseentry points cast the base reference toResourceResponse. The base is 112 bytes, butConstructFieldsinitializes a 280-byteResourceResponse; the base field constructors call it atcore/libs/prx/libSceNKWebKit/src/ResourceResponse.cpp:560and:564. The setters also access derivedstateBitsat offset 178 through that cast (:540-542). Calling these exports with a standaloneResourceResponseBasecan write beyond the object. Keep base construction and setters within the base object’s extent, and handle derived state only where the object is known to be aResourceResponse.Sources
Not verified
No tests, console execution, or console module comparison were performed.
Export.cppwas too large to include in the prepared full-text files; its relevant removals were inspected in the supplied diff.InventoryExports.hppandLegacyExports.hppwere inspected only for relevant export declarations. Other read files:description.md,commits.md,manifest.json,diff.patch,files.json,ResourceResponse.cpp,ResourceResponseAbi.hpp,ResourceResponseExports.hpp,tests/ResourceResponse.cpp, anddocs/dev/debt/changes/feat-nkwebkit-resource-response.md.To get this to a good state
Keep
ResourceResponseBaseconstructors and setters from accessing or initializing derivedResourceResponsefields. Then rerun the relevant tests on the updated head and verify the ABI behavior on console.Pull request closed