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

Top-level browsing context restrictions. #175

Closed
mikewest opened this issue Mar 17, 2017 · 3 comments · Fixed by #185
Closed

Top-level browsing context restrictions. #175

mikewest opened this issue Mar 17, 2017 · 3 comments · Fixed by #185

Comments

@mikewest
Copy link
Member

https://w3c.github.io/sensors/#browsing-context says:

Sensor readings must only be available in the top-level browsing context to avoid the privacy risk of sharing the information defined in this specification (and specifications extending it) with contexts unfamiliar to the user. For example, a mobile device will only fire the event on the active tab, and not on the background tabs or within iframes.

It sounds like you're trying to restrict the API to the document the user is actually interacting with. Unfortunately, there are lots of top-level browsing contexts (every tab is it's own "top-level"). I think you'll probably want to reference something like https://html.spec.whatwg.org/#has-focus-steps to ensure that you're talking about the right top-level browsing context.

Perhaps something like "the [=active document=] of a [=top-level browsing context=] for which the [=has focus steps=] returns true."?

Note that whatwg/html#2391 points out some issues with the "has focus steps" algorithm, but that shouldn't be your problem to work out. :)

/cc @arturjanc

@mikewest
Copy link
Member Author

Also, it's unclear how this restriction works. https://w3c.github.io/sensors/#construct-sensor-object prevents construction of a sensor object by non-top-level contexts, but once you have the object, are you prevented from accessing sensor data if you move to the background?

@tobie
Copy link
Member

tobie commented Mar 21, 2017

This is sort of addressed, albeit poorly here.

Needs to be cleaned-up and clarified as part of the processing model which I still need to write.

@tobie
Copy link
Member

tobie commented Apr 13, 2017

Looking at this a bit more closely, I think I initially mixed-up "top-level browsing context" with "visibility state".

I think we want to distinguish the two. Restrict both for now, then lift restrictions around top-levle browsing context using FeaturePolicy and page visibility using more complex permission descriptors (with a boolean allowBackgroundUsage = false; dictionary member).

tobie added a commit to tobie/sensors that referenced this issue Apr 27, 2017
Add visibility state requirement.

Closes w3c#175.
tobie added a commit to tobie/sensors that referenced this issue Apr 27, 2017
Add visibility state requirement.

Closes w3c#175.
tobie added a commit that referenced this issue Apr 27, 2017
Add visibility state requirement.

Closes #175.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants