Bug 1334112 -part3 : Trigger UpdateReadyState after unbind TrackElement's and TextTrack::SetReadyState. r=rillian
authorbechen <bechen@mozilla.com>
Tue, 21 Feb 2017 15:44:10 +0800
changeset 373044 c3c1ac0041b76dcd7cd017777c592c5c6a65bd0d
parent 373043 f2efeff392e39971a35d4b4f9f548dc53e7bf26b
child 373045 677df628b9981803035ca0453aaadd21eac8aa62
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs1334112
milestone54.0a1
Bug 1334112 -part3 : Trigger UpdateReadyState after unbind TrackElement's and TextTrack::SetReadyState. r=rillian MozReview-Commit-ID: pEeOzZSpak
dom/html/HTMLTrackElement.cpp
dom/media/TextTrack.cpp
--- a/dom/html/HTMLTrackElement.cpp
+++ b/dom/html/HTMLTrackElement.cpp
@@ -387,16 +387,17 @@ HTMLTrackElement::BindToTree(nsIDocument
 void
 HTMLTrackElement::UnbindFromTree(bool aDeep, bool aNullParent)
 {
   if (mMediaParent && aNullParent) {
     // mTrack can be null if HTMLTrackElement::LoadResource has never been
     // called.
     if (mTrack) {
       mMediaParent->RemoveTextTrack(mTrack);
+      mMediaParent->UpdateReadyState();
     }
     mMediaParent = nullptr;
   }
 
   nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
 }
 
 uint16_t
--- a/dom/media/TextTrack.cpp
+++ b/dom/media/TextTrack.cpp
@@ -258,16 +258,17 @@ TextTrack::SetReadyState(TextTrackReadyS
   if (!mTextTrackList) {
     return;
   }
 
   HTMLMediaElement* mediaElement = mTextTrackList->GetMediaElement();
   if (mediaElement && (mReadyState == TextTrackReadyState::Loaded||
       mReadyState == TextTrackReadyState::FailedToLoad)) {
     mediaElement->RemoveTextTrack(this, true);
+    mediaElement->UpdateReadyState();
   }
 }
 
 TextTrackList*
 TextTrack::GetTextTrackList()
 {
   return mTextTrackList;
 }