Bug 1329122 - should unregister agent when media element becomes inactive. draft
authorAlastor Wu <alwu@mozilla.com>
Wed, 22 Mar 2017 00:04:24 +0800
changeset 502284 313383e0656eb32c299eafa6fbfaf2960c28f6ed
parent 494872 58753259bfeb3b818eac7870871b0aae1f8de64a
child 550123 a2a8c26f0857657fa3952b9281a38992f4412220
push id50242
push useralwu@mozilla.com
push dateTue, 21 Mar 2017 16:04:50 +0000
bugs1329122
milestone55.0a1
Bug 1329122 - should unregister agent when media element becomes inactive. We should remove the media control interface immediately when the document is inacitve, even it was paused by media control before. MozReview-Commit-ID: GBDhzEFOTXE
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1023,31 +1023,31 @@ private:
   bool
   IsPlayingThroughTheAudioChannel() const
   {
     // If we have an error, we are not playing.
     if (mOwner->GetError()) {
       return false;
     }
 
+    // We should consider any bfcached page or inactive document as non-playing.
+    if (!mOwner->IsActive()) {
+      return false;
+    }
+
     // It might be resumed from remote, we should keep the audio channel agent.
     if (IsSuspended()) {
       return true;
     }
 
     // Are we paused
     if (mOwner->mPaused) {
       return false;
     }
 
-    // We should consider any bfcached page or inactive document as non-playing.
-    if (!mOwner->IsActive()) {
-      return false;
-    }
-
     // A loop always is playing
     if (mOwner->HasAttr(kNameSpaceID_None, nsGkAtoms::loop)) {
       return true;
     }
 
     // If we are actually playing...
     if (mOwner->IsCurrentlyPlaying()) {
       return true;