diff --git a/core/libs/prx/libSceNKWebKit/Export.cpp b/core/libs/prx/libSceNKWebKit/Export.cpp index b2ecc459d8..d9b05e349f 100644 --- a/core/libs/prx/libSceNKWebKit/Export.cpp +++ b/core/libs/prx/libSceNKWebKit/Export.cpp @@ -12598,21 +12598,6 @@ int APS5_VABI WKAXObjectButtonState() { NotImplemented_nid_no_patch(__func__); } -int APS5_VABI WKAXObjectCopyDescription() { - NotImplemented_nid_no_patch(__func__); -} - -int APS5_VABI WKAXObjectCopyHelpText() { - NotImplemented_nid_no_patch(__func__); -} - -int APS5_VABI WKAXObjectCopyTitle() { - NotImplemented_nid_no_patch(__func__); -} - -int APS5_VABI WKAXObjectCopyURL() { - NotImplemented_nid_no_patch(__func__); -} int APS5_VABI WKAXObjectFrame() { NotImplemented_nid_no_patch(__func__); diff --git a/core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp b/core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp index 1294a580d9..ed89080545 100644 --- a/core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp +++ b/core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp @@ -32,10 +32,6 @@ int APS5_VABI JSRemoteInspectorStart(); int APS5_VABI JSRunLoop(); int APS5_VABI JSSetOptions(); int APS5_VABI WKAXObjectButtonState(); -int APS5_VABI WKAXObjectCopyDescription(); -int APS5_VABI WKAXObjectCopyHelpText(); -int APS5_VABI WKAXObjectCopyTitle(); -int APS5_VABI WKAXObjectCopyURL(); int APS5_VABI WKAXObjectFrame(); int APS5_VABI WKAXObjectPage(); int APS5_VABI WKAXObjectRole(); diff --git a/core/libs/prx/libSceNKWebKit/include/WebKitValueExports.hpp b/core/libs/prx/libSceNKWebKit/include/WebKitValueExports.hpp index 6593983c7b..cf9c32226a 100644 --- a/core/libs/prx/libSceNKWebKit/include/WebKitValueExports.hpp +++ b/core/libs/prx/libSceNKWebKit/include/WebKitValueExports.hpp @@ -14,6 +14,10 @@ struct RectValue; extern "C" { std::uint32_t APS5_VABI WKAXObjectGetTypeID(); +const void* APS5_VABI WKAXObjectCopyTitle(const void* objectRef); +const void* APS5_VABI WKAXObjectCopyDescription(const void* objectRef); +const void* APS5_VABI WKAXObjectCopyHelpText(const void* objectRef); +const void* APS5_VABI WKAXObjectCopyURL(const void* objectRef); std::uint32_t APS5_VABI WKApplicationCacheManagerGetTypeID(); void APS5_VABI WKArrayAppendItem(void* arrayRef, const void* itemRef); const void* APS5_VABI WKArrayCreate(const void** values, std::size_t numberOfValues); diff --git a/core/libs/prx/libSceNKWebKit/src/AccessibilityObject.cpp b/core/libs/prx/libSceNKWebKit/src/AccessibilityObject.cpp new file mode 100644 index 0000000000..da8558eb83 --- /dev/null +++ b/core/libs/prx/libSceNKWebKit/src/AccessibilityObject.cpp @@ -0,0 +1,26 @@ +#include "prx/libSceNKWebKit/include/WebKitValueExports.hpp" +#include "prx/libSceNKWebKit/src/Types.hpp" + +extern "C" { + +const void* APS5_VABI WKAXObjectCopyTitle(const void* objectRef) { + const auto* object = NKWebKit::Cast(objectRef, __func__); + return object->title ? NKWebKit::ToRef(object->title) : nullptr; +} + +const void* APS5_VABI WKAXObjectCopyDescription(const void* objectRef) { + const auto* object = NKWebKit::Cast(objectRef, __func__); + return object->description ? NKWebKit::ToRef(object->description) : nullptr; +} + +const void* APS5_VABI WKAXObjectCopyHelpText(const void* objectRef) { + const auto* object = NKWebKit::Cast(objectRef, __func__); + return object->helpText ? NKWebKit::ToRef(object->helpText) : nullptr; +} + +const void* APS5_VABI WKAXObjectCopyURL(const void* objectRef) { + const auto* object = NKWebKit::Cast(objectRef, __func__); + return object->url ? NKWebKit::ToRef(object->url) : nullptr; +} + +} diff --git a/core/libs/prx/libSceNKWebKit/src/Types.hpp b/core/libs/prx/libSceNKWebKit/src/Types.hpp index cc32e388d0..29f3584f0a 100644 --- a/core/libs/prx/libSceNKWebKit/src/Types.hpp +++ b/core/libs/prx/libSceNKWebKit/src/Types.hpp @@ -114,4 +114,12 @@ public: bool isContentEditable = false; }; +class AccessibilityObject final : public ObjectOf { +public: + Retained title; + Retained description; + Retained helpText; + Retained url; +}; + } // namespace NKWebKit diff --git a/core/libs/prx/libSceNKWebKit/tests/Base.cpp b/core/libs/prx/libSceNKWebKit/tests/Base.cpp index bd48d40b46..7a795e08bc 100644 --- a/core/libs/prx/libSceNKWebKit/tests/Base.cpp +++ b/core/libs/prx/libSceNKWebKit/tests/Base.cpp @@ -429,6 +429,51 @@ static void TestHitTestResult() { WKRelease(ref); } +static void TestAXObject() { + Require(WKAXObjectGetTypeID() == 132); + auto ax = NKWebKit::Make(); + const void* ref = ax.Get(); + + Require(WKAXObjectCopyTitle(ref) == nullptr); + Require(WKAXObjectCopyDescription(ref) == nullptr); + Require(WKAXObjectCopyHelpText(ref) == nullptr); + Require(WKAXObjectCopyURL(ref) == nullptr); + + ax->title = NKWebKit::String::FromUtf8("Submit Button"); + ax->description = NKWebKit::String::FromUtf8("Submits the form"); + ax->helpText = NKWebKit::String::FromUtf8("Click to send your input"); + ax->url = NKWebKit::String::FromUtf8("https://example.com/action"); + + auto* title = WKAXObjectCopyTitle(ref); + Require(title != nullptr); + Require(WKStringIsEqualToUTF8CString(title, "Submit Button")); + WKRelease(title); + + auto* desc = WKAXObjectCopyDescription(ref); + Require(desc != nullptr); + Require(WKStringIsEqualToUTF8CString(desc, "Submits the form")); + WKRelease(desc); + + auto* help = WKAXObjectCopyHelpText(ref); + Require(help != nullptr); + Require(WKStringIsEqualToUTF8CString(help, "Click to send your input")); + WKRelease(help); + + auto* url = WKAXObjectCopyURL(ref); + Require(url != nullptr); + Require(WKGetTypeID(url) == WKStringGetTypeID()); + Require(WKStringIsEqualToUTF8CString(url, "https://example.com/action")); + WKRelease(url); + + bool threw = false; + try { + WKAXObjectCopyTitle(nullptr); + } catch (const std::invalid_argument&) { + threw = true; + } + Require(threw); +} + static void TestCertificateInfo() { Require(WKCertificateInfoGetTypeID() == 0); Require(WKCertificateInfoCreateWithCertficateChain(nullptr) == nullptr); @@ -452,6 +497,58 @@ int main() { TestURLRequestResponse(); TestError(); TestHitTestResult(); + alToUTF8CString(title, "Submit Button")); + WKRelease(title); + + auto* desc = WKAXObjectCopyDescription(ref); + Require(desc != nullptr); + Require(WKStringIsEqualToUTF8CString(desc, "Submits the form")); + WKRelease(desc); + + auto* help = WKAXObjectCopyHelpText(ref); + Require(help != nullptr); + Require(WKStringIsEqualToUTF8CString(help, "Click to send your input")); + WKRelease(help); + + auto* url = WKAXObjectCopyURL(ref); + Require(url != nullptr); + Require(WKGetTypeID(url) == WKStringGetTypeID()); + Require(WKStringIsEqualToUTF8CString(url, "https://example.com/action")); + WKRelease(url); + + bool threw = false; + try { + WKAXObjectCopyTitle(nullptr); + } catch (const std::invalid_argument&) { + threw = true; + } + Require(threw); +} + +static void TestCertificateInfo() { + Require(WKCertificateInfoGetTypeID() == 0); + Require(WKCertificateInfoCreateWithCertficateChain(nullptr) == nullptr); + Require(WKCertificateInfoGetVerificationError(nullptr) == 0); + Require(WKCertificateInfoCopyVerificationErrorDescription(nullptr) == nullptr); + Require(WKCertificateInfoGetCertificateChainSize(nullptr) == 0); + Require(WKCertificateInfoCopyCertificateAtIndex(nullptr, 0) == nullptr); +} + +int main() { + TestTypeIDs(); + TestSecurityOrigin(); + TestRetainRelease(); + TestStrings(); + TestURL(); + TestArray(); + TestDictionary(); + TestData(); + TestNumbers(); + TestGeometry(); + TestUserContentURLPattern(); + TestURLRequestResponse(); + TestError(); + TestAXObject(); TestCertificateInfo(); std::printf("All libSceNKWebKit Base tests passed!\n"); return 0; diff --git a/docs/dev/debt/libSceNKWebKit.md b/docs/dev/debt/libSceNKWebKit.md index 6ab3e588c7..254ddb7e01 100644 --- a/docs/dev/debt/libSceNKWebKit.md +++ b/docs/dev/debt/libSceNKWebKit.md @@ -43,7 +43,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) - 7366 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) - 7362 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 | | --- | --- | @@ -56,10 +56,6 @@ Inventory prose retains historical counts; use the [generated progress report](h | `JSRunLoop` | `Olb6L5-YCBE` | | `JSSetOptions` | `vE61ounVJEI` | | `WKAXObjectButtonState` | `Dp64o6lCLkM` | -| `WKAXObjectCopyDescription` | `YHG4TtOxLmw` | -| `WKAXObjectCopyHelpText` | `XEncuQcKGeQ` | -| `WKAXObjectCopyTitle` | `KYRL0uRR90o` | -| `WKAXObjectCopyURL` | `Np-E0FZrqkQ` | | `WKAXObjectFrame` | `huPnixU5dNc` | | `WKAXObjectPage` | `KrVXrd3WyfM` | | `WKAXObjectRole` | `pt0Eyg26hqw` | @@ -7427,5 +7423,9 @@ Inventory prose retains historical counts; use the [generated progress report](h - [WTF::FileSystemImpl::encodeForFileName, decodeFromFilename and lastComponentOfPathIgnoringTrailingSlash](../../../core/libs/prx/libSceNKWebKit/src/WtfString.cpp) - are source-guided by pinned [FileSystem.cpp](https://github.com/WebKit/WebKit/blob/c55364d53f97/Source/WTF/wtf/FileSystem.cpp#L66-L210), not console-measured; the device's WebKit revision is unverified. A null `String` reference, or an encoded result above 2^31-1 units, throws where WebKit has undefined behaviour or a release assertion. - [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. +<<<<<<< HEAD - [WTF StringBuilder](../../../core/libs/prx/libSceNKWebKit/src/StringBuilder.cpp) (libSceNKWebKit) - throws where WebKit crashes: an overflow of a builder that crashes on overflow, a length sum above `UINT32_MAX`, `toString` after an overflow, and null characters with a nonzero length. It also throws where a debug assertion guards memory WebKit would corrupt: `reserveCapacity` on an empty 16-bit builder without a buffer, and [`appendQuotedJSONString`](https://github.com/WebKit/WebKit/blob/c55364d53f97/Source/WTF/wtf/text/StringBuilderJSON.cpp#L127-L128) of a 16-bit string into an 8-bit builder that holds an adopted string and no buffer. A capacity above the tree's `StringImpl` limit records an overflow, as a failed allocation does. Growing or shrinking a buffer with one reference copies it instead of calling `fastRealloc`, so its address always changes. - [WTF TextStream pointers](../../../core/libs/prx/libSceNKWebKit/src/TextStream.cpp) (libSceNKWebKit) - `operator<<(const void*)` formats the pointer as the tree's libc formats `%p` ([`snprintf`](https://github.com/WebKit/WebKit/blob/c55364d53f97/Source/WTF/wtf/text/TextStream.cpp#L114-L119) in WebKit); the console libc's output is unverified. +======= +- [WKAXObject property getters](../../../core/libs/prx/libSceNKWebKit/src/AccessibilityObject.cpp) (libSceNKWebKit) - accessibility objects are test-driven until accessibility tree queries produce them. +>>>>>>> 5bc9e26569 (feat(libSceNKWebKit): implement WKAXObject property getters)