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
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user