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
--- 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;