Bug 1354810, CycleCollectedJSContext::Get() needs to be null-checked, r=baku. a=gchang
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Fri, 14 Apr 2017 12:24:07 +0300
changeset 375965 bd935f8a9fee
parent 375964 665b9de58dee
child 375966 076f4a79219b
push id11069
push userihsiao@mozilla.com
push dateTue, 18 Apr 2017 10:00:59 +0000
treeherdermozilla-aurora@7595a01c76d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, gchang
bugs1354810
milestone54.0a2
Bug 1354810, CycleCollectedJSContext::Get() needs to be null-checked, r=baku. a=gchang
dom/promise/Promise.cpp
--- a/dom/promise/Promise.cpp
+++ b/dom/promise/Promise.cpp
@@ -565,16 +565,19 @@ Promise::PerformMicroTaskCheckpoint()
 }
 
 void
 Promise::PerformWorkerMicroTaskCheckpoint()
 {
   MOZ_ASSERT(!NS_IsMainThread(), "Wrong thread!");
 
   CycleCollectedJSContext* context = CycleCollectedJSContext::Get();
+  if (!context) {
+    return;
+  }
 
   for (;;) {
     // For a normal microtask checkpoint, we try to use the debugger microtask
     // queue first. If the debugger queue is empty, we use the normal microtask
     // queue instead.
     std::queue<nsCOMPtr<nsIRunnable>>* microtaskQueue =
       &context->GetDebuggerPromiseMicroTaskQueue();
 
@@ -599,16 +602,19 @@ Promise::PerformWorkerMicroTaskCheckpoin
 }
 
 void
 Promise::PerformWorkerDebuggerMicroTaskCheckpoint()
 {
   MOZ_ASSERT(!NS_IsMainThread(), "Wrong thread!");
 
   CycleCollectedJSContext* context = CycleCollectedJSContext::Get();
+  if (!context) {
+    return;
+  }
 
   for (;;) {
     // For a debugger microtask checkpoint, we always use the debugger microtask
     // queue.
     std::queue<nsCOMPtr<nsIRunnable>>* microtaskQueue =
       &context->GetDebuggerPromiseMicroTaskQueue();
 
     if (microtaskQueue->empty()) {