Bug 887334 - Fix JSAPI test harness to not fail when the initial compartment is null. r=luke
authorBobby Holley <bobbyholley@gmail.com>
Wed, 17 Jul 2013 11:53:53 -0700
changeset 138961 9ddf00b075162269022d43ad8ccc77a0c371b79e
parent 138960 09a8607459c447424033028eca4c1859af0d4203
child 138962 85bfca8bc62391d55b65e44f89c9ada313a00d06
push id24977
push userryanvm@gmail.com
push dateFri, 19 Jul 2013 00:35:38 +0000
treeherdermozilla-central@0d0263a58f06 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs887334
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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.
js/src/jsapi-tests/tests.cpp
js/src/jsapi-tests/tests.h
--- a/js/src/jsapi-tests/tests.cpp
+++ b/js/src/jsapi-tests/tests.cpp
@@ -18,18 +18,18 @@ bool JSAPITest::init()
         return false;
     cx = createContext();
     if (!cx)
         return false;
     JS_BeginRequest(cx);
     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)
 {
     JS::RootedValue v(cx);
     JS::HandleObject global = JS::HandleObject::fromMarkedLocation(&this->global);
     return JS_EvaluateScript(cx, global, bytes, strlen(bytes), filename, lineno, v.address()) ||
         fail(bytes, filename, lineno);
--- a/js/src/jsapi-tests/tests.h
+++ b/js/src/jsapi-tests/tests.h
@@ -76,16 +76,17 @@ class JSAPITest
 
     virtual void uninit() {
         if (oldCompartment) {
             JS_LeaveCompartment(cx, oldCompartment);
             oldCompartment = NULL;
         }
         if (cx) {
             JS_RemoveObjectRoot(cx, &global);
+            JS_LeaveCompartment(cx, NULL);
             JS_EndRequest(cx);
             JS_DestroyContext(cx);
             cx = NULL;
         }
         if (rt) {
             destroyRuntime();
             rt = NULL;
         }