[MediaStream] MediaDeviceInfo.label must be empty in some situations
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Dec 2015 22:51:28 +0000 (22:51 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Dec 2015 22:51:28 +0000 (22:51 +0000)
commit41a323838b736014f55c9d61f809e92f892ca1c0
tree8aaa6cc1b4ee8273f7e0e6cb3c32d474d19edd1f
parent7d818d2df3db21a3bbeae7331fe5b624be9f8d91
[MediaStream] MediaDeviceInfo.label must be empty in some situations
https://bugs.webkit.org/show_bug.cgi?id=152000

Reviewed by Brent Fulgham.

Source/WebCore:

No new tests, updated fast/mediastream/MediaDevices-enumerateDevices.html.

* Modules/mediastream/CaptureDeviceManager.cpp:
(CaptureDeviceManager::getSourcesInfo): TrackSourceInfo constructor takes persistent ID.

* Modules/mediastream/MediaDevicesRequest.cpp:
(WebCore::MediaDevicesRequest::start): If Document had an active stream track, don't bother
  checking for a persistent permission to access devices.
(WebCore::MediaDevicesRequest::didCompleteCheck): m_hasUserMediaPermission -> m_canShowLabels.
(WebCore::MediaDevicesRequest::getTrackSources): New, factored out of didCompleteCheck so it
  can be called when we don't need to check permissions.
(WebCore::MediaDevicesRequest::didCompleteRequest): m_hasUserMediaPermission -> m_canShowLabels.
* Modules/mediastream/MediaDevicesRequest.h:

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::MediaStream): Call setIsActive. Register new stream with MediaStreamRegistry.
(WebCore::MediaStream::~MediaStream): Unregister stream with MediaStreamRegistry.
(WebCore::MediaStream::setIsActive): New. Set m_isActive and call Document if stream is active.
(WebCore::MediaStream::scheduleActiveStateChange): Call setIsActive.
(WebCore::MediaStream::registry): MediaStreamRegistry::registry -> MediaStreamRegistry::shared.
(WebCore::mediaStreams): Deleted. Drive-by cleanup: moved list of all streams to MediaStreamRegistry.
(WebCore::registerMediaStream): Ditto.
(WebCore::unRegisterMediaStream): Ditto.
(WebCore::MediaStream::lookUp): Ditto.
(WebCore::MediaStream::setRegistry): Ditto.
* Modules/mediastream/MediaStream.h:

* Modules/mediastream/MediaStreamRegistry.cpp:
(WebCore::MediaStreamRegistry::shared): Renamed from "registry".
(WebCore::MediaStreamRegistry::MediaStreamRegistry):
(WebCore::MediaStreamRegistry::lookUp): Moved here from MediaStream.
(WebCore::mediaStreams): Ditto.
(WebCore::MediaStreamRegistry::registerStream): Ditto.
(WebCore::MediaStreamRegistry::unregisterStream): Ditto.
(WebCore::MediaStreamRegistry::registry): Deleted.
* Modules/mediastream/MediaStreamRegistry.h:

* dom/Document.h:
(WebCore::Document::setHasActiveMediaStreamTrack): New, set m_hasHadActiveMediaStreamTrack.
(WebCore::Document::hasHadActiveMediaStreamTrack): New, return m_hasHadActiveMediaStreamTrack.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::loadResource): MediaStream::lookUp -> MediaStreamRegistry::shared().lookUp.

* platform/mediastream/MediaStreamTrackSourcesRequestClient.h:
(WebCore::TrackSourceInfo::create): Take track persistent ID.
(WebCore::TrackSourceInfo::persistentId): New.
(WebCore::TrackSourceInfo::TrackSourceInfo): Take track persistent ID.

* platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
(WebCore::RealtimeMediaSourceCenterMac::sourceWithUID): TrackSourceInfo::create takes persistent ID.

* platform/mock/MockRealtimeMediaSource.cpp:
(WebCore::MockRealtimeMediaSource::trackSourceWithUID): Ditto.

* platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp:
(WebCore::RealtimeMediaSourceCenterMac::sourceWithUID): TrackSourceInfo::create takes persistent ID.

Tools:

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::setUserMediaPermission):
(WTR::InjectedBundle::setUserMediaPermissionForOrigin): New.
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:

* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setUserMediaPermissionForOrigin): New.
* WebKitTestRunner/InjectedBundle/TestRunner.h:

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::setUserMediaPermissionForOrigin):
(WTR::TestController::handleCheckOfUserMediaPermissionForOrigin): Add NULL check.
(WTR::TestController::decidePolicyForUserMediaPermissionRequestIfPossible): Don't add
  persistent permission for origin, that can be done from script now.
* WebKitTestRunner/TestController.h:

* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Add support for
  SetUserMediaPermissionForOrigin.

LayoutTests:

* fast/mediastream/MediaDevices-enumerateDevices-expected.txt:
* fast/mediastream/MediaDevices-enumerateDevices.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194397 268f45cc-cd09-0410-ab3c-d52691b4dbfc
26 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/mediastream/MediaDevices-enumerateDevices-expected.txt
LayoutTests/fast/mediastream/MediaDevices-enumerateDevices.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/CaptureDeviceManager.cpp
Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp
Source/WebCore/Modules/mediastream/MediaDevicesRequest.h
Source/WebCore/Modules/mediastream/MediaStream.cpp
Source/WebCore/Modules/mediastream/MediaStream.h
Source/WebCore/Modules/mediastream/MediaStreamRegistry.cpp
Source/WebCore/Modules/mediastream/MediaStreamRegistry.h
Source/WebCore/dom/Document.h
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/platform/mediastream/MediaStreamTrackSourcesRequestClient.h
Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp
Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp
Source/WebCore/platform/mock/MockRealtimeMediaSource.cpp
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestInvocation.cpp