diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index d6445400180..182d25567d4 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -1083,12 +1083,7 @@ ThreadSafeContext::recoverFromOutOfMemory() // If this is not a JSContext, there's nothing to do. if (JSContext *maybecx = maybeJSContext()) { if (maybecx->isExceptionPending()) { -#ifdef DEBUG - RootedValue v(maybecx); - bool ok = maybecx->getPendingException(&v); - MOZ_ASSERT(ok); - MOZ_ASSERT(v == StringValue(maybecx->names().outOfMemory)); -#endif + MOZ_ASSERT(maybecx->isThrowingOutOfMemory()); maybecx->clearPendingException(); } else { MOZ_ASSERT(maybecx->runtime()->hadOutOfMemory); @@ -1150,6 +1145,12 @@ JSContext::getPendingException(MutableHandleValue rval) return true; } +bool +JSContext::isThrowingOutOfMemory() +{ + return throwing && unwrappedException_ == StringValue(names().outOfMemory); +} + void JSContext::enterGenerator(JSGenerator *gen) { diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index a9081718d1d..c1350310817 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -560,6 +560,8 @@ struct JSContext : public js::ExclusiveContext, MOZ_WARN_UNUSED_RESULT bool getPendingException(JS::MutableHandleValue rval); + bool isThrowingOutOfMemory(); + void setPendingException(js::Value v); void clearPendingException() {