mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-08 13:50:20 +00:00
feat(libSceNKWebKit): implement WKBundleHitTestResult property getters
This commit is contained in:
1 parent
9ab6a281ea
commit
d5957e7cc2
7 files changed
+127
-34
No files matched your search
@@ -12960,37 +12960,16 @@ int APS5_VABI WKBundleGetJavaScriptObjectsCount() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
}
|
||||
|
||||
int APS5_VABI WKBundleHitTestResultCopyAbsoluteImageURL() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
}
|
||||
|
||||
int APS5_VABI WKBundleHitTestResultCopyAbsoluteLinkURL() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
}
|
||||
|
||||
int APS5_VABI WKBundleHitTestResultCopyAbsoluteMediaURL() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
}
|
||||
|
||||
int APS5_VABI WKBundleHitTestResultCopyAbsolutePDFURL() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
}
|
||||
|
||||
int APS5_VABI WKBundleHitTestResultCopyImage() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
}
|
||||
|
||||
int APS5_VABI WKBundleHitTestResultCopyLinkLabel() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
}
|
||||
|
||||
int APS5_VABI WKBundleHitTestResultCopyLinkSuggestedFilename() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
}
|
||||
|
||||
int APS5_VABI WKBundleHitTestResultCopyLinkTitle() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
}
|
||||
|
||||
int APS5_VABI WKBundleHitTestResultCopyNodeHandle() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
|
||||
@@ -137,14 +137,8 @@ int APS5_VABI WKBundleGarbageCollectJavaScriptObjectsOnAlternateThreadForDebuggi
|
||||
int APS5_VABI WKBundleGarbageCollectJavaScriptObjects();
|
||||
int APS5_VABI WKBundleGetApplicationConnection();
|
||||
int APS5_VABI WKBundleGetJavaScriptObjectsCount();
|
||||
int APS5_VABI WKBundleHitTestResultCopyAbsoluteImageURL();
|
||||
int APS5_VABI WKBundleHitTestResultCopyAbsoluteLinkURL();
|
||||
int APS5_VABI WKBundleHitTestResultCopyAbsoluteMediaURL();
|
||||
int APS5_VABI WKBundleHitTestResultCopyAbsolutePDFURL();
|
||||
int APS5_VABI WKBundleHitTestResultCopyImage();
|
||||
int APS5_VABI WKBundleHitTestResultCopyLinkLabel();
|
||||
int APS5_VABI WKBundleHitTestResultCopyLinkSuggestedFilename();
|
||||
int APS5_VABI WKBundleHitTestResultCopyLinkTitle();
|
||||
int APS5_VABI WKBundleHitTestResultCopyNodeHandle();
|
||||
int APS5_VABI WKBundleHitTestResultCopyURLElementHandle();
|
||||
int APS5_VABI WKBundleHitTestResultGetFrame();
|
||||
|
||||
@@ -35,6 +35,12 @@ std::uint32_t APS5_VABI WKBundleDOMWindowExtensionGetTypeID();
|
||||
std::uint32_t APS5_VABI WKBundleFrameGetTypeID();
|
||||
std::uint32_t APS5_VABI WKBundleGetTypeID();
|
||||
std::uint32_t APS5_VABI WKBundleHitTestResultGetTypeID();
|
||||
const void* APS5_VABI WKBundleHitTestResultCopyAbsoluteImageURL(const void* hitTestResultRef);
|
||||
const void* APS5_VABI WKBundleHitTestResultCopyAbsoluteLinkURL(const void* hitTestResultRef);
|
||||
const void* APS5_VABI WKBundleHitTestResultCopyAbsoluteMediaURL(const void* hitTestResultRef);
|
||||
const void* APS5_VABI WKBundleHitTestResultCopyAbsolutePDFURL(const void* hitTestResultRef);
|
||||
const void* APS5_VABI WKBundleHitTestResultCopyLinkLabel(const void* hitTestResultRef);
|
||||
const void* APS5_VABI WKBundleHitTestResultCopyLinkTitle(const void* hitTestResultRef);
|
||||
std::uint32_t APS5_VABI WKBundleInspectorGetTypeID();
|
||||
std::uint32_t APS5_VABI WKBundleNavigationActionGetTypeID();
|
||||
std::uint32_t APS5_VABI WKBundleNodeHandleGetTypeID();
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#include "prx/libSceNKWebKit/include/WebKitValueExports.hpp"
|
||||
#include "prx/libSceNKWebKit/src/Types.hpp"
|
||||
|
||||
extern "C" {
|
||||
|
||||
const void* APS5_VABI WKBundleHitTestResultCopyAbsoluteImageURL(const void* hitTestResultRef) {
|
||||
const auto* result = NKWebKit::Cast<NKWebKit::BundleHitTestResult>(hitTestResultRef, __func__);
|
||||
return result->absoluteImageURL ? NKWebKit::ToRef(result->absoluteImageURL) : nullptr;
|
||||
}
|
||||
|
||||
const void* APS5_VABI WKBundleHitTestResultCopyAbsoluteLinkURL(const void* hitTestResultRef) {
|
||||
const auto* result = NKWebKit::Cast<NKWebKit::BundleHitTestResult>(hitTestResultRef, __func__);
|
||||
return result->absoluteLinkURL ? NKWebKit::ToRef(result->absoluteLinkURL) : nullptr;
|
||||
}
|
||||
|
||||
const void* APS5_VABI WKBundleHitTestResultCopyAbsoluteMediaURL(const void* hitTestResultRef) {
|
||||
const auto* result = NKWebKit::Cast<NKWebKit::BundleHitTestResult>(hitTestResultRef, __func__);
|
||||
return result->absoluteMediaURL ? NKWebKit::ToRef(result->absoluteMediaURL) : nullptr;
|
||||
}
|
||||
|
||||
const void* APS5_VABI WKBundleHitTestResultCopyAbsolutePDFURL(const void* hitTestResultRef) {
|
||||
const auto* result = NKWebKit::Cast<NKWebKit::BundleHitTestResult>(hitTestResultRef, __func__);
|
||||
return result->absolutePDFURL ? NKWebKit::ToRef(result->absolutePDFURL) : nullptr;
|
||||
}
|
||||
|
||||
const void* APS5_VABI WKBundleHitTestResultCopyLinkLabel(const void* hitTestResultRef) {
|
||||
const auto* result = NKWebKit::Cast<NKWebKit::BundleHitTestResult>(hitTestResultRef, __func__);
|
||||
return result->linkLabel ? NKWebKit::ToRef(result->linkLabel) : NKWebKit::ToRef(NKWebKit::String::FromUtf8(""));
|
||||
}
|
||||
|
||||
const void* APS5_VABI WKBundleHitTestResultCopyLinkTitle(const void* hitTestResultRef) {
|
||||
const auto* result = NKWebKit::Cast<NKWebKit::BundleHitTestResult>(hitTestResultRef, __func__);
|
||||
return result->linkTitle ? NKWebKit::ToRef(result->linkTitle) : NKWebKit::ToRef(NKWebKit::String::FromUtf8(""));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -101,4 +101,14 @@ public:
|
||||
bool valid = false;
|
||||
};
|
||||
|
||||
class BundleHitTestResult final : public ObjectOf<ObjectType::BundleHitTestResult> {
|
||||
public:
|
||||
Retained<URL> absoluteImageURL;
|
||||
Retained<URL> absoluteLinkURL;
|
||||
Retained<URL> absoluteMediaURL;
|
||||
Retained<URL> absolutePDFURL;
|
||||
Retained<String> linkLabel;
|
||||
Retained<String> linkTitle;
|
||||
};
|
||||
|
||||
} // namespace NKWebKit
|
||||
@@ -397,6 +397,78 @@ static void TestError() {
|
||||
WKRelease(domain);
|
||||
}
|
||||
|
||||
static void TestBundleHitTestResult() {
|
||||
Require(WKBundleHitTestResultGetTypeID() == 120);
|
||||
auto hit = NKWebKit::Make<NKWebKit::BundleHitTestResult>();
|
||||
const void* ref = hit.Get();
|
||||
|
||||
Require(WKBundleHitTestResultCopyAbsoluteImageURL(ref) == nullptr);
|
||||
Require(WKBundleHitTestResultCopyAbsoluteLinkURL(ref) == nullptr);
|
||||
Require(WKBundleHitTestResultCopyAbsoluteMediaURL(ref) == nullptr);
|
||||
Require(WKBundleHitTestResultCopyAbsolutePDFURL(ref) == nullptr);
|
||||
auto* unsetLabel = WKBundleHitTestResultCopyLinkLabel(ref);
|
||||
Require(unsetLabel != nullptr);
|
||||
Require(WKStringIsEqualToUTF8CString(unsetLabel, ""));
|
||||
WKRelease(unsetLabel);
|
||||
auto* unsetTitle = WKBundleHitTestResultCopyLinkTitle(ref);
|
||||
Require(unsetTitle != nullptr);
|
||||
Require(WKStringIsEqualToUTF8CString(unsetTitle, ""));
|
||||
WKRelease(unsetTitle);
|
||||
|
||||
hit->absoluteImageURL = NKWebKit::Make<NKWebKit::URL>("https://example.com/img.png");
|
||||
hit->absoluteLinkURL = NKWebKit::Make<NKWebKit::URL>("https://example.com/link");
|
||||
hit->absoluteMediaURL = NKWebKit::Make<NKWebKit::URL>("https://example.com/media.mp4");
|
||||
hit->absolutePDFURL = NKWebKit::Make<NKWebKit::URL>("https://example.com/doc.pdf");
|
||||
hit->linkLabel = NKWebKit::String::FromUtf8("Example Link");
|
||||
hit->linkTitle = NKWebKit::String::FromUtf8("Example Title");
|
||||
|
||||
auto* imgUrl = WKBundleHitTestResultCopyAbsoluteImageURL(ref);
|
||||
Require(imgUrl != nullptr);
|
||||
auto* imgStr = WKURLCopyString(imgUrl);
|
||||
Require(WKStringIsEqualToUTF8CString(imgStr, "https://example.com/img.png"));
|
||||
WKRelease(imgStr);
|
||||
WKRelease(imgUrl);
|
||||
|
||||
auto* linkUrl = WKBundleHitTestResultCopyAbsoluteLinkURL(ref);
|
||||
Require(linkUrl != nullptr);
|
||||
auto* linkStr = WKURLCopyString(linkUrl);
|
||||
Require(WKStringIsEqualToUTF8CString(linkStr, "https://example.com/link"));
|
||||
WKRelease(linkStr);
|
||||
WKRelease(linkUrl);
|
||||
|
||||
auto* mediaUrl = WKBundleHitTestResultCopyAbsoluteMediaURL(ref);
|
||||
Require(mediaUrl != nullptr);
|
||||
auto* mediaStr = WKURLCopyString(mediaUrl);
|
||||
Require(WKStringIsEqualToUTF8CString(mediaStr, "https://example.com/media.mp4"));
|
||||
WKRelease(mediaStr);
|
||||
WKRelease(mediaUrl);
|
||||
|
||||
auto* pdfUrl = WKBundleHitTestResultCopyAbsolutePDFURL(ref);
|
||||
Require(pdfUrl != nullptr);
|
||||
auto* pdfStr = WKURLCopyString(pdfUrl);
|
||||
Require(WKStringIsEqualToUTF8CString(pdfStr, "https://example.com/doc.pdf"));
|
||||
WKRelease(pdfStr);
|
||||
WKRelease(pdfUrl);
|
||||
|
||||
auto* label = WKBundleHitTestResultCopyLinkLabel(ref);
|
||||
Require(label != nullptr);
|
||||
Require(WKStringIsEqualToUTF8CString(label, "Example Link"));
|
||||
WKRelease(label);
|
||||
|
||||
auto* title = WKBundleHitTestResultCopyLinkTitle(ref);
|
||||
Require(title != nullptr);
|
||||
Require(WKStringIsEqualToUTF8CString(title, "Example Title"));
|
||||
WKRelease(title);
|
||||
|
||||
bool threw = false;
|
||||
try {
|
||||
WKBundleHitTestResultCopyLinkLabel(nullptr);
|
||||
} catch (const std::invalid_argument&) {
|
||||
threw = true;
|
||||
}
|
||||
Require(threw);
|
||||
}
|
||||
|
||||
static void TestCertificateInfo() {
|
||||
Require(WKCertificateInfoGetTypeID() == 0);
|
||||
Require(WKCertificateInfoCreateWithCertficateChain(nullptr) == nullptr);
|
||||
@@ -420,6 +492,7 @@ int main() {
|
||||
TestUserContentURLPattern();
|
||||
TestURLRequestResponse();
|
||||
TestError();
|
||||
TestBundleHitTestResult();
|
||||
TestCertificateInfo();
|
||||
std::printf("All libSceNKWebKit Base tests passed!\n");
|
||||
return 0;
|
||||
|
||||
@@ -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) - 7423 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 |
|
||||
| --- | --- |
|
||||
@@ -135,14 +135,8 @@ Inventory prose retains historical counts; use the [generated progress report](h
|
||||
| `WKBundleGarbageCollectJavaScriptObjects` | `vNNCUDOFpFY` |
|
||||
| `WKBundleGetApplicationConnection` | `L4ZuA2XEwzw` |
|
||||
| `WKBundleGetJavaScriptObjectsCount` | `IzxyWmghAig` |
|
||||
| `WKBundleHitTestResultCopyAbsoluteImageURL` | `H2oBJVmx0XQ` |
|
||||
| `WKBundleHitTestResultCopyAbsoluteLinkURL` | `0gETKZk91ig` |
|
||||
| `WKBundleHitTestResultCopyAbsoluteMediaURL` | `rW+n1QeUDdo` |
|
||||
| `WKBundleHitTestResultCopyAbsolutePDFURL` | `9+nPgH-HAXs` |
|
||||
| `WKBundleHitTestResultCopyImage` | `SKZ7PFisSuc` |
|
||||
| `WKBundleHitTestResultCopyLinkLabel` | `dKzR0C0qpTM` |
|
||||
| `WKBundleHitTestResultCopyLinkSuggestedFilename` | `mf6n1uCzOY8` |
|
||||
| `WKBundleHitTestResultCopyLinkTitle` | `-j+JFiFPjnc` |
|
||||
| `WKBundleHitTestResultCopyNodeHandle` | `y-ZCGGbJyUU` |
|
||||
| `WKBundleHitTestResultCopyURLElementHandle` | `S2Sb-NajDeo` |
|
||||
| `WKBundleHitTestResultGetFrame` | `mGM-NRBuZvE` |
|
||||
@@ -7466,3 +7460,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.
|
||||
- [WKBundleHitTestResult property getters](../../../core/libs/prx/libSceNKWebKit/src/BundleHitTestResult.cpp) (libSceNKWebKit) - hit test results are test-driven until injected bundle hit testing produces them.
|
||||
Reference in new issue
Block a user