feat(libSceNKWebKit): implement WKPopupMenuItem property queries

This commit is contained in:
Adria Espi committed 2026-11-04 19:19:11 +01:00
1 parent 9ab6a281ea
commit b4f89f832e
7 files changed
+83 -24

No files matched your search

-15
View File
@@ -15184,21 +15184,6 @@ int APS5_VABI WKPageWillHandleHorizontalScrollEvents() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI WKPopupMenuItemCopyText() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI WKPopupMenuItemIsEnabled() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI WKPopupMenuItemIsItem() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI WKPopupMenuItemIsSeparator() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI WKPreferencesSetAccelerated2DCanvasEnabled() {
NotImplemented_nid_no_patch(__func__);
@@ -744,10 +744,6 @@ int APS5_VABI WKPluginInformationPathKey();
int APS5_VABI WKPluginInformationPluginURLKey();
int APS5_VABI WKPluginInformationPluginspageAttributeURLKey();
int APS5_VABI WKPluginInformationUpdatePastLastBlockedVersionIsKnownAvailableKey();
int APS5_VABI WKPopupMenuItemCopyText();
int APS5_VABI WKPopupMenuItemIsEnabled();
int APS5_VABI WKPopupMenuItemIsItem();
int APS5_VABI WKPopupMenuItemIsSeparator();
int APS5_VABI WKPreferencesGetAccelerated2DCanvasEnabled();
int APS5_VABI WKPreferencesGetQTKitEnabled();
int APS5_VABI WKPreferencesGetTypeID();
@@ -108,6 +108,10 @@ const void* APS5_VABI WKPointCreate(NKWebKit::PointValue point);
std::uint32_t APS5_VABI WKPointGetTypeID();
NKWebKit::PointValue APS5_VABI WKPointGetValue(const void* pointRef);
std::uint32_t APS5_VABI WKPopupMenuItemGetTypeID();
const void* APS5_VABI WKPopupMenuItemCopyText(const void* itemRef);
bool APS5_VABI WKPopupMenuItemIsEnabled(const void* itemRef);
bool APS5_VABI WKPopupMenuItemIsItem(const void* itemRef);
bool APS5_VABI WKPopupMenuItemIsSeparator(const void* itemRef);
std::uint32_t APS5_VABI WKProtectionSpaceGetTypeID();
const void* APS5_VABI WKRectCreate(NKWebKit::RectValue rect);
std::uint32_t APS5_VABI WKRectGetTypeID();
@@ -0,0 +1,26 @@
#include "prx/libSceNKWebKit/include/WebKitValueExports.hpp"
#include "prx/libSceNKWebKit/src/Types.hpp"
extern "C" {
const void* APS5_VABI WKPopupMenuItemCopyText(const void* itemRef) {
const auto* item = NKWebKit::Cast<NKWebKit::PopupMenuItem>(itemRef, __func__);
return item->text ? NKWebKit::ToRef(item->text) : nullptr;
}
bool APS5_VABI WKPopupMenuItemIsEnabled(const void* itemRef) {
const auto* item = NKWebKit::Cast<NKWebKit::PopupMenuItem>(itemRef, __func__);
return item->enabled;
}
bool APS5_VABI WKPopupMenuItemIsItem(const void* itemRef) {
const auto* item = NKWebKit::Cast<NKWebKit::PopupMenuItem>(itemRef, __func__);
return item->isItem;
}
bool APS5_VABI WKPopupMenuItemIsSeparator(const void* itemRef) {
const auto* item = NKWebKit::Cast<NKWebKit::PopupMenuItem>(itemRef, __func__);
return item->isSeparator;
}
}
@@ -101,4 +101,12 @@ public:
bool valid = false;
};
class PopupMenuItem final : public ObjectOf<ObjectType::PopupMenuItem> {
public:
Retained<String> text;
bool enabled = true;
bool isItem = true;
bool isSeparator = false;
};
} // namespace NKWebKit
@@ -397,6 +397,48 @@ static void TestError() {
WKRelease(domain);
}
static void TestPopupMenuItem() {
Require(WKPopupMenuItemGetTypeID() == 131);
auto item = NKWebKit::Make<NKWebKit::PopupMenuItem>();
const void* ref = item.Get();
Require(WKPopupMenuItemIsEnabled(ref));
Require(WKPopupMenuItemIsItem(ref));
Require(!WKPopupMenuItemIsSeparator(ref));
Require(WKPopupMenuItemCopyText(ref) == nullptr);
item->text = NKWebKit::String::FromUtf8("Option 1");
auto* text = WKPopupMenuItemCopyText(ref);
Require(text != nullptr);
Require(WKStringIsEqualToUTF8CString(text, "Option 1"));
WKRelease(text);
item->enabled = false;
Require(!WKPopupMenuItemIsEnabled(ref));
Require(WKPopupMenuItemIsItem(ref));
Require(!WKPopupMenuItemIsSeparator(ref));
item->enabled = true;
item->isItem = false;
Require(WKPopupMenuItemIsEnabled(ref));
Require(!WKPopupMenuItemIsItem(ref));
Require(!WKPopupMenuItemIsSeparator(ref));
item->isItem = true;
item->isSeparator = true;
Require(WKPopupMenuItemIsEnabled(ref));
Require(WKPopupMenuItemIsItem(ref));
Require(WKPopupMenuItemIsSeparator(ref));
bool threw = false;
try {
WKPopupMenuItemIsEnabled(nullptr);
} catch (const std::invalid_argument&) {
threw = true;
}
Require(threw);
}
static void TestCertificateInfo() {
Require(WKCertificateInfoGetTypeID() == 0);
Require(WKCertificateInfoCreateWithCertficateChain(nullptr) == nullptr);
@@ -420,6 +462,7 @@ int main() {
TestUserContentURLPattern();
TestURLRequestResponse();
TestError();
TestPopupMenuItem();
TestCertificateInfo();
std::printf("All libSceNKWebKit Base tests passed!\n");
return 0;
+2 -5
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) - 7425 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 |
| --- | --- |
@@ -694,10 +694,6 @@ Inventory prose retains historical counts; use the [generated progress report](h
| `WKPageValidateCommand` | `K82wly5zJoc` |
| `WKPageVerticalRubberBandingIsEnabled` | `p-jMGxCpEF4` |
| `WKPageWillHandleHorizontalScrollEvents` | `pYHt5lL67G8` |
| `WKPopupMenuItemCopyText` | `xmQq6hB1vqE` |
| `WKPopupMenuItemIsEnabled` | `DUF5lHKpf6o` |
| `WKPopupMenuItemIsItem` | `w6uemFn00hc` |
| `WKPopupMenuItemIsSeparator` | `cIEUZ-pzXZo` |
| `WKPreferencesSetAccelerated2DCanvasEnabled` | `UEBk9iGqhPo` |
| `WKPreferencesSetQTKitEnabled` | `6jkxaKVf01A` |
| `WKProtectionSpaceCopyCertificateInfo` | `FdhooB4MqkE` |
@@ -7466,3 +7462,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.
- [WKPopupMenuItem property queries](../../../core/libs/prx/libSceNKWebKit/src/PopupMenuItem.cpp) (libSceNKWebKit) - state fields are test-driven until a real popup menu source is connected.