Backed out changeset cbef096ccab3 (bug 1836377) for causing mochitest-media failures on test_enumerateDevices.html. CLOSED TREE

This commit is contained in:
Iulian Moraru 2023-06-02 20:58:42 +03:00
parent 1ff1ac2e13
commit c10126be84
3 changed files with 13 additions and 9 deletions

View File

@ -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,
@ -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);

View File

@ -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.

View File

@ -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