Bug 1027425 - Make all Proxy handler constructors use MOZ_CONSTEXPR. (r=bz, r=froydnj)

This commit is contained in:
Eric Faust 2014-08-28 13:47:16 -07:00
parent b482cea504
commit dd4eb066b2
19 changed files with 471 additions and 495 deletions

View File

@ -15,7 +15,7 @@ namespace dom {
class WindowNamedPropertiesHandler : public BaseDOMProxyHandler
{
public:
WindowNamedPropertiesHandler()
MOZ_CONSTEXPR WindowNamedPropertiesHandler()
: BaseDOMProxyHandler(nullptr, /* hasPrototype = */ true)
{
}

View File

@ -599,7 +599,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(DialogValueHolder)
class nsOuterWindowProxy : public js::Wrapper
{
public:
nsOuterWindowProxy() : js::Wrapper(0) { }
MOZ_CONSTEXPR nsOuterWindowProxy() : js::Wrapper(0) { }
virtual bool finalizeInBackground(JS::Value priv) const MOZ_OVERRIDE {
return false;
@ -1026,7 +1026,7 @@ nsOuterWindowProxy::singleton;
class nsChromeOuterWindowProxy : public nsOuterWindowProxy
{
public:
nsChromeOuterWindowProxy() : nsOuterWindowProxy() {}
MOZ_CONSTEXPR nsChromeOuterWindowProxy() : nsOuterWindowProxy() { }
virtual const char *className(JSContext *cx, JS::Handle<JSObject*> wrapper) const MOZ_OVERRIDE;

View File

@ -9045,12 +9045,15 @@ class ClassConstructor(ClassItem):
body contains a string with the code for the constructor, defaults to empty.
"""
def __init__(self, args, inline=False, bodyInHeader=False,
visibility="private", explicit=False, baseConstructors=None,
visibility="private", explicit=False, constexpr=False, baseConstructors=None,
body=""):
assert not (inline and constexpr)
assert not (bodyInHeader and constexpr)
self.args = args
self.inline = inline or bodyInHeader
self.bodyInHeader = bodyInHeader
self.bodyInHeader = bodyInHeader or constexpr
self.explicit = explicit
self.constexpr = constexpr
self.baseConstructors = baseConstructors or []
self.body = body
ClassItem.__init__(self, None, visibility)
@ -9061,6 +9064,8 @@ class ClassConstructor(ClassItem):
decorators.append('explicit')
if self.inline and declaring:
decorators.append('inline')
if self.constexpr and declaring:
decorators.append('MOZ_CONSTEXPR')
if decorators:
return ' '.join(decorators) + ' '
return ''
@ -10657,7 +10662,7 @@ class CGDOMJSProxyHandler(CGClass):
constructors = [
ClassConstructor(
[],
bodyInHeader=True,
constexpr=True,
visibility="public",
explicit=True)
]

View File

@ -27,7 +27,7 @@ template<typename T> struct Prefable;
class BaseDOMProxyHandler : public js::BaseProxyHandler
{
public:
explicit BaseDOMProxyHandler(const void* aProxyFamily, bool aHasPrototype = false)
explicit MOZ_CONSTEXPR BaseDOMProxyHandler(const void* aProxyFamily, bool aHasPrototype = false)
: js::BaseProxyHandler(aProxyFamily, aHasPrototype)
{}
@ -77,10 +77,9 @@ protected:
class DOMProxyHandler : public BaseDOMProxyHandler
{
public:
DOMProxyHandler()
MOZ_CONSTEXPR DOMProxyHandler()
: BaseDOMProxyHandler(&family)
{
}
{}
bool preventExtensions(JSContext *cx, JS::Handle<JSObject*> proxy) const MOZ_OVERRIDE;
bool defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,

View File

@ -48,7 +48,7 @@ WrapperOwner::idOf(JSObject *obj)
class CPOWProxyHandler : public BaseProxyHandler
{
public:
CPOWProxyHandler()
MOZ_CONSTEXPR CPOWProxyHandler()
: BaseProxyHandler(&family) {}
virtual bool finalizeInBackground(Value priv) const MOZ_OVERRIDE {

View File

@ -83,13 +83,6 @@ js::assertEnteredPolicy(JSContext *cx, JSObject *proxy, jsid id,
}
#endif
BaseProxyHandler::BaseProxyHandler(const void *family, bool hasPrototype, bool hasSecurityPolicy)
: mFamily(family),
mHasPrototype(hasPrototype),
mHasSecurityPolicy(hasSecurityPolicy)
{
}
bool
BaseProxyHandler::enter(JSContext *cx, HandleObject wrapper, HandleId id, Action act,
bool *bp) const
@ -574,12 +567,6 @@ DirectProxyHandler::weakmapKeyDelegate(JSObject *proxy) const
return UncheckedUnwrap(proxy);
}
DirectProxyHandler::DirectProxyHandler(const void *family, bool hasPrototype,
bool hasSecurityPolicy)
: BaseProxyHandler(family, hasPrototype, hasSecurityPolicy)
{
}
bool
DirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const
{
@ -757,7 +744,9 @@ namespace {
class ScriptedIndirectProxyHandler : public BaseProxyHandler
{
public:
ScriptedIndirectProxyHandler();
MOZ_CONSTEXPR ScriptedIndirectProxyHandler()
: BaseProxyHandler(&family)
{ }
/* ES5 Harmony fundamental proxy traps. */
virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE;
@ -816,11 +805,6 @@ static const Class CallConstructHolder = {
// This variable exists solely to provide a unique address for use as an identifier.
const char ScriptedIndirectProxyHandler::family = 0;
ScriptedIndirectProxyHandler::ScriptedIndirectProxyHandler()
: BaseProxyHandler(&family)
{
}
bool
ScriptedIndirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy,
bool *extensible) const
@ -1069,7 +1053,9 @@ const ScriptedIndirectProxyHandler ScriptedIndirectProxyHandler::singleton;
/* Derived class for all scripted direct proxy handlers. */
class ScriptedDirectProxyHandler : public DirectProxyHandler {
public:
ScriptedDirectProxyHandler();
MOZ_CONSTEXPR ScriptedDirectProxyHandler()
: DirectProxyHandler(&family)
{ }
/* ES5 Harmony fundamental proxy traps. */
virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE;
@ -1377,11 +1363,6 @@ ArrayToIdVector(JSContext *cx, HandleObject proxy, HandleObject target, HandleVa
return true;
}
ScriptedDirectProxyHandler::ScriptedDirectProxyHandler()
: DirectProxyHandler(&family)
{
}
// ES6 (22 May, 2014) 9.5.4 Proxy.[[PreventExtensions]]()
bool
ScriptedDirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) const

View File

@ -125,8 +125,12 @@ class JS_FRIEND_API(BaseProxyHandler)
bool mHasSecurityPolicy;
public:
explicit BaseProxyHandler(const void *family, bool hasPrototype = false,
bool hasSecurityPolicy = false);
explicit MOZ_CONSTEXPR BaseProxyHandler(const void *aFamily, bool aHasPrototype = false,
bool aHasSecurityPolicy = false)
: mFamily(aFamily),
mHasPrototype(aHasPrototype),
mHasSecurityPolicy(aHasSecurityPolicy)
{ }
bool hasPrototype() const {
return mHasPrototype;
@ -246,8 +250,10 @@ class JS_FRIEND_API(BaseProxyHandler)
class JS_PUBLIC_API(DirectProxyHandler) : public BaseProxyHandler
{
public:
explicit DirectProxyHandler(const void *family, bool hasPrototype = false,
bool hasSecurityPolicy = false);
explicit MOZ_CONSTEXPR DirectProxyHandler(const void *aFamily, bool aHasPrototype = false,
bool aHasSecurityPolicy = false)
: BaseProxyHandler(aFamily, aHasPrototype, aHasSecurityPolicy)
{ }
/* ES5 Harmony fundamental proxy traps. */
virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE;

View File

@ -128,12 +128,6 @@ js::IsCrossCompartmentWrapper(JSObject *obj)
!!(Wrapper::wrapperHandler(obj)->flags() & Wrapper::CROSS_COMPARTMENT);
}
Wrapper::Wrapper(unsigned flags, bool hasPrototype, bool hasSecurityPolicy)
: DirectProxyHandler(&family, hasPrototype, hasSecurityPolicy),
mFlags(flags)
{
}
const char Wrapper::family = 0;
const Wrapper Wrapper::singleton((unsigned)0);
const Wrapper Wrapper::singletonWithPrototype((unsigned)0, true);
@ -168,12 +162,6 @@ ErrorCopier::~ErrorCopier()
/* Cross compartment wrappers. */
CrossCompartmentWrapper::CrossCompartmentWrapper(unsigned flags, bool hasPrototype,
bool hasSecurityPolicy)
: Wrapper(CROSS_COMPARTMENT | flags, hasPrototype, hasSecurityPolicy)
{
}
bool Wrapper::finalizeInBackground(Value priv) const
{
if (!priv.isObject())
@ -610,12 +598,6 @@ const CrossCompartmentWrapper CrossCompartmentWrapper::singleton(0u);
/* Security wrappers. */
template <class Base>
SecurityWrapper<Base>::SecurityWrapper(unsigned flags, bool hasPrototype)
: Base(flags, hasPrototype, /* hasSecurityPolicy = */ true)
{
}
template <class Base>
bool
SecurityWrapper<Base>::isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) const
@ -738,11 +720,6 @@ SecurityWrapper<Base>::unwatch(JSContext *cx, HandleObject proxy,
template class js::SecurityWrapper<Wrapper>;
template class js::SecurityWrapper<CrossCompartmentWrapper>;
DeadObjectProxy::DeadObjectProxy()
: BaseProxyHandler(&family)
{
}
bool
DeadObjectProxy::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const
{

View File

@ -81,7 +81,11 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler
return mFlags;
}
explicit Wrapper(unsigned flags, bool hasPrototype = false, bool hasSecurityPolicy = false);
explicit MOZ_CONSTEXPR Wrapper(unsigned aFlags, bool aHasPrototype = false,
bool aHasSecurityPolicy = false)
: DirectProxyHandler(&family, aHasPrototype, aHasSecurityPolicy),
mFlags(aFlags)
{ }
virtual bool finalizeInBackground(Value priv) const MOZ_OVERRIDE;
@ -102,8 +106,10 @@ WrapperOptions::proto() const
class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper
{
public:
explicit CrossCompartmentWrapper(unsigned flags, bool hasPrototype = false,
bool hasSecurityPolicy = false);
explicit MOZ_CONSTEXPR CrossCompartmentWrapper(unsigned aFlags, bool aHasPrototype = false,
bool aHasSecurityPolicy = false)
: Wrapper(CROSS_COMPARTMENT | aFlags, aHasPrototype, aHasSecurityPolicy)
{ }
/* ES5 Harmony fundamental wrapper traps. */
virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) const MOZ_OVERRIDE;
@ -166,7 +172,9 @@ template <class Base>
class JS_FRIEND_API(SecurityWrapper) : public Base
{
public:
explicit SecurityWrapper(unsigned flags, bool hasPrototype = false);
explicit MOZ_CONSTEXPR SecurityWrapper(unsigned flags, bool hasPrototype = false)
: Base(flags, hasPrototype, /* hasSecurityPolicy = */ true)
{ }
virtual bool isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) const MOZ_OVERRIDE;
virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) const MOZ_OVERRIDE;
@ -204,7 +212,9 @@ typedef SecurityWrapper<CrossCompartmentWrapper> CrossCompartmentSecurityWrapper
class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler
{
public:
explicit DeadObjectProxy();
explicit MOZ_CONSTEXPR DeadObjectProxy()
: BaseProxyHandler(&family)
{ }
/* ES5 Harmony fundamental wrapper traps. */
virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE;

View File

@ -1326,7 +1326,7 @@ class DebugScopeProxy : public BaseProxyHandler
static const char family;
static const DebugScopeProxy singleton;
DebugScopeProxy() : BaseProxyHandler(&family) {}
MOZ_CONSTEXPR DebugScopeProxy() : BaseProxyHandler(&family) {}
bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE
{

View File

@ -66,11 +66,6 @@ Interpose(JSContext *cx, HandleObject target, const nsIID *iid, HandleId id,
return true;
}
template<typename Base>
AddonWrapper<Base>::AddonWrapper(unsigned flags) : Base(flags)
{
}
template<typename Base>
bool
AddonWrapper<Base>::getPropertyDescriptor(JSContext *cx, HandleObject wrapper,

View File

@ -22,7 +22,7 @@ Interpose(JSContext *cx, JS::HandleObject target, const nsIID *iid, JS::HandleId
template<typename Base>
class AddonWrapper : public Base {
public:
AddonWrapper(unsigned flags);
explicit MOZ_CONSTEXPR AddonWrapper(unsigned flags) : Base(flags) { }
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,

View File

@ -26,7 +26,7 @@ struct ExposedPropertiesOnly;
class ChromeObjectWrapper : public ChromeObjectWrapperBase
{
public:
ChromeObjectWrapper() : ChromeObjectWrapperBase(0) {}
MOZ_CONSTEXPR ChromeObjectWrapper() : ChromeObjectWrapperBase(0) {}
/* Custom traps. */
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,

View File

@ -16,11 +16,6 @@ using namespace js;
namespace xpc {
template <typename Base, typename Policy>
FilteringWrapper<Base, Policy>::FilteringWrapper(unsigned flags) : Base(flags)
{
}
template <typename Policy>
static bool
Filter(JSContext *cx, HandleObject wrapper, AutoIdVector &props)

View File

@ -23,7 +23,7 @@ namespace xpc {
template <typename Base, typename Policy>
class FilteringWrapper : public Base {
public:
FilteringWrapper(unsigned flags);
MOZ_CONSTEXPR FilteringWrapper(unsigned flags) : Base(flags) {}
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,

View File

@ -31,10 +31,6 @@ WaiveAccessors(JSContext *cx, JS::MutableHandle<JSPropertyDescriptor> desc)
return true;
}
WaiveXrayWrapper::WaiveXrayWrapper(unsigned flags) : js::CrossCompartmentWrapper(flags)
{
}
bool
WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper,
HandleId id, JS::MutableHandle<JSPropertyDescriptor> desc)

View File

@ -15,7 +15,7 @@ namespace xpc {
class WaiveXrayWrapper : public js::CrossCompartmentWrapper {
public:
WaiveXrayWrapper(unsigned flags);
explicit MOZ_CONSTEXPR WaiveXrayWrapper(unsigned flags) : js::CrossCompartmentWrapper(flags) { }
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,

View File

@ -181,125 +181,25 @@ ResolvingId::getResolvingIdFromWrapper(JSObject *wrapper)
return getResolvingId(getHolderObject(wrapper));
}
class MOZ_STACK_CLASS ResolvingIdDummy
JSObject *
XrayTraits::getExpandoChain(HandleObject obj)
{
public:
ResolvingIdDummy(JSContext *cx, HandleObject wrapper, HandleId id)
{
}
};
return ObjectScope(obj)->GetExpandoChain(obj);
}
class XrayTraits
bool
XrayTraits::setExpandoChain(JSContext *cx, HandleObject obj, HandleObject chain)
{
public:
XrayTraits() {}
return ObjectScope(obj)->SetExpandoChain(cx, obj, chain);
}
static JSObject* getTargetObject(JSObject *wrapper) {
return js::UncheckedUnwrap(wrapper, /* stopAtOuter = */ false);
}
virtual bool resolveNativeProperty(JSContext *cx, HandleObject wrapper,
HandleObject holder, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) = 0;
// NB: resolveOwnProperty may decide whether or not to cache what it finds
// on the holder. If the result is not cached, the lookup will happen afresh
// for each access, which is the right thing for things like dynamic NodeList
// properties.
virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper,
HandleObject wrapper, HandleObject holder,
HandleId id, MutableHandle<JSPropertyDescriptor> desc);
bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) {
*bp = true;
return true;
}
static const char *className(JSContext *cx, HandleObject wrapper, const js::Wrapper& baseInstance) {
return baseInstance.className(cx, wrapper);
}
virtual void preserveWrapper(JSObject *target) = 0;
static bool set(JSContext *cx, HandleObject wrapper, HandleObject receiver, HandleId id,
bool strict, MutableHandleValue vp);
JSObject* getExpandoObject(JSContext *cx, HandleObject target,
HandleObject consumer);
JSObject* ensureExpandoObject(JSContext *cx, HandleObject wrapper,
HandleObject target);
JSObject* getHolder(JSObject *wrapper);
JSObject* ensureHolder(JSContext *cx, HandleObject wrapper);
virtual JSObject* createHolder(JSContext *cx, JSObject *wrapper) = 0;
JSObject* getExpandoChain(HandleObject obj) {
return ObjectScope(obj)->GetExpandoChain(obj);
}
bool setExpandoChain(JSContext *cx, HandleObject obj, HandleObject chain) {
return ObjectScope(obj)->SetExpandoChain(cx, obj, chain);
}
bool cloneExpandoChain(JSContext *cx, HandleObject dst, HandleObject src);
private:
bool expandoObjectMatchesConsumer(JSContext *cx, HandleObject expandoObject,
nsIPrincipal *consumerOrigin,
HandleObject exclusiveGlobal);
JSObject* getExpandoObjectInternal(JSContext *cx, HandleObject target,
nsIPrincipal *origin,
JSObject *exclusiveGlobal);
JSObject* attachExpandoObject(JSContext *cx, HandleObject target,
nsIPrincipal *origin,
HandleObject exclusiveGlobal);
XrayTraits(XrayTraits &) MOZ_DELETE;
const XrayTraits& operator=(XrayTraits &) MOZ_DELETE;
};
class XPCWrappedNativeXrayTraits : public XrayTraits
// static
XPCWrappedNative *
XPCWrappedNativeXrayTraits::getWN(JSObject *wrapper)
{
public:
enum {
HasPrototype = 0
};
static const XrayType Type = XrayForWrappedNative;
virtual bool resolveNativeProperty(JSContext *cx, HandleObject wrapper,
HandleObject holder, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper,
HandleObject holder, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<JSPropertyDescriptor> desc,
Handle<JSPropertyDescriptor> existingDesc, bool *defined);
virtual bool enumerateNames(JSContext *cx, HandleObject wrapper, unsigned flags,
AutoIdVector &props);
static bool call(JSContext *cx, HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance);
static bool construct(JSContext *cx, HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance);
static bool isResolving(JSContext *cx, JSObject *holder, jsid id);
static bool resolveDOMCollectionProperty(JSContext *cx, HandleObject wrapper,
HandleObject holder, HandleId id,
MutableHandle<JSPropertyDescriptor> desc);
static XPCWrappedNative* getWN(JSObject *wrapper) {
return XPCWrappedNative::Get(getTargetObject(wrapper));
}
virtual void preserveWrapper(JSObject *target) MOZ_OVERRIDE;
typedef ResolvingId ResolvingIdImpl;
virtual JSObject* createHolder(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE;
static const JSClass HolderClass;
static XPCWrappedNativeXrayTraits singleton;
};
return XPCWrappedNative::Get(getTargetObject(wrapper));
}
const JSClass XPCWrappedNativeXrayTraits::HolderClass = {
"NativePropertyHolder", JSCLASS_HAS_RESERVED_SLOTS(2),
@ -307,169 +207,6 @@ const JSClass XPCWrappedNativeXrayTraits::HolderClass = {
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};
class DOMXrayTraits : public XrayTraits
{
public:
enum {
HasPrototype = 0
};
static const XrayType Type = XrayForDOMObject;
virtual bool resolveNativeProperty(JSContext *cx, HandleObject wrapper,
HandleObject holder, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper,
HandleObject holder, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<JSPropertyDescriptor> desc,
Handle<JSPropertyDescriptor> existingDesc, bool *defined);
static bool set(JSContext *cx, HandleObject wrapper, HandleObject receiver, HandleId id,
bool strict, MutableHandleValue vp);
virtual bool enumerateNames(JSContext *cx, HandleObject wrapper, unsigned flags,
AutoIdVector &props);
static bool call(JSContext *cx, HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance);
static bool construct(JSContext *cx, HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance);
static bool isResolving(JSContext *cx, JSObject *holder, jsid id)
{
return false;
}
typedef ResolvingIdDummy ResolvingIdImpl;
virtual void preserveWrapper(JSObject *target) MOZ_OVERRIDE;
virtual JSObject* createHolder(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE;
static DOMXrayTraits singleton;
};
class JSXrayTraits : public XrayTraits
{
public:
enum {
HasPrototype = 1
};
static const XrayType Type = XrayForJSObject;
virtual bool resolveNativeProperty(JSContext *cx, HandleObject wrapper,
HandleObject holder, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE
{
MOZ_CRASH("resolveNativeProperty hook should never be called with HasPrototype = 1");
}
virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper,
HandleObject holder, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp);
bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<JSPropertyDescriptor> desc,
Handle<JSPropertyDescriptor> existingDesc, bool *defined);
virtual bool enumerateNames(JSContext *cx, HandleObject wrapper, unsigned flags,
AutoIdVector &props);
static bool call(JSContext *cx, HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance)
{
JSXrayTraits &self = JSXrayTraits::singleton;
RootedObject holder(cx, self.ensureHolder(cx, wrapper));
if (self.getProtoKey(holder) == JSProto_Function)
return baseInstance.call(cx, wrapper, args);
RootedValue v(cx, ObjectValue(*wrapper));
js_ReportIsNotFunction(cx, v);
return false;
}
static bool construct(JSContext *cx, HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance)
{
JSXrayTraits &self = JSXrayTraits::singleton;
RootedObject holder(cx, self.ensureHolder(cx, wrapper));
if (self.getProtoKey(holder) == JSProto_Function)
return baseInstance.construct(cx, wrapper, args);
RootedValue v(cx, ObjectValue(*wrapper));
js_ReportIsNotFunction(cx, v);
return false;
}
static bool isResolving(JSContext *cx, JSObject *holder, jsid id)
{
return false;
}
typedef ResolvingIdDummy ResolvingIdImpl;
bool getPrototypeOf(JSContext *cx, JS::HandleObject wrapper,
JS::HandleObject target,
JS::MutableHandleObject protop)
{
RootedObject holder(cx, ensureHolder(cx, wrapper));
JSProtoKey key = getProtoKey(holder);
if (isPrototype(holder)) {
JSProtoKey parentKey = js::ParentKeyForStandardClass(key);
if (parentKey == JSProto_Null) {
protop.set(nullptr);
return true;
}
key = parentKey;
}
{
JSAutoCompartment ac(cx, target);
if (!JS_GetClassPrototype(cx, key, protop))
return false;
}
return JS_WrapObject(cx, protop);
}
virtual void preserveWrapper(JSObject *target) MOZ_OVERRIDE {
// In the case of pure JS objects, there is no underlying object, and
// the target is the canonical representation of state. If it gets
// collected, then expandos and such should be collected too. So there's
// nothing to do here.
}
enum {
SLOT_PROTOKEY = 0,
SLOT_ISPROTOTYPE,
SLOT_CONSTRUCTOR_FOR,
SLOT_COUNT
};
virtual JSObject* createHolder(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE;
static JSProtoKey getProtoKey(JSObject *holder) {
int32_t key = js::GetReservedSlot(holder, SLOT_PROTOKEY).toInt32();
return static_cast<JSProtoKey>(key);
}
static bool isPrototype(JSObject *holder) {
return js::GetReservedSlot(holder, SLOT_ISPROTOTYPE).toBoolean();
}
static JSProtoKey constructorFor(JSObject *holder) {
int32_t key = js::GetReservedSlot(holder, SLOT_CONSTRUCTOR_FOR).toInt32();
return static_cast<JSProtoKey>(key);
}
static bool getOwnPropertyFromTargetIfSafe(JSContext *cx,
HandleObject target,
HandleObject wrapper,
HandleId id,
MutableHandle<JSPropertyDescriptor> desc);
static const JSClass HolderClass;
static JSXrayTraits singleton;
};
const JSClass JSXrayTraits::HolderClass = {
"JSXrayHolder", JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
@ -478,101 +215,17 @@ const JSClass JSXrayTraits::HolderClass = {
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};
// These traits are used when the target is not Xrayable and we therefore want
// to make it opaque modulo the usual Xray machinery (like expandos and
// .wrappedJSObject).
class OpaqueXrayTraits : public XrayTraits
bool
OpaqueXrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper,
HandleObject holder, HandleId id,
MutableHandle<JSPropertyDescriptor> desc)
{
public:
enum {
HasPrototype = 1
};
static const XrayType Type = XrayForOpaqueObject;
bool ok = XrayTraits::resolveOwnProperty(cx, jsWrapper, wrapper, holder, id, desc);
if (!ok || desc.object())
return ok;
virtual bool resolveNativeProperty(JSContext *cx, HandleObject wrapper,
HandleObject holder, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE
{
MOZ_CRASH("resolveNativeProperty hook should never be called with HasPrototype = 1");
}
virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper,
HandleObject holder, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE
{
bool ok = XrayTraits::resolveOwnProperty(cx, jsWrapper, wrapper, holder, id, desc);
if (!ok || desc.object())
return ok;
return SilentFailure(cx, id, "object is not safely Xrayable");
}
bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<JSPropertyDescriptor> desc,
Handle<JSPropertyDescriptor> existingDesc, bool *defined)
{
*defined = false;
return true;
}
virtual bool enumerateNames(JSContext *cx, HandleObject wrapper, unsigned flags,
AutoIdVector &props)
{
return true;
}
static bool call(JSContext *cx, HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance)
{
RootedValue v(cx, ObjectValue(*wrapper));
js_ReportIsNotFunction(cx, v);
return false;
}
static bool construct(JSContext *cx, HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance)
{
RootedValue v(cx, ObjectValue(*wrapper));
js_ReportIsNotFunction(cx, v);
return false;
}
static bool isResolving(JSContext *cx, JSObject *holder, jsid id)
{
return false;
}
typedef ResolvingIdDummy ResolvingIdImpl;
bool getPrototypeOf(JSContext *cx, JS::HandleObject wrapper,
JS::HandleObject target,
JS::MutableHandleObject protop)
{
// Opaque wrappers just get targetGlobal.Object.prototype as their
// prototype. This is preferable to using a null prototype because it
// lets things like |toString| and |__proto__| work.
{
JSAutoCompartment ac(cx, target);
if (!JS_GetClassPrototype(cx, JSProto_Object, protop))
return false;
}
return JS_WrapObject(cx, protop);
}
static const char *className(JSContext *cx, HandleObject wrapper, const js::Wrapper& baseInstance) {
return "Opaque";
}
virtual void preserveWrapper(JSObject *target) MOZ_OVERRIDE { }
virtual JSObject* createHolder(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE
{
RootedObject global(cx, JS_GetGlobalForObject(cx, wrapper));
return JS_NewObjectWithGivenProto(cx, nullptr, JS::NullPtr(), global);
}
static OpaqueXrayTraits singleton;
};
return SilentFailure(cx, id, "object is not safely Xrayable");
}
bool
SilentFailure(JSContext *cx, HandleId id, const char *reason)
@ -2244,12 +1897,6 @@ DOMXrayTraits::createHolder(JSContext *cx, JSObject *wrapper)
return JS_NewObjectWithGivenProto(cx, nullptr, JS::NullPtr(), global);
}
template <typename Base, typename Traits>
XrayWrapper<Base, Traits>::XrayWrapper(unsigned flags)
: Base(flags | WrapperFactory::IS_XRAY_WRAPPER_FLAG, /* hasPrototype = */ Traits::HasPrototype)
{
}
namespace XrayUtils {
JSObject *

View File

@ -9,6 +9,8 @@
#include "mozilla/Attributes.h"
#include "WrapperFactory.h"
#include "jswrapper.h"
// Xray wrappers re-resolve the original native properties on the native
@ -17,6 +19,9 @@
// we pull them out of the Wrapper inheritance hierarchy and create a
// little world around them.
class nsIPrincipal;
class XPCWrappedNative;
namespace xpc {
bool
@ -45,13 +50,6 @@ HasNativeProperty(JSContext *cx, JS::HandleObject wrapper, JS::HandleId id,
bool *hasProp);
}
class XrayTraits;
class XPCWrappedNativeXrayTraits;
class DOMXrayTraits;
class JSXrayTraits;
class OpaqueXrayTraits;
enum XrayType {
XrayForDOMObject,
XrayForWrappedNative,
@ -60,6 +58,393 @@ enum XrayType {
NotXray
};
class MOZ_STACK_CLASS ResolvingId {
public:
ResolvingId(JSContext *cx, JS::HandleObject wrapper, JS::HandleId id);
~ResolvingId();
bool isXrayShadowing(jsid id);
bool isResolving(jsid id);
static ResolvingId* getResolvingId(JSObject *holder);
static JSObject* getHolderObject(JSObject *wrapper);
static ResolvingId *getResolvingIdFromWrapper(JSObject *wrapper);
private:
friend class AutoSetWrapperNotShadowing;
friend class XPCWrappedNativeXrayTraits;
JS::HandleId mId;
JS::RootedObject mHolder;
ResolvingId *mPrev;
bool mXrayShadowing;
};
class MOZ_STACK_CLASS ResolvingIdDummy
{
public:
ResolvingIdDummy(JSContext *cx, JS::HandleObject wrapper, JS::HandleId id)
{
}
};
class XrayTraits
{
public:
XrayTraits() {}
static JSObject* getTargetObject(JSObject *wrapper) {
return js::UncheckedUnwrap(wrapper, /* stopAtOuter = */ false);
}
virtual bool resolveNativeProperty(JSContext *cx, JS::HandleObject wrapper,
JS::HandleObject holder, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc) = 0;
// NB: resolveOwnProperty may decide whether or not to cache what it finds
// on the holder. If the result is not cached, the lookup will happen afresh
// for each access, which is the right thing for things like dynamic NodeList
// properties.
virtual bool resolveOwnProperty(JSContext *cx, const js::Wrapper &jsWrapper,
JS::HandleObject wrapper, JS::HandleObject holder,
JS::HandleId id, JS::MutableHandle<JSPropertyDescriptor> desc);
bool delete_(JSContext *cx, JS::HandleObject wrapper, JS::HandleId id, bool *bp) {
*bp = true;
return true;
}
static const char *className(JSContext *cx, JS::HandleObject wrapper, const js::Wrapper& baseInstance) {
return baseInstance.className(cx, wrapper);
}
virtual void preserveWrapper(JSObject *target) = 0;
static bool set(JSContext *cx, JS::HandleObject wrapper, JS::HandleObject receiver, JS::HandleId id,
bool strict, JS::MutableHandleValue vp);
JSObject* getExpandoObject(JSContext *cx, JS::HandleObject target,
JS::HandleObject consumer);
JSObject* ensureExpandoObject(JSContext *cx, JS::HandleObject wrapper,
JS::HandleObject target);
JSObject* getHolder(JSObject *wrapper);
JSObject* ensureHolder(JSContext *cx, JS::HandleObject wrapper);
virtual JSObject* createHolder(JSContext *cx, JSObject *wrapper) = 0;
JSObject* getExpandoChain(JS::HandleObject obj);
bool setExpandoChain(JSContext *cx, JS::HandleObject obj, JS::HandleObject chain);
bool cloneExpandoChain(JSContext *cx, JS::HandleObject dst, JS::HandleObject src);
private:
bool expandoObjectMatchesConsumer(JSContext *cx, JS::HandleObject expandoObject,
nsIPrincipal *consumerOrigin,
JS::HandleObject exclusiveGlobal);
JSObject* getExpandoObjectInternal(JSContext *cx, JS::HandleObject target,
nsIPrincipal *origin,
JSObject *exclusiveGlobal);
JSObject* attachExpandoObject(JSContext *cx, JS::HandleObject target,
nsIPrincipal *origin,
JS::HandleObject exclusiveGlobal);
XrayTraits(XrayTraits &) MOZ_DELETE;
const XrayTraits& operator=(XrayTraits &) MOZ_DELETE;
};
class XPCWrappedNativeXrayTraits : public XrayTraits
{
public:
enum {
HasPrototype = 0
};
static const XrayType Type = XrayForWrappedNative;
virtual bool resolveNativeProperty(JSContext *cx, JS::HandleObject wrapper,
JS::HandleObject holder, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool resolveOwnProperty(JSContext *cx, const js::Wrapper &jsWrapper, JS::HandleObject wrapper,
JS::HandleObject holder, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
bool defineProperty(JSContext *cx, JS::HandleObject wrapper, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc,
JS::Handle<JSPropertyDescriptor> existingDesc, bool *defined);
virtual bool enumerateNames(JSContext *cx, JS::HandleObject wrapper, unsigned flags,
JS::AutoIdVector &props);
static bool call(JSContext *cx, JS::HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance);
static bool construct(JSContext *cx, JS::HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance);
static bool isResolving(JSContext *cx, JSObject *holder, jsid id);
static bool resolveDOMCollectionProperty(JSContext *cx, JS::HandleObject wrapper,
JS::HandleObject holder, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc);
static XPCWrappedNative* getWN(JSObject *wrapper);
virtual void preserveWrapper(JSObject *target) MOZ_OVERRIDE;
typedef ResolvingId ResolvingIdImpl;
virtual JSObject* createHolder(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE;
static const JSClass HolderClass;
static XPCWrappedNativeXrayTraits singleton;
};
class DOMXrayTraits : public XrayTraits
{
public:
enum {
HasPrototype = 0
};
static const XrayType Type = XrayForDOMObject;
virtual bool resolveNativeProperty(JSContext *cx, JS::HandleObject wrapper,
JS::HandleObject holder, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool resolveOwnProperty(JSContext *cx, const js::Wrapper &jsWrapper, JS::HandleObject wrapper,
JS::HandleObject holder, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
bool defineProperty(JSContext *cx, JS::HandleObject wrapper, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc,
JS::Handle<JSPropertyDescriptor> existingDesc, bool *defined);
static bool set(JSContext *cx, JS::HandleObject wrapper, JS::HandleObject receiver, JS::HandleId id,
bool strict, JS::MutableHandleValue vp);
virtual bool enumerateNames(JSContext *cx, JS::HandleObject wrapper, unsigned flags,
JS::AutoIdVector &props);
static bool call(JSContext *cx, JS::HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance);
static bool construct(JSContext *cx, JS::HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance);
static bool isResolving(JSContext *cx, JSObject *holder, jsid id)
{
return false;
}
typedef ResolvingIdDummy ResolvingIdImpl;
virtual void preserveWrapper(JSObject *target) MOZ_OVERRIDE;
virtual JSObject* createHolder(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE;
static DOMXrayTraits singleton;
};
class JSXrayTraits : public XrayTraits
{
public:
enum {
HasPrototype = 1
};
static const XrayType Type = XrayForJSObject;
virtual bool resolveNativeProperty(JSContext *cx, JS::HandleObject wrapper,
JS::HandleObject holder, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE
{
MOZ_CRASH("resolveNativeProperty hook should never be called with HasPrototype = 1");
}
virtual bool resolveOwnProperty(JSContext *cx, const js::Wrapper &jsWrapper, JS::HandleObject wrapper,
JS::HandleObject holder, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
bool delete_(JSContext *cx, JS::HandleObject wrapper, JS::HandleId id, bool *bp);
bool defineProperty(JSContext *cx, JS::HandleObject wrapper, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc,
JS::Handle<JSPropertyDescriptor> existingDesc, bool *defined);
virtual bool enumerateNames(JSContext *cx, JS::HandleObject wrapper, unsigned flags,
JS::AutoIdVector &props);
static bool call(JSContext *cx, JS::HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance)
{
JSXrayTraits &self = JSXrayTraits::singleton;
JS::RootedObject holder(cx, self.ensureHolder(cx, wrapper));
if (self.getProtoKey(holder) == JSProto_Function)
return baseInstance.call(cx, wrapper, args);
JS::RootedValue v(cx, JS::ObjectValue(*wrapper));
js_ReportIsNotFunction(cx, v);
return false;
}
static bool construct(JSContext *cx, JS::HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance)
{
JSXrayTraits &self = JSXrayTraits::singleton;
JS::RootedObject holder(cx, self.ensureHolder(cx, wrapper));
if (self.getProtoKey(holder) == JSProto_Function)
return baseInstance.construct(cx, wrapper, args);
JS::RootedValue v(cx, JS::ObjectValue(*wrapper));
js_ReportIsNotFunction(cx, v);
return false;
}
static bool isResolving(JSContext *cx, JSObject *holder, jsid id)
{
return false;
}
typedef ResolvingIdDummy ResolvingIdImpl;
bool getPrototypeOf(JSContext *cx, JS::HandleObject wrapper,
JS::HandleObject target,
JS::MutableHandleObject protop)
{
JS::RootedObject holder(cx, ensureHolder(cx, wrapper));
JSProtoKey key = getProtoKey(holder);
if (isPrototype(holder)) {
JSProtoKey parentKey = js::ParentKeyForStandardClass(key);
if (parentKey == JSProto_Null) {
protop.set(nullptr);
return true;
}
key = parentKey;
}
{
JSAutoCompartment ac(cx, target);
if (!JS_GetClassPrototype(cx, key, protop))
return false;
}
return JS_WrapObject(cx, protop);
}
virtual void preserveWrapper(JSObject *target) MOZ_OVERRIDE {
// In the case of pure JS objects, there is no underlying object, and
// the target is the canonical representation of state. If it gets
// collected, then expandos and such should be collected too. So there's
// nothing to do here.
}
enum {
SLOT_PROTOKEY = 0,
SLOT_ISPROTOTYPE,
SLOT_CONSTRUCTOR_FOR,
SLOT_COUNT
};
virtual JSObject* createHolder(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE;
static JSProtoKey getProtoKey(JSObject *holder) {
int32_t key = js::GetReservedSlot(holder, SLOT_PROTOKEY).toInt32();
return static_cast<JSProtoKey>(key);
}
static bool isPrototype(JSObject *holder) {
return js::GetReservedSlot(holder, SLOT_ISPROTOTYPE).toBoolean();
}
static JSProtoKey constructorFor(JSObject *holder) {
int32_t key = js::GetReservedSlot(holder, SLOT_CONSTRUCTOR_FOR).toInt32();
return static_cast<JSProtoKey>(key);
}
static bool getOwnPropertyFromTargetIfSafe(JSContext *cx,
JS::HandleObject target,
JS::HandleObject wrapper,
JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc);
static const JSClass HolderClass;
static JSXrayTraits singleton;
};
// These traits are used when the target is not Xrayable and we therefore want
// to make it opaque modulo the usual Xray machinery (like expandos and
// .wrappedJSObject).
class OpaqueXrayTraits : public XrayTraits
{
public:
enum {
HasPrototype = 1
};
static const XrayType Type = XrayForOpaqueObject;
virtual bool resolveNativeProperty(JSContext *cx, JS::HandleObject wrapper,
JS::HandleObject holder, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE
{
MOZ_CRASH("resolveNativeProperty hook should never be called with HasPrototype = 1");
}
virtual bool resolveOwnProperty(JSContext *cx, const js::Wrapper &jsWrapper, JS::HandleObject wrapper,
JS::HandleObject holder, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
bool defineProperty(JSContext *cx, JS::HandleObject wrapper, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc,
JS::Handle<JSPropertyDescriptor> existingDesc, bool *defined)
{
*defined = false;
return true;
}
virtual bool enumerateNames(JSContext *cx, JS::HandleObject wrapper, unsigned flags,
JS::AutoIdVector &props)
{
return true;
}
static bool call(JSContext *cx, JS::HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance)
{
JS::RootedValue v(cx, JS::ObjectValue(*wrapper));
js_ReportIsNotFunction(cx, v);
return false;
}
static bool construct(JSContext *cx, JS::HandleObject wrapper,
const JS::CallArgs &args, const js::Wrapper& baseInstance)
{
JS::RootedValue v(cx, JS::ObjectValue(*wrapper));
js_ReportIsNotFunction(cx, v);
return false;
}
static bool isResolving(JSContext *cx, JSObject *holder, jsid id)
{
return false;
}
typedef ResolvingIdDummy ResolvingIdImpl;
bool getPrototypeOf(JSContext *cx, JS::HandleObject wrapper,
JS::HandleObject target,
JS::MutableHandleObject protop)
{
// Opaque wrappers just get targetGlobal.Object.prototype as their
// prototype. This is preferable to using a null prototype because it
// lets things like |toString| and |__proto__| work.
{
JSAutoCompartment ac(cx, target);
if (!JS_GetClassPrototype(cx, JSProto_Object, protop))
return false;
}
return JS_WrapObject(cx, protop);
}
static const char *className(JSContext *cx, JS::HandleObject wrapper, const js::Wrapper& baseInstance) {
return "Opaque";
}
virtual void preserveWrapper(JSObject *target) MOZ_OVERRIDE { }
virtual JSObject* createHolder(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE
{
JS::RootedObject global(cx, JS_GetGlobalForObject(cx, wrapper));
return JS_NewObjectWithGivenProto(cx, nullptr, JS::NullPtr(), global);
}
static OpaqueXrayTraits singleton;
};
XrayType GetXrayType(JSObject *obj);
XrayTraits* GetXrayTraits(JSObject *obj);
@ -67,7 +452,9 @@ XrayTraits* GetXrayTraits(JSObject *obj);
template <typename Base, typename Traits = XPCWrappedNativeXrayTraits >
class XrayWrapper : public Base {
public:
XrayWrapper(unsigned flags);
MOZ_CONSTEXPR XrayWrapper(unsigned flags)
: Base(flags | WrapperFactory::IS_XRAY_WRAPPER_FLAG, Traits::HasPrototype)
{ };
/* Fundamental proxy traps. */
virtual bool isExtensible(JSContext *cx, JS::Handle<JSObject*> wrapper, bool *extensible) const MOZ_OVERRIDE;
@ -152,7 +539,7 @@ class XrayWrapper : public Base {
class SandboxProxyHandler : public js::Wrapper {
public:
SandboxProxyHandler() : js::Wrapper(0)
MOZ_CONSTEXPR SandboxProxyHandler() : js::Wrapper(0)
{
}
@ -186,7 +573,7 @@ extern const SandboxProxyHandler sandboxProxyHandler;
// to them directly.
class SandboxCallableProxyHandler : public js::Wrapper {
public:
SandboxCallableProxyHandler() : js::Wrapper(0)
MOZ_CONSTEXPR SandboxCallableProxyHandler() : js::Wrapper(0)
{
}
@ -197,28 +584,6 @@ public:
extern const SandboxCallableProxyHandler sandboxCallableProxyHandler;
class AutoSetWrapperNotShadowing;
class XPCWrappedNativeXrayTraits;
class MOZ_STACK_CLASS ResolvingId {
public:
ResolvingId(JSContext *cx, JS::HandleObject wrapper, JS::HandleId id);
~ResolvingId();
bool isXrayShadowing(jsid id);
bool isResolving(jsid id);
static ResolvingId* getResolvingId(JSObject *holder);
static JSObject* getHolderObject(JSObject *wrapper);
static ResolvingId *getResolvingIdFromWrapper(JSObject *wrapper);
private:
friend class AutoSetWrapperNotShadowing;
friend class XPCWrappedNativeXrayTraits;
JS::HandleId mId;
JS::RootedObject mHolder;
ResolvingId *mPrev;
bool mXrayShadowing;
};
}