Add support for approximate location (without separate permission) - #233
Add support for approximate location (without separate permission)#233antosart wants to merge 5 commits into
Conversation
5f74f73 to
31df1a2
Compare
|
@marcoscaceres can you have a look and confirm if this version of the PR adheres to the WebKit model you proposed and hence is acceptable for WebKit. We believe this can be acceptable for Chromium. |
reillyeon
left a comment
There was a problem hiding this comment.
Some editorial comments, but overall this looks good to me.
31df1a2 to
33fec6a
Compare
Thanks, I've addressed your comments! |
reillyeon
left a comment
There was a problem hiding this comment.
Thank you for revising this proposal. @marcoscaceres, please take a look.
33fec6a to
0adfa8d
Compare
Hi @marcoscaceres, |
|
Sorry, been trying my best to get back to this 🙈. Got dragged into finishing another project. |
| associated with <a>"geolocation"</a>. | ||
| <aside class="note"> | ||
| <p> | ||
| Despite the naming, the algorithm [=prompt the user to |
There was a problem hiding this comment.
Feels kinda not great to have this note (instead of handling this in the algorithm)... like, should we have a flag or something that assures the prompt and when it doesn't?
There was a problem hiding this comment.
I added the note to clarify that this will not result in a prompt to the user, but I am also happy to remove the note.
According to the Permissions specification, this won't result in an additional prompt being displayed, because the user has already been prompted for the same options. Unfortunately, the Permissions specification does not prescribe how the user agent should store internally the chosen option, nor it provides any other algorithm to just query it, so I am not sure how else to word this.
marcoscaceres
left a comment
There was a problem hiding this comment.
Can we set up a call to chat if enableHighAccuracy can stand for AccuracyMode?
0adfa8d to
896c0ce
Compare
marcoscaceres
left a comment
There was a problem hiding this comment.
I'm flipping this to "approved", but don't merge it yet. I want to do prototype implementation first and check if everything is ok.
I'm getting Claude to implement it, but doing a spec-driven / conformance-first implementation, where the implementation is a test of the spec. I'm hopeful that by being super rigorous, it should generate a bunch of comments and fixes to the PR.
Expect some suggestions coming in...
8b8479d to
8866b48
Compare
8866b48 to
524de6b
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the Geolocation specification to support a privacy-preserving “approximate position” mode without introducing a separate powerful feature, aligning the permission/choice flow with a “choose accuracy” model.
Changes:
- Defines “precise position”, “approximate position”, and an “approximate location information source”.
- Adds
AccuracyModeandPositionOptions.accuracyMode, plus new examples and privacy guidance around approximate location. - Updates the permission request and acquisition algorithms to incorporate accuracy choice and caching behavior keyed by the chosen accuracy.
Comments suppressed due to low confidence (1)
index.html:905
- The list item that introduces |promptOptions|/|permission| includes an
<aside>, but the<li>itself is not explicitly closed before the next<li>begins. This relies on HTML's implicit<li>closing and is inconsistent with the rest of the algorithm markup.
</aside>
<li>If |permission| is "denied":
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
marcoscaceres
left a comment
There was a problem hiding this comment.
Feedback from a WebKit prototype of this PR (spec-driven, implementation as a conformance test). Three comments below: one construction bug ([[accuracyMode]] is never set), and two suggested clarifying notes.
|
Thanks for finding these additional issues/bugs! I addressed all the comments (also from copilot). |
|
Awesome, thanks... still validating the WebKit implementation... but have something drafty working. |
|
@antosart can you arrange for Mozilla to review this too? It’s looking pretty solid. We also need to update the testing part, I think. |
Thanks! I pinged Mozilla in the standard position request and asked them if they'd like to review.
Do you mean adding WPTs? We will definitely update the idlharness tests to include |
According to the new version of the spec PR (w3c/geolocation#233) we won't expose a separate "geolocation-approximate" powerful feature anymore. When querying the state of "geolocation", the website should just know whether any accuracy is granted. In order to do that, we just return the internal state of "geolocation-approximate" when the site queries "geolocation". The previous behavior is still implemented behind the runtime enabled features, which are now disabled also in tests. Bug: 465381902 Change-Id: Ic69108bd2483130185a3c6b0f74d690de4a309ba Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8151266 Reviewed-by: Tom Van Goethem <tov@chromium.org> Commit-Queue: Antonio Sartori <antoniosartori@chromium.org> Reviewed-by: Mike West <mkwst@chromium.org> Cr-Commit-Position: refs/heads/main@{#1669234}
|
If it's not testable, we effectively don't have normative way to enforce any behavior. The spec has no clear definition of what is "approximate position", which also makes it untestable. What does Blink and WebKit PRs do? Can we make it normative based on whatever the PRs do, and make tests based on that? |
We can definitely change set emulated position to be able to set both an approximate and a precise location. We can then test that requesting approximate location returns the emulated approximate location and requesting precise location returns the emulated precise location. @marcoscaceres do you think that would make sense? |
|
I would more expect the browser process the approximate coordinate, if then we don't need to pass two location. And emulate a moving user and see how the approximate mode ensures a certain level of "approximate"-ness. We should not just delegate to system behavior. |
Why not, if the platform provides a "approximate location" concept? Wouldn't this be more consistent with user expectations? |
|
Yeah, I agree with @antosart and @antosart. This is a rare case where we do want to hand it to the OS if possible, even if it becomes non-deterministic. The OS is in the best, um, position to provide the appropriate position (no pun intended). For testing via webdriver, we could define a rule, like round to x and y degrees and drop heading, speed, etc. |
|
Because that's a complete black box for spec perspective. Less black box for Apple et al. given they have access for their respective implementation, but less so for others. Mozilla will have zero idea how they works, what they actually ensure. |
|
Follow-up to my comment about defining a rule for testing: the draft does not say what happens to Android's platform coarsening already does this: The step is in antosart#2, added to "A new |
* Editorial: name the chosen accuracy |choice|, not |permission| * Null altitude, altitudeAccuracy, speed, and heading for approximate positions
Thanks. I think that makes sense, merged in this PR now. |
Closes #182
This PR is an alternate version of #195, introducing the ability for developers to request a less precise, privacy-preserving "approximate" location but without defining a separate powerful feature nor prescribing a specific permission model which distinguishes approximate and precise geolocation. In particular, while this PR is motivated by the explainer, it actually tries to follow and specify the proposed WebKit model.
The following tasks have been completed:
Implementation commitment (and no objections):
Documentation (new feature):
Preview | Diff