Bug 1242594 - Don't remove the textTrack if it's parent is not null. r=rillian draft
authorbechen <bechen@mozilla.com>
Tue, 26 Apr 2016 16:38:24 +0800
changeset 356325 ddb4ff222870a0cf774b14128e0b4baf2db6dbe1
parent 350156 fb921246e2d60f521f83defed54e30a38df1be3e
child 356326 160582c5b876e95b8a565c4a20cda24b44f01984
child 356327 775f269711fdf2157ae96c00d92d14d6b532b483
push id16498
push userbechen@mozilla.com
push dateTue, 26 Apr 2016 08:52:22 +0000
reviewersrillian
bugs1242594
milestone48.0a1
Bug 1242594 - Don't remove the textTrack if it's parent is not null. r=rillian MozReview-Commit-ID: 3nIE1XFFT99
dom/html/HTMLTrackElement.cpp
--- a/dom/html/HTMLTrackElement.cpp
+++ b/dom/html/HTMLTrackElement.cpp
@@ -265,25 +265,23 @@ HTMLTrackElement::BindToTree(nsIDocument
   }
 
   return NS_OK;
 }
 
 void
 HTMLTrackElement::UnbindFromTree(bool aDeep, bool aNullParent)
 {
-  if (mMediaParent) {
+  if (mMediaParent && aNullParent) {
     // mTrack can be null if HTMLTrackElement::LoadResource has never been
     // called.
     if (mTrack) {
       mMediaParent->RemoveTextTrack(mTrack);
     }
-    if (aNullParent) {
-      mMediaParent = nullptr;
-    }
+    mMediaParent = nullptr;
   }
 
   nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
 }
 
 uint16_t
 HTMLTrackElement::ReadyState() const
 {