Bug 1323369 - Make HTMLMediaElement::UnbindFromTree to follow WhatWG HTML spec. r?jwwang
W3C HTML5 spec isn't very actively maintained now. WhatWG HTML spec:
When a media element is removed from a Document, the user agent must run the following steps:
Below is the related statement in WhatWG HTML spec:
Await a stable state, allowing the task that removed the media element from the Document to continue. The synchronous section consists of all the remaining steps of this algorithm. (Steps in the synchronous section are marked with ⌛.)
⌛ If the media element is in a document, abort these steps.
⌛ Run the internal pause steps for the media element.
MozReview-Commit-ID: H4EgPqj2YxD
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -4446,18 +4446,17 @@ void HTMLMediaElement::UnbindFromTree(bo
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) {
+ if (self->mUnboundFromTree) {
self->Pause();
}
});
RunInStableState(task);
}
/* static */
CanPlayStatus