Bug 761695 - Rename getInnerObject to getTargetObject. r=peterv
authorBobby Holley <bobbyholley@gmail.com>
Fri, 05 Oct 2012 18:59:22 +0200
changeset 109392 317a3211dfad1e17310c3a427892a354fde2b394
parent 109391 9af31b39e3f794fb0481559cca258992cb90720f
child 109393 f5225ec3579517e083d62a5ea6161368ee1d6bae
push id16008
push userbobbyholley@gmail.com
push dateFri, 05 Oct 2012 16:59:43 +0000
treeherdermozilla-inbound@3b4562fd4f20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs761695
milestone18.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 761695 - Rename getInnerObject to getTargetObject. r=peterv The current name potentially implies that the object returned is an inner object in the JS sense, which isn't true. Really we just want the thing we're Xraying to.
js/xpconnect/wrappers/XrayWrapper.cpp
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -329,17 +329,17 @@ public:
     ResolvingIdDummy(JSObject *wrapper, jsid id)
     {
     }
 };
 
 class XrayTraits
 {
 public:
-    static JSObject* getInnerObject(JSObject *wrapper) {
+    static JSObject* getTargetObject(JSObject *wrapper) {
         return js::UnwrapObject(wrapper, /* stopAtOuter = */ false);
     }
 };
 
 class XPCWrappedNativeXrayTraits : public XrayTraits
 {
 public:
     static bool resolveNativeProperty(JSContext *cx, JSObject *wrapper, JSObject *holder, jsid id,
@@ -474,17 +474,17 @@ GetWrappedNative(JSObject *obj)
     return static_cast<XPCWrappedNative *>(js::GetObjectPrivate(obj));
 }
 
 static XPCWrappedNative *
 GetWrappedNativeFromHolder(JSObject *holder)
 {
     MOZ_ASSERT(js::GetObjectJSClass(holder) == &HolderClass);
     JSObject *wrapper = &js::GetReservedSlot(holder, JSSLOT_WRAPPER).toObject();
-    return GetWrappedNative(XrayTraits::getInnerObject(wrapper));
+    return GetWrappedNative(XrayTraits::getTargetObject(wrapper));
 }
 
 static JSObject *
 GetWrappedNativeObjectFromHolder(JSObject *holder)
 {
     return GetWrappedNativeFromHolder(holder)->GetFlatJSObject();
 }
 
@@ -1097,25 +1097,25 @@ XPCWrappedNativeXrayTraits::enumerateNam
     }
     return true;
 }
 
 bool
 ProxyXrayTraits::resolveNativeProperty(JSContext *cx, JSObject *wrapper, JSObject *holder,
                                        jsid id, bool set, JSPropertyDescriptor *desc)
 {
-    JSObject *obj = getInnerObject(wrapper);
+    JSObject *obj = getTargetObject(wrapper);
     return js::GetProxyHandler(obj)->getPropertyDescriptor(cx, wrapper, id, set, desc);
 }
 
 bool
 ProxyXrayTraits::resolveOwnProperty(JSContext *cx, js::Wrapper &jsWrapper, JSObject *wrapper,
                                     JSObject *holder, jsid id, bool set, PropertyDescriptor *desc)
 {
-    JSObject *obj = getInnerObject(wrapper);
+    JSObject *obj = getTargetObject(wrapper);
     bool ok = js::GetProxyHandler(obj)->getOwnPropertyDescriptor(cx, wrapper, id, set, desc);
     if (ok) {
         // The 'not found' property descriptor has obj == NULL.
         if (desc->obj)
             desc->obj = wrapper;
     }
 
     // Own properties don't get cached on the holder. Just return.
@@ -1132,32 +1132,32 @@ ProxyXrayTraits::defineProperty(JSContex
 
     return JS_DefinePropertyById(cx, holder, id, desc->value, desc->getter, desc->setter,
                                  desc->attrs);
 }
 
 bool
 ProxyXrayTraits::delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
 {
-    JSObject *obj = getInnerObject(wrapper);
+    JSObject *obj = getTargetObject(wrapper);
     if (!js::GetProxyHandler(obj)->delete_(cx, wrapper, id, bp))
         return false;
 
     JSObject *holder;
     if (*bp && (holder = getHolderObject(cx, wrapper, false)))
         JS_DeletePropertyById(cx, holder, id);
 
     return true;
 }
 
 bool
 ProxyXrayTraits::enumerateNames(JSContext *cx, JSObject *wrapper, unsigned flags,
                                 JS::AutoIdVector &props)
 {
-    JSObject *obj = getInnerObject(wrapper);
+    JSObject *obj = getTargetObject(wrapper);
     if (flags & (JSITER_OWNONLY | JSITER_HIDDEN))
         return js::GetProxyHandler(obj)->getOwnPropertyNames(cx, wrapper, props);
 
     return js::GetProxyHandler(obj)->enumerate(cx, wrapper, props);
 }
 
 // The 'holder' here isn't actually of [[Class]] HolderClass like those used by
 // XPCWrappedNativeXrayTraits. Instead, it's a funny hybrid of the 'expando' and
@@ -1172,17 +1172,17 @@ ProxyXrayTraits::createHolderObject(JSCo
     js::SetProxyExtra(wrapper, 0, ObjectValue(*obj));
     return obj;
 }
 
 bool
 DOMXrayTraits::resolveNativeProperty(JSContext *cx, JSObject *wrapper, JSObject *holder, jsid id,
                                      bool set, JSPropertyDescriptor *desc)
 {
-    JSObject *obj = getInnerObject(wrapper);
+    JSObject *obj = getTargetObject(wrapper);
     const NativePropertyHooks *nativeHooks = GetDOMClass(obj)->mNativeHooks;
 
     do {
         if (!nativeHooks->mResolveProperty(cx, wrapper, id, set, desc))
             return false;
 
         if (desc->obj) {
             NS_ASSERTION(desc->obj == wrapper, "What did we resolve this on?");
@@ -1192,17 +1192,17 @@ DOMXrayTraits::resolveNativeProperty(JSC
 
     return true;
 }
 
 bool
 DOMXrayTraits::resolveOwnProperty(JSContext *cx, js::Wrapper &jsWrapper, JSObject *wrapper,
                                   JSObject *holder, jsid id, bool set, JSPropertyDescriptor *desc)
 {
-    JSObject *obj = getInnerObject(wrapper);
+    JSObject *obj = getTargetObject(wrapper);
     const NativePropertyHooks *nativeHooks = GetDOMClass(obj)->mNativeHooks;
 
     if (nativeHooks->mResolveOwnProperty) {
         if (!nativeHooks->mResolveOwnProperty(cx, wrapper, id, set, desc))
             return false;
 
         NS_ASSERTION(!desc->obj || desc->obj == wrapper,
                      "What did we resolve this on?");
@@ -1231,17 +1231,17 @@ DOMXrayTraits::delete_(JSContext *cx, JS
 
     return true;
 }
 
 bool
 DOMXrayTraits::enumerateNames(JSContext *cx, JSObject *wrapper, unsigned flags,
                               JS::AutoIdVector &props)
 {
-    JSObject *obj = getInnerObject(wrapper);
+    JSObject *obj = getTargetObject(wrapper);
     const NativePropertyHooks *nativeHooks = GetDOMClass(obj)->mNativeHooks;
 
     if (nativeHooks->mEnumerateOwnProperties &&
         !nativeHooks->mEnumerateOwnProperties(cx, wrapper, props))
         return false;
 
     if (flags & (JSITER_OWNONLY | JSITER_HIDDEN))
         // Probably need to return expandos on the Xray here!
@@ -1367,17 +1367,17 @@ XrayWrapper<Base, Traits>::getPropertyDe
     desc->obj = NULL; // default value
     if (!this->enter(cx, wrapper, id, action, &status))
         return status;
 
     typename Traits::ResolvingIdImpl resolving(wrapper, id);
 
     // Redirect access straight to the wrapper if we should be transparent.
     if (XrayUtils::IsTransparent(cx, wrapper)) {
-        JSObject *obj = Traits::getInnerObject(wrapper);
+        JSObject *obj = Traits::getTargetObject(wrapper);
         {
             JSAutoCompartment ac(cx, obj);
             if (!JS_GetPropertyDescriptorById(cx, obj, id,
                                               (set ? JSRESOLVE_ASSIGNING : 0) | JSRESOLVE_QUALIFIED,
                                               desc)) {
                 return false;
             }
         }
@@ -1469,17 +1469,17 @@ XrayWrapper<Base, Traits>::getOwnPropert
         return status;
 
     typename Traits::ResolvingIdImpl resolving(wrapper, id);
 
     // NB: Nothing we do here acts on the wrapped native itself, so we don't
     // enter our policy.
     // Redirect access straight to the wrapper if we should be transparent.
     if (XrayUtils::IsTransparent(cx, wrapper)) {
-        JSObject *obj = Traits::getInnerObject(wrapper);
+        JSObject *obj = Traits::getTargetObject(wrapper);
         {
             JSAutoCompartment ac(cx, obj);
             if (!JS_GetPropertyDescriptorById(cx, obj, id,
                                               (set ? JSRESOLVE_ASSIGNING : 0) | JSRESOLVE_QUALIFIED,
                                               desc)) {
                 return false;
             }
         }
@@ -1520,17 +1520,17 @@ XrayWrapper<Base, Traits>::definePropert
         if (nativeProp.obj) {
             JS_ReportError(cx, "Permission denied to shadow native property");
             return false;
         }
     }
 
     // Redirect access straight to the wrapper if we should be transparent.
     if (XrayUtils::IsTransparent(cx, wrapper)) {
-        JSObject *obj = Traits::getInnerObject(wrapper);
+        JSObject *obj = Traits::getTargetObject(wrapper);
         JSAutoCompartment ac(cx, obj);
         if (!JS_WrapPropertyDescriptor(cx, desc))
             return false;
 
         return JS_DefinePropertyById(cx, obj, id, desc->value, desc->getter, desc->setter,
                                      desc->attrs);
     }
 
@@ -1553,17 +1553,17 @@ XrayWrapper<Base, Traits>::getOwnPropert
 }
 
 template <typename Base, typename Traits>
 bool
 XrayWrapper<Base, Traits>::delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
 {
     // Redirect access straight to the wrapper if we should be transparent.
     if (XrayUtils::IsTransparent(cx, wrapper)) {
-        JSObject *obj = Traits::getInnerObject(wrapper);
+        JSObject *obj = Traits::getTargetObject(wrapper);
 
         JSAutoCompartment ac(cx, obj);
 
         JSBool b;
         jsval v;
         if (!JS_DeletePropertyById2(cx, obj, id, &v) || !JS_ValueToBoolean(cx, v, &b))
             return false;
         *bp = !!b;
@@ -1575,17 +1575,17 @@ XrayWrapper<Base, Traits>::delete_(JSCon
 
 template <typename Base, typename Traits>
 bool
 XrayWrapper<Base, Traits>::enumerate(JSContext *cx, JSObject *wrapper, unsigned flags,
                                      JS::AutoIdVector &props)
 {
     // Redirect access straight to the wrapper if we should be transparent.
     if (XrayUtils::IsTransparent(cx, wrapper)) {
-        JSObject *obj = Traits::getInnerObject(wrapper);
+        JSObject *obj = Traits::getTargetObject(wrapper);
         JSAutoCompartment ac(cx, obj);
         return js::GetPropertyNames(cx, obj, flags, &props);
     }
 
     if (!AccessCheck::wrapperSubsumes(wrapper)) {
         JS_ReportError(cx, "Not allowed to enumerate cross origin objects");
         return false;
     }