Bug 1334825 - part 2: notify inner window when media element playback state changes. r?alwu draft
authorJohn Lin <jolin@mozilla.com>
Fri, 10 Feb 2017 11:00:03 +0800
changeset 481644 2c747e94f9530fc508e598484d99067c006f055c
parent 481643 dfe7ef81f0bb140cfa755ab2039b56507fc8eab5
child 481645 a9e69e8269851726a9967d0cd89efd4de6eadade
push id44891
push userbmo:jolin@mozilla.com
push dateFri, 10 Feb 2017 08:51:17 +0000
reviewersalwu
bugs1334825
milestone54.0a1
Bug 1334825 - part 2: notify inner window when media element playback state changes. r?alwu MozReview-Commit-ID: KfxUdPJHGZo
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -646,16 +646,22 @@ public:
 
     if (playingThroughTheAudioChannel != mPlayingThroughTheAudioChannel) {
       if (!MaybeCreateAudioChannelAgent()) {
         return;
       }
 
       mPlayingThroughTheAudioChannel = playingThroughTheAudioChannel;
       NotifyAudioChannelAgent(mPlayingThroughTheAudioChannel);
+
+      nsPIDOMWindowInner* window = mOwner->OwnerDoc()->GetInnerWindow();
+      if (window) {
+        mPlayingThroughTheAudioChannel ? window->AddPlayingElement(mOwner)
+                                       : window->RemovePlayingElement(mOwner);
+      }
     }
   }
 
   bool
   ShouldResetSuspend() const
   {
     // The disposable-pause should be clear after media starts playing.
     if (!mOwner->Paused() &&