Skip to content

Commit 3b7c5b5

Browse files
Addition: support geolocation emulation
1 parent f9a9530 commit 3b7c5b5

File tree

1 file changed

+82
-59
lines changed

1 file changed

+82
-59
lines changed

index.html

+82-59
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,12 @@ <h2>
752752
change of geographic position is left to the
753753
implementation. User agents MAY impose a rate limit on how
754754
frequently position changes are reported.
755+
<aside class="addition" id="a4">
756+
<span class="marker">Candidate Addition:</span> Update
757+
watch position when emulated position data is set.
758+
</aside><ins cite="#a4"> User agents MUST consider
759+
invoking [=set emulated position data=] as a significant
760+
change.</ins>
755761
</li>
756762
<li>If |document| is not [=Document/fully active=] or
757763
[=Document/visibility state=] is not "visible", go back to
@@ -799,23 +805,27 @@ <h2>
799805
<li>Let |acquisitionTime:EpochTimeStamp| be a new {{EpochTimeStamp}}
800806
that represents now.
801807
</li>
802-
<li>Let |emulated position data| be [=get emulated position data=]
803-
passing [=this=].
804-
</li>
805-
<li>If |emulated position data| is not null:
806-
<ol>
807-
<li>Let |position| be [=a new `GeolocationPosition`=] passing
808-
|emulated position data|, |acquisitionTime| and
809-
|options|.{{PositionOptions/enableHighAccuracy}}.
810-
</li>
811-
<li>[=Queue a task=] on the [=geolocation task source=] with a
812-
step that [=invokes=] |successCallback| with « |position| » and
813-
"`report`".
814-
</li>
815-
<li>Terminate this algorithm.
816-
</li>
817-
</ol>
818-
</li>
808+
<aside class="addition" id="a4">
809+
<span class="marker">Candidate Addition:</span> If emulated position
810+
data is set, use it instead of the real position.
811+
</aside><ins cite="#a4">
812+
<li>Let |emulated position data| be [=get emulated position data=]
813+
passing [=this=].
814+
</li>
815+
<li>If |emulated position data| is not null:
816+
<ol>
817+
<li>Let |position| be [=a new `GeolocationPosition`=] passing
818+
|emulated position data|, |acquisitionTime| and
819+
|options|.{{PositionOptions/enableHighAccuracy}}.
820+
</li>
821+
<li>[=Queue a task=] on the [=geolocation task source=] with a
822+
step that [=invokes=] |successCallback| with « |position| » and
823+
"`report`".
824+
</li>
825+
<li>Terminate this algorithm.
826+
</li>
827+
</ol>
828+
</li></ins>
819829
<li>Let |timeoutTime| be the sum of |acquisitionTime| and
820830
|options|.{{PositionOptions/timeout}}.
821831
</li>
@@ -1489,48 +1499,61 @@ <h2>
14891499
feature/default allowlist=] is [=default allowlist/'self'=].
14901500
</p>
14911501
</section>
1492-
<section data-cite="html">
1493-
<h2>
1494-
Emulation
1495-
</h2>
1496-
<p>
1497-
For the purposes of user-agent automation and application testing, this
1498-
document defines geolocation emulations.
1499-
</p>
1500-
<p>
1501-
Each [=top-level traversable=] has an associated
1502-
<code>"emulated position data"</code>, which is data representing
1503-
{{GeolocationCoordinates}} or null, initially null.
1504-
</p>
1505-
<p>
1506-
To <dfn class="export">set emulated position data</dfn>, given
1507-
[=navigable=] |navigable| and an optional |emulated position data|:
1508-
</p>
1509-
<ol class="algorithm">
1510-
<li>Let |traversable| be |navigable|’s [=navigable/top-level traversable=].
1511-
</li>
1512-
<li>If |traversable| is not null, set |traversable|'s associated
1513-
<code>"emulated position data"</code> to |emulated position data|.
1514-
</li>
1515-
</ol>
1516-
<p>
1517-
To <dfn>get emulated position data</dfn>, given {{Geolocation}}
1518-
|geolocation|:
1519-
</p>
1520-
<ol class="algorithm">
1521-
<li>Let |navigable| be |geolocation|'s [=relevant global object=]'s
1522-
[=associated `Document`=]'s [=node navigable=].
1523-
</li>
1524-
<li>If |navigable| is null, return null.
1525-
</li>
1526-
<li>Let |traversable| be |navigable|’s [=navigable/top-level traversable=].
1527-
</li>
1528-
<li>If |traversable| is null, return null.
1529-
</li>
1530-
<li>Return |traversable|'s associated <code>"emulated position data"</code>.
1531-
</li>
1532-
</ol>
1533-
</section>
1502+
<section data-cite="html">
1503+
<h2>
1504+
Emulation
1505+
</h2>
1506+
<aside class="addition" id="a4">
1507+
<span class="marker">Candidate Addition:</span> Introduce emulated
1508+
position data to enable user-agent automation.
1509+
</aside><ins cite="#a4">
1510+
<p>
1511+
For the purposes of user-agent automation and application testing, this
1512+
document defines geolocation emulations.
1513+
</p>
1514+
<p>
1515+
Each [=top-level traversable=] has an associated
1516+
<code>"emulated position data"</code>, which is data representing
1517+
{{GeolocationCoordinates}} or null, initially null.
1518+
</p>
1519+
<p>
1520+
To <dfn class="export">set emulated position data</dfn>, given
1521+
[=navigable=] |navigable| and an optional |emulated position data|:
1522+
</p>
1523+
<ol class="algorithm">
1524+
<li>Let |traversable| be |navigable|’s [=navigable/top-level traversable=].
1525+
</li>
1526+
<li>If |traversable| is not null:
1527+
<ol class="algorithm">
1528+
<li>Set |traversable|'s associated
1529+
<code>"emulated position data"</code> to |emulated position data|.
1530+
</li>
1531+
<li>Consider this is a "significant change" in
1532+
<a href="#wait-for-change">wait for a significant change of
1533+
geographic position</a> step.
1534+
</li>
1535+
</ol>
1536+
</li>
1537+
</ol>
1538+
<p>
1539+
To <dfn>get emulated position data</dfn>, given {{Geolocation}}
1540+
|geolocation|:
1541+
</p>
1542+
<ol class="algorithm">
1543+
<li>Let |navigable| be |geolocation|'s [=relevant global object=]'s
1544+
[=associated `Document`=]'s [=node navigable=].
1545+
</li>
1546+
<li>If |navigable| is null, return null.
1547+
</li>
1548+
<li>Let |traversable| be |navigable|’s [=navigable/top-level traversable=].
1549+
</li>
1550+
<li>If |traversable| is null, return null.
1551+
</li>
1552+
<li>Return |traversable|'s associated <code>"emulated position data"</code>.
1553+
</li>
1554+
</ol>
1555+
</ins>
1556+
</section>
15341557
<section id="conformance"></section>
15351558
<section id="idl-index" class="appendix">
15361559
<!-- All the Web IDL will magically appear here -->

0 commit comments

Comments
 (0)