mirror of
https://github.com/servo/servo.git
synced 2025-10-02 17:49:16 +01:00
script: Stubs for geolocation interfaces (#39584)
Needed for #39526; stubs out all the necessary interface from https://www.w3.org/TR/geolocation/. Testing: WPT Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
parent
9e380614ee
commit
65588cd5df
28 changed files with 494 additions and 5 deletions
47
components/script_bindings/webidls/Geolocation.webidl
Normal file
47
components/script_bindings/webidls/Geolocation.webidl
Normal file
|
@ -0,0 +1,47 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
* The origin of this IDL file is
|
||||
* https://www.w3.org/TR/geolocation/#geolocation_interface
|
||||
*/
|
||||
|
||||
partial interface Navigator {
|
||||
[SameObject, Pref="dom_geolocation_enabled"] readonly attribute Geolocation geolocation;
|
||||
};
|
||||
|
||||
// FIXME: The errorCallback parameters are currently commented out because they are not yet supported by the codegen,
|
||||
// further debugging is needed.
|
||||
// https://www.w3.org/TR/geolocation/#geolocation_interface
|
||||
[Pref="dom_geolocation_enabled", 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
|
||||
);
|
||||
|
||||
// https://www.w3.org/TR/geolocation/#position_options_interface
|
||||
dictionary PositionOptions {
|
||||
boolean enableHighAccuracy = false;
|
||||
[Clamp] unsigned long timeout = 0xFFFFFFFF;
|
||||
[Clamp] unsigned long maximumAge = 0;
|
||||
};
|
|
@ -0,0 +1,20 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
* The origin of this IDL file is
|
||||
* https://www.w3.org/TR/geolocation/#coordinates_interface
|
||||
*/
|
||||
|
||||
// https://www.w3.org/TR/geolocation/#coordinates_interface
|
||||
[Pref="dom_geolocation_enabled", 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;
|
||||
};
|
|
@ -0,0 +1,15 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
* The origin of this IDL file is
|
||||
* https://www.w3.org/TR/geolocation/#position_interface
|
||||
*/
|
||||
|
||||
// https://www.w3.org/TR/geolocation/#position_interface
|
||||
[Pref="dom_geolocation_enabled", Exposed=Window, SecureContext]
|
||||
interface GeolocationPosition {
|
||||
readonly attribute GeolocationCoordinates coords;
|
||||
readonly attribute EpochTimeStamp timestamp;
|
||||
};
|
|
@ -0,0 +1,18 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
* The origin of this IDL file is
|
||||
* https://www.w3.org/TR/geolocation/#position_error_interface
|
||||
*/
|
||||
|
||||
// https://www.w3.org/TR/geolocation/#position_error_interface
|
||||
[Pref="dom_geolocation_enabled", 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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue