diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index b195726a6396..48d503493693 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -18,6 +18,8 @@ #include "nsDOMFile.h" #include "nsGlobalWindow.h" +#include "mozilla/Preferences.h" + /* Using WebRTC backend on Desktops (Mac, Windows, Linux), otherwise default */ #include "MediaEngineDefault.h" #if defined(MOZ_WEBRTC) @@ -673,6 +675,11 @@ MediaManager::GetUserMedia(bool aPrivileged, nsPIDOMWindow* aWindow, mActiveWindows.Put(windowID, listeners); } + // Developer preference for turning off permission check. + if (Preferences::GetBool("media.navigator.permission.disabled", false)) { + aPrivileged = true; + } + /** * Pass runnables along to GetUserMediaRunnable so it can add the * MediaStreamListener to the runnable list. The last argument can @@ -706,7 +713,7 @@ MediaManager::GetUserMedia(bool aPrivileged, nsPIDOMWindow* aWindow, if (picture) { // ShowFilePickerForMimeType() must run on the Main Thread! (on Android) NS_DispatchToMainThread(gUMRunnable); - } else if (aPrivileged) { + } else if (aPrivileged || fake) { if (!mMediaThread) { nsresult rv = NS_NewThread(getter_AddRefs(mMediaThread)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index f8a18213e52b..387259287c3e 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -174,6 +174,7 @@ pref("media.h264.enabled", true); #ifdef MOZ_WEBRTC pref("media.navigator.enabled", false); pref("media.peerconnection.enabled", false); +pref("media.navigator.permission.disabled", false); #else #ifdef ANDROID pref("media.navigator.enabled", true);