feat(libSceNKWebKit): implement WKDownload property queries

This commit is contained in:
Adria Espi committed 2026-11-04 19:20:01 +01:00
1 parent 9ab6a281ea
commit 391df3de9c
7 files changed
+62 -18

No files matched your search

-11
View File
@@ -13976,17 +13976,6 @@ int APS5_VABI WKCookieManagerStopObservingCookieChanges() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI WKDownloadCopyRequest() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI WKDownloadGetOriginatingPage() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI WKDownloadGetWasUserInitiated() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI WKFormSubmissionListenerContinue() {
NotImplemented_nid_no_patch(__func__);
@@ -417,9 +417,6 @@ int APS5_VABI WKCookieManagerSetClient();
int APS5_VABI WKCookieManagerSetHTTPCookieAcceptPolicy();
int APS5_VABI WKCookieManagerStartObservingCookieChanges();
int APS5_VABI WKCookieManagerStopObservingCookieChanges();
int APS5_VABI WKDownloadCopyRequest();
int APS5_VABI WKDownloadGetOriginatingPage();
int APS5_VABI WKDownloadGetWasUserInitiated();
int APS5_VABI WKFormSubmissionListenerContinue();
int APS5_VABI WKFrameCanProvideSource();
int APS5_VABI WKFrameCanShowMIMEType();
@@ -67,6 +67,9 @@ const void* APS5_VABI WKDoubleCreate(double value);
std::uint32_t APS5_VABI WKDoubleGetTypeID();
double APS5_VABI WKDoubleGetValue(const void* doubleRef);
std::uint32_t APS5_VABI WKDownloadGetTypeID();
const void* APS5_VABI WKDownloadCopyRequest(const void* downloadRef);
const void* APS5_VABI WKDownloadGetOriginatingPage(const void* downloadRef);
bool APS5_VABI WKDownloadGetWasUserInitiated(const void* downloadRef);
const void* APS5_VABI WKErrorCopyWKErrorDomain();
std::uint32_t APS5_VABI WKErrorGetTypeID();
std::uint32_t APS5_VABI WKFormSubmissionListenerGetTypeID();
@@ -0,0 +1,21 @@
#include "prx/libSceNKWebKit/include/WebKitValueExports.hpp"
#include "prx/libSceNKWebKit/src/Types.hpp"
extern "C" {
const void* APS5_VABI WKDownloadCopyRequest(const void* downloadRef) {
const auto* download = NKWebKit::Cast<NKWebKit::Download>(downloadRef, __func__);
return download->request ? NKWebKit::ToRef(download->request) : nullptr;
}
const void* APS5_VABI WKDownloadGetOriginatingPage(const void* downloadRef) {
const auto* download = NKWebKit::Cast<NKWebKit::Download>(downloadRef, __func__);
return download->originatingPage ? download->originatingPage.Get() : nullptr;
}
bool APS5_VABI WKDownloadGetWasUserInitiated(const void* downloadRef) {
const auto* download = NKWebKit::Cast<NKWebKit::Download>(downloadRef, __func__);
return download->wasUserInitiated;
}
}
@@ -101,4 +101,11 @@ public:
bool valid = false;
};
class Download final : public ObjectOf<ObjectType::Download> {
public:
Retained<Object> request;
Retained<Object> originatingPage;
bool wasUserInitiated = false;
};
} // namespace NKWebKit
@@ -397,6 +397,34 @@ static void TestError() {
WKRelease(domain);
}
static void TestDownload() {
Require(WKDownloadGetTypeID() == 52);
auto download = NKWebKit::Make<NKWebKit::Download>();
const void* ref = download.Get();
Require(!WKDownloadGetWasUserInitiated(ref));
Require(WKDownloadCopyRequest(ref) == nullptr);
Require(WKDownloadGetOriginatingPage(ref) == nullptr);
download->wasUserInitiated = true;
Require(WKDownloadGetWasUserInitiated(ref));
auto dummyReq = NKWebKit::Make<NKWebKit::Data>(std::vector<std::uint8_t>{1, 2, 3});
download->request = std::move(dummyReq);
auto* req = WKDownloadCopyRequest(ref);
Require(req != nullptr);
Require(WKGetTypeID(req) == WKDataGetTypeID());
WKRelease(req);
bool threw = false;
try {
WKDownloadGetWasUserInitiated(nullptr);
} catch (const std::invalid_argument&) {
threw = true;
}
Require(threw);
}
static void TestCertificateInfo() {
Require(WKCertificateInfoGetTypeID() == 0);
Require(WKCertificateInfoCreateWithCertficateChain(nullptr) == nullptr);
@@ -420,6 +448,7 @@ int main() {
TestUserContentURLPattern();
TestURLRequestResponse();
TestError();
TestDownload();
TestCertificateInfo();
std::printf("All libSceNKWebKit Base tests passed!\n");
return 0;
+2 -4
View File
@@ -33,7 +33,7 @@ Inventory prose retains historical counts; use the [generated progress report](h
- The [revision-pinned identity inventory](https://gist.github.com/kyon-eth/d44995f181e1818977bd38f0e6fc0f34/8afcb14b0707a09b6274ff7f7bcf33ef46cfe2e7) records the module, library, symbol type and NIDs for the declarations in [Export.cpp](../../../core/libs/prx/libSceNKWebKit/Export.cpp); it is a metadata summary rather than independent verification. For the 255 absent from the public catalogue, [per-image ELF records](https://gist.github.com/kyon-eth/147be8dd556e9cced2577ccbed548972/1a659ecfe819e724675991a574a1aebb5fbb48e5) include the raw qualified names, module and library identities, symbol type, values and sizes; the record file SHA-256 is `44bdc4d6073192a8f41b7be359b75364b3d41dbbd11ce649924b8cebdd4ffe51`. Image labels are not authenticated.
- [Additional callable exports](../../../core/libs/prx/libSceNKWebKit/Export.cpp) - 7429 of the 8703 inventory declarations listed below throw through `NotImplemented_nid_no_patch`; signatures and behavior are unverified. The later 13.60-labelled image contains all 8703; 8448 match the public 3.20 catalogue, while 255 are absent and their presence in retail 3.20 is unverified. Per-image records show the latter in a separate 3.20-labelled image, but neither image label is authenticated. Identified names match NIDs in the [public symbol database](https://github.com/zecoxao/sce_symbols/blob/2883963a0a514ba6e77407a08ef4730a65e88254/aerolib.csv) or [supplemental catalog](https://github.com/claimore22/ps5rs/blob/2304be5131221bae0dac24b9767cabffda33f747/data/nids.csv). Data exports need separate analysis.
- [Additional callable exports](../../../core/libs/prx/libSceNKWebKit/Export.cpp) - 7426 of the 8703 inventory declarations listed below throw through `NotImplemented_nid_no_patch`; signatures and behavior are unverified. The later 13.60-labelled image contains all 8703; 8448 match the public 3.20 catalogue, while 255 are absent and their presence in retail 3.20 is unverified. Per-image records show the latter in a separate 3.20-labelled image, but neither image label is authenticated. Identified names match NIDs in the [public symbol database](https://github.com/zecoxao/sce_symbols/blob/2883963a0a514ba6e77407a08ef4730a65e88254/aerolib.csv) or [supplemental catalog](https://github.com/claimore22/ps5rs/blob/2304be5131221bae0dac24b9767cabffda33f747/data/nids.csv). Data exports need separate analysis.
| Name | NID |
| --- | --- |
@@ -389,9 +389,6 @@ Inventory prose retains historical counts; use the [generated progress report](h
| `WKCookieManagerSetHTTPCookieAcceptPolicy` | `a7yz7vOyBxk` |
| `WKCookieManagerStartObservingCookieChanges` | `vyOiJyvWOik` |
| `WKCookieManagerStopObservingCookieChanges` | `ebPeu+4eyj8` |
| `WKDownloadCopyRequest` | `9AGT4R9XxlU` |
| `WKDownloadGetOriginatingPage` | `44ygghy3b4E` |
| `WKDownloadGetWasUserInitiated` | `YqiQrQV1Wbk` |
| `WKErrorCopyDomain` | `CbWxMDgV5WQ` |
| `WKErrorCopyFailingURL` | `Rcz4V01xRBo` |
| `WKErrorGetErrorCode` | `Jx+jaw-BVuE` |
@@ -7466,3 +7463,4 @@ Inventory prose retains historical counts; use the [generated progress report](h
- [parseDateFromNullTerminatedCharacters(const char*, bool&)](../../../core/libs/prx/libSceNKWebKit/DateParsing.cpp) (libSceNKWebKit) - is not measured on a device, and throws where pinned [DateMath.cpp](https://github.com/WebKit/WebKit/blob/c55364d53f97/Source/WTF/wtf/DateMath.cpp#L684-L988) overflows a signed integer, which is undefined there (the `YYYY/MM/DD` day count, the `GMT+hh:mm` minute total and comment nesting), and for a null argument, where WebKit faults.
- [WTF decimal parsing](../../../core/libs/prx/libSceNKWebKit/CharactersToNumber.cpp) - the device's WebKit revision is unverified; `charactersToDouble`, `charactersToFloat` and `StringToDoubleConverter` follow pinned WebKit [toDoubleType](https://github.com/WebKit/WebKit/blob/c55364d53f97/Source/WTF/wtf/text/WTFString.cpp#L1040-L1098) and [StringToIeee](https://github.com/WebKit/WebKit/blob/c55364d53f97/Source/WTF/wtf/dtoa/double-conversion.cc#L459-L664). Under a rounding mode other than round-to-nearest, WebKit's [exact-power fast path](https://github.com/WebKit/WebKit/blob/c55364d53f97/Source/WTF/wtf/dtoa/strtod.cc#L219-L254) and the double-to-float cast in [Strtof](https://github.com/WebKit/WebKit/blob/c55364d53f97/Source/WTF/wtf/dtoa/strtod.cc#L485-L588) round in the current mode and the host conversion may round differently.
- [WTF decimal parsing limits](../../../core/libs/prx/libSceNKWebKit/CharactersToNumber.cpp) - inputs of about 1 GiB or more whose decimal exponent leaves the range of WebKit's [`int` exponent](https://github.com/WebKit/WebKit/blob/c55364d53f97/Source/WTF/wtf/dtoa/double-conversion.cc#L488-L490) throw, where WebKit overflows. A UTF-16 `charactersTo*` length above `UINT32_MAX` after leading spaces throws where WebKit's [conversion Vector](https://github.com/WebKit/WebKit/blob/c55364d53f97/Source/WTF/wtf/Vector.h#L291-L293) crashes.
- [WKDownload property queries](../../../core/libs/prx/libSceNKWebKit/src/Download.cpp) (libSceNKWebKit) - download properties reflect host state until downloads are connected to network transfers.