Loading dom/media/MediaDevices.cpp +5 −6 Original line number Diff line number Diff line Loading @@ -425,17 +425,12 @@ void MediaDevices::ResumeEnumerateDevices( void MediaDevices::ResolveEnumerateDevicesPromise( Promise* aPromise, const LocalMediaDeviceSet& aDevices) const { nsCOMPtr<nsPIDOMWindowInner> window = GetOwner(); auto windowId = window->WindowID(); nsTArray<RefPtr<MediaDeviceInfo>> infos; bool legacy = StaticPrefs::media_devices_enumerate_legacy_enabled(); bool capturePermitted = legacy && MediaManager::Get()->IsActivelyCapturingOrHasAPermission(windowId); for (const RefPtr<LocalMediaDevice>& device : aDevices) { bool exposeInfo = CanExposeInfo(device->Kind()) || legacy; bool exposeLabel = legacy ? capturePermitted : exposeInfo; bool exposeLabel = legacy ? DeviceInformationCanBeExposed() : exposeInfo; infos.AppendElement(MakeRefPtr<MediaDeviceInfo>( exposeInfo ? device->mID : u""_ns, device->Kind(), exposeLabel ? device->mName : u""_ns, Loading Loading @@ -796,6 +791,10 @@ void MediaDevices::EventListenerAdded(nsAtom* aType) { SetupDeviceChangeListener(); } bool MediaDevices::DeviceInformationCanBeExposed() const { return mCanExposeCameraInfo || mCanExposeMicrophoneInfo; } JSObject* MediaDevices::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) { return MediaDevices_Binding::Wrap(aCx, this, aGivenProto); Loading dom/media/MediaDevices.h +3 −0 Original line number Diff line number Diff line Loading @@ -116,6 +116,9 @@ class MediaDevices final : public DOMEventTargetHelper { void ResolveEnumerateDevicesPromise( Promise* aPromise, const LocalMediaDeviceSet& aDevices) const; // See https://www.w3.org/TR/mediacapture-streams/#device-information-exposure bool DeviceInformationCanBeExposed() const; nsTHashSet<nsString> mExplicitlyGrantedAudioOutputRawIds; nsTArray<RefPtr<Promise>> mPendingEnumerateDevicesPromises; // Set only once, if and when required. Loading modules/libpref/init/StaticPrefList.yaml +5 −3 Original line number Diff line number Diff line Loading @@ -10769,9 +10769,11 @@ # getUserMedia calls. Should only be turned on to resolve web compat issues, # since doing so reveals more user fingerprinting information to trackers. # # In this mode, camera and microphone device labels are exposed if the site has a # persisted permission to either kind, as well as while actively capturing either # kind (temporary and tab-specific grace-period permissions do not count). # This mode is marginally more permissive than the legacy behavior it attempts # to emulate in that device labels do not disappear when tracks are stopped and # temporary permission expires. That behavior isn't emulated due to low relative # privacy value compared to spec and it not being being conducive to spec # convergence. # # Planned next steps: true → @IS_NOT_NIGHTLY_BUILD@ → false - name: media.devices.enumerate.legacy.enabled Loading Loading
dom/media/MediaDevices.cpp +5 −6 Original line number Diff line number Diff line Loading @@ -425,17 +425,12 @@ void MediaDevices::ResumeEnumerateDevices( void MediaDevices::ResolveEnumerateDevicesPromise( Promise* aPromise, const LocalMediaDeviceSet& aDevices) const { nsCOMPtr<nsPIDOMWindowInner> window = GetOwner(); auto windowId = window->WindowID(); nsTArray<RefPtr<MediaDeviceInfo>> infos; bool legacy = StaticPrefs::media_devices_enumerate_legacy_enabled(); bool capturePermitted = legacy && MediaManager::Get()->IsActivelyCapturingOrHasAPermission(windowId); for (const RefPtr<LocalMediaDevice>& device : aDevices) { bool exposeInfo = CanExposeInfo(device->Kind()) || legacy; bool exposeLabel = legacy ? capturePermitted : exposeInfo; bool exposeLabel = legacy ? DeviceInformationCanBeExposed() : exposeInfo; infos.AppendElement(MakeRefPtr<MediaDeviceInfo>( exposeInfo ? device->mID : u""_ns, device->Kind(), exposeLabel ? device->mName : u""_ns, Loading Loading @@ -796,6 +791,10 @@ void MediaDevices::EventListenerAdded(nsAtom* aType) { SetupDeviceChangeListener(); } bool MediaDevices::DeviceInformationCanBeExposed() const { return mCanExposeCameraInfo || mCanExposeMicrophoneInfo; } JSObject* MediaDevices::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) { return MediaDevices_Binding::Wrap(aCx, this, aGivenProto); Loading
dom/media/MediaDevices.h +3 −0 Original line number Diff line number Diff line Loading @@ -116,6 +116,9 @@ class MediaDevices final : public DOMEventTargetHelper { void ResolveEnumerateDevicesPromise( Promise* aPromise, const LocalMediaDeviceSet& aDevices) const; // See https://www.w3.org/TR/mediacapture-streams/#device-information-exposure bool DeviceInformationCanBeExposed() const; nsTHashSet<nsString> mExplicitlyGrantedAudioOutputRawIds; nsTArray<RefPtr<Promise>> mPendingEnumerateDevicesPromises; // Set only once, if and when required. Loading
modules/libpref/init/StaticPrefList.yaml +5 −3 Original line number Diff line number Diff line Loading @@ -10769,9 +10769,11 @@ # getUserMedia calls. Should only be turned on to resolve web compat issues, # since doing so reveals more user fingerprinting information to trackers. # # In this mode, camera and microphone device labels are exposed if the site has a # persisted permission to either kind, as well as while actively capturing either # kind (temporary and tab-specific grace-period permissions do not count). # This mode is marginally more permissive than the legacy behavior it attempts # to emulate in that device labels do not disappear when tracks are stopped and # temporary permission expires. That behavior isn't emulated due to low relative # privacy value compared to spec and it not being being conducive to spec # convergence. # # Planned next steps: true → @IS_NOT_NIGHTLY_BUILD@ → false - name: media.devices.enumerate.legacy.enabled Loading