зеркало из https://github.com/mozilla/gecko-dev.git
Bug 808608 - Remove Xray shadowing protection infrastructure. r=mrbkap
This is now unused.
This commit is contained in:
Родитель
abee0881bb
Коммит
f0c88f066f
|
@ -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);
|
||||
|
|
|
@ -1461,19 +1461,6 @@ 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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче