Diff
Modified: trunk/Source/WebCore/ChangeLog (242752 => 242753)
--- trunk/Source/WebCore/ChangeLog 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebCore/ChangeLog 2019-03-11 23:14:20 UTC (rev 242753)
@@ -1,3 +1,14 @@
+2019-03-11 Chris Dumez <[email protected]>
+
+ Update device orientation & motion permission native SPI as per latest proposal
+ https://bugs.webkit.org/show_bug.cgi?id=195567
+
+ Reviewed by Youenn Fablet.
+
+ * dom/DeviceOrientationAndMotionAccessController.cpp:
+ (WebCore::DeviceOrientationAndMotionAccessController::shouldAllowAccess):
+ * page/ChromeClient.h:
+
2019-03-11 Wenson Hsieh <[email protected]>
[macOS] Dispatching reentrant "contextmenu" events may cause crashes
Modified: trunk/Source/WebCore/dom/DeviceOrientationAndMotionAccessController.cpp (242752 => 242753)
--- trunk/Source/WebCore/dom/DeviceOrientationAndMotionAccessController.cpp 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebCore/dom/DeviceOrientationAndMotionAccessController.cpp 2019-03-11 23:14:20 UTC (rev 242753)
@@ -52,11 +52,15 @@
if (!page)
return callback(false);
+ auto* frame = m_document.frame();
+ if (!frame)
+ return callback(false);
+
m_pendingRequests.append(WTFMove(callback));
if (m_pendingRequests.size() > 1)
return;
- page->chrome().client().shouldAllowDeviceOrientationAndMotionAccess(m_document.securityOrigin(), [this, weakThis = makeWeakPtr(*this)](bool granted) mutable {
+ page->chrome().client().shouldAllowDeviceOrientationAndMotionAccess(*frame, [this, weakThis = makeWeakPtr(*this)](bool granted) mutable {
if (weakThis)
setAccessState(granted);
});
Modified: trunk/Source/WebCore/page/ChromeClient.h (242752 => 242753)
--- trunk/Source/WebCore/page/ChromeClient.h 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebCore/page/ChromeClient.h 2019-03-11 23:14:20 UTC (rev 242753)
@@ -483,7 +483,7 @@
virtual void requestStorageAccess(String&& /*subFrameHost*/, String&& /*topFrameHost*/, uint64_t /*frameID*/, uint64_t /*pageID*/, WTF::CompletionHandler<void (bool)>&& callback) { callback(false); }
#if ENABLE(DEVICE_ORIENTATION)
- virtual void shouldAllowDeviceOrientationAndMotionAccess(const SecurityOrigin&, WTF::CompletionHandler<void(bool)>&& callback) { callback(true); }
+ virtual void shouldAllowDeviceOrientationAndMotionAccess(Frame&, WTF::CompletionHandler<void(bool)>&& callback) { callback(true); }
#endif
virtual void didInsertMenuElement(HTMLMenuElement&) { }
Modified: trunk/Source/WebKit/ChangeLog (242752 => 242753)
--- trunk/Source/WebKit/ChangeLog 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebKit/ChangeLog 2019-03-11 23:14:20 UTC (rev 242753)
@@ -1,3 +1,33 @@
+2019-03-11 Chris Dumez <[email protected]>
+
+ Update device orientation & motion permission native SPI as per latest proposal
+ https://bugs.webkit.org/show_bug.cgi?id=195567
+
+ Reviewed by Youenn Fablet.
+
+ The native SPI is now:
+ +- (void)_webView:(WKWebView *)webView shouldAllowDeviceOrientationAndMotionAccessRequestedByFrame:(WKFrameInfo *)frameInfo decisionHandler:(void (^)(BOOL))decisionHandler;
+
+ * UIProcess/API/APIUIClient.h:
+ (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageUIClient):
+ * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+ * UIProcess/Cocoa/UIDelegate.h:
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::setDelegate):
+ (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
+ * WebProcess/WebPage/WebPage.h:
+
2019-03-11 Andy Estes <[email protected]>
[Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
Modified: trunk/Source/WebKit/UIProcess/API/APIUIClient.h (242752 => 242753)
--- trunk/Source/WebKit/UIProcess/API/APIUIClient.h 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebKit/UIProcess/API/APIUIClient.h 2019-03-11 23:14:20 UTC (rev 242753)
@@ -174,7 +174,7 @@
#endif
#if ENABLE(DEVICE_ORIENTATION)
- virtual void shouldAllowDeviceOrientationAndMotionAccess(WebKit::WebPageProxy&, SecurityOrigin&, CompletionHandler<void(bool)>&& completionHandler) { completionHandler(true); }
+ virtual void shouldAllowDeviceOrientationAndMotionAccess(WebKit::WebPageProxy&, WebKit::WebFrameProxy& webFrameProxy, const WebCore::SecurityOriginData&, CompletionHandler<void(bool)>&& completionHandler) { completionHandler(true); }
#endif
virtual void didClickAutoFillButton(WebKit::WebPageProxy&, Object*) { }
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (242752 => 242753)
--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2019-03-11 23:14:20 UTC (rev 242753)
@@ -1904,12 +1904,13 @@
}
#if ENABLE(DEVICE_ORIENTATION)
- void shouldAllowDeviceOrientationAndMotionAccess(WebPageProxy& page, API::SecurityOrigin& origin, CompletionHandler<void(bool)>&& completionHandler) final
+ void shouldAllowDeviceOrientationAndMotionAccess(WebPageProxy& page, WebFrameProxy&, const WebCore::SecurityOriginData& originData, CompletionHandler<void(bool)>&& completionHandler) final
{
if (!m_client.shouldAllowDeviceOrientationAndMotionAccess)
return completionHandler(true);
- completionHandler(m_client.shouldAllowDeviceOrientationAndMotionAccess(toAPI(&page), toAPI(&origin), m_client.base.clientInfo));
+ auto origin = API::SecurityOrigin::create(originData.securityOrigin());
+ completionHandler(m_client.shouldAllowDeviceOrientationAndMotionAccess(toAPI(&page), toAPI(origin.ptr()), m_client.base.clientInfo));
}
#endif
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (242752 => 242753)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2019-03-11 23:14:20 UTC (rev 242753)
@@ -178,7 +178,7 @@
If you do not implement this method, access to the device's orientation and motion will be granted.
*/
-- (void)_webView:(WKWebView *)webView shouldAllowDeviceOrientationAndMotionAccessForSecurityOrigin:(WKSecurityOrigin *)securityOrigin decisionHandler:(void (^)(BOOL))decisionHandler WK_API_AVAILABLE(ios(WK_IOS_TBA));
+- (void)_webView:(WKWebView *)webView shouldAllowDeviceOrientationAndMotionAccessRequestedByFrame:(WKFrameInfo *)requestingFrame decisionHandler:(void (^)(BOOL))decisionHandler WK_API_AVAILABLE(ios(WK_IOS_TBA));
#else // TARGET_OS_IPHONE
- (void)_prepareForImmediateActionAnimationForWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.13.4));
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h (242752 => 242753)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2019-03-11 23:14:20 UTC (rev 242753)
@@ -121,7 +121,7 @@
void saveDataToFileInDownloadsFolder(WebPageProxy*, const WTF::String&, const WTF::String&, const URL&, API::Data&) final;
#endif
#if ENABLE(DEVICE_ORIENTATION)
- void shouldAllowDeviceOrientationAndMotionAccess(WebKit::WebPageProxy&, API::SecurityOrigin&, CompletionHandler<void(bool)>&&) final;
+ void shouldAllowDeviceOrientationAndMotionAccess(WebKit::WebPageProxy&, WebFrameProxy&, const WebCore::SecurityOriginData&, CompletionHandler<void(bool)>&&) final;
#endif
bool needsFontAttributes() const final { return m_uiDelegate.m_delegateMethods.webViewDidChangeFontAttributes; }
void didChangeFontAttributes(const WebCore::FontAttributes&) final;
@@ -192,7 +192,7 @@
bool webViewRequestNotificationPermissionForSecurityOriginDecisionHandler : 1;
#endif
#if ENABLE(DEVICE_ORIENTATION)
- bool webViewShouldAllowDeviceOrientationAndMotionAccessForSecurityOriginDecisionHandler : 1;
+ bool webViewShouldAllowDeviceOrientationAndMotionAccessRequestedByFrameDecisionHandler : 1;
#endif
bool webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler : 1;
bool webViewDecideDatabaseQuotaForSecurityOriginDatabaseNameDisplayNameCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler : 1;
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (242752 => 242753)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2019-03-11 23:14:20 UTC (rev 242753)
@@ -134,7 +134,7 @@
m_delegateMethods.webViewRequestNotificationPermissionForSecurityOriginDecisionHandler = [delegate respondsToSelector:@selector(_webView:requestNotificationPermissionForSecurityOrigin:decisionHandler:)];
#endif
#if ENABLE(DEVICE_ORIENTATION)
- m_delegateMethods.webViewShouldAllowDeviceOrientationAndMotionAccessForSecurityOriginDecisionHandler = [delegate respondsToSelector:@selector(_webView:shouldAllowDeviceOrientationAndMotionAccessForSecurityOrigin:decisionHandler:)];
+ m_delegateMethods.webViewShouldAllowDeviceOrientationAndMotionAccessRequestedByFrameDecisionHandler = [delegate respondsToSelector:@selector(_webView:shouldAllowDeviceOrientationAndMotionAccessRequestedByFrame:decisionHandler:)];
#endif
m_delegateMethods.webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler = [delegate respondsToSelector:@selector(_webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:)];
m_delegateMethods.webViewDecideDatabaseQuotaForSecurityOriginDatabaseNameDisplayNameCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler = [delegate respondsToSelector:@selector(_webView:decideDatabaseQuotaForSecurityOrigin:databaseName:displayName:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:)];
@@ -848,9 +848,9 @@
#endif
#if ENABLE(DEVICE_ORIENTATION)
-void UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess(WebKit::WebPageProxy&, API::SecurityOrigin& securityOrigin, CompletionHandler<void(bool)>&& completionHandler)
+void UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess(WebKit::WebPageProxy&, WebFrameProxy& webFrameProxy, const WebCore::SecurityOriginData& securityOriginData, CompletionHandler<void(bool)>&& completionHandler)
{
- if (!m_uiDelegate.m_delegateMethods.webViewShouldAllowDeviceOrientationAndMotionAccessForSecurityOriginDecisionHandler)
+ if (!m_uiDelegate.m_delegateMethods.webViewShouldAllowDeviceOrientationAndMotionAccessRequestedByFrameDecisionHandler)
return completionHandler(true);
auto delegate = m_uiDelegate.m_delegate.get();
@@ -857,8 +857,8 @@
if (!delegate)
return completionHandler(true);
- auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:shouldAllowDeviceOrientationAndMotionAccessForSecurityOrigin:decisionHandler:));
- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView shouldAllowDeviceOrientationAndMotionAccessForSecurityOrigin:wrapper(securityOrigin) decisionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL granted) mutable {
+ auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:shouldAllowDeviceOrientationAndMotionAccessRequestedByFrame:decisionHandler:));
+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView shouldAllowDeviceOrientationAndMotionAccessRequestedByFrame:wrapper(API::FrameInfo::create(webFrameProxy, securityOriginData.securityOrigin())) decisionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL granted) mutable {
if (checker->completionHandlerHasBeenCalled())
return;
checker->didCallCompletionHandler();
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (242752 => 242753)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-03-11 23:14:20 UTC (rev 242753)
@@ -7176,10 +7176,12 @@
}
#if ENABLE(DEVICE_ORIENTATION)
-void WebPageProxy::requestDeviceOrientationAndMotionAccess(WebCore::SecurityOriginData&& originData, CompletionHandler<void(bool)>&& completionHandler)
+void WebPageProxy::requestDeviceOrientationAndMotionAccess(uint64_t frameID, WebCore::SecurityOriginData&& originData, CompletionHandler<void(bool)>&& completionHandler)
{
- auto origin = API::SecurityOrigin::create(originData.securityOrigin());
- m_uiClient->shouldAllowDeviceOrientationAndMotionAccess(*this, origin.get(), WTFMove(completionHandler));
+ WebFrameProxy* frame = m_process->webFrame(frameID);
+ MESSAGE_CHECK(m_process, frame);
+
+ m_uiClient->shouldAllowDeviceOrientationAndMotionAccess(*this, *frame, WTFMove(originData), WTFMove(completionHandler));
}
#endif
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (242752 => 242753)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-03-11 23:14:20 UTC (rev 242753)
@@ -1406,7 +1406,7 @@
#endif
#if ENABLE(DEVICE_ORIENTATION)
- void requestDeviceOrientationAndMotionAccess(WebCore::SecurityOriginData&&, CompletionHandler<void(bool)>&&);
+ void requestDeviceOrientationAndMotionAccess(uint64_t frameID, WebCore::SecurityOriginData&&, CompletionHandler<void(bool)>&&);
#endif
static WebPageProxy* nonEphemeralWebPageProxy();
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (242752 => 242753)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2019-03-11 23:14:20 UTC (rev 242753)
@@ -534,7 +534,7 @@
LoadSynchronousURLSchemeTask(struct WebKit::URLSchemeTaskParameters parameters) -> (WebCore::ResourceResponse response, WebCore::ResourceError error, IPC::DataReference data) Delayed
#if ENABLE(DEVICE_ORIENTATION)
- RequestDeviceOrientationAndMotionAccess(struct WebCore::SecurityOriginData origin) -> (bool granted) Async
+ RequestDeviceOrientationAndMotionAccess(uint64_t frameID, struct WebCore::SecurityOriginData origin) -> (bool granted) Async
#endif
#if ENABLE(ATTACHMENT_ELEMENT)
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (242752 => 242753)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2019-03-11 23:14:20 UTC (rev 242753)
@@ -1321,9 +1321,11 @@
#endif
#if ENABLE(DEVICE_ORIENTATION)
-void WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess(const SecurityOrigin& origin, CompletionHandler<void(bool)>&& callback)
+void WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess(Frame& frame, CompletionHandler<void(bool)>&& callback)
{
- m_page.shouldAllowDeviceOrientationAndMotionAccess(origin, WTFMove(callback));
+ auto* webFrame = WebFrame::fromCoreFrame(frame);
+ ASSERT(webFrame);
+ m_page.shouldAllowDeviceOrientationAndMotionAccess(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), WTFMove(callback));
}
#endif
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (242752 => 242753)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2019-03-11 23:14:20 UTC (rev 242753)
@@ -367,7 +367,7 @@
#endif
#if ENABLE(DEVICE_ORIENTATION)
- void shouldAllowDeviceOrientationAndMotionAccess(const WebCore::SecurityOrigin&, CompletionHandler<void(bool)>&&) final;
+ void shouldAllowDeviceOrientationAndMotionAccess(WebCore::Frame&, CompletionHandler<void(bool)>&&) final;
#endif
String m_cachedToolTip;
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (242752 => 242753)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-03-11 23:14:20 UTC (rev 242753)
@@ -6341,9 +6341,9 @@
#endif
#if ENABLE(DEVICE_ORIENTATION)
-void WebPage::shouldAllowDeviceOrientationAndMotionAccess(const WebCore::SecurityOrigin& origin, CompletionHandler<void(bool)>&& completionHandler)
+void WebPage::shouldAllowDeviceOrientationAndMotionAccess(uint64_t frameID, WebCore::SecurityOriginData&& origin, CompletionHandler<void(bool)>&& completionHandler)
{
- sendWithAsyncReply(Messages::WebPageProxy::RequestDeviceOrientationAndMotionAccess(origin.data()), WTFMove(completionHandler));
+ sendWithAsyncReply(Messages::WebPageProxy::RequestDeviceOrientationAndMotionAccess(frameID, WTFMove(origin)), WTFMove(completionHandler));
}
#endif
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (242752 => 242753)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-03-11 23:08:29 UTC (rev 242752)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-03-11 23:14:20 UTC (rev 242753)
@@ -1116,7 +1116,7 @@
#endif
#if ENABLE(DEVICE_ORIENTATION)
- void shouldAllowDeviceOrientationAndMotionAccess(const WebCore::SecurityOrigin&, CompletionHandler<void(bool)>&&);
+ void shouldAllowDeviceOrientationAndMotionAccess(uint64_t frameID, WebCore::SecurityOriginData&&, CompletionHandler<void(bool)>&&);
#endif
void showShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback);