Bug 798966: Create a preference to bypass gUM permission; r=jesup

This commit is contained in:
Anant Narayanan 2012-10-07 17:31:45 -07:00
parent 969a991bb2
commit b768c06860
2 changed files with 9 additions and 1 deletions

View File

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

View File

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