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
|
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. |
|
I wrote some web platform tests to cover |
This CL adds a basic Web Platform Test covering a call to geolocation.getCurrentPosition with accuracyMode set to approximate. This allows us to have minimal coverage for w3c/geolocation#233. Change-Id: I78321992cb90a065fee416b2047c05be0892d38f Force-WPT-Export: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8174483 Reviewed-by: Alvin Ji <alvinji@chromium.org> Commit-Queue: Antonio Sartori <antoniosartori@chromium.org> Cr-Commit-Position: refs/heads/main@{#1674767}
This CL adds a basic Web Platform Test covering a call to geolocation.getCurrentPosition with accuracyMode set to approximate. This allows us to have minimal coverage for w3c/geolocation#233. Change-Id: I78321992cb90a065fee416b2047c05be0892d38f Force-WPT-Export: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8174483 Reviewed-by: Alvin Ji <alvinji@chromium.org> Commit-Queue: Antonio Sartori <antoniosartori@chromium.org> Cr-Commit-Position: refs/heads/main@{#1674767}
This CL adds a basic Web Platform Test covering a call to geolocation.getCurrentPosition with accuracyMode set to approximate. This allows us to have minimal coverage for w3c/geolocation#233. Change-Id: I78321992cb90a065fee416b2047c05be0892d38f Force-WPT-Export: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8174483 Reviewed-by: Alvin Ji <alvinji@chromium.org> Commit-Queue: Antonio Sartori <antoniosartori@chromium.org> Cr-Commit-Position: refs/heads/main@{#1674767}
This CL adds a basic Web Platform Test covering a call to geolocation.getCurrentPosition with accuracyMode set to approximate. This allows us to have minimal coverage for w3c/geolocation#233. Change-Id: I78321992cb90a065fee416b2047c05be0892d38f Force-WPT-Export: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8174483 Reviewed-by: Alvin Ji <alvinji@chromium.org> Commit-Queue: Antonio Sartori <antoniosartori@chromium.org> Cr-Commit-Position: refs/heads/main@{#1674767}
This CL adds a basic Web Platform Test covering a call to geolocation.getCurrentPosition with accuracyMode set to approximate. This allows us to have minimal coverage for w3c/geolocation#233. Change-Id: I78321992cb90a065fee416b2047c05be0892d38f Force-WPT-Export: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8174483 Reviewed-by: Alvin Ji <alvinji@chromium.org> Commit-Queue: Antonio Sartori <antoniosartori@chromium.org> Cr-Commit-Position: refs/heads/main@{#1674767}
…, a=testonly Automatic update from web-platform-tests [approx-geo] Add WPT for approx location This CL adds a basic Web Platform Test covering a call to geolocation.getCurrentPosition with accuracyMode set to approximate. This allows us to have minimal coverage for w3c/geolocation#233. Change-Id: I78321992cb90a065fee416b2047c05be0892d38f Force-WPT-Export: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8174483 Reviewed-by: Alvin Ji <alvinji@chromium.org> Commit-Queue: Antonio Sartori <antoniosartori@chromium.org> Cr-Commit-Position: refs/heads/main@{#1674767} -- wpt-commits: 070c80e52881e9719ee244563d80b383c76b07bf wpt-pr: 61742
|
I think the tests don't match the spec. Sent a fix: web-platform-tests/wpt#61886 For future tests, can I ask that they are sent as regular PRs so other browser vendors have a chance to review them? 🙏 |
|
On what WebKit does, since the question of what "approximate" means concretely came up, and in case it is useful input for a testing rule. We coarsen at the single point where a position is delivered to the page, so the one-shot, watch and cached paths all get the same treatment. The rule is deterministic, with no randomness and no time input, so repeated reads of the same true position return the same approximate point rather than letting a site average successive answers toward the real one.
None of that is meant as the only reasonable rule, and the 5 km figure is a platform match rather than a guarantee about any particular device. It is offered because a concrete set of numbers seemed more useful here than another round of argument about whether the area should be bounded. |
Indeed, thanks for fixing. I actually tried to open a PR to wpt in the past, but I have no rights on the repo, and even finding out who could review my PR was basically impossible (so that I ended up redoing the same in chromium). But I'll try again next time though! |
|
@saschanaz see my suggestion above about coarsening and making it more deterministic, specifically over Web Driver. Would that work for you? |
… assertions (#61886) The second test is named "precise" but requested "approximate" and then asserted that altitude, altitudeAccuracy, heading and speed come back populated, which w3c/geolocation#233 requires to be null for an approximate position. The first test asserted that the emulated latitude, longitude and accuracy come back unchanged, which an implementation that actually coarsens cannot satisfy, and the pull request leaves the coarsened area to the underlying system. Also drops two assignments to an undeclared calledAsync global.
I don't see how it helps if it's just specific to webdriver - that won't allow testing anything on real behavior, right? |
|
@saschanaz i think quite a bit, like coarsening, making sure the various things that need to be null are null’ed out (see test fix above). And cache behavior in both modes (cache allowing). It’s pretty comprehensive and there’s room to make it better. I haven’t implemented the testing API in WebKit, but just from the tests, we can get a lot of behavior tested. @antosart, does this Web Driver extension allow emulation of both precise and approx? If so, we I think we could have something really good here |
|
It might help with testing, but I'm not convinced about the privacy story. A lack of dynamism makes this easier to reason about, but it still means a two-layer prompting story if a site ever wants to get better geolocation. That's not privacy harm in the information-loss sense, but privacy harm in the annoying AF sense. |
|
😹 it’s not that bad, @martinthomson. Yes, it’s potentially a second prompt on upgrade, but it’s the exceptional case and it still puts the user in control. But then it becomes more of a UX problem. At least, if a site generally needs approx, but sometimes precise, it can request precise up front and approx data. That “solves” double prompting. |
I'm open to this. I only wonder if it is worth to specify (and implement) in details a coarsening algorithm only for testing purposes (as opposed to, for example, just saying that the webdriver coarsened location should have null heading, speed, altitude, altitudeAccuracy and accuracy > X km). |
sorry, I was not clear. It’s not for “testing purposes”, a cached precise position can be coarsened by the UA without hitting the GPS module. That’s great for both privacy and power efficiency. |
|
(We might be accidentally talking past each other, but I think are goal is the same… we need to fix #193 which should make testing act “like the real thing”… I’m definitely not proposing any deviation from specified behavior when using web driver: setting a position via Web Driver would exercise the real code paths) |
My concern with that is that by potentially exposing to a website two positions, coarsened in different ways (one coarsened by the device, one by the UA computed from a cached precise position) we will end up exposing more information (the website can now infer that the user is in the intersection of the two positions). Fixing #193 makes sense to me. But couldn't we just have a "cached precise position" and a "cached approximate position"? |
|
I’m not following. The site already had the user’s precise position? Getting approx just gives them a coarse thing they already have. What am I missing? |
|
Sorry, maybe we are talking past each other. I thought you were proposing to add a coarsening algorithm to the spec, for coarsening a cached precise position? My point is: if there are two ways of producing a coarsened location (one is produced directly by the user agent, another one comes directly from the underlying device) and the coarsening algorithms are different, then we might end up exposing more information than expected. |
|
It may still be useful to provide coarsened location if the previous one is outdated enough, maybe the user moved far enough or it was just a long time ago, etc. |
You should now have waiting in your inbox an invite to join the WPT Reviewers GitHub team. Once you accept that, you’ll have push/write perms for the WPT repo.
That’s a separate problem that we can’t really do anything about from the WPT side. As an author of a WPT PR you’re expected to find your own reviewer for the PR. O else, if you’re upstreaming a test change that’s already gone through internal review within your own engine project (for changes to an in-tree imported downstream copy of the WPT test) then you can state as much in the WPT PR description, and either ask for someone else from your project to rubberstamp the WPT PR, or else mention That said, since the Chromium project also has the @chromium-wpt-export-bot for upstreaming WPT test changes, you can hook into that from any Chromium changeset. And as far as I know, that’s supposed to mark the upstreamed WPT as already-reviewed and ready-to-merge (as long as it passes all the other WPT GH Actions checks). |
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