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

device_orientation: Add requestPermission() to Device{Orientation,Motion}Event #17397

Closed
wants to merge 1 commit into from

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Jun 19, 2019

Implement w3c/deviceorientation#68, which has added
a static requestPermission() method to both DeviceOrientationEvent as well
as DeviceMotionEvent.

Permission granted via requestPermission() is checked for after other
existing checks (if the requires feature policy checks fail, for example, we
still do not register the event handler at all).

The spec is somewhat vague in how permission handling should be implemented.
For Chromium, we have settled on the following behavior:

  • If sensor access is set to "Allow", event listeners can be registered at
    any time, and calling requestPermission() returns a promise that resolves
    to "granted".
  • If sensor access is set to "Block", event listeners will only receive a
    single null event, and calling requestPermission() returns a promise that
    resolves to "blocked".
  • If sensor access is set to "Ask", event listeners will only receive a
    single null event until requestPermission() is called and access is
    granted (i.e. the user explicitly clicked "Allow" in the permission
    bubble, any other behavior including dismissing the bubble results in
    denial). If requestPermission() is NOT called through a user gesture, it
    will return a promise that rejecs with a NotAllowedError DOMException. If
    access is granted, requestPermission() returns a promise that resolves to
    "granted"; if access is denied, requestPermission() returns a promise that
    resolves to "blocked".

Bug: 947112
Change-Id: Ibb6ad43b78ca54189cf8f7ef802a4f812c5030df
Reviewed-on: https://chromium-review.googlesource.com/1583809
WPT-Export-Revision: 31ad6db314529fde6707b8fdb7c60d2d177dea5d

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already reviewed downstream.

…ion}Event

Implement w3c/deviceorientation#68, which has added
a static requestPermission() method to both DeviceOrientationEvent as well
as DeviceMotionEvent.

Permission granted via requestPermission() is checked for after other
existing checks (if the requires feature policy checks fail, for example, we
still do not register the event handler at all).

The spec is somewhat vague in how permission handling should be implemented.
For Chromium, we have settled on the following behavior:
* If sensor access is set to "Allow", event listeners can be registered at
  any time, and calling requestPermission() returns a promise that resolves
  to "granted".
* If sensor access is set to "Block", event listeners will only receive a
  single null event, and calling requestPermission() returns a promise that
  resolves to "blocked".
* If sensor access is set to "Ask", event listeners will only receive a
  single null event until requestPermission() is called and access is
  granted (i.e. the user explicitly clicked "Allow" in the permission
  bubble, any other behavior including dismissing the bubble results in
  denial). If requestPermission() is NOT called through a user gesture, it
  will return a promise that rejecs with a NotAllowedError DOMException. If
  access is granted, requestPermission() returns a promise that resolves to
  "granted"; if access is denied, requestPermission() returns a promise that
  resolves to "blocked".

Bug: 947112
Change-Id: Ibb6ad43b78ca54189cf8f7ef802a4f812c5030df
@gsnedders gsnedders closed this Jan 24, 2020
@gsnedders gsnedders deleted the chromium-export-cl-1583809 branch January 24, 2020 18:03
@gsnedders gsnedders restored the chromium-export-cl-1583809 branch January 24, 2020 18:50
@Hexcles Hexcles reopened this Jan 24, 2020
@KyleJu KyleJu closed this Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants