Bug 1318506 - Label MessagePort runnables by DocGroup (r=bkelly)
authorBill McCloskey <billm@mozilla.com>
Sun, 13 Nov 2016 10:22:40 -0800
changeset 325083 0576b5d998094d9ee06cbf7719c846a4ff599a20
parent 325082 526959c0620c36fd5fe9d0cfe8af0c9a184f9887
child 325084 279c4b0395ea5d4cc9b5c6fd098236724c741e80
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersbkelly
bugs1318506
milestone53.0a1
Bug 1318506 - Label MessagePort runnables by DocGroup (r=bkelly) MozReview-Commit-ID: 8uhgm7ivVSh
dom/messagechannel/MessagePort.cpp
--- a/dom/messagechannel/MessagePort.cpp
+++ b/dom/messagechannel/MessagePort.cpp
@@ -561,16 +561,22 @@ MessagePort::Dispatch()
       break;
   }
 
   RefPtr<SharedMessagePortMessage> data = mMessages.ElementAt(0);
   mMessages.RemoveElementAt(0);
 
   mPostMessageRunnable = new PostMessageRunnable(this, data);
 
+  nsCOMPtr<nsIGlobalObject> global = GetOwnerGlobal();
+  if (NS_IsMainThread() && global) {
+    MOZ_ALWAYS_SUCCEEDS(global->Dispatch("MessagePortMessage", TaskCategory::Other, do_AddRef(mPostMessageRunnable)));
+    return;
+  }
+
   MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(mPostMessageRunnable));
 }
 
 void
 MessagePort::Close()
 {
   CloseInternal(true /* aSoftly */);
 }