Bug 1239899. Part 2 - per spec. await a stable state to pause the element when it is removed from the document. r=cpearce

MozReview-Commit-ID: BCCWgXmUchU

--HG--
extra : rebase_source : 4abe51e9ebce048db99fc6bff2b2d283bbb3acf1
extra : source : 18b3ff4dbb9654a159522c4cc64d2b41921c7f11
This commit is contained in:
JW Wang 2016-09-23 16:16:43 +08:00
Родитель 0a2c5a3d36
Коммит 4988b09533
1 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -3653,16 +3653,21 @@ void HTMLMediaElement::UnbindFromTree(bool aDeep,
{
mUnboundFromTree = true;
if (!mPaused && mNetworkState != nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
Pause();
}
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
if (mDecoder) {
MOZ_ASSERT(IsHidden());
mDecoder->NotifyOwnerActivityChanged(false);
}
RefPtr<HTMLMediaElement> self(this);
nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction([self] () {
if (self->mUnboundFromTree &&
self->mNetworkState != nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
self->Pause();
}
});
RunInStableState(task);
}
/* static */