Bug 1054756, part 4 - Remove BaseProxyHandler::defaultValue. r=jandem.

This commit is contained in:
Jason Orendorff 2015-03-20 14:03:24 -05:00
parent de8a5d035d
commit 0c06131205
14 changed files with 0 additions and 98 deletions

View File

@ -329,7 +329,6 @@ class JS_FRIEND_API(BaseProxyHandler)
virtual JSString* fun_toString(JSContext* cx, HandleObject proxy, unsigned indent) const;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const;
virtual bool boxedValue_unbox(JSContext* cx, HandleObject proxy, MutableHandleValue vp) const;
virtual bool defaultValue(JSContext* cx, HandleObject obj, JSType hint, MutableHandleValue vp) const;
virtual void trace(JSTracer* trc, JSObject* proxy) const;
virtual void finalize(JSFreeOp* fop, JSObject* proxy) const;
virtual void objectMoved(JSObject* proxy, const JSObject* old) const;

View File

@ -64,9 +64,6 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler
LAST_USED_FLAG = CROSS_COMPARTMENT
};
virtual bool defaultValue(JSContext* cx, HandleObject obj, JSType hint,
MutableHandleValue vp) const override;
static JSObject* New(JSContext* cx, JSObject* obj, const Wrapper* handler,
const WrapperOptions& options = WrapperOptions());
@ -155,8 +152,6 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper
unsigned indent) const override;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const override;
virtual bool boxedValue_unbox(JSContext* cx, HandleObject proxy, MutableHandleValue vp) const override;
virtual bool defaultValue(JSContext* cx, HandleObject wrapper, JSType hint,
MutableHandleValue vp) const override;
static const CrossCompartmentWrapper singleton;
static const CrossCompartmentWrapper singletonWithPrototype;
@ -211,7 +206,6 @@ class JS_FRIEND_API(OpaqueCrossCompartmentWrapper) : public CrossCompartmentWrap
JS::IsArrayAnswer* answer) const override;
virtual const char* className(JSContext* cx, HandleObject wrapper) const override;
virtual JSString* fun_toString(JSContext* cx, HandleObject proxy, unsigned indent) const override;
virtual bool defaultValue(JSContext* cx, HandleObject obj, JSType hint, MutableHandleValue vp) const override;
static const OpaqueCrossCompartmentWrapper singleton;
};
@ -253,8 +247,6 @@ class JS_FRIEND_API(SecurityWrapper) : public Base
virtual bool isArray(JSContext* cx, HandleObject wrapper, JS::IsArrayAnswer* answer) const override;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const override;
virtual bool boxedValue_unbox(JSContext* cx, HandleObject proxy, MutableHandleValue vp) const override;
virtual bool defaultValue(JSContext* cx, HandleObject wrapper, JSType hint,
MutableHandleValue vp) const override;
// Allow isCallable and isConstructor. They used to be class-level, and so could not be guarded
// against.

View File

@ -292,13 +292,6 @@ BaseProxyHandler::boxedValue_unbox(JSContext* cx, HandleObject proxy, MutableHan
return true;
}
bool
BaseProxyHandler::defaultValue(JSContext* cx, HandleObject proxy, JSType hint,
MutableHandleValue vp) const
{
return OrdinaryToPrimitive(cx, proxy, hint, vp);
}
bool
BaseProxyHandler::nativeCall(JSContext* cx, IsAcceptableThis test, NativeImpl impl,
const CallArgs& args) const

View File

@ -417,16 +417,6 @@ CrossCompartmentWrapper::boxedValue_unbox(JSContext* cx, HandleObject wrapper, M
cx->compartment()->wrap(cx, vp));
}
bool
CrossCompartmentWrapper::defaultValue(JSContext* cx, HandleObject wrapper, JSType hint,
MutableHandleValue vp) const
{
PIERCE(cx, wrapper,
NOTHING,
Wrapper::defaultValue(cx, wrapper, hint, vp),
cx->compartment()->wrap(cx, vp));
}
const CrossCompartmentWrapper CrossCompartmentWrapper::singleton(0u);
bool

View File

@ -148,14 +148,6 @@ DeadObjectProxy::regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard*
return false;
}
bool
DeadObjectProxy::defaultValue(JSContext* cx, HandleObject obj, JSType hint,
MutableHandleValue vp) const
{
ReportDead(cx);
return false;
}
const char DeadObjectProxy::family = 0;
const DeadObjectProxy DeadObjectProxy::singleton;

View File

@ -49,8 +49,6 @@ class DeadObjectProxy : public BaseProxyHandler
virtual const char* className(JSContext* cx, HandleObject proxy) const override;
virtual JSString* fun_toString(JSContext* cx, HandleObject proxy, unsigned indent) const override;
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const override;
virtual bool defaultValue(JSContext* cx, HandleObject obj, JSType hint,
MutableHandleValue vp) const override;
static const char family;
static const DeadObjectProxy singleton;

View File

