Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SecureContext and API behavior of browsers #34

Merged
merged 4 commits into from
Sep 9, 2019
Merged
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
53 changes: 42 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
};
</script>
</head>
<body>
<body data-cite="secure-contexts">

<section id=abstract>

Expand Down Expand Up @@ -398,6 +398,23 @@ <h3><dfn>Geolocation</dfn> interface</h3>
<p>The implementation of the <a data-link-for=Geolocation>getCurrentPosition</a> method
MUST execute the following set of steps:</p>
<ol>
<li>
Return and continue asynchronously.
</li>
<li>
If the <a>environment settings object</a> is a <a>non-secure context</a>:
<ol>
<li>
If |errorCallback| was passed, invoke the |errorCallback| with a newly created {{GeolocationPositionError}} object whose {{GeolocationPositionError/code}} attribute is initialized to {{GeolocationPositionError/PERMISSION_DENIED}}.
</li>
<li>
Optionally, inform the developer that the API can only be used from <a>secure contexts</a>.
</li>
<li>
Terminate this algorithm.
</li>
</ol>
</li>
<li> If a cached <a>GeolocationPosition</a> object, whose age is no greater
than the value of the <a data-link-for=PositionOptions>maximumAge</a> variable, is available,
invoke the <var>successCallback</var> with the
Expand Down Expand Up @@ -428,12 +445,25 @@ <h3><dfn>Geolocation</dfn> interface</h3>
present) with a new <a>GeolocationPositionError</a> object
whose <a data-link-for=GeolocationPositionError>code</a> is set to <a data-link-for=GeolocationPositionError>POSITION_UNAVAILABLE</a>.</li>
</ol>

<p>The <dfn>watchPosition()</dfn>
method takes one, two or three arguments. When called, it MUST immediately
return a long value that uniquely identifies a <a>watch
process</a> and then asynchronously start the watch
operation. This operation MUST first attempt to obtain the current location of the
<p>The <dfn>watchPosition()</dfn> method takes one, two or three arguments. When called, immediately return a long value that uniquely identifies a <a>watch process</a> and continue asynchronously.</p>
<ol data-link-for=GeolocationPositionError>
<li>
If the <a>environment settings object</a> is a <a>non-secure context</a>:
<ol>
<li>
If |errorCallback| was passed, invoke the |errorCallback| with a newly created {{GeolocationPositionError}} object whose {{GeolocationPositionError/code}} attribute is initialized to {{GeolocationPositionError/PERMISSION_DENIED}}.
</li>
<li>
Optionally, inform the developer that the API can only be used from <a>secure contexts</a>.
</li>
<li>
Terminate this algorithm.
</li>
</ol>
</li>
<li>
<p>
Otherwise, start the watch operation. This operation MUST first attempt to obtain the current location of the
device. If the attempt is successful, the <var>successCallback</var> MUST be invoked
(i.e. the {{EventListener/handleEvent()}} operation MUST be called on the
callback object) with a new <a>GeolocationPosition</a> object,
Expand All @@ -444,9 +474,10 @@ <h3><dfn>Geolocation</dfn> interface</h3>
to monitor the position of the device and invoke the appropriate
callback every time this position changes. The <a>watch process</a>
MUST continue until
the <a>clearWatch()</a> method is
the {{Geolocation/clearWatch()}} method is
called with the corresponding identifier.</p>

</li>
</ol>
<p>The <dfn>PositionCallBack</dfn> callback is invoked when a <a>GeolocationPosition</a> object is available, resulting
from a cached object or the acquisition operation. The <a>PositionCallBack</a> callback gets set using
the <dfn>successCallback</dfn> parameter.</p>
Expand Down Expand Up @@ -622,7 +653,7 @@ <h3><dfn>GeolocationPosition</dfn> interface</h3>
position (e.g. street addresses).

<pre class=idl>
[Exposed=Window]
[Exposed=Window, SecureContext]
interface GeolocationPosition {
readonly attribute GeolocationCoordinates coords;
readonly attribute DOMTimeStamp timestamp;
Expand All @@ -641,7 +672,7 @@ <h3><dfn>GeolocationPosition</dfn> interface</h3>
<h3><dfn>GeolocationCoordinates</dfn> interface</h3>

<pre class=idl>
[Exposed=Window]
[Exposed=Window, SecureContext]
interface GeolocationCoordinates {
readonly attribute double latitude;
readonly attribute double longitude;
Expand Down