Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -6288,6 +6288,7 @@ The <dfn export for=commands>emulation.setGeolocationOverride</dfn> command modi
latitude: -90.0..90.0,
longitude: -180.0..180.0,
? accuracy: (float .ge 0.0) .default 1.0,
? accuracyMode: "approximate" / "precise",
? altitude: float / null .default null,
? altitudeAccuracy: (float .ge 0.0) / null .default null,
? heading: (0.0...360.0) / null .default null,
Expand All @@ -6307,14 +6308,7 @@ The <dfn export for=commands>emulation.setGeolocationOverride</dfn> command modi
</dd>
</dl>

A <dfn>geolocation override</dfn> is a [=struct=] with:
* [=struct/item=] named <dfn attribute for="geolocation override">latitude</dfn> which is a float;
* [=struct/item=] named <dfn attribute for="geolocation override">longitude</dfn> which is a float;
* [=struct/item=] named <dfn attribute for="geolocation override">accuracy</dfn> which is a float;
* [=struct/item=] named <dfn attribute for="geolocation override">altitude</dfn> which is a float or null;
* [=struct/item=] named <dfn attribute for="geolocation override">altitudeAccuracy</dfn> which is a float or null;
* [=struct/item=] named <dfn attribute for="geolocation override">heading</dfn> which is a float or null;
* [=struct/item=] named <dfn attribute for="geolocation override">speed</dfn> which is a float or null.
A <dfn>geolocation override</dfn> is a [=/map=].
Comment on lines -6310 to +6311

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change all these lines? It's for the internal data structure. You need to get the accuracy mode added. Maybe this was caused by a merge conflict? The same applies to the changes below.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @whimboo,
Thanks for the review! The reason for changing the geolocation override from a struct to a map was intend to fix an existing type inconsistency in the spec regarding how we handle the error parameter.
In the original code, geolocation override was defined as a strict struct containing only coordinate floats (latitude, longitude, etc.). However, in the algorithm steps for setGeolocationOverride, when an "error" is provided, the spec does this:

Let emulated position data be a map matching GeolocationPositionError production...

This created an inconsistency where the geolocation override configuration (which is typed as a geolocation override) was being forced to store a map representing a GeolocationPositionError, instead of the expected struct of coordinates. I believe changing internal definition of geolocation override to be a map, containing either GeolocationCoordinates or GeolocationPositionError, should resolve this conflict. So Geolocation side can check what does geolocation override contain and decide what to create. Please let me know what do you think about this.

Thanks!


A [=remote end=] has a <dfn>geolocation override configuration</dfn>, which is
[=WebDriver configuration=] with [=WebDriver configuration/associated type=] [=geolocation override=].
Expand All @@ -6336,28 +6330,35 @@ To <dfn>update geolocation override</dfn> for [=/navigable=] |navigable|:

The [=remote end steps=] with |command parameters| are:

1. If |command parameters| [=map/contains=] "<code>coordinates</code>" and
|command parameters|["<code>coordinates</code>"] [=map/contains=]
"<code>altitudeAccuracy</code>" and
|command parameters|["<code>coordinates</code>"] doesn't [=map/contain=]
"<code>altitude</code>", return [=error=] with [=error code=]
[=invalid argument=].
1. Let |emulated position data| be [=WebDriver configuration/unset=].

1. If |command parameters| [=map/contains=] "<code>error</code>":

1. Assert |command parameters|["<code>error</code>"]["<code>type</code>"] equals
"<code>positionUnavailable</code>".

1. Let |emulated position data| be a [=/map=] matching [=GeolocationPositionError=]
production, with <code>code</code> field set to [=POSITION_UNAVAILABLE=] and
<code>message</code> field set to the empty string.
1. Set |emulated position data| to a new [=/map=].

Note: <code>message</code> will be ignored by implementation according to the geolocation spec.
1. [=map/set|Set=] |emulated position data|["<code>error</code>"] to
|command parameters|["<code>error</code>"].

1. Otherwise, let |emulated position data| be |command parameters|["<code>coordinates</code>"].
1. Otherwise, if |command parameters| [=map/contains=] "<code>coordinates</code>":

1. If |emulated position data| is null, set |emulated position data| to
[=WebDriver configuration/unset=].
1. If |command parameters|["<code>coordinates</code>"] is not null:

1. Assert |command parameters|["<code>coordinates</code>"] [=map/contains=]
"<code>latitude</code>" and |command parameters|["<code>coordinates</code>"]
[=map/contains=] "<code>longitude</code>".

1. If |command parameters|["<code>coordinates</code>"] [=map/contains=] "<code>accuracyMode</code>":

1. Assert |command parameters|["<code>coordinates</code>"]["<code>accuracyMode</code>"] is "<code>precise</code>"
or "<code>approximate</code>".

1. Set |emulated position data| to a new [=/map=].

1. [=map/set|Set=] |emulated position data|["<code>coordinates</code>"] to
|command parameters|["<code>coordinates</code>"].

1. Let |affected navigables| be the result of [=trying=] to [=store WebDriver configuration=]
[=geolocation override configuration=] |emulated position data| for |command parameters|.
Expand Down
Loading