bug 1088758 - Add the ability to mirror tabs from desktop to a second screen, restrict privledged GuM based on calling compartment rather than passed window's document r=rjesup
authorBrad Lassey <blassey@mozilla.com>
Wed, 10 Dec 2014 09:06:02 -0800
changeset 219913 d0be7c6566ae0d21a411cfb413b75cde7b81b611
parent 219912 1565f4af276878080204cfa3074977148b960856
child 219914 a7770ec46f0401c0a855e68f656ad8362be77ffc
push id52946
push usercbook@mozilla.com
push dateTue, 16 Dec 2014 12:43:15 +0000
treeherdermozilla-inbound@df8db207bf66 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrjesup
bugs1088758
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1088758 - Add the ability to mirror tabs from desktop to a second screen, restrict privledged GuM based on calling compartment rather than passed window's document r=rjesup
dom/media/MediaManager.cpp
dom/media/webspeech/recognition/SpeechRecognition.cpp
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -1575,17 +1575,17 @@ MediaManager::GetUserMedia(
   nsIDOMGetUserMediaErrorCallback* aOnFailure)
 {
   NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
 
   NS_ENSURE_TRUE(aWindow, NS_ERROR_NULL_POINTER);
   NS_ENSURE_TRUE(aOnFailure, NS_ERROR_NULL_POINTER);
   NS_ENSURE_TRUE(aOnSuccess, NS_ERROR_NULL_POINTER);
 
-  bool privileged = nsContentUtils::IsChromeDoc(aWindow->GetExtantDoc());
+  bool privileged = nsContentUtils::IsCallerChrome();
 
   nsCOMPtr<nsIDOMGetUserMediaSuccessCallback> onSuccess(aOnSuccess);
   nsCOMPtr<nsIDOMGetUserMediaErrorCallback> onFailure(aOnFailure);
 
   MediaStreamConstraints c(aConstraints); // copy
 
   static bool created = false;
   if (!created) {
--- a/dom/media/webspeech/recognition/SpeechRecognition.cpp
+++ b/dom/media/webspeech/recognition/SpeechRecognition.cpp
@@ -708,16 +708,17 @@ SpeechRecognition::Start(const Optional<
   NS_ENSURE_SUCCESS_VOID(rv);
 
   MediaStreamConstraints constraints;
   constraints.mAudio.SetAsBoolean() = true;
 
   if (aStream.WasPassed()) {
     StartRecording(&aStream.Value());
   } else {
+    AutoNoJSAPI();
     MediaManager* manager = MediaManager::Get();
     manager->GetUserMedia(GetOwner(),
                           constraints,
                           new GetUserMediaSuccessCallback(this),
                           new GetUserMediaErrorCallback(this));
   }
 
   nsRefPtr<SpeechEvent> event = new SpeechEvent(this, EVENT_START);