@ -182,11 +182,4 @@ OpaqueCrossCompartmentWrapper::fun_toString(JSContext* cx, HandleObject proxy,
return nullptr;
}
bool
OpaqueCrossCompartmentWrapper::defaultValue(JSContext* cx, HandleObject wrapper, JSType hint,
MutableHandleValue vp) const
{
return OrdinaryToPrimitive(cx, wrapper, hint, vp);
}
const OpaqueCrossCompartmentWrapper OpaqueCrossCompartmentWrapper::singleton;

View File

@ -62,7 +62,6 @@ class Proxy
static JSString* fun_toString(JSContext* cx, HandleObject proxy, unsigned indent);
static bool regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g);
static bool boxedValue_unbox(JSContext* cx, HandleObject proxy, MutableHandleValue vp);
static bool defaultValue(JSContext* cx, HandleObject obj, JSType hint, MutableHandleValue vp);
static bool watch(JSContext* cx, HandleObject proxy, HandleId id, HandleObject callable);
static bool unwatch(JSContext* cx, HandleObject proxy, HandleId id);

View File

@ -74,17 +74,6 @@ SecurityWrapper<Base>::isExtensible(JSContext* cx, HandleObject wrapper, bool* e
return true;
}
// For security wrappers, we run the OrdinaryToPrimitive algorithm on the wrapper
// itself, which means that the existing security policy on operations like
// toString() will take effect and do the right thing here.
template <class Base>
bool
SecurityWrapper<Base>::defaultValue(JSContext* cx, HandleObject wrapper,
JSType hint, MutableHandleValue vp) const
{
return OrdinaryToPrimitive(cx, wrapper, hint, vp);
}
template <class Base>
bool
SecurityWrapper<Base>::getBuiltinClass(JSContext* cx, HandleObject wrapper,

View File

@ -16,22 +16,6 @@
using namespace js;
/*
* Wrapper forwards this call directly to the wrapped object for efficiency
* and transparency. In particular, the hint is needed to properly stringify
* Date objects in certain cases - see bug 646129. Note also the
* SecurityWrapper overrides this trap to avoid information leaks. See bug
* 720619.
*/
bool
Wrapper::defaultValue(JSContext* cx, HandleObject proxy, JSType hint, MutableHandleValue vp) const
{
vp.set(ObjectValue(*proxy->as<ProxyObject>().target()));
if (hint == JSTYPE_VOID)
return ToPrimitive(cx, vp);
return ToPrimitive(cx, hint, vp);
}
JSObject*
Wrapper::New(JSContext* cx, JSObject* obj, const Wrapper* handler,
const WrapperOptions& options)

View File

@ -154,14 +154,6 @@ FilteringWrapper<Base, Policy>::nativeCall(JSContext* cx, JS::IsAcceptableThis t
return Base::Restrictive::nativeCall(cx, test, impl, args);
}
template <typename Base, typename Policy>
bool
FilteringWrapper<Base, Policy>::defaultValue(JSContext* cx, HandleObject obj,
JSType hint, MutableHandleValue vp) const
{
return Base::defaultValue(cx, obj, hint, vp);
}
template <typename Base, typename Policy>
bool
FilteringWrapper<Base, Policy>::getPrototype(JSContext* cx, JS::HandleObject wrapper,

View File

@ -52,9 +52,6 @@ class FilteringWrapper : public Base {
virtual bool nativeCall(JSContext* cx, JS::IsAcceptableThis test, JS::NativeImpl impl,
const JS::CallArgs& args) const override;
virtual bool defaultValue(JSContext* cx, JS::Handle<JSObject*> obj, JSType hint,
JS::MutableHandleValue vp) const override;
virtual bool getPrototype(JSContext* cx, JS::HandleObject wrapper,
JS::MutableHandleObject protop) const override;

View File

@ -2182,19 +2182,6 @@ XrayWrapper<Base, Traits>::className(JSContext* cx, HandleObject wrapper) const
return Traits::className(cx, wrapper, Base::singleton);
}
template <typename Base, typename Traits>
bool
XrayWrapper<Base, Traits>::defaultValue(JSContext* cx, HandleObject wrapper,
JSType hint, MutableHandleValue vp) const
{
// Even if this isn't a security wrapper, Xray semantics dictate that we
// run the OrdinaryToPrimitive algorithm directly on the Xray wrapper.
//
// NB: We don't have to worry about things with special [[DefaultValue]]
// behavior like Date because we'll never have an XrayWrapper to them.
return OrdinaryToPrimitive(cx, wrapper, hint, vp);
}
template <typename Base, typename Traits>
bool
XrayWrapper<Base, Traits>::getPrototype(JSContext* cx, JS::HandleObject wrapper,

View File

@ -465,9 +465,6 @@ class XrayWrapper : public Base {
JS::AutoIdVector& props) const override;
virtual const char* className(JSContext* cx, JS::HandleObject proxy) const override;
virtual bool defaultValue(JSContext* cx, JS::HandleObject wrapper,
JSType hint, JS::MutableHandleValue vp)
const override;
static const XrayWrapper singleton;