Diff
Modified: trunk/Source/WebKit/ChangeLog (267567 => 267568)
--- trunk/Source/WebKit/ChangeLog 2020-09-25 14:17:53 UTC (rev 267567)
+++ trunk/Source/WebKit/ChangeLog 2020-09-25 14:35:47 UTC (rev 267568)
@@ -1,5 +1,33 @@
2020-09-25 Youenn Fablet <you...@apple.com>
+ Implement default behavior for getUserMedia requests in case where there is no delegate set
+ https://bugs.webkit.org/show_bug.cgi?id=216968
+
+ Reviewed by Eric Carlson.
+
+ In case page UIDelegate is not set, make the getUserMedia request do its default action.
+ In case there is a UIDelegate but no getUserMedia specific delegates, make the getUserMedia request do its default action.
+ Default action is deny for getDisplayMedia and for non cocoa ports.
+ For cocoa ports, a prompt is shown.
+
+ Manually tested with MiniBrowser and MobileMiniBrowser.
+
+ * SourcesCocoa.txt:
+ * UIProcess/API/APIUIClient.h:
+ (API::UIClient::decidePolicyForUserMediaPermissionRequest):
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::requestUserMediaAuthorizationForFrame):
+ * UIProcess/Cocoa/UserMediaPermissionRequestProxy.mm: Renamed from Source/WebKit/UIProcess/Cocoa/WKUserMediaCaptureAccessAlert.mm.
+ (WebKit::alertMessageText):
+ (WebKit::UserMediaPermissionRequestProxy::doDefaultAction):
+ * UIProcess/Cocoa/WKUserMediaCaptureAccessAlert.h: Removed.
+ * UIProcess/UserMediaPermissionRequestProxy.cpp:
+ (WebKit::UserMediaPermissionRequestProxy::doDefaultAction):
+ * UIProcess/UserMediaPermissionRequestProxy.h:
+ * WebKit.xcodeproj/project.pbxproj:
+
+2020-09-25 Youenn Fablet <you...@apple.com>
+
Introduce WKWebViewConfiguration mediaCaptureEnabled
https://bugs.webkit.org/show_bug.cgi?id=216872
Modified: trunk/Source/WebKit/SourcesCocoa.txt (267567 => 267568)
--- trunk/Source/WebKit/SourcesCocoa.txt 2020-09-25 14:17:53 UTC (rev 267567)
+++ trunk/Source/WebKit/SourcesCocoa.txt 2020-09-25 14:35:47 UTC (rev 267568)
@@ -386,6 +386,7 @@
UIProcess/Cocoa/UIDelegate.mm
UIProcess/Cocoa/UIRemoteObjectRegistry.cpp
UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp
+UIProcess/Cocoa/UserMediaPermissionRequestProxy.mm
UIProcess/Cocoa/VersionChecks.mm
UIProcess/Cocoa/VideoFullscreenManagerProxy.mm
UIProcess/Cocoa/WebPageProxyCocoa.mm
Modified: trunk/Source/WebKit/UIProcess/API/APIUIClient.h (267567 => 267568)
--- trunk/Source/WebKit/UIProcess/API/APIUIClient.h 2020-09-25 14:17:53 UTC (rev 267567)
+++ trunk/Source/WebKit/UIProcess/API/APIUIClient.h 2020-09-25 14:35:47 UTC (rev 267568)
@@ -138,7 +138,7 @@
virtual bool runOpenPanel(WebKit::WebPageProxy&, WebKit::WebFrameProxy*, WebKit::FrameInfoData&&, OpenPanelParameters*, WebKit::WebOpenPanelResultListenerProxy*) { return false; }
virtual void decidePolicyForGeolocationPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, const WebKit::FrameInfoData&, Function<void(bool)>&) { }
- virtual void decidePolicyForUserMediaPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionRequestProxy& request) { request.deny(); }
+ virtual void decidePolicyForUserMediaPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionRequestProxy& request) { request.doDefaultAction(); }
virtual void checkUserMediaPermissionForOrigin(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionCheckProxy& request) { request.deny(); }
virtual void decidePolicyForNotificationPermissionRequest(WebKit::WebPageProxy&, SecurityOrigin&, Function<void(bool)>&& completionHandler) { completionHandler(false); }
virtual void requestStorageAccessConfirm(WebKit::WebPageProxy&, WebKit::WebFrameProxy*, const WebCore::RegistrableDomain& requestingDomain, const WebCore::RegistrableDomain& currentDomain, CompletionHandler<void(bool)>&& completionHandler) { completionHandler(true); }
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (267567 => 267568)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2020-09-25 14:17:53 UTC (rev 267567)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2020-09-25 14:35:47 UTC (rev 267568)
@@ -44,7 +44,6 @@
#import "WKSecurityOriginInternal.h"
#import "WKStorageAccessAlert.h"
#import "WKUIDelegatePrivate.h"
-#import "WKUserMediaCaptureAccessAlert.h"
#import "WKWebViewConfigurationInternal.h"
#import "WKWebViewInternal.h"
#import "WKWindowFeaturesInternal.h"
@@ -896,6 +895,14 @@
#if ENABLE(MEDIA_STREAM)
static void requestUserMediaAuthorizationForFrame(const WebFrameProxy& frame, API::SecurityOrigin& topLevelOrigin, UserMediaPermissionRequestProxy& request, id <WKUIDelegatePrivate> delegate, WKWebView& webView)
{
+ bool respondsToRequestMediaCaptureAuthorization = [delegate respondsToSelector:@selector(_webView:requestMediaCaptureAuthorization:decisionHandler:)];
+ bool respondsToRequestUserMediaAuthorizationForDevices = [delegate respondsToSelector:@selector(_webView:requestUserMediaAuthorizationForDevices:url:mainFrameURL:decisionHandler:)];
+
+ if (!respondsToRequestMediaCaptureAuthorization && !respondsToRequestUserMediaAuthorizationForDevices) {
+ request.doDefaultAction();
+ return;
+ }
+
auto checker = CompletionHandlerCallChecker::create(delegate, @selector(_webView:requestMediaCaptureAuthorization:decisionHandler:));
auto decisionHandler = makeBlockPtr([protectedRequest = makeRef(request), checker = WTFMove(checker)](BOOL authorized) {
if (checker->completionHandlerHasBeenCalled())
@@ -921,15 +928,6 @@
ASSERT(!(devices & _WKCaptureDeviceCamera));
}
- bool respondsToRequestMediaCaptureAuthorization = [delegate respondsToSelector:@selector(_webView:requestMediaCaptureAuthorization:decisionHandler:)];
- bool respondsToRequestUserMediaAuthorizationForDevices = [delegate respondsToSelector:@selector(_webView:requestUserMediaAuthorizationForDevices:url:mainFrameURL:decisionHandler:)];
- if (!request.requiresDisplayCapture() && !respondsToRequestUserMediaAuthorizationForDevices && !respondsToRequestMediaCaptureAuthorization) {
- presentUserMediaCaptureAccessAlert(&webView, topLevelOrigin, devices, [decisionHandler = WTFMove(decisionHandler)](bool authorized) mutable {
- decisionHandler(authorized);
- });
- return;
- }
-
// FIXME: Provide a specific delegate for display capture.
if (!request.requiresDisplayCapture() && respondsToRequestMediaCaptureAuthorization) {
[delegate _webView:&webView requestMediaCaptureAuthorization:devices decisionHandler:decisionHandler.get()];
Copied: trunk/Source/WebKit/UIProcess/Cocoa/UserMediaPermissionRequestProxy.mm (from rev 267567, trunk/Source/WebKit/UIProcess/Cocoa/WKUserMediaCaptureAccessAlert.mm) (0 => 267568)
--- trunk/Source/WebKit/UIProcess/Cocoa/UserMediaPermissionRequestProxy.mm (rev 0)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UserMediaPermissionRequestProxy.mm 2020-09-25 14:35:47 UTC (rev 267568)
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2020 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 "UserMediaPermissionRequestProxy.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+#import "UserMediaPermissionRequestManagerProxy.h"
+#import "WKWebViewInternal.h"
+#import <WebCore/LocalizedStrings.h>
+#import <wtf/BlockPtr.h>
+#import <wtf/URLHelpers.h>
+
+namespace WebKit {
+
+static NSString* visibleDomain(const String& host)
+{
+ auto domain = WTF::URLHelpers::userVisibleURL(host.utf8());
+ return startsWithLettersIgnoringASCIICase(domain, "www.") ? domain.substring(4) : domain;
+}
+
+static NSString *alertMessageText(const WebCore::SecurityOrigin& origin, bool shouldAskUserForAccessToMicrophone, bool shouldAskUserForAccessToCamera)
+{
+ if (origin.protocol() != "http" && origin.protocol() != "https")
+ return nil;
+
+ if (shouldAskUserForAccessToCamera && shouldAskUserForAccessToMicrophone)
+ return [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to use your camera and microphone?", @"Message for user media prompt"), visibleDomain(origin.host())];
+ if (shouldAskUserForAccessToCamera)
+ return [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to use your camera?", @"Message for user camera access prompt"), visibleDomain(origin.host())];
+ if (shouldAskUserForAccessToMicrophone)
+ return [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to use your microphone?", @"Message for user microphone access prompt"), visibleDomain(origin.host())];
+ return nil;
+}
+
+void UserMediaPermissionRequestProxy::doDefaultAction()
+{
+ ASSERT(m_manager);
+ if (!m_manager) {
+ deny();
+ return;
+ }
+ auto *webView = fromWebPageProxy(m_manager->page());
+ if (!webView) {
+ deny();
+ return;
+ }
+ if (requiresDisplayCapture()) {
+ // FIXME: Implement getDisplayMedia prompt, for now deny.
+ deny();
+ return;
+ }
+
+ auto *alertTitle = alertMessageText(topLevelDocumentSecurityOrigin(), requiresAudioCapture(), requiresVideoCapture());
+ if (!alertTitle) {
+ deny();
+ return;
+ }
+
+ auto completionBlock = makeBlockPtr([this, protectedThis = makeRef(*this)](bool shouldAllow) mutable {
+ if (!shouldAllow)
+ deny();
+ else
+ allow();
+ });
+
+ NSString *allowButtonString = WEB_UI_STRING_KEY(@"Allow", "Allow (usermedia)", @"Allow button title in user media prompt");
+ NSString *doNotAllowButtonString = WEB_UI_STRING_KEY(@"Don’t Allow", "Don’t Allow (usermedia)", @"Disallow button title in user media prompt");
+
+#if PLATFORM(MAC)
+ auto alert = adoptNS([NSAlert new]);
+ [alert setMessageText:alertTitle];
+ [alert addButtonWithTitle:allowButtonString];
+ [alert addButtonWithTitle:doNotAllowButtonString];
+ [alert beginSheetModalForWindow:webView.window completionHandler:[completionBlock](NSModalResponse returnCode) {
+ auto shouldAllow = returnCode == NSAlertFirstButtonReturn;
+ completionBlock(shouldAllow);
+ }];
+#else
+ UIAlertController* alert = [UIAlertController alertControllerWithTitle:alertTitle message:nil preferredStyle:UIAlertControllerStyleAlert];
+ UIAlertAction* allowAction = [UIAlertAction actionWithTitle:allowButtonString style:UIAlertActionStyleCancel handler:[completionBlock](UIAlertAction *action) {
+ completionBlock(true);
+ }];
+
+ UIAlertAction* doNotAllowAction = [UIAlertAction actionWithTitle:doNotAllowButtonString style:UIAlertActionStyleDefault handler:[completionBlock](UIAlertAction *action) {
+ completionBlock(false);
+ }];
+
+ [alert addAction:doNotAllowAction];
+ [alert addAction:allowAction];
+
+ [[UIViewController _viewControllerForFullScreenPresentationFromView:webView] presentViewController:alert animated:YES completion:nil];
+#endif
+}
+
+} // namespace WebKit
+
+#else
+
+namespace WebKit {
+
+void UserMediaPermissionRequestProxy::doDefaultAction()
+{
+ ASSERT_NOT_REACHED();
+}
+
+}
+#endif // ENABLE(MEDIA_STREAM)
Deleted: trunk/Source/WebKit/UIProcess/Cocoa/WKUserMediaCaptureAccessAlert.h (267567 => 267568)
--- trunk/Source/WebKit/UIProcess/Cocoa/WKUserMediaCaptureAccessAlert.h 2020-09-25 14:17:53 UTC (rev 267567)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKUserMediaCaptureAccessAlert.h 2020-09-25 14:35:47 UTC (rev 267568)
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2020 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(MEDIA_STREAM)
-
-#import "WKWebViewPrivate.h"
-#import <wtf/Forward.h>
-
-@class WKWebView;
-
-namespace API {
-class SecurityOrigin;
-}
-
-namespace WebKit {
-
-void presentUserMediaCaptureAccessAlert(WKWebView *, API::SecurityOrigin&, _WKCaptureDevices, CompletionHandler<void(bool)>&&);
-
-}
-
-#endif // ENABLE(DEVICE_ORIENTATION)
Deleted: trunk/Source/WebKit/UIProcess/Cocoa/WKUserMediaCaptureAccessAlert.mm (267567 => 267568)
--- trunk/Source/WebKit/UIProcess/Cocoa/WKUserMediaCaptureAccessAlert.mm 2020-09-25 14:17:53 UTC (rev 267567)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKUserMediaCaptureAccessAlert.mm 2020-09-25 14:35:47 UTC (rev 267568)
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2020 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 "WKUserMediaCaptureAccessAlert.h"
-
-#if ENABLE(MEDIA_STREAM)
-
-#import "WKWebViewInternal.h"
-#import "WKWebViewPrivate.h"
-#import "WebPageProxy.h"
-#import <WebCore/LocalizedStrings.h>
-#import <wtf/BlockPtr.h>
-#import <wtf/URLHelpers.h>
-#import <wtf/text/WTFString.h>
-
-namespace WebKit {
-
-static NSString* visibleDomain(const String& host)
-{
- auto domain = WTF::URLHelpers::userVisibleURL(host.utf8());
- return startsWithLettersIgnoringASCIICase(domain, "www.") ? domain.substring(4) : domain;
-}
-
-static NSString *alertMessageText(API::SecurityOrigin& topLevelOrigin, _WKCaptureDevices devices)
-{
- bool shouldAskUserForAccessToCamera = devices & _WKCaptureDeviceCamera;
- bool shouldAskUserForAccessToMicrophone = devices & _WKCaptureDeviceMicrophone;
-
- auto& origin = topLevelOrigin.securityOrigin();
- if (origin.protocol() != "http" && origin.protocol() != "https")
- return nil;
-
- if (shouldAskUserForAccessToCamera && shouldAskUserForAccessToMicrophone)
- return [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to use your camera and microphone?", @"Message for user media prompt"), visibleDomain(origin.host())];
- if (shouldAskUserForAccessToCamera)
- return [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to use your camera?", @"Message for user camera access prompt"), visibleDomain(origin.host())];
- if (shouldAskUserForAccessToMicrophone)
- return [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to use your microphone?", @"Message for user microphone access prompt"), visibleDomain(origin.host())];
- return nil;
-}
-
-void presentUserMediaCaptureAccessAlert(WKWebView *webView, API::SecurityOrigin& topLevelOrigin, _WKCaptureDevices devices, CompletionHandler<void(bool)>&& completionHandler)
-{
- auto *alertTitle = alertMessageText(topLevelOrigin, devices);
- if (!alertTitle) {
- completionHandler(false);
- return;
- }
-
- auto completionBlock = makeBlockPtr([completionHandler = WTFMove(completionHandler)](bool shouldAllow) mutable {
- completionHandler(shouldAllow);
- });
-
- NSString *allowButtonString = WEB_UI_STRING_KEY(@"Allow", "Allow (usermedia)", @"Allow button title in user media prompt");
- NSString *doNotAllowButtonString = WEB_UI_STRING_KEY(@"Don’t Allow", "Don’t Allow (usermedia)", @"Disallow button title in user media prompt");
-
-#if PLATFORM(MAC)
- auto alert = adoptNS([NSAlert new]);
- [alert setMessageText:alertTitle];
- [alert addButtonWithTitle:allowButtonString];
- [alert addButtonWithTitle:doNotAllowButtonString];
- [alert beginSheetModalForWindow:webView.window completionHandler:[completionBlock](NSModalResponse returnCode) {
- auto shouldAllow = returnCode == NSAlertFirstButtonReturn;
- completionBlock(shouldAllow);
- }];
-#else
- UIAlertController* alert = [UIAlertController alertControllerWithTitle:alertTitle message:nil preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction* allowAction = [UIAlertAction actionWithTitle:allowButtonString style:UIAlertActionStyleCancel handler:[completionBlock](UIAlertAction *action) {
- completionBlock(true);
- }];
-
- UIAlertAction* doNotAllowAction = [UIAlertAction actionWithTitle:doNotAllowButtonString style:UIAlertActionStyleDefault handler:[completionBlock](UIAlertAction *action) {
- completionBlock(false);
- }];
-
- [alert addAction:doNotAllowAction];
- [alert addAction:allowAction];
-
- [[UIViewController _viewControllerForFullScreenPresentationFromView:webView] presentViewController:alert animated:YES completion:nil];
-#endif
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(DEVICE_ORIENTATION)
Modified: trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestProxy.cpp (267567 => 267568)
--- trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestProxy.cpp 2020-09-25 14:17:53 UTC (rev 267567)
+++ trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestProxy.cpp 2020-09-25 14:35:47 UTC (rev 267568)
@@ -95,6 +95,13 @@
invalidate();
}
+#if !PLATFORM(COCOA)
+void UserMediaPermissionRequestProxy::doDefaultAction()
+{
+ deny();
+}
+#endif
+
void UserMediaPermissionRequestProxy::invalidate()
{
m_manager = nullptr;
Modified: trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestProxy.h (267567 => 267568)
--- trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestProxy.h 2020-09-25 14:17:53 UTC (rev 267567)
+++ trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestProxy.h 2020-09-25 14:35:47 UTC (rev 267568)
@@ -47,6 +47,8 @@
enum class UserMediaAccessDenialReason { NoConstraints, UserMediaDisabled, NoCaptureDevices, InvalidConstraint, HardwareError, PermissionDenied, OtherFailure };
void deny(UserMediaAccessDenialReason = UserMediaAccessDenialReason::UserMediaDisabled);
+ void doDefaultAction();
+
void invalidate();
bool isPending() const { return m_manager; }
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (267567 => 267568)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-09-25 14:17:53 UTC (rev 267567)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-09-25 14:35:47 UTC (rev 267568)
@@ -902,7 +902,6 @@
413075B41DE85F580039EC69 /* LibWebRTCProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 413075A81DE85EE70039EC69 /* LibWebRTCProvider.h */; };
413CCD5020DEBC740065A21A /* com.google.googletalkbrowserplugin.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 413CCD4F20DEBC2F0065A21A /* com.google.googletalkbrowserplugin.sb */; };
4143751C20EAEA2D00FAD06C /* cn.microdone.cmb.safari.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 4143751B20EAEA1E00FAD06C /* cn.microdone.cmb.safari.sb */; };
- 4147DC692519EC3300214EE7 /* WKUserMediaCaptureAccessAlert.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4147DC672519E29D00214EE7 /* WKUserMediaCaptureAccessAlert.mm */; };
414DD37920BF43F5006959FB /* com.cisco.webex.plugin.gpc64.sb in Resources */ = {isa = PBXBuildFile; fileRef = 414DD37820BF43EA006959FB /* com.cisco.webex.plugin.gpc64.sb */; };
414DD37A20BF49A5006959FB /* com.cisco.webex.plugin.gpc64.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 414DD37820BF43EA006959FB /* com.cisco.webex.plugin.gpc64.sb */; };
4157E4B020E2ECDF00A6C0D7 /* com.google.o1dbrowserplugin.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 4157E4AF20E2EC9800A6C0D7 /* com.google.o1dbrowserplugin.sb */; };
@@ -3390,6 +3389,7 @@
4118DC1B21E6D11A00DE04C7 /* WebsiteDataStoreClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteDataStoreClient.h; sourceTree = "<group>"; };
411A8DD920DDB6050060D34F /* WKMockMediaDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKMockMediaDevice.h; sourceTree = "<group>"; };
411A8DDA20DDB6050060D34F /* WKMockMediaDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKMockMediaDevice.cpp; sourceTree = "<group>"; };
+ 411A9A9A251DE93E00807D7E /* UserMediaPermissionRequestProxy.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UserMediaPermissionRequestProxy.mm; sourceTree = "<group>"; };
411B22621E371244004F7363 /* LibWebRTCNetwork.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCNetwork.h; path = Network/webrtc/LibWebRTCNetwork.h; sourceTree = "<group>"; };
41287D4B225C05C4009A3E26 /* WebSocketTaskCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSocketTaskCocoa.mm; sourceTree = "<group>"; };
41287D4C225C05C5009A3E26 /* WebSocketTaskCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSocketTaskCocoa.h; sourceTree = "<group>"; };
@@ -3412,8 +3412,6 @@
4135FBD01F4FB7F20074C47B /* CacheStorageEngineCaches.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStorageEngineCaches.h; sourceTree = "<group>"; };
413CCD4F20DEBC2F0065A21A /* com.google.googletalkbrowserplugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.google.googletalkbrowserplugin.sb; sourceTree = "<group>"; };
4143751B20EAEA1E00FAD06C /* cn.microdone.cmb.safari.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cn.microdone.cmb.safari.sb; sourceTree = "<group>"; };
- 4147DC672519E29D00214EE7 /* WKUserMediaCaptureAccessAlert.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKUserMediaCaptureAccessAlert.mm; sourceTree = "<group>"; };
- 4147DC682519E29D00214EE7 /* WKUserMediaCaptureAccessAlert.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKUserMediaCaptureAccessAlert.h; sourceTree = "<group>"; };
414DD37820BF43EA006959FB /* com.cisco.webex.plugin.gpc64.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.cisco.webex.plugin.gpc64.sb; sourceTree = "<group>"; };
4150A5A023E06C910051264A /* GPUProcessSessionParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPUProcessSessionParameters.h; sourceTree = "<group>"; };
41518535222704F5005430C6 /* ServiceWorkerFetchTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerFetchTask.h; sourceTree = "<group>"; };
@@ -6361,6 +6359,7 @@
1AFE436318B6C081009C7A48 /* UIDelegate.mm */,
463236862314833F00A48FA7 /* UIRemoteObjectRegistry.cpp */,
463236852314833F00A48FA7 /* UIRemoteObjectRegistry.h */,
+ 411A9A9A251DE93E00807D7E /* UserMediaPermissionRequestProxy.mm */,
E4E8648E1B1673FB00C82F40 /* VersionChecks.h */,
E4E8648F1B1673FB00C82F40 /* VersionChecks.mm */,
52D5A1AA1C57494E00DE34A3 /* VideoFullscreenManagerProxy.h */,
@@ -6393,8 +6392,6 @@
2D7AAFD218C8640600A7ACD4 /* WKWebViewContentProvider.h */,
2DC6D9C118C44A610043BAD4 /* WKWebViewContentProviderRegistry.h */,
2DC6D9C218C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm */,
- 4147DC682519E29D00214EE7 /* WKUserMediaCaptureAccessAlert.h */,
- 4147DC672519E29D00214EE7 /* WKUserMediaCaptureAccessAlert.mm */,
C1710CF224A7BD0300D7C112 /* XPCEventHandler.h */,
);
path = Cocoa;
@@ -12975,7 +12972,6 @@
2D11B7BF2126A283006F8878 /* UnifiedSource56-mm.mm in Sources */,
2D11B7C12126A283006F8878 /* UnifiedSource57-mm.mm in Sources */,
2D11B7C22126A283006F8878 /* UnifiedSource57.cpp in Sources */,
- 4147DC692519EC3300214EE7 /* WKUserMediaCaptureAccessAlert.mm in Sources */,
2D11B7C32126A283006F8878 /* UnifiedSource58-mm.mm in Sources */,
2D11B7C42126A283006F8878 /* UnifiedSource58.cpp in Sources */,
2D11B7C62126A283006F8878 /* UnifiedSource59.cpp in Sources */,
Modified: trunk/Tools/ChangeLog (267567 => 267568)
--- trunk/Tools/ChangeLog 2020-09-25 14:17:53 UTC (rev 267567)
+++ trunk/Tools/ChangeLog 2020-09-25 14:35:47 UTC (rev 267568)
@@ -1,3 +1,17 @@
+2020-09-25 Youenn Fablet <you...@apple.com>
+
+ Implement default behavior for getUserMedia requests in case where there is no delegate set
+ https://bugs.webkit.org/show_bug.cgi?id=216968
+
+ Reviewed by Eric Carlson.
+
+ Add camera and microphone entitlements to MobileMiniBrowser.
+ Expose mediaDevices to web pages and use mock devices.
+
+ * MobileMiniBrowser/MobileMiniBrowser/Info.plist:
+ * MobileMiniBrowser/MobileMiniBrowserFramework/WebViewController.m:
+ (-[WebViewController createWebView]):
+
2020-09-25 Lauro Moura <lmo...@igalia.com>
[webkitperl] Check for custom Flatpak user dirs in webkitdirs.pm
Modified: trunk/Tools/MobileMiniBrowser/MobileMiniBrowser/Info.plist (267567 => 267568)
--- trunk/Tools/MobileMiniBrowser/MobileMiniBrowser/Info.plist 2020-09-25 14:17:53 UTC (rev 267567)
+++ trunk/Tools/MobileMiniBrowser/MobileMiniBrowser/Info.plist 2020-09-25 14:35:47 UTC (rev 267568)
@@ -54,5 +54,11 @@
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
+ <key>com.apple.security.device.camera</key>
+ <true/>
+ <key>com.apple.security.device.microphone</key>
+ <true/>
+ <key>NSCameraUsageDescription</key>
+ <string>Camera usage description</string>
</dict>
</plist>
Modified: trunk/Tools/MobileMiniBrowser/MobileMiniBrowserFramework/WebViewController.m (267567 => 267568)
--- trunk/Tools/MobileMiniBrowser/MobileMiniBrowserFramework/WebViewController.m 2020-09-25 14:17:53 UTC (rev 267567)
+++ trunk/Tools/MobileMiniBrowser/MobileMiniBrowserFramework/WebViewController.m 2020-09-25 14:35:47 UTC (rev 267568)
@@ -28,6 +28,7 @@
#import "TabViewController.h"
#import <WebKit/WKNavigation.h>
#import <WebKit/WKNavigationDelegate.h>
+#import <WebKit/WKPreferencesPrivate.h>
#import <WebKit/WKWebView.h>
#import <WebKit/WKWebViewConfiguration.h>
@@ -175,6 +176,10 @@
- (WKWebView *)createWebView
{
WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
+
+ configuration.preferences._mediaDevicesEnabled = YES;
+ configuration.preferences._mockCaptureDevicesEnabled = YES;
+
WKWebView *webView = [[WKWebView alloc] initWithFrame:self.webViewContainer.bounds configuration:configuration];
webView.navigationDelegate = self;
webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;