Bug 1318506 - Assign DocGroup for ScriptLoader runnable (r=ehsan)
authorBill McCloskey <billm@mozilla.com>
Sun, 13 Nov 2016 10:23:05 -0800
changeset 325084 279c4b0395ea5d4cc9b5c6fd098236724c741e80
parent 325083 0576b5d998094d9ee06cbf7719c846a4ff599a20
child 325085 ca40b6ff416d2aa61a7a89dad46432daab3f1856
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersehsan
bugs1318506
milestone53.0a1
Bug 1318506 - Assign DocGroup for ScriptLoader runnable (r=ehsan) MozReview-Commit-ID: G8nQdpq11bR
dom/base/nsScriptLoader.cpp
--- a/dom/base/nsScriptLoader.cpp
+++ b/dom/base/nsScriptLoader.cpp
@@ -2217,18 +2217,23 @@ void
 nsScriptLoader::ProcessPendingRequestsAsync()
 {
   if (mParserBlockingRequest ||
       !mXSLTRequests.isEmpty() ||
       !mLoadedAsyncRequests.isEmpty() ||
       !mNonAsyncExternalScriptInsertedRequests.isEmpty() ||
       !mDeferRequests.isEmpty() ||
       !mPendingChildLoaders.IsEmpty()) {
-    NS_DispatchToCurrentThread(NewRunnableMethod(this,
-                                                 &nsScriptLoader::ProcessPendingRequests));
+    nsCOMPtr<nsIRunnable> task = NewRunnableMethod(this,
+                                                   &nsScriptLoader::ProcessPendingRequests);
+    if (mDocument) {
+      mDocument->Dispatch("ScriptLoader", TaskCategory::Other, task.forget());
+    } else {
+      NS_DispatchToCurrentThread(task.forget());
+    }
   }
 }
 
 void
 nsScriptLoader::ProcessPendingRequests()
 {
   RefPtr<nsScriptLoadRequest> request;