Skip to content

Commit 5e3b177

Browse files
emulate geolocation POSITION_UNAVAILABLE error (#911)
emulate only "positionUnavailable" Co-authored-by: Henrik Skupin <[email protected]>
1 parent 9834a1d commit 5e3b177

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

index.bs

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ spec: GEOMETRY; urlPrefix: https://drafts.fxtf.org/geometry/
182182
text: height dimension; url: rectangle-height-dimension
183183
spec: GEOLOCATION; urlPrefix: https://www.w3.org/TR/geolocation/
184184
type: dfn
185+
text: GeolocationPositionError; url: #dom-geolocationpositionerror
186+
text: POSITION_UNAVAILABLE; url: #dom-geolocationpositionerror-position_unavailable
185187
text: set emulated position data; url: #dfn-set-emulated-position-data
186188
spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
187189
type: dfn
@@ -5623,7 +5625,10 @@ The <dfn export for=commands>emulation.setGeolocationOverride</dfn> command modi
56235625
)
56245626

56255627
emulation.SetGeolocationOverrideParameters = {
5626-
coordinates: emulation.GeolocationCoordinates / null,
5628+
(
5629+
(coordinates: emulation.GeolocationCoordinates / null) //
5630+
(error: emulation.GeolocationPositionError)
5631+
),
56275632
? contexts: [+browsingContext.BrowsingContext],
56285633
? userContexts: [+browser.UserContext],
56295634
}
@@ -5637,6 +5642,10 @@ The <dfn export for=commands>emulation.setGeolocationOverride</dfn> command modi
56375642
? heading: (0.0...360.0) / null .default null,
56385643
? speed: (float .ge 0.0) / null .default null,
56395644
}
5645+
5646+
emulation.GeolocationPositionError = {
5647+
type: "positionUnavailable"
5648+
}
56405649
</pre>
56415650
</dd>
56425651
<dt>Result Type</dt>
@@ -5651,9 +5660,26 @@ The <dfn export for=commands>emulation.setGeolocationOverride</dfn> command modi
56515660

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

5654-
1. If |command parameters| [=map/contains=] "<code>altitudeAccuracy</code>"
5655-
and |command parameters| doesn't [=map/contain=] "<code>altitude</code>",
5656-
return [=error=] with [=error code=] [=invalid argument=].
5663+
1. If |command parameters| [=map/contains=] "<code>coordinates</code>" and
5664+
|command parameters|["<code>coordinates</code>"] [=map/contains=]
5665+
"<code>altitudeAccuracy</code>" and
5666+
|command parameters|["<code>coordinates</code>"] doesn't [=map/contain=]
5667+
"<code>altitude</code>", return [=error=] with [=error code=]
5668+
[=invalid argument=].
5669+
5670+
1. If |command parameters| [=map/contains=] "<code>error</code>":
5671+
5672+
1. Assert |command parameters|["<code>error</code>"]["<code>type</code>"] equals
5673+
"<code>positionUnavailable</code>".
5674+
5675+
1. Let |emulated position data| be a [=/map=] matching [=GeolocationPositionError=]
5676+
production, with <code>code</code> field set to [=POSITION_UNAVAILABLE=] and
5677+
<code>message</code> field set to the empty string.
5678+
5679+
Note: <code>message</code> will be ignored by implementation according to the geolocation spec.
5680+
5681+
1. Otherwise, let |emulated position data| be
5682+
|command parameters|["<code>coordinates</code>"].
56575683

56585684
1. If |command parameters| [=map/contains=] "<code>userContexts</code>"
56595685
and |command parameters| [=map/contains=] "<code>context</code>",
@@ -5675,7 +5701,7 @@ The [=remote end steps=] with |command parameters| are:
56755701

56765702
1. For each |user context| of |user contexts|:
56775703

5678-
1. [=map/Set=] [=geolocation overrides map=][|user context|] to |command parameters|["<code>coordinates</code>"].
5704+
1. [=map/Set=] [=geolocation overrides map=][|user context|] to |emulated position data|.
56795705

56805706
1. [=list/For each=] |top-level traversable| of the list of all [=/top-level traversables=]
56815707
whose [=associated user context=] is |user context|:
@@ -5684,7 +5710,7 @@ The [=remote end steps=] with |command parameters| are:
56845710

56855711
1. For each |navigable| of |navigables|:
56865712

5687-
1. [=Set emulated position data=] with |navigable| and |command parameters|["<code>coordinates</code>"].
5713+
1. [=Set emulated position data=] with |navigable| and |emulated position data|.
56885714

56895715
1. Return [=success=] with data null.
56905716

0 commit comments

Comments
 (0)