Bug 1001383 - HTMLMediaElement::UpdateAudioChannelPlayingState() should use system principal because calling AudioChannel API, r=bz
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 28 Apr 2014 11:22:16 +0100
changeset 180925 8114506aaccbc800ae483b5dd37314356ce16608
parent 180924 e4ff4df25884c6eda82af0d9d081886e9b0455ea
child 180926 408998b14b5d8e47f699f68c547e190bda96b65e
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersbz
bugs1001383
milestone31.0a1
Bug 1001383 - HTMLMediaElement::UpdateAudioChannelPlayingState() should use system principal because calling AudioChannel API, r=bz
content/html/content/src/HTMLMediaElement.cpp
--- a/content/html/content/src/HTMLMediaElement.cpp
+++ b/content/html/content/src/HTMLMediaElement.cpp
@@ -3843,16 +3843,21 @@ void HTMLMediaElement::UpdateAudioChanne
       } else {
         mAudioChannelAgent->InitWithWeakCallback(OwnerDoc()->GetWindow(),
                                                  static_cast<int32_t>(mAudioChannel),
                                                  this);
       }
       mAudioChannelAgent->SetVisibilityState(!OwnerDoc()->Hidden());
     }
 
+    // This is needed to pass nsContentUtils::IsCallerChrome().
+    // AudioChannel API should not called from content but it can happen that
+    // this method has some content JS in its stack.
+    AutoNoJSAPI nojsapi;
+
     if (mPlayingThroughTheAudioChannel) {
       int32_t canPlay;
       mAudioChannelAgent->StartPlaying(&canPlay);
       CanPlayChanged(canPlay);
     } else {
       mAudioChannelAgent->StopPlaying();
       mAudioChannelAgent = nullptr;
     }