|
752 | 752 | change of geographic position is left to the
|
753 | 753 | implementation. User agents MAY impose a rate limit on how
|
754 | 754 | frequently position changes are reported.
|
| 755 | + <ins cite="#a4"> User agents MUST consider |
| 756 | + invoking [=set emulated position data=] as a significant |
| 757 | + change.</ins> |
755 | 758 | </li>
|
756 | 759 | <li>If |document| is not [=Document/fully active=] or
|
757 | 760 | [=Document/visibility state=] is not "visible", go back to
|
@@ -823,6 +826,38 @@ <h2>
|
823 | 826 | </li>
|
824 | 827 | <li>If |permission| is "granted":
|
825 | 828 | <ol>
|
| 829 | + <li> |
| 830 | + <ins cite="#a4">Check if an emulated position should be used by running |
| 831 | + the following steps: |
| 832 | + <ol> |
| 833 | + <li>Let |emulatedPositionData| be [=get emulated position data=] |
| 834 | + passing [=this=]. |
| 835 | + </li> |
| 836 | + <li>If |emulatedPositionData| is not null: |
| 837 | + <ol> |
| 838 | + <li>If |emulatedPositionData| is a {{GeolocationPositionError}}: |
| 839 | + <ol> |
| 840 | + <li>[=Call back with error=] passing |errorCallback| and |
| 841 | + |emulatedPositionData|. |
| 842 | + </li> |
| 843 | + <li>Terminate this algorithm.</li> |
| 844 | + </ol> |
| 845 | + </li> |
| 846 | + <li>Let |position| be [=a new `GeolocationPosition`=] |
| 847 | + passing |emulatedPositionData|, |acquisitionTime| and |
| 848 | + |options|.{{PositionOptions/enableHighAccuracy}}. |
| 849 | + </li> |
| 850 | + <li>[=Queue a task=] on the [=geolocation task source=] with |
| 851 | + a step that [=invokes=] |successCallback| with |
| 852 | + « |position| » and "`report`". |
| 853 | + </li> |
| 854 | + <li>Terminate this algorithm. |
| 855 | + </li> |
| 856 | + </ol> |
| 857 | + </li> |
| 858 | + </ol> |
| 859 | + </ins> |
| 860 | + </li> |
826 | 861 | <li>Let |position| be null.
|
827 | 862 | </li>
|
828 | 863 | <li>If |cachedPosition| is not null, and
|
@@ -1472,6 +1507,65 @@ <h2>
|
1472 | 1507 | feature/default allowlist=] is [=default allowlist/'self'=].
|
1473 | 1508 | </p>
|
1474 | 1509 | </section>
|
| 1510 | + <section data-cite="html"> |
| 1511 | + <h2> |
| 1512 | + Emulation |
| 1513 | + </h2> |
| 1514 | + <aside class="addition" id="a4"> |
| 1515 | + <span class="marker">Candidate Addition:</span> Introduce emulated |
| 1516 | + position data to enable user-agent automation. |
| 1517 | + </aside><ins cite="#a4"> |
| 1518 | + <p> |
| 1519 | + For the purposes of user-agent automation and application testing, this |
| 1520 | + document defines geolocation emulations. |
| 1521 | + </p> |
| 1522 | + <p> |
| 1523 | + Each [=top-level traversable=] has an associated |
| 1524 | + <dfn>emulated position data</dfn>, which is data representing |
| 1525 | + {{GeolocationCoordinates}}, {{GeolocationPositionError}} or null, |
| 1526 | + initially null. |
| 1527 | + </p> |
| 1528 | + <p> |
| 1529 | + To <dfn class="export">set emulated position data</dfn>, given |
| 1530 | + [=navigable=] |navigable| and an |emulatedPositionData|: |
| 1531 | + </p> |
| 1532 | + <ol class="algorithm"> |
| 1533 | + <li>Assert |emulatedPositionData| is either null, a |
| 1534 | + {{GeolocationCoordinates}}, or a {{GeolocationPositionError}}. |
| 1535 | + </li> |
| 1536 | + <li>Let |traversable| be |navigable|’s [=navigable/top-level traversable=]. |
| 1537 | + </li> |
| 1538 | + <li>If |traversable| is not null: |
| 1539 | + <ol class="algorithm"> |
| 1540 | + <li>Set |traversable|'s associated [=emulated position data=] to |
| 1541 | + |emulatedPositionData|. |
| 1542 | + </li> |
| 1543 | + <li>User agents MUST consider this as a "significant change" in the |
| 1544 | + <a href="#wait-for-change">wait for a significant change of |
| 1545 | + geographic position</a> step. |
| 1546 | + </li> |
| 1547 | + </ol> |
| 1548 | + </li> |
| 1549 | + </ol> |
| 1550 | + <p> |
| 1551 | + To <dfn>get emulated position data</dfn>, given {{Geolocation}} |
| 1552 | + |geolocation|: |
| 1553 | + </p> |
| 1554 | + <ol class="algorithm"> |
| 1555 | + <li>Let |navigable| be |geolocation|'s [=relevant global object=]'s |
| 1556 | + [=associated `Document`=]'s [=node navigable=]. |
| 1557 | + </li> |
| 1558 | + <li>If |navigable| is null, return null. |
| 1559 | + </li> |
| 1560 | + <li>Let |traversable| be |navigable|’s [=navigable/top-level traversable=]. |
| 1561 | + </li> |
| 1562 | + <li>If |traversable| is null, return null. |
| 1563 | + </li> |
| 1564 | + <li>Return |traversable|'s associated [=emulated position data=]. |
| 1565 | + </li> |
| 1566 | + </ol> |
| 1567 | + </ins> |
| 1568 | + </section> |
1475 | 1569 | <section id="conformance"></section>
|
1476 | 1570 | <section id="idl-index" class="appendix">
|
1477 | 1571 | <!-- All the Web IDL will magically appear here -->
|
|
0 commit comments