From 36f005e12f25960ead717bf19b3067903baf4ffb Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 17 Jul 2013 11:53:51 -0700 Subject: [PATCH] Bug 887334 - Null-check compartment() in JS_GetGlobalForScopeChain(). r=luke cx->global() assumes a non-null compartment(). When we fix up various bugs related to being in a compartment when we shouldn't be, we start to crash here. Fix it. --- js/src/jsapi.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 57711331d61..9e5e70365a5 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -2087,6 +2087,8 @@ JS_GetGlobalForScopeChain(JSContext *cx) { AssertHeapIsIdleOrIterating(cx); CHECK_REQUEST(cx); + if (!cx->compartment()) + return NULL; return cx->global(); }