feat(libSceNKWebKit): implement WebCore::ResourceRequestBase accessors, header fields, bodies and isolated copies #22978
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22978"
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-18T15:28:45Z.
What
Implements 16
WebCore::ResourceRequestBaseaccessors in libSceNKWebKit, replacing theirNotImplementedstubs inExport.cpp:isolatedCopy() const,setAsIsolatedCopy(const ResourceRequest&),equal(const ResourceRequest&, const ResourceRequest&),httpHeaderFields() const,httpHeaderField(const WTF::String&) const,setHTTPHeaderFields(HTTPHeaderMap),httpBody() const,setHTTPBody(WTF::RefPtr<FormData>&&),hasUpload() const,setResponseContentDispositionEncodingFallbackArray(const WTF::String&, const WTF::String&, const WTF::String&),removeCredentials(),setExistingHTTPReferrerToOriginString(),clearPurpose(),clearHTTPReferrer(),partitionName(const WTF::String&)andsetCachePartition(const WTF::String&).setAsIsolatedCopyL61,removeCredentialsL186,setHTTPBodyL521,equalL701,partitionNameL812). TheResourceRequestBaselayout inResourceRequestAbi.hppfollows ResourceRequestBase.h and is not compared with a console module.hasHTTPHeaderFieldandsetCachePartitionthrows whenm_resourceRequestUpdatedis false, because the PS5doUpdateResourceRequestis unknown;setExistingHTTPReferrerToOriginStringreturns before that gate when noRefererheader is set.httpBody,hasUploadandequalalso throw whenm_resourceRequestBodyUpdatedis false.setAsIsolatedCopyandisolatedCopyisolate the URL, first-party URL, method and initiator identifier throughWTF::String::isolatedCopy, rebuild the fallback array through the newsetResponseContentDispositionEncodingFallbackArray, and copy the body through the existingWebCore::FormData::isolatedCopy.m_cachePartitionis not copied, matching upstream wheresetCachePartitionis a no-op without cache partitioning.WTF::String::isolatedCopyrather than throughWebCore::HTTPHeaderMap::isolatedCopy, which is still a stub.equalcompares URL, cache policy, timeout, first-party URL, same-site disposition, top-site, method, cookies, priority, requester, both header maps and theFormDataElements (bytes, file name/range/modification time, blob URL); upstream's trailingResourceRequest::platformCompareis not reproduced.partitionNamereturns the shared empty string for every domain without touching its argument, andsetCachePartitionignores its argument, matchingENABLE(CACHE_PARTITIONING)andENABLE(PUBLIC_SUFFIX_LIST)both 0 as in PlatformEnableCocoa.h. The console values are unverified and no export readsm_cachePartition.NotImplemented_nid_no_patch:removeCredentialson a valid URL with credentials, because the console rewrites throughURL::removeandURL::parse, which are unimplemented;setExistingHTTPReferrerToOriginStringwith an existing referrer, becauseSecurityPolicy::referrerToOriginStringneedsSecurityOrigin::createFromStringandtoString.redirectedRequestandsetHTTPReferrerover 4096 code units are unchanged.RefPtror fallback-array string pointers throwstd::invalid_argument, as do vectors withsize > capacityor non-null size with null storage, and unknownFormDataElementkinds.WebCore::FormDataABI and exports (FormDataAbi.hpp,FormDataExports.hpp),WebCore::HTTPHeaderMap(HttpHeaderMapAbi.hpp,HttpHeaderMapExports.hpp) and the WTF string/vector helpers (WtfExports.hpp,WtfValueExports.hpp,WtfVector.hpp).ResourceRequestAbi.hppgains aFormDataRefPtrfor theRefPtr<FormData>thathttpBodyreturns, with size and offset asserts.Api.hpp,InventoryExports.hppandLegacyExports.hppinto typed declarations inResourceRequestExports.hpp. The implementations are added to the existingsrc/ResourceRequest.cpp, whose existing functions are unchanged.tests/ResourceRequestBaseOps.cppexercises all 16 exports against the registered application heap, tracks every guest allocation to zero and asserts refcount balance, update-flag transitions and the throwing paths.docs/dev/debt/changes/feat-nkwebkit-resource-request-base.mdrecords the update-flag gating and layout provenance, adds Functional entries for the cache-partition and credentials gaps, and removes the 13 NID inventory rows listed there for the implemented exports.Tested
Arch Linux x86-64, GCC 16.2.1, Release build with
-DBUILD_TESTING=ON: the newnkwebkit_resourcerequestbaseopstest and every othernkwebkit_*test, 136 of 136 passed.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)Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-18T15:28:58Z.
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-18T15:34:07Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
ef8ba0630a:tools/check_conventions.pypassed.nkwebkit_resourcerequestbaseops_testsbuilt cleanly.nkwebkit_resourcerequestbaseops):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/Api.hpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/include/ResourceRequestExports.hpp,core/libs/prx/libSceNKWebKit/src/ResourceRequest.cpp,core/libs/prx/libSceNKWebKit/src/ResourceRequestAbi.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.*text(copy constructor) which increments refcount, whilefirstwas created via IsolatedString which returns a new String with refcount 1. Whenfirstgoes out of scope, refcount decrements back to 1. Clean._ZN3WTF8fastFreeEPv(map.common.buffer); _ZN3WTF8fastFreeEPv(map.uncommon.buffer);- wait, line 181:_ZN3WTF8fastFreeEPv(map.common.buffer);and line 182:_ZN3WTF8fastFreeEPv(map.uncommon.buffer);is freeing map.common.buffer TWICE!ReleaseHeaderMap,_ZN3WTF8fastFreeEPv(map.common.buffer);is mistakenly called twice consecutively instead of freeingmap.common.bufferandmap.uncommon.buffer:_ZN3WTF8fastFreeEPv(map.common.buffer); _ZN3WTF8fastFreeEPv(map.common.buffer);. This results in a double-free ofmap.common.bufferand leaksmap.uncommon.bufferwhenever a header map with both buffers allocated is released.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-18T15:51:56Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
ef8ba0630a:tools/check_conventions.pypassed.nkwebkit_resourcerequestbaseops_testsbuilt cleanly.nkwebkit_resourcerequestbaseops):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/Api.hpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/include/ResourceRequestExports.hpp,core/libs/prx/libSceNKWebKit/src/ResourceRequest.cpp,core/libs/prx/libSceNKWebKit/src/ResourceRequestAbi.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 PrivacyOnion on 2026-11-19T09:00:58Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
23b84b6802:tools/check_conventions.pypassed.nkwebkit_resourcerequestbaseops_testsbuilt cleanly.nkwebkit_resourcerequestbaseops):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/Api.hpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/include/ResourceRequestExports.hpp,core/libs/prx/libSceNKWebKit/src/ResourceRequest.cpp,core/libs/prx/libSceNKWebKit/src/ResourceRequestAbi.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me