Skip to content
Permalink
Browse files
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.


Canonical link: https://commits.webkit.org/195070@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
burg committed Oct 27, 2017
1 parent 02fbb71 commit a3d8a053956f4ebc1031bdd190760a4de53e5383
Showing 2 changed files with 23 additions and 6 deletions.
@@ -1,3 +1,20 @@
2017-10-26 Brian Burg <bburg@apple.com>

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 <mcatanzaro@igalia.com>

Unreviewed, fix GCC warning spam after r224077
@@ -290,22 +290,22 @@ void UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame(

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);
};

0 comments on commit a3d8a05

Please sign in to comment.