Bug 808608 - Remove Xray shadowing protection infrastructure. r=mrbkap
authorBobby Holley <bobbyholley@gmail.com>
Wed, 21 Nov 2012 13:20:05 -0800
changeset 113931 783573d542dfe17473170e0981faf7c021bf222e
parent 113930 10bfd3601af186ff1b727f7e0a476b585e0abe8c
child 113932 81bea5f51d637fc52ddaa279b36c4f6bafcf3df9
push id18459
push userbobbyholley@gmail.com
push dateWed, 21 Nov 2012 21:21:06 +0000
treeherdermozilla-inbound@030c89e22e3e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs808608
milestone20.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 808608 - Remove Xray shadowing protection infrastructure. r=mrbkap This is now unused.
js/xpconnect/wrappers/WrapperFactory.h
js/xpconnect/wrappers/XrayWrapper.cpp
--- a/js/xpconnect/wrappers/WrapperFactory.h
+++ b/js/xpconnect/wrappers/WrapperFactory.h
@@ -13,43 +13,33 @@
 
 namespace xpc {
 
 class WrapperFactory {
   public:
     enum { WAIVE_XRAY_WRAPPER_FLAG = js::Wrapper::LAST_USED_FLAG << 1,
            IS_XRAY_WRAPPER_FLAG    = WAIVE_XRAY_WRAPPER_FLAG << 1,
            SCRIPT_ACCESS_ONLY_FLAG = IS_XRAY_WRAPPER_FLAG << 1,
-           SOW_FLAG                = SCRIPT_ACCESS_ONLY_FLAG << 1,
-
-           // Prevent scripts from shadowing native properties.
-           // NB: Applies only to Xray wrappers.
-           // NB: This will prevent scriptable helpers from defining special
-           //     handlers for properties defined in IDL. Use with caution.
-           SHADOWING_FORBIDDEN     = SOW_FLAG << 1 };
+           SOW_FLAG                = SCRIPT_ACCESS_ONLY_FLAG << 1 };
 
     // Return true if any of any of the nested wrappers have the flag set.
     static bool HasWrapperFlag(JSObject *wrapper, unsigned flag) {
         unsigned flags = 0;
         js::UnwrapObject(wrapper, true, &flags);
         return !!(flags & flag);
     }
 
     static bool IsXrayWrapper(JSObject *wrapper) {
         return HasWrapperFlag(wrapper, IS_XRAY_WRAPPER_FLAG);
     }
 
     static bool HasWaiveXrayFlag(JSObject *wrapper) {
         return HasWrapperFlag(wrapper, WAIVE_XRAY_WRAPPER_FLAG);
     }
 
-    static bool IsShadowingForbidden(JSObject *wrapper) {
-        return HasWrapperFlag(wrapper, SHADOWING_FORBIDDEN);
-    }
-
     static JSObject *GetXrayWaiver(JSObject *obj);
     static JSObject *CreateXrayWaiver(JSContext *cx, JSObject *obj);
     static JSObject *WaiveXray(JSContext *cx, JSObject *obj);
 
     static JSObject *DoubleWrap(JSContext *cx, JSObject *obj, unsigned flags);
 
     // Prepare a given object for wrapping in a new compartment.
     static JSObject *PrepareForWrapping(JSContext *cx,
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -1456,29 +1456,16 @@ XrayWrapper<Base, Traits>::getOwnPropert
     return true;
 }
 
 template <typename Base, typename Traits>
 bool
 XrayWrapper<Base, Traits>::defineProperty(JSContext *cx, JSObject *wrapper, jsid id,
                                           js::PropertyDescriptor *desc)
 {
-    // If shadowing is forbidden, see if the id corresponds to an underlying
-    // native property.
-    if (WrapperFactory::IsShadowingForbidden(wrapper)) {
-        JSObject *holder = Traits::singleton.ensureHolder(cx, wrapper);
-        js::PropertyDescriptor nativeProp;
-        if (!Traits::resolveNativeProperty(cx, wrapper, holder, id, false, &nativeProp))
-            return false;
-        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::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,