Bug 1329122 - should unregister agent when media element becomes inactive. r=baku a=gchang
authorAlastor Wu <alwu@mozilla.com>
Wed, 22 Mar 2017 00:04:24 +0800
changeset 379286 7de080726b477ffe3d2a3b39c5c1b2c2d44ec97c
parent 379285 46fcb35c50db23ae533f2202c4aaef9ba0d2992b
child 379287 1055ee5b740b0077dea9c7c9c88c4a19837dd9dd
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, gchang
bugs1329122
milestone53.0
Bug 1329122 - should unregister agent when media element becomes inactive. r=baku a=gchang 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
@@ -1026,31 +1026,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;