Bug 1316616 part 1. Replace some redundant code in GetCurrentThreadWorkerPrivate() with a call to a function that we already have. r=bkelly

This commit is contained in:
Boris Zbarsky 2016-11-18 16:13:06 -05:00
Родитель 96500c4e69
Коммит 884fc2ea5c
1 изменённых файлов: 5 добавлений и 11 удалений

Просмотреть файл

@ -1454,17 +1454,11 @@ GetCurrentThreadWorkerPrivate()
JSContext* cx = ccjscx->Context(); JSContext* cx = ccjscx->Context();
MOZ_ASSERT(cx); MOZ_ASSERT(cx);
void* cxPrivate = JS_GetContextPrivate(cx); // Note that we can return nullptr if the nsCycleCollector_shutdown() in
if (!cxPrivate) { // ~WorkerJSContext() triggers any calls to GetCurrentThreadWorkerPrivate().
// This can happen if the nsCycleCollector_shutdown() in ~WorkerJSContext() // At this stage CycleCollectedJSContext::Get() will still return a context,
// triggers any calls to GetCurrentThreadWorkerPrivate(). At this stage // but the context private has already been cleared.
// CycleCollectedJSContext::Get() will still return a context, but return GetWorkerPrivateFromContext(cx);
// the context private has already been cleared.
return nullptr;
}
return
static_cast<WorkerThreadContextPrivate*>(cxPrivate)->GetWorkerPrivate();
} }
bool bool