зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1732409 let fake:true getUserMedia() parameter override loopback prefs r=jib
and ignore fake:false so that it behaves like a missing/default fake parameter and does not override "media.navigator.streams.fake". Neither of these combinations are required in tests, but the fake:true override provides simpler testing of real-world scenarios, such as bug 1743524, even when loopback prefs are set, as is the preferred default test configuration. Also, adjusting the logic in this way so that fake: in getUserMedia() behaves similarly to ShouldResistFingerprinting() in enumerateDevices() will allow simplification of EnumerateDevicesImpl() parameters and moving the logic for the effect of preferences on enumeration to one place. Depends on D132895 Differential Revision: https://phabricator.services.mozilla.com/D132896
This commit is contained in:
Родитель
e6032cb268
Коммит
300a8443dd
|
@ -2661,15 +2661,15 @@ RefPtr<MediaManager::StreamPromise> MediaManager::GetUserMedia(
|
|||
|
||||
// Handle loopback and fake requests. For gUM we don't consider resist
|
||||
// fingerprinting as users should be prompted anyway.
|
||||
bool wantFakes = c.mFake.WasPassed()
|
||||
? c.mFake.Value()
|
||||
: Preferences::GetBool("media.navigator.streams.fake");
|
||||
bool forceFakes = c.mFake.WasPassed() && c.mFake.Value();
|
||||
bool wantFakes =
|
||||
forceFakes || Preferences::GetBool("media.navigator.streams.fake");
|
||||
nsAutoCString videoLoopDev, audioLoopDev;
|
||||
// Video
|
||||
if (videoType == MediaSourceEnum::Camera) {
|
||||
Preferences::GetCString("media.video_loopback_dev", videoLoopDev);
|
||||
// Loopback prefs take precedence over fake prefs
|
||||
if (!videoLoopDev.IsEmpty()) {
|
||||
if (!videoLoopDev.IsEmpty() && !forceFakes) {
|
||||
videoEnumerationType = DeviceEnumerationType::Loopback;
|
||||
} else if (wantFakes) {
|
||||
videoEnumerationType = DeviceEnumerationType::Fake;
|
||||
|
@ -2679,7 +2679,7 @@ RefPtr<MediaManager::StreamPromise> MediaManager::GetUserMedia(
|
|||
if (audioType == MediaSourceEnum::Microphone) {
|
||||
Preferences::GetCString("media.audio_loopback_dev", audioLoopDev);
|
||||
// Loopback prefs take precedence over fake prefs
|
||||
if (!audioLoopDev.IsEmpty()) {
|
||||
if (!audioLoopDev.IsEmpty() && !forceFakes) {
|
||||
audioEnumerationType = DeviceEnumerationType::Loopback;
|
||||
} else if (wantFakes) {
|
||||
audioEnumerationType = DeviceEnumerationType::Fake;
|
||||
|
|
|
@ -18,10 +18,7 @@ runTest(async () => {
|
|||
["media.setsinkid.enabled", true],
|
||||
// This test uses real devices because fake devices are not grouped with
|
||||
// audiooutput devices.
|
||||
["media.navigator.streams.fake", false],
|
||||
// Non empty media.audio_loopback_dev would disable fake:true for streams
|
||||
// returned from getUserMedia().
|
||||
["media.audio_loopback_dev", ""]);
|
||||
["media.navigator.streams.fake", false]);
|
||||
const devices = navigator.mediaDevices;
|
||||
{
|
||||
// `fake:true` means that getUserMedia() resolves without any permission
|
||||
|
|
Загрузка…
Ссылка в новой задаче