Bug 1354810, CycleCollectedJSContext::Get() needs to be null-checked, r=baku. a=gchang
--- 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()) {