Bug 1468252 part 2 - Rename GetOriginalEval to GetRealmOriginalEval, remove scope argument. r=evilpie
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 14 Jun 2018 09:07:30 -0700
changeset 422552 09901c91248bf67c695540ac0bebf2212802feeb
parent 422551 671e4d24c51171391552ed243a0e4d4de12953aa
child 422553 4face648a1521ac31836069665fa5cbb46df4ea9
push id34138
push userdluca@mozilla.com
push dateFri, 15 Jun 2018 02:39:59 +0000
treeherdermozilla-central@e51f8dbf0397 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie
bugs1468252
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 1468252 part 2 - Rename GetOriginalEval to GetRealmOriginalEval, remove scope argument. r=evilpie
js/src/jsfriendapi.cpp
js/src/jsfriendapi.h
js/xpconnect/wrappers/XrayWrapper.cpp
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -528,21 +528,19 @@ js::GetObjectProto(JSContext* cx, JS::Ha
 JS_FRIEND_API(JSObject*)
 js::GetStaticPrototype(JSObject* obj)
 {
     MOZ_ASSERT(obj->hasStaticPrototype());
     return obj->staticPrototype();
 }
 
 JS_FRIEND_API(bool)
-js::GetOriginalEval(JSContext* cx, HandleObject scope, MutableHandleObject eval)
+js::GetRealmOriginalEval(JSContext* cx, MutableHandleObject eval)
 {
-    assertSameCompartment(cx, scope);
-    Rooted<GlobalObject*> global(cx, &scope->global());
-    return GlobalObject::getOrCreateEval(cx, global, eval);
+    return GlobalObject::getOrCreateEval(cx, cx->global(), eval);
 }
 
 JS_FRIEND_API(void)
 js::SetReservedSlotWithBarrier(JSObject* obj, size_t slot, const js::Value& value)
 {
     if (IsProxy(obj))
         obj->as<ProxyObject>().setReservedSlot(slot, value);
     else
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -738,18 +738,17 @@ FunctionHasNativeReserved(JSObject* fun)
 
 JS_FRIEND_API(bool)
 GetObjectProto(JSContext* cx, JS::HandleObject obj, JS::MutableHandleObject proto);
 
 extern JS_FRIEND_API(JSObject*)
 GetStaticPrototype(JSObject* obj);
 
 JS_FRIEND_API(bool)
-GetOriginalEval(JSContext* cx, JS::HandleObject scope,
-                JS::MutableHandleObject eval);
+GetRealmOriginalEval(JSContext* cx, JS::MutableHandleObject eval);
 
 inline void*
 GetObjectPrivate(JSObject* obj)
 {
     MOZ_ASSERT(GetObjectClass(obj)->flags & JSCLASS_HAS_PRIVATE);
     const shadow::Object* nobj = reinterpret_cast<const shadow::Object*>(obj);
     void** addr = reinterpret_cast<void**>(&nobj->fixedSlots()[nobj->numFixedSlots()]);
     return *addr;
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -1433,17 +1433,17 @@ XrayTraits::resolveOwnProperty(JSContext
             RootedObject constructor(cx);
             if (!JS_GetClassObject(cx, key, &constructor))
                 return false;
             MOZ_ASSERT(constructor);
             desc.value().set(ObjectValue(*constructor));
             found = true;
         } else if (id == GetJSIDByIndex(cx, XPCJSContext::IDX_EVAL)) {
             RootedObject eval(cx);
-            if (!js::GetOriginalEval(cx, target, &eval))
+            if (!js::GetRealmOriginalEval(cx, &eval))
                 return false;
             desc.value().set(ObjectValue(*eval));
             found = true;
         }
     }
 
     if (found) {
         if (!JS_WrapPropertyDescriptor(cx, desc))