Bug 1318506 - Label DispatchContentLoaded events with a DocGroup (r=ehsan)
authorBill McCloskey <billm@mozilla.com>
Thu, 10 Nov 2016 11:39:22 -0800
changeset 325082 526959c0620c36fd5fe9d0cfe8af0c9a184f9887
parent 325081 044347624e6050c8a505f4de1cae38177708e7ad
child 325083 0576b5d998094d9ee06cbf7719c846a4ff599a20
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersehsan
bugs1318506
milestone53.0a1
Bug 1318506 - Label DispatchContentLoaded events with a DocGroup (r=ehsan) MozReview-Commit-ID: 8vx2Vzvvxhu
dom/base/nsDocument.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -5066,19 +5066,20 @@ nsDocument::UnblockDOMContentLoaded()
   MOZ_ASSERT(mBlockDOMContentLoaded);
   if (--mBlockDOMContentLoaded != 0 || mDidFireDOMContentLoaded) {
     return;
   }
   mDidFireDOMContentLoaded = true;
 
   MOZ_ASSERT(mReadyState == READYSTATE_INTERACTIVE);
   if (!mSynchronousDOMContentLoaded) {
+    MOZ_RELEASE_ASSERT(NS_IsMainThread());
     nsCOMPtr<nsIRunnable> ev =
       NewRunnableMethod(this, &nsDocument::DispatchContentLoadedEvents);
-    NS_DispatchToCurrentThread(ev);
+    Dispatch("DispatchContentLoadedEvents", TaskCategory::Other, ev.forget());
   } else {
     DispatchContentLoadedEvents();
   }
 }
 
 void
 nsDocument::ContentStateChanged(nsIContent* aContent, EventStates aStateMask)
 {