Title: [224082] trunk/Source/WebKit
Revision
224082
Author
[email protected]
Date
2017-10-26 19:32:03 -0700 (Thu, 26 Oct 2017)

Log Message

Web Automation: denying user permission for getUserMedia doesn't work
https://bugs.webkit.org/show_bug.cgi?id=178895

Reviewed by Youenn Fablet.

* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
The ordering of special cases is incorrect. Safari configures its automation views to
allow mock devices and never prompt for them. These checks were before the check for
the automation session's getUserMedia permission. Switch these checks.

Also change the deny reason so that subsequent requests are also denied. This matches
behavior when a user denies a permission request on a real dialog. With this change,
the DOM error changes from SecurityError to NotAllowedError, which makes more sense.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (224081 => 224082)


--- trunk/Source/WebKit/ChangeLog	2017-10-27 02:20:05 UTC (rev 224081)
+++ trunk/Source/WebKit/ChangeLog	2017-10-27 02:32:03 UTC (rev 224082)
@@ -1,3 +1,20 @@
+2017-10-26  Brian Burg  <[email protected]>
+
+        Web Automation: denying user permission for getUserMedia doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=178895
+
+        Reviewed by Youenn Fablet.
+
+        * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
+        (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
+        The ordering of special cases is incorrect. Safari configures its automation views to
+        allow mock devices and never prompt for them. These checks were before the check for
+        the automation session's getUserMedia permission. Switch these checks.
+
+        Also change the deny reason so that subsequent requests are also denied. This matches
+        behavior when a user denies a permission request on a real dialog. With this change,
+        the DOM error changes from SecurityError to NotAllowedError, which makes more sense.
+
 2017-10-26  Michael Catanzaro  <[email protected]>
 
         Unreviewed, fix GCC warning spam after r224077

Modified: trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp (224081 => 224082)


--- trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp	2017-10-27 02:20:05 UTC (rev 224081)
+++ trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp	2017-10-27 02:32:03 UTC (rev 224082)
@@ -290,22 +290,22 @@
 
         auto request = createRequest(userMediaID, m_page.mainFrame()->frameID(), frameID, WTFMove(userMediaDocumentOrigin), WTFMove(topLevelDocumentOrigin), WTFMove(audioDeviceUIDs), WTFMove(videoDeviceUIDs), WTFMove(deviceIdentifierHashSalt));
 
-        if (m_page.preferences().mockCaptureDevicesEnabled() && !m_page.preferences().mockCaptureDevicesPromptEnabled()) {
-            allowRequest(request);
-            return;
-        }
-        
         if (m_page.isControlledByAutomation()) {
             if (WebAutomationSession* automationSession = m_page.process().processPool().automationSession()) {
                 if (automationSession->shouldAllowGetUserMediaForPage(m_page))
                     allowRequest(request);
                 else
-                    userMediaAccessWasDenied(userMediaID, UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::UserMediaDisabled);
+                    userMediaAccessWasDenied(userMediaID, UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::PermissionDenied);
 
                 return;
             }
         }
 
+        if (m_page.preferences().mockCaptureDevicesEnabled() && !m_page.preferences().mockCaptureDevicesPromptEnabled()) {
+            allowRequest(request);
+            return;
+        }
+
         if (!m_page.uiClient().decidePolicyForUserMediaPermissionRequest(m_page, *m_page.process().webFrame(frameID), WTFMove(userMediaOrigin), WTFMove(topLevelOrigin), request.get()))
             userMediaAccessWasDenied(userMediaID, UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::UserMediaDisabled);
     };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to