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

--HG--
extra : commitid : 2c3wdgbGsGs
extra : rebase_source : d7d00204286b855fc90e19ac85c74f046166b643
This commit is contained in:
Jason Orendorff 2015-03-20 14:03:24 -05:00
Родитель 81838ba2bd
Коммит 69f5edcebe
14 изменённых файлов: 0 добавлений и 98 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -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,

Просмотреть файл

@ -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)

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;