Changeset 224082 in webkit


Ignore:
Timestamp:
Oct 26, 2017 7:32:03 PM (6 years ago)
Author:
BJ Burg
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.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r224080 r224082  
     12017-10-26  Brian Burg  <bburg@apple.com>
     2
     3        Web Automation: denying user permission for getUserMedia doesn't work
     4        https://bugs.webkit.org/show_bug.cgi?id=178895
     5
     6        Reviewed by Youenn Fablet.
     7
     8        * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
     9        (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
     10        The ordering of special cases is incorrect. Safari configures its automation views to
     11        allow mock devices and never prompt for them. These checks were before the check for
     12        the automation session's getUserMedia permission. Switch these checks.
     13
     14        Also change the deny reason so that subsequent requests are also denied. This matches
     15        behavior when a user denies a permission request on a real dialog. With this change,
     16        the DOM error changes from SecurityError to NotAllowedError, which makes more sense.
     17
    1182017-10-26  Michael Catanzaro  <mcatanzaro@igalia.com>
    219
  • trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp

    r223988 r224082  
    291291        auto request = createRequest(userMediaID, m_page.mainFrame()->frameID(), frameID, WTFMove(userMediaDocumentOrigin), WTFMove(topLevelDocumentOrigin), WTFMove(audioDeviceUIDs), WTFMove(videoDeviceUIDs), WTFMove(deviceIdentifierHashSalt));
    292292
    293         if (m_page.preferences().mockCaptureDevicesEnabled() && !m_page.preferences().mockCaptureDevicesPromptEnabled()) {
    294             allowRequest(request);
    295             return;
    296         }
    297        
    298293        if (m_page.isControlledByAutomation()) {
    299294            if (WebAutomationSession* automationSession = m_page.process().processPool().automationSession()) {
     
    301296                    allowRequest(request);
    302297                else
    303                     userMediaAccessWasDenied(userMediaID, UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::UserMediaDisabled);
     298                    userMediaAccessWasDenied(userMediaID, UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::PermissionDenied);
    304299
    305300                return;
    306301            }
     302        }
     303
     304        if (m_page.preferences().mockCaptureDevicesEnabled() && !m_page.preferences().mockCaptureDevicesPromptEnabled()) {
     305            allowRequest(request);
     306            return;
    307307        }
    308308
Note: See TracChangeset for help on using the changeset viewer.