Bug 586531 - Make jsapi-tests not use the default compartment by default. r=jorendorff.

This commit is contained in:
Andreas Gal 2010-08-16 16:42:50 -05:00
Родитель 6cf4874f8b
Коммит 6268564285
1 изменённых файлов: 11 добавлений и 3 удалений

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

@ -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;