Bug 1464134 part 3 - Remove GetRealmForCompartment calls from jsapi-tests. r=anba
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 30 May 2018 16:53:49 +0200
changeset 420511 bdadfc22d3fe4e60abf1847c8f01f4eb6e7238a6
parent 420510 8de4be88b8caaeafa6ffcda87123b777c6943107
child 420512 8af7dd4fb5e201208f018e484c93b101e2fa3212
push id34073
push useraiakab@mozilla.com
push dateWed, 30 May 2018 22:05:51 +0000
treeherdermozilla-central@3931f461c8e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersanba
bugs1464134
milestone62.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 1464134 part 3 - Remove GetRealmForCompartment calls from jsapi-tests. r=anba
js/src/jsapi-tests/testSavedStacks.cpp
js/src/jsapi-tests/tests.cpp
js/src/jsapi-tests/tests.h
--- a/js/src/jsapi-tests/testSavedStacks.cpp
+++ b/js/src/jsapi-tests/testSavedStacks.cpp
@@ -10,18 +10,17 @@
 #include "builtin/TestingFunctions.h"
 #include "jsapi-tests/tests.h"
 #include "vm/ArrayObject.h"
 #include "vm/JSCompartment.h"
 #include "vm/SavedStacks.h"
 
 BEGIN_TEST(testSavedStacks_withNoStack)
 {
-    JSCompartment* compartment = js::GetContextCompartment(cx);
-    JS::Realm* realm = JS::GetRealmForCompartment(compartment);
+    JS::Realm* realm = cx->realm();
     realm->setAllocationMetadataBuilder(&js::SavedStacks::metadataBuilder);
     JS::RootedObject obj(cx, js::NewDenseEmptyArray(cx));
     realm->setAllocationMetadataBuilder(nullptr);
     return true;
 }
 END_TEST(testSavedStacks_withNoStack)
 
 BEGIN_TEST(testSavedStacks_ApiDefaultValues)
--- a/js/src/jsapi-tests/tests.cpp
+++ b/js/src/jsapi-tests/tests.cpp
@@ -27,20 +27,16 @@ bool JSAPITest::init()
     if (!global)
         return false;
     JS::EnterRealm(cx, global);
     return true;
 }
 
 void JSAPITest::uninit()
 {
-    if (oldCompartment) {
-        JS::LeaveRealm(cx, JS::GetRealmForCompartment(oldCompartment));
-        oldCompartment = nullptr;
-    }
     if (global) {
         JS::LeaveRealm(cx, nullptr);
         global = nullptr;
     }
     if (cx) {
         JS_EndRequest(cx);
         destroyContext();
         cx = nullptr;
--- a/js/src/jsapi-tests/tests.h
+++ b/js/src/jsapi-tests/tests.h
@@ -68,19 +68,18 @@ class JSAPITest
   public:
     static JSAPITest* list;
     JSAPITest* next;
 
     JSContext* cx;
     JS::PersistentRootedObject global;
     bool knownFail;
     JSAPITestString msgs;
-    JSCompartment* oldCompartment;
 
-    JSAPITest() : cx(nullptr), knownFail(false), oldCompartment(nullptr) {
+    JSAPITest() : cx(nullptr), knownFail(false) {
         next = list;
         list = this;
     }
 
     virtual ~JSAPITest() {
         MOZ_RELEASE_ASSERT(!cx);
         MOZ_RELEASE_ASSERT(!global);
     }