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

--HG--
extra : rebase_source : 2c15adaaadd955662797dcf1c5158927f16bab97
This commit is contained in:
ctai 2016-12-13 15:34:14 +08:00
parent 2b7a18a819
commit 3ce829affc

View File

@ -4451,8 +4451,7 @@ void HTMLMediaElement::UnbindFromTree(bool aDeep,
RefPtr<HTMLMediaElement> self(this);
nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction([self] () {
if (self->mUnboundFromTree &&
self->mNetworkState != nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
if (self->mUnboundFromTree) {
self->Pause();
}
});