Bug 1343798 - Label runnables for HTMLTrackElement. r=jwwang
authorbechen <bechen@mozilla.com>
Wed, 08 Mar 2017 10:10:35 +0800
changeset 394846 ccc6503612ef581ee8a7ad67eefd0eb8b1dd3b5b
parent 394845 a7f51c857549fa3d89d421308ea9a89237452887
child 394847 f7689bfb22d7828b70a9159403f5818ce6750366
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang
bugs1343798
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1343798 - Label runnables for HTMLTrackElement. r=jwwang MozReview-Commit-ID: El7LXJFAHiM
dom/html/HTMLTrackElement.cpp
--- a/dom/html/HTMLTrackElement.cpp
+++ b/dom/html/HTMLTrackElement.cpp
@@ -428,22 +428,27 @@ HTMLTrackElement::SetReadyState(uint16_t
     }
     mTrack->SetReadyState(aReadyState);
   }
 }
 
 void
 HTMLTrackElement::DispatchTrackRunnable(const nsString& aEventName)
 {
+  nsIDocument* doc = OwnerDoc();
+  if (!doc) {
+    return;
+  }
   nsCOMPtr<nsIRunnable> runnable =
     NewRunnableMethod
       <const nsString>(this,
                        &HTMLTrackElement::DispatchTrustedEvent,
                        aEventName);
-  NS_DispatchToMainThread(runnable);
+  doc->Dispatch("HTMLTrackElement::DispatchTrackRunnable",
+                TaskCategory::Other, runnable.forget());
 }
 
 void
 HTMLTrackElement::DispatchTrustedEvent(const nsAString& aName)
 {
   nsIDocument* doc = OwnerDoc();
   if (!doc) {
     return;