From f0c88f066f1ab03be5806745279cce181d01d246 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 21 Nov 2012 13:20:05 -0800 Subject: [PATCH] Bug 808608 - Remove Xray shadowing protection infrastructure. r=mrbkap This is now unused. --- js/xpconnect/wrappers/WrapperFactory.h | 12 +----------- js/xpconnect/wrappers/XrayWrapper.cpp | 13 ------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/js/xpconnect/wrappers/WrapperFactory.h b/js/xpconnect/wrappers/WrapperFactory.h index 86e809068fee..b9f6a6f3e35b 100644 --- a/js/xpconnect/wrappers/WrapperFactory.h +++ b/js/xpconnect/wrappers/WrapperFactory.h @@ -18,13 +18,7 @@ class WrapperFactory { 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) { @@ -41,10 +35,6 @@ class WrapperFactory { 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); diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index 749646a35d06..46fc7bb5e84a 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -1461,19 +1461,6 @@ bool XrayWrapper::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);