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 451845 39053ae7e6b32599085f7d011f6fbe4fbb03995d
parent 451844 86ce1b2ebe8f9af44aa5bc75498e22db80bd456c
child 451846 546a319e8ef090a647f7dbe7d8d748cd11378f14
push id39311
push userbmo:ctai@mozilla.com
push dateWed, 21 Dec 2016 03:01:37 +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
@@ -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