Bug 887334 - Fix JSAPI test harness to not fail when the initial compartment is null. r=luke

I don't know why it's done this way, but it sure needs to change.
This commit is contained in:
Bobby Holley 2013-07-17 11:53:53 -07:00
parent b6dac750a0
commit 6934cef71d
2 changed files with 3 additions and 2 deletions

View File

@ -23,8 +23,8 @@ bool JSAPITest::init()
JS::RootedObject global(cx, createGlobal());
if (!global)
return false;
oldCompartment = JS_EnterCompartment(cx, global);
return oldCompartment != NULL;
JS_EnterCompartment(cx, global);
return true;
}
bool JSAPITest::exec(const char *bytes, const char *filename, int lineno)

View File

@ -81,6 +81,7 @@ class JSAPITest
}
if (cx) {
JS_RemoveObjectRoot(cx, &global);
JS_LeaveCompartment(cx, NULL);
JS_EndRequest(cx);
JS_DestroyContext(cx);
cx = NULL;