Gyroscope (DeviceMotion related) permission cannot be requested in WKWebView unless...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Dec 2019 21:27:22 +0000 (21:27 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Dec 2019 21:27:22 +0000 (21:27 +0000)
commitb72aeae6c0383f17398baa9cc29245703ce842cb
tree5bd45dd1e67ff8850941ce82090de71869bdedb1
parent222fc60c5343e38aaccb663c0ed30e256555d999
Gyroscope (DeviceMotion related) permission cannot be requested in WKWebView unless the client app sets a WKUIDelegate
https://bugs.webkit.org/show_bug.cgi?id=203287

Reviewed by Alex Christensen.

Source/WebKit:

Device orientation / motion events permission dialog would not be shown unless the client app
set a WKUIDelegate on the WKWebView, even though we do not need this WKUIDelegate to show the
prompt.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _deviceOrientationUserPermissionHandler]):
(-[WKWebView _setDeviceOrientationUserPermissionHandler:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
* UIProcess/Cocoa/WKOrientationAccessAlert.mm:
(WebKit::presentOrientationAccessAlert):

Tools:

Add layout test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/DeviceOrientation.mm:
(runDeviceOrientationTest):
(TEST):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@253343 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
Source/WebKit/UIProcess/Cocoa/WKOrientationAccessAlert.mm
Source/WebKit/UIProcess/WebPageProxy.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/DeviceOrientation.mm