Bug 1323369 - Make HTMLMediaElement::UnbindFromTree to follow WhatWG HTML spec. r?jwwang draft
authorctai <ctai@mozilla.com>
Tue, 13 Dec 2016 15:34:14 +0800
changeset 449455 54853a8d33a67cdd56dd66116984704664416fe3
parent 449454 a3363ce89f1f2846c78626132a2432aa559a0dca
child 449456 6f7f1866ef45ff5c2c6671eeada0ad4128d7d3b5
push id38565
push userbmo:ctai@mozilla.com
push dateWed, 14 Dec 2016 06:31:56 +0000
reviewersjwwang
bugs1323369
milestone53.0a1
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
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -4434,18 +4434,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