From f3c1dfb2f18d8861e61d086314d477bde169dc06 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Thu, 19 Jun 2025 14:35:35 +0200 Subject: [PATCH] LibWeb: Import geolocation/idlharness.https.window.html WPT test --- .../geolocation/idlharness.https.window.txt | 74 +++++++++++++++++++ .../geolocation/idlharness.https.window.html | 11 +++ .../geolocation/idlharness.https.window.js | 14 ++++ .../wpt-import/interfaces/geolocation.idl | 67 +++++++++++++++++ .../input/wpt-import/interfaces/hr-time.idl | 19 +++++ 5 files changed, 185 insertions(+) create mode 100644 Tests/LibWeb/Text/expected/wpt-import/geolocation/idlharness.https.window.txt create mode 100644 Tests/LibWeb/Text/input/wpt-import/geolocation/idlharness.https.window.html create mode 100644 Tests/LibWeb/Text/input/wpt-import/geolocation/idlharness.https.window.js create mode 100644 Tests/LibWeb/Text/input/wpt-import/interfaces/geolocation.idl create mode 100644 Tests/LibWeb/Text/input/wpt-import/interfaces/hr-time.idl diff --git a/Tests/LibWeb/Text/expected/wpt-import/geolocation/idlharness.https.window.txt b/Tests/LibWeb/Text/expected/wpt-import/geolocation/idlharness.https.window.txt new file mode 100644 index 00000000000..c2ca49f66dd --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/geolocation/idlharness.https.window.txt @@ -0,0 +1,74 @@ +Harness status: OK + +Found 68 tests + +13 Pass +55 Fail +Pass idl_test setup +Pass idl_test validation +Pass Partial interface Navigator: original interface defined +Pass Partial interface Navigator: member names are unique +Pass Partial interface Navigator[2]: member names are unique +Pass Partial interface mixin NavigatorID: member names are unique +Pass Navigator includes NavigatorID: member names are unique +Pass Navigator includes NavigatorLanguage: member names are unique +Pass Navigator includes NavigatorOnLine: member names are unique +Pass Navigator includes NavigatorContentUtils: member names are unique +Pass Navigator includes NavigatorCookies: member names are unique +Pass Navigator includes NavigatorPlugins: member names are unique +Pass Navigator includes NavigatorConcurrentHardware: member names are unique +Fail Geolocation interface: existence and properties of interface object +Fail Geolocation interface object length +Fail Geolocation interface object name +Fail Geolocation interface: existence and properties of interface prototype object +Fail Geolocation interface: existence and properties of interface prototype object's "constructor" property +Fail Geolocation interface: existence and properties of interface prototype object's @@unscopables property +Fail Geolocation interface: operation getCurrentPosition(PositionCallback, optional PositionErrorCallback?, optional PositionOptions) +Fail Geolocation interface: operation watchPosition(PositionCallback, optional PositionErrorCallback?, optional PositionOptions) +Fail Geolocation interface: operation clearWatch(long) +Fail Geolocation must be primary interface of navigator.geolocation +Fail Stringification of navigator.geolocation +Fail Geolocation interface: navigator.geolocation must inherit property "getCurrentPosition(PositionCallback, optional PositionErrorCallback?, optional PositionOptions)" with the proper type +Fail Geolocation interface: calling getCurrentPosition(PositionCallback, optional PositionErrorCallback?, optional PositionOptions) on navigator.geolocation with too few arguments must throw TypeError +Fail Geolocation interface: navigator.geolocation must inherit property "watchPosition(PositionCallback, optional PositionErrorCallback?, optional PositionOptions)" with the proper type +Fail Geolocation interface: calling watchPosition(PositionCallback, optional PositionErrorCallback?, optional PositionOptions) on navigator.geolocation with too few arguments must throw TypeError +Fail Geolocation interface: navigator.geolocation must inherit property "clearWatch(long)" with the proper type +Fail Geolocation interface: calling clearWatch(long) on navigator.geolocation with too few arguments must throw TypeError +Fail GeolocationPosition interface: existence and properties of interface object +Fail GeolocationPosition interface object length +Fail GeolocationPosition interface object name +Fail GeolocationPosition interface: existence and properties of interface prototype object +Fail GeolocationPosition interface: existence and properties of interface prototype object's "constructor" property +Fail GeolocationPosition interface: existence and properties of interface prototype object's @@unscopables property +Fail GeolocationPosition interface: attribute coords +Fail GeolocationPosition interface: attribute timestamp +Fail GeolocationPosition interface: operation toJSON() +Fail GeolocationCoordinates interface: existence and properties of interface object +Fail GeolocationCoordinates interface object length +Fail GeolocationCoordinates interface object name +Fail GeolocationCoordinates interface: existence and properties of interface prototype object +Fail GeolocationCoordinates interface: existence and properties of interface prototype object's "constructor" property +Fail GeolocationCoordinates interface: existence and properties of interface prototype object's @@unscopables property +Fail GeolocationCoordinates interface: attribute accuracy +Fail GeolocationCoordinates interface: attribute latitude +Fail GeolocationCoordinates interface: attribute longitude +Fail GeolocationCoordinates interface: attribute altitude +Fail GeolocationCoordinates interface: attribute altitudeAccuracy +Fail GeolocationCoordinates interface: attribute heading +Fail GeolocationCoordinates interface: attribute speed +Fail GeolocationCoordinates interface: operation toJSON() +Fail GeolocationPositionError interface: existence and properties of interface object +Fail GeolocationPositionError interface object length +Fail GeolocationPositionError interface object name +Fail GeolocationPositionError interface: existence and properties of interface prototype object +Fail GeolocationPositionError interface: existence and properties of interface prototype object's "constructor" property +Fail GeolocationPositionError interface: existence and properties of interface prototype object's @@unscopables property +Fail GeolocationPositionError interface: constant PERMISSION_DENIED on interface object +Fail GeolocationPositionError interface: constant PERMISSION_DENIED on interface prototype object +Fail GeolocationPositionError interface: constant POSITION_UNAVAILABLE on interface object +Fail GeolocationPositionError interface: constant POSITION_UNAVAILABLE on interface prototype object +Fail GeolocationPositionError interface: constant TIMEOUT on interface object +Fail GeolocationPositionError interface: constant TIMEOUT on interface prototype object +Fail GeolocationPositionError interface: attribute code +Fail GeolocationPositionError interface: attribute message +Fail Navigator interface: attribute geolocation \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/geolocation/idlharness.https.window.html b/Tests/LibWeb/Text/input/wpt-import/geolocation/idlharness.https.window.html new file mode 100644 index 00000000000..538fdb0cb92 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/geolocation/idlharness.https.window.html @@ -0,0 +1,11 @@ + + + + + + + + + +
+ diff --git a/Tests/LibWeb/Text/input/wpt-import/geolocation/idlharness.https.window.js b/Tests/LibWeb/Text/input/wpt-import/geolocation/idlharness.https.window.js new file mode 100644 index 00000000000..eadd6b7a4fb --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/geolocation/idlharness.https.window.js @@ -0,0 +1,14 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js + +// https://www.w3.org/TR/geolocation-API/ + +window.onload = async () => { + idl_test(["geolocation"], ["hr-time", "html"], (idl_array) => { + idl_array.add_objects({ + Geolocation: ["navigator.geolocation"], + }); + }); +}; diff --git a/Tests/LibWeb/Text/input/wpt-import/interfaces/geolocation.idl b/Tests/LibWeb/Text/input/wpt-import/interfaces/geolocation.idl new file mode 100644 index 00000000000..062a38bebc5 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/interfaces/geolocation.idl @@ -0,0 +1,67 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: Geolocation (https://w3c.github.io/geolocation/) + +partial interface Navigator { + [SameObject] readonly attribute Geolocation geolocation; +}; + +[Exposed=Window] +interface Geolocation { + undefined getCurrentPosition ( + PositionCallback successCallback, + optional PositionErrorCallback? errorCallback = null, + optional PositionOptions options = {} + ); + + long watchPosition ( + PositionCallback successCallback, + optional PositionErrorCallback? errorCallback = null, + optional PositionOptions options = {} + ); + + undefined clearWatch (long watchId); +}; + +callback PositionCallback = undefined ( + GeolocationPosition position +); + +callback PositionErrorCallback = undefined ( + GeolocationPositionError positionError +); + +dictionary PositionOptions { + boolean enableHighAccuracy = false; + [Clamp] unsigned long timeout = 0xFFFFFFFF; + [Clamp] unsigned long maximumAge = 0; +}; + +[Exposed=Window, SecureContext] +interface GeolocationPosition { + readonly attribute GeolocationCoordinates coords; + readonly attribute EpochTimeStamp timestamp; + [Default] object toJSON(); +}; + +[Exposed=Window, SecureContext] +interface GeolocationCoordinates { + readonly attribute double accuracy; + readonly attribute double latitude; + readonly attribute double longitude; + readonly attribute double? altitude; + readonly attribute double? altitudeAccuracy; + readonly attribute double? heading; + readonly attribute double? speed; + [Default] object toJSON(); +}; + +[Exposed=Window] +interface GeolocationPositionError { + const unsigned short PERMISSION_DENIED = 1; + const unsigned short POSITION_UNAVAILABLE = 2; + const unsigned short TIMEOUT = 3; + readonly attribute unsigned short code; + readonly attribute DOMString message; +}; diff --git a/Tests/LibWeb/Text/input/wpt-import/interfaces/hr-time.idl b/Tests/LibWeb/Text/input/wpt-import/interfaces/hr-time.idl new file mode 100644 index 00000000000..835ee8a65c8 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/interfaces/hr-time.idl @@ -0,0 +1,19 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: High Resolution Time (https://w3c.github.io/hr-time/) + +typedef double DOMHighResTimeStamp; + +typedef unsigned long long EpochTimeStamp; + +[Exposed=(Window,Worker)] +interface Performance : EventTarget { + DOMHighResTimeStamp now(); + readonly attribute DOMHighResTimeStamp timeOrigin; + [Default] object toJSON(); +}; + +partial interface mixin WindowOrWorkerGlobalScope { + [Replaceable] readonly attribute Performance performance; +};