[MediaStream] enumerateDevices should not expose devices that are not available to...
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 3 Nov 2018 13:30:30 +0000 (13:30 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 3 Nov 2018 13:30:30 +0000 (13:30 +0000)
commitf33e82d341e4c8729128414613d92e4df2f99f4d
treefcd77ebb956607435a06bd507dae438f832a140a
parentb23d585808d30b92559440999bb2c227797dcb29
[MediaStream] enumerateDevices should not expose devices that are not available to getUserMedia
https://bugs.webkit.org/show_bug.cgi?id=191177
<rdar://problem/45747873>

Reviewed by Jer Noble.

Source/WebCore:

Test: http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute.html

* Modules/mediastream/MediaDevicesRequest.cpp:
(WebCore::MediaDevicesRequest::start): Only expose devices that are available to gUM.

* Modules/mediastream/UserMediaController.cpp:
(WebCore::isSecure): Moved from UserMediaRequest.cpp.
(WebCore::isAllowedToUse): Ditto.
(WebCore::UserMediaController::canCallGetUserMedia): Modified from UserMediaRequest.cpp.
(WebCore::UserMediaController::logGetUserMediaDenial): Log reason for denial.
* Modules/mediastream/UserMediaController.h:

* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::start): Use UserMediaController::canCallGetUserMedia.
(WebCore::isSecure): Deleted.
(WebCore::isAllowedToUse): Deleted.
(WebCore::canCallGetUserMedia): Deleted.

LayoutTests:

* http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute-expected.txt: Added.
* http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute.html: Added.
* http/tests/media/media-stream/resources/enumerate-devices-iframe.html: Added.
* http/tests/ssl/media-stream/get-user-media-different-host-expected.txt: Rebased for updated logging.
* http/tests/ssl/media-stream/get-user-media-nested-expected.txt: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237770 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-stream/resources/enumerate-devices-iframe.html [new file with mode: 0644]
LayoutTests/http/tests/ssl/media-stream/get-user-media-different-host-expected.txt
LayoutTests/http/tests/ssl/media-stream/get-user-media-nested-expected.txt
LayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-default-feature-policy.https-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp
Source/WebCore/Modules/mediastream/UserMediaController.cpp
Source/WebCore/Modules/mediastream/UserMediaController.h
Source/WebCore/Modules/mediastream/UserMediaRequest.cpp