Diff
Modified: trunk/Source/WebCore/en.lproj/Localizable.strings (244359 => 244360)
--- trunk/Source/WebCore/en.lproj/Localizable.strings 2019-04-16 21:35:13 UTC (rev 244359)
+++ trunk/Source/WebCore/en.lproj/Localizable.strings 2019-04-16 22:43:55 UTC (rev 244360)
@@ -109,6 +109,9 @@
/* Button title in Storage Access API prompt */
"Allow (cross-site cookie and website data access)" = "Allow";
+/* Button title in Device Orientation Permission API prompt */
+"Allow (device motion and orientation access)" = "Allow";
+
/* Message for requesting cross-site cookie and website data access. */
"Allow \"%@\" to use cookies and website data while browsing \"%@\"?" = "Allow \"%@\" to use cookies and website data while browsing \"%@\"?";
@@ -154,6 +157,9 @@
/* Cancel */
"Cancel" = "Cancel";
+/* Button title in Device Orientation Permission API prompt */
+"Cancel (device motion and orientation access)" = "Cancel";
+
/* Title for Cancel button label in button bar */
"Cancel button label in button bar" = "Cancel";
@@ -967,6 +973,9 @@
/* message in authentication panel */
"Your password will be sent unencrypted." = "Your password will be sent unencrypted.";
+/* Message for requesting access to the device motion and orientation */
+"\"%@\" Would Like to Access Motion and Orientation" = "\"%@\" Would Like to Access Motion and Orientation";
+
/* HTTP result code string */
"accepted" = "accepted";
Modified: trunk/Source/WebKit/ChangeLog (244359 => 244360)
--- trunk/Source/WebKit/ChangeLog 2019-04-16 21:35:13 UTC (rev 244359)
+++ trunk/Source/WebKit/ChangeLog 2019-04-16 22:43:55 UTC (rev 244360)
@@ -1,3 +1,21 @@
+2019-04-16 Chris Dumez <[email protected]>
+
+ Show prompt for device orientation access if the client does not implement the corresponding API delegate
+ https://bugs.webkit.org/show_bug.cgi?id=196971
+ <rdar://problem/49945840>
+
+ Reviewed by Alex Christensen.
+
+ Show prompt for device orientation access if the client does not implement the corresponding
+ API delegate, instead of rejecting access by default.
+
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
+ * UIProcess/Cocoa/WKOrientationAccessAlert.h: Added.
+ * UIProcess/Cocoa/WKOrientationAccessAlert.mm: Added.
+ (WebKit::presentOrientationAccessAlert):
+ * WebKit.xcodeproj/project.pbxproj:
+
2019-04-16 Zalan Bujtas <[email protected]>
REGRESSION(r243557)[ContentChangeObserver] Need to double tap text formatting elements in MS Word web app
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (244359 => 244360)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2019-04-16 21:35:13 UTC (rev 244359)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2019-04-16 22:43:55 UTC (rev 244360)
@@ -39,6 +39,7 @@
#import "WKNSDictionary.h"
#import "WKNavigationActionInternal.h"
#import "WKOpenPanelParametersInternal.h"
+#import "WKOrientationAccessAlert.h"
#import "WKSecurityOriginInternal.h"
#import "WKStorageAccessAlert.h"
#import "WKUIDelegatePrivate.h"
@@ -849,13 +850,15 @@
#if ENABLE(DEVICE_ORIENTATION)
void UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess(WebKit::WebPageProxy&, WebFrameProxy& webFrameProxy, const WebCore::SecurityOriginData& securityOriginData, CompletionHandler<void(bool)>&& completionHandler)
{
- if (!m_uiDelegate.m_delegateMethods.webViewShouldAllowDeviceOrientationAndMotionAccessRequestedByFrameDecisionHandler)
- return completionHandler(false);
-
auto delegate = m_uiDelegate.m_delegate.get();
if (!delegate)
return completionHandler(false);
+ if (!m_uiDelegate.m_delegateMethods.webViewShouldAllowDeviceOrientationAndMotionAccessRequestedByFrameDecisionHandler) {
+ presentOrientationAccessAlert(m_uiDelegate.m_webView, securityOriginData.host, WTFMove(completionHandler));
+ return;
+ }
+
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())
Added: trunk/Source/WebKit/UIProcess/Cocoa/WKOrientationAccessAlert.h (0 => 244360)
--- trunk/Source/WebKit/UIProcess/Cocoa/WKOrientationAccessAlert.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKOrientationAccessAlert.h 2019-04-16 22:43:55 UTC (rev 244360)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(DEVICE_ORIENTATION)
+
+#import <wtf/Forward.h>
+
+@class WKWebView;
+
+namespace WebKit {
+
+void presentOrientationAccessAlert(WKWebView *, const String& host, CompletionHandler<void(bool)>&&);
+
+}
+
+#endif // ENABLE(DEVICE_ORIENTATION)
Added: trunk/Source/WebKit/UIProcess/Cocoa/WKOrientationAccessAlert.mm (0 => 244360)
--- trunk/Source/WebKit/UIProcess/Cocoa/WKOrientationAccessAlert.mm (rev 0)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKOrientationAccessAlert.mm 2019-04-16 22:43:55 UTC (rev 244360)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WKOrientationAccessAlert.h"
+
+#if ENABLE(DEVICE_ORIENTATION)
+
+#import "WKWebViewInternal.h"
+#import <WebCore/LocalizedStrings.h>
+#import <wtf/text/WTFString.h>
+
+namespace WebKit {
+
+void presentOrientationAccessAlert(WKWebView *view, const String& host, CompletionHandler<void(bool)>&& completionHandler)
+{
+ NSString *alertText = [NSString stringWithFormat:WEB_UI_NSSTRING(@"\"%@\" Would Like to Access Motion and Orientation", @"Message for requesting access to the device motion and orientation"), (NSString *)host];
+ UIAlertController* alert = [UIAlertController alertControllerWithTitle:alertText message:nil preferredStyle:UIAlertControllerStyleAlert];
+
+ auto completionBlock = makeBlockPtr([completionHandler = WTFMove(completionHandler)](bool shouldAllow) mutable {
+ completionHandler(shouldAllow);
+ });
+
+ NSString *cancelButtonString = WEB_UI_STRING_KEY(@"Cancel", "Cancel (device motion and orientation access)", @"Button title in Device Orientation Permission API prompt");
+ UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:cancelButtonString style:UIAlertActionStyleCancel handler:[completionBlock](UIAlertAction *action) {
+ completionBlock(false);
+ }];
+
+ NSString *allowButtonString = WEB_UI_STRING_KEY(@"Allow", "Allow (device motion and orientation access)", @"Button title in Device Orientation Permission API prompt");
+ UIAlertAction* allowAction = [UIAlertAction actionWithTitle:allowButtonString style:UIAlertActionStyleDefault handler:[completionBlock](UIAlertAction *action) {
+ completionBlock(true);
+ }];
+ [alert addAction:cancelAction];
+ [alert addAction:allowAction];
+
+ [[UIViewController _viewControllerForFullScreenPresentationFromView:view] presentViewController:alert animated:YES completion:nil];
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(DEVICE_ORIENTATION)
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (244359 => 244360)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2019-04-16 21:35:13 UTC (rev 244359)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2019-04-16 22:43:55 UTC (rev 244360)
@@ -901,6 +901,8 @@
460F48901F996F7100CF4B87 /* WebSWContextManagerConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 460F488E1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessages.h */; };
463FD4801EB9459600A2982C /* WKProcessTerminationReason.h in Headers */ = {isa = PBXBuildFile; fileRef = 463FD47F1EB9458400A2982C /* WKProcessTerminationReason.h */; settings = {ATTRIBUTES = (Private, ); }; };
463FD4821EB94EC000A2982C /* ProcessTerminationReason.h in Headers */ = {isa = PBXBuildFile; fileRef = 463FD4811EB94EAD00A2982C /* ProcessTerminationReason.h */; };
+ 4657D88922664A2D005DE823 /* WKOrientationAccessAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = 4657D88722664A19005DE823 /* WKOrientationAccessAlert.h */; };
+ 4657D88A22664A2F005DE823 /* WKOrientationAccessAlert.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4657D88822664A1A005DE823 /* WKOrientationAccessAlert.mm */; };
466BC03C1FA266DA002FA9C1 /* WebSWContextManagerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 466BC0391FA266C9002FA9C1 /* WebSWContextManagerConnection.h */; };
467E43E82243FF7D00B13924 /* WebProcessDataStoreParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 467E43E72243FF6D00B13924 /* WebProcessDataStoreParameters.h */; };
46A2B6091E5676A600C3DEDA /* BackgroundProcessResponsivenessTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A2B6071E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.h */; };
@@ -3128,6 +3130,8 @@
463FD4811EB94EAD00A2982C /* ProcessTerminationReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessTerminationReason.h; sourceTree = "<group>"; };
4651ECE622178A850067EB95 /* WebProcessCacheCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessCacheCocoa.mm; sourceTree = "<group>"; };
465250E51ECF52CD002025CB /* WebKit2InitializeCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKit2InitializeCocoa.mm; sourceTree = "<group>"; };
+ 4657D88722664A19005DE823 /* WKOrientationAccessAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKOrientationAccessAlert.h; sourceTree = "<group>"; };
+ 4657D88822664A1A005DE823 /* WKOrientationAccessAlert.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKOrientationAccessAlert.mm; sourceTree = "<group>"; };
466BC0381FA266C9002FA9C1 /* WebSWContextManagerConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWContextManagerConnection.cpp; sourceTree = "<group>"; };
466BC0391FA266C9002FA9C1 /* WebSWContextManagerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWContextManagerConnection.h; sourceTree = "<group>"; };
466BC03A1FA266C9002FA9C1 /* WebSWContextManagerConnection.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebSWContextManagerConnection.messages.in; sourceTree = "<group>"; };
@@ -5437,6 +5441,8 @@
2ECF66CD21D6B77E009E5C3F /* WKEditCommand.mm */,
E1AEA22D14687BDB00804569 /* WKFullKeyboardAccessWatcher.h */,
E1AEA22E14687BDB00804569 /* WKFullKeyboardAccessWatcher.mm */,
+ 4657D88722664A19005DE823 /* WKOrientationAccessAlert.h */,
+ 4657D88822664A1A005DE823 /* WKOrientationAccessAlert.mm */,
1AD01BCB1905D54900C9C45F /* WKReloadFrameErrorRecoveryAttempter.h */,
1AD01BCA1905D54900C9C45F /* WKReloadFrameErrorRecoveryAttempter.mm */,
5CA26D80217ABBB600F97A35 /* WKSafeBrowsingWarning.h */,
@@ -9973,6 +9979,7 @@
5C26958520043212005C439B /* WKOpenPanelParametersPrivate.h in Headers */,
BC857FE612B843D800EDEB2E /* WKOpenPanelParametersRef.h in Headers */,
BC1DFE8F12B31CA8005DF730 /* WKOpenPanelResultListener.h in Headers */,
+ 4657D88922664A2D005DE823 /* WKOrientationAccessAlert.h in Headers */,
BCD597D7112B56DC00EC8C23 /* WKPage.h in Headers */,
7C89D29C1A67837B003A5FDE /* WKPageConfigurationRef.h in Headers */,
1AB8A1F818400BB800E9AE69 /* WKPageContextMenuClient.h in Headers */,
@@ -11263,6 +11270,7 @@
2D931169212F61B200044BFE /* WKContentView.mm in Sources */,
2D93116A212F61B500044BFE /* WKContentViewInteraction.mm in Sources */,
637281A321ADC744009E0DE6 /* WKDownloadProgress.mm in Sources */,
+ 4657D88A22664A2F005DE823 /* WKOrientationAccessAlert.mm in Sources */,
5CA26D83217AD1B800F97A35 /* WKSafeBrowsingWarning.mm in Sources */,
1DB01944211CF005009FB3E8 /* WKShareSheet.mm in Sources */,
7A78FF332241919B0096483E /* WKStorageAccessAlert.mm in Sources */,