Bug 868611 - Implement HTMLTrackElement::UnbindFromTree. r=rillian

Update HTMLTrackElement::UnbindFromTree to remove its TextTrack from
its HTMLMediaElement's list of TextTracks.
This commit is contained in:
Rick Eyre 2013-06-24 11:35:58 -04:00
parent f8467f7947
commit 7735a60358
2 changed files with 15 additions and 2 deletions

View File

@ -530,6 +530,12 @@ public:
mTextTracks->AddTextTrack(aTextTrack);
}
void RemoveTextTrack(TextTrack* aTextTrack) {
if (mTextTracks) {
mTextTracks->RemoveTextTrack(*aTextTrack);
}
}
protected:
class MediaLoadListener;
class StreamListener;

View File

@ -290,8 +290,15 @@ HTMLTrackElement::BindToTree(nsIDocument* aDocument,
void
HTMLTrackElement::UnbindFromTree(bool aDeep, bool aNullParent)
{
if (mMediaParent && aNullParent) {
mMediaParent = nullptr;
if (mMediaParent) {
// mTrack can be null if HTMLTrackElement::LoadResource has never been
// called.
if (mTrack) {
mMediaParent->RemoveTextTrack(mTrack);
}
if (aNullParent) {
mMediaParent = nullptr;
}
}
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);