Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
device_orientation: Add requestPermission() to Device{Orientation,Mot…
…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
- Loading branch information