Device orientation's permission should only require a user gesture to prompt the...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Mar 2019 18:57:58 +0000 (18:57 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Mar 2019 18:57:58 +0000 (18:57 +0000)
commitd5dfe11c3cbec0f833e30185686b37c3c579be55
tree18437b4ca23ae52437f40234858583870993cace
parentd50b73e606d3738b5905e9c041034d6024cb9749
Device orientation's permission should only require a user gesture to prompt the user
https://bugs.webkit.org/show_bug.cgi?id=195731

Reviewed by Geoffrey Garen.

Source/WebCore:

Device orientation's permission should only require a user gesture to prompt the user. If the
user already made a decision, we should resolve the promise with this decision, even without
user gesture.

This is useful for JS to figure out if they are access to device orientation or not because
showing UI for the user to give permission.

No new tests, updated existing tests.

* dom/DeviceOrientationAndMotionAccessController.cpp:
(WebCore::DeviceOrientationAndMotionAccessController::shouldAllowAccess):
* dom/DeviceOrientationAndMotionAccessController.h:
* dom/DeviceOrientationOrMotionEvent.cpp:
(WebCore::DeviceOrientationOrMotionEvent::requestPermission):

LayoutTests:

Update layout tests accordingly.

* fast/device-orientation/device-motion-request-permission-denied.html:
* fast/device-orientation/device-motion-request-permission-granted.html:
* fast/device-orientation/device-motion-request-permission-user-gesture-expected.txt:
* fast/device-orientation/device-orientation-request-permission-denied.html:
* fast/device-orientation/device-orientation-request-permission-granted.html:
* fast/device-orientation/device-orientation-request-permission-user-gesture-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242951 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/device-orientation/device-motion-request-permission-denied.html
LayoutTests/fast/device-orientation/device-motion-request-permission-granted.html
LayoutTests/fast/device-orientation/device-motion-request-permission-user-gesture-expected.txt
LayoutTests/fast/device-orientation/device-orientation-request-permission-denied.html
LayoutTests/fast/device-orientation/device-orientation-request-permission-granted.html
LayoutTests/fast/device-orientation/device-orientation-request-permission-user-gesture-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/dom/DeviceOrientationAndMotionAccessController.cpp
Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h
Source/WebCore/dom/DeviceOrientationOrMotionEvent.cpp