Bug 1410132 - Skip mutex ordering checks when JS engine is not initialized r=sfink

This commit is contained in:
Jon Coppeard 2017-11-07 17:37:25 +00:00
parent 0a74c282e1
commit 5f7c71c302

View File

@ -6,6 +6,7 @@
#include "threading/Mutex.h"
#include "js/Initialization.h"
#include "js/Utility.h"
using namespace js;
@ -44,6 +45,11 @@ js::Mutex::heldMutexStack()
void
js::Mutex::lock()
{
if (!JS_IsInitialized()) {
MutexImpl::lock();
return;
}
auto& stack = heldMutexStack();
if (!stack.empty()) {
const Mutex& prev = *stack.back();
@ -65,6 +71,11 @@ js::Mutex::lock()
void
js::Mutex::unlock()
{
if (!JS_IsInitialized()) {
MutexImpl::unlock();
return;
}
auto& stack = heldMutexStack();
MOZ_ASSERT(stack.back() == this);
MutexImpl::unlock();