Bug 1329122 - should unregister agent when media element becomes inactive. r=baku
authorAlastor Wu <alwu@mozilla.com>
Wed, 22 Mar 2017 00:04:24 +0800
changeset 348758 9857a6a7000061909a0ef75242c4f198d87b1de4
parent 348757 9e59049712448824a3717ce2d9dcbe1cf07da941
child 348759 b8d4e0ec2f08bef459b679aac105bcf3544d642f
push id31535
push usercbook@mozilla.com
push dateWed, 22 Mar 2017 13:25:07 +0000
treeherdermozilla-central@ee30286771eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1329122
milestone55.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 1329122 - should unregister agent when media element becomes inactive. r=baku 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
@@ -1025,31 +1025,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;