diff --git a/js/src/jsapi-tests/tests.h b/js/src/jsapi-tests/tests.h index 35fbfe1fe4d..9b09bb59188 100644 --- a/js/src/jsapi-tests/tests.h +++ b/js/src/jsapi-tests/tests.h @@ -113,8 +113,9 @@ public: JSObject *global; bool knownFail; JSAPITestString msgs; + JSCrossCompartmentCall *call; - JSAPITest() : rt(NULL), cx(NULL), global(NULL), knownFail(false) { + JSAPITest() : rt(NULL), cx(NULL), global(NULL), knownFail(false), call(NULL) { next = list; list = this; } @@ -130,10 +131,17 @@ public: return false; JS_BeginRequest(cx); global = createGlobal(); - return global != NULL; + if (!global) + return false; + call = JS_EnterCrossCompartmentCall(cx, global); + return call != NULL; } virtual void uninit() { + if (call) { + JS_LeaveCrossCompartmentCall(call); + call = NULL; + } if (cx) { JS_EndRequest(cx); JS_DestroyContext(cx); @@ -273,7 +281,7 @@ protected: virtual JSObject * createGlobal() { /* Create the global object. */ - JSObject *global = JS_NewGlobalObject(cx, getGlobalClass()); + JSObject *global = JS_NewCompartmentAndGlobalObject(cx, getGlobalClass(), NULL); if (!global) return NULL;