[MediaStream] 'devicechange' event should not fire in frames that can't access captur...
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Dec 2018 03:11:36 +0000 (03:11 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Dec 2018 03:11:36 +0000 (03:11 +0000)
commit813b3fb1573be990772b2fc0672957bb12a2fd64
tree01e2f54f33c27d8f39515663707d88b3652a2b68
parent52153b4769fc6d3f9b0186bbd58b6a9e115f850b
[MediaStream] 'devicechange' event should not fire in frames that can't access capture devices
https://bugs.webkit.org/show_bug.cgi?id=192511
<rdar://problem/46562063>

Reviewed by Youenn Fablet.

Source/WebCore:

Test: http/tests/media/media-stream/device-change-event-in-iframe.html

* Modules/mediastream/MediaDevices.cpp:
(WebCore::MediaDevices::addEventListener): Don't fire the event unless the document can
access a camera or microphone.

Source/WebKit:

* UIProcess/UserMediaPermissionCheckProxy.cpp:
(WebKit::UserMediaPermissionCheckProxy::UserMediaPermissionCheckProxy): Remove userMediaID parameter.
(WebKit::UserMediaPermissionCheckProxy::setUserMediaAccessInfo): ID not passed to callback.
* UIProcess/UserMediaPermissionCheckProxy.h:
(WebKit::UserMediaPermissionCheckProxy::create):
(WebKit::UserMediaPermissionCheckProxy::completionHandler): Deleted.

* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::generateRequestID): New.
(WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged): Don't notify if
the page does not have a granted request and does not have persistent access.
(WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): Use generateRequestID.
(WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo): Change variable name.
(WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): Use generateRequestID.
* UIProcess/UserMediaPermissionRequestManagerProxy.h:

LayoutTests:

* fast/mediastream/device-change-event.html: Fix bogus title.
* http/tests/media/media-stream/device-change-event-in-iframe-expected.txt: Added.
* http/tests/media/media-stream/device-change-event-in-iframe.html: Added.
* http/tests/media/media-stream/resources/device-change-iframe.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239006 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/mediastream/device-change-event.html
LayoutTests/http/tests/media/media-stream/device-change-event-in-iframe-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-stream/device-change-event-in-iframe.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-stream/resources/device-change-iframe.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaDevices.cpp
Source/WebCore/Modules/mediastream/MediaStreamTrack.h
Source/WebKit/ChangeLog
Source/WebKit/Scripts/webkit/messages.py
Source/WebKit/UIProcess/UserMediaPermissionCheckProxy.cpp
Source/WebKit/UIProcess/UserMediaPermissionCheckProxy.h
Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp
Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.h
Source/WebKit/WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp
Source/WebKit/WebProcess/MediaStream/UserMediaPermissionRequestManager.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/WebPage.messages.in