mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-12 02:31:41 +00:00
Bug 1027402 - Part 2: Mark Proxy Handler instances as const. (r=bholley, r=bz over IRC)
This commit is contained in:
parent
d6d3b525f2
commit
992c8dde5a
@ -54,10 +54,10 @@ public:
|
||||
return "WindowProperties";
|
||||
}
|
||||
|
||||
static WindowNamedPropertiesHandler*
|
||||
static const WindowNamedPropertiesHandler*
|
||||
getInstance()
|
||||
{
|
||||
static WindowNamedPropertiesHandler instance;
|
||||
static const WindowNamedPropertiesHandler instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
|
@ -660,7 +660,7 @@ public:
|
||||
unsigned flags,
|
||||
JS::MutableHandle<JS::Value> vp) MOZ_OVERRIDE;
|
||||
|
||||
static nsOuterWindowProxy singleton;
|
||||
static const nsOuterWindowProxy singleton;
|
||||
|
||||
protected:
|
||||
nsGlobalWindow* GetWindow(JSObject *proxy)
|
||||
@ -1015,7 +1015,7 @@ nsOuterWindowProxy::unwatch(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||
return js::UnwatchGuts(cx, proxy, id);
|
||||
}
|
||||
|
||||
nsOuterWindowProxy
|
||||
const nsOuterWindowProxy
|
||||
nsOuterWindowProxy::singleton;
|
||||
|
||||
class nsChromeOuterWindowProxy : public nsOuterWindowProxy
|
||||
@ -1025,7 +1025,7 @@ public:
|
||||
|
||||
virtual const char *className(JSContext *cx, JS::Handle<JSObject*> wrapper) MOZ_OVERRIDE;
|
||||
|
||||
static nsChromeOuterWindowProxy singleton;
|
||||
static const nsChromeOuterWindowProxy singleton;
|
||||
};
|
||||
|
||||
const char *
|
||||
@ -1037,7 +1037,7 @@ nsChromeOuterWindowProxy::className(JSContext *cx,
|
||||
return "ChromeWindow";
|
||||
}
|
||||
|
||||
nsChromeOuterWindowProxy
|
||||
const nsChromeOuterWindowProxy
|
||||
nsChromeOuterWindowProxy::singleton;
|
||||
|
||||
static JSObject*
|
||||
|
@ -10189,11 +10189,11 @@ class CGDOMJSProxyHandler_slice(ClassMethod):
|
||||
|
||||
class CGDOMJSProxyHandler_getInstance(ClassMethod):
|
||||
def __init__(self):
|
||||
ClassMethod.__init__(self, "getInstance", "DOMProxyHandler*", [], static=True)
|
||||
ClassMethod.__init__(self, "getInstance", "const DOMProxyHandler*", [], static=True)
|
||||
|
||||
def getBody(self):
|
||||
return dedent("""
|
||||
static DOMProxyHandler instance;
|
||||
static const DOMProxyHandler instance;
|
||||
return &instance;
|
||||
""")
|
||||
|
||||
@ -10214,6 +10214,15 @@ class CGDOMJSProxyHandler(CGClass):
|
||||
CGDOMJSProxyHandler_finalize(descriptor),
|
||||
CGDOMJSProxyHandler_getInstance(),
|
||||
CGDOMJSProxyHandler_delete(descriptor)]
|
||||
constructors = [
|
||||
ClassConstructor(
|
||||
[],
|
||||
bodyInHeader=True,
|
||||
visibility="public",
|
||||
explicit=True)
|
||||
]
|
||||
|
||||
|
||||
if descriptor.supportsIndexedProperties():
|
||||
methods.append(CGDOMJSProxyHandler_slice(descriptor))
|
||||
if (descriptor.operations['IndexedSetter'] is not None or
|
||||
@ -10223,6 +10232,7 @@ class CGDOMJSProxyHandler(CGClass):
|
||||
|
||||
CGClass.__init__(self, 'DOMProxyHandler',
|
||||
bases=[ClassBase('mozilla::dom::DOMProxyHandler')],
|
||||
constructors=constructors,
|
||||
methods=methods)
|
||||
|
||||
|
||||
|
@ -84,10 +84,10 @@ class CPOWProxyHandler : public BaseProxyHandler
|
||||
virtual const char* className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE;
|
||||
virtual void finalize(JSFreeOp *fop, JSObject *proxy) MOZ_OVERRIDE;
|
||||
|
||||
static CPOWProxyHandler singleton;
|
||||
static const CPOWProxyHandler singleton;
|
||||
};
|
||||
|
||||
CPOWProxyHandler CPOWProxyHandler::singleton;
|
||||
const CPOWProxyHandler CPOWProxyHandler::singleton;
|
||||
|
||||
#define FORWARD(call, args) \
|
||||
WrapperOwner *owner = OwnerOf(proxy); \
|
||||
|
@ -769,7 +769,7 @@ class ScriptedIndirectProxyHandler : public BaseProxyHandler
|
||||
virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) MOZ_OVERRIDE;
|
||||
virtual bool isScripted() MOZ_OVERRIDE { return true; }
|
||||
|
||||
static ScriptedIndirectProxyHandler singleton;
|
||||
static const ScriptedIndirectProxyHandler singleton;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -1043,7 +1043,7 @@ ScriptedIndirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, un
|
||||
return fun_toStringHelper(cx, obj, indent);
|
||||
}
|
||||
|
||||
ScriptedIndirectProxyHandler ScriptedIndirectProxyHandler::singleton;
|
||||
const ScriptedIndirectProxyHandler ScriptedIndirectProxyHandler::singleton;
|
||||
|
||||
/* Derived class for all scripted direct proxy handlers. */
|
||||
class ScriptedDirectProxyHandler : public DirectProxyHandler {
|
||||
@ -1089,7 +1089,7 @@ class ScriptedDirectProxyHandler : public DirectProxyHandler {
|
||||
virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE;
|
||||
virtual bool isScripted() MOZ_OVERRIDE { return true; }
|
||||
|
||||
static ScriptedDirectProxyHandler singleton;
|
||||
static const ScriptedDirectProxyHandler singleton;
|
||||
};
|
||||
|
||||
// This variable exists solely to provide a unique address for use as an identifier.
|
||||
@ -2089,7 +2089,7 @@ ScriptedDirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const C
|
||||
return true;
|
||||
}
|
||||
|
||||
ScriptedDirectProxyHandler ScriptedDirectProxyHandler::singleton;
|
||||
const ScriptedDirectProxyHandler ScriptedDirectProxyHandler::singleton;
|
||||
|
||||
#define INVOKE_ON_PROTOTYPE(cx, handler, proxy, protoCall) \
|
||||
JS_BEGIN_MACRO \
|
||||
@ -2845,7 +2845,7 @@ const Class* const js::CallableProxyClassPtr = &ProxyObject::callableClass_;
|
||||
const Class* const js::UncallableProxyClassPtr = &ProxyObject::uncallableClass_;
|
||||
|
||||
JS_FRIEND_API(JSObject *)
|
||||
js::NewProxyObject(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, JSObject *proto_,
|
||||
js::NewProxyObject(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv, JSObject *proto_,
|
||||
JSObject *parent_, const ProxyOptions &options)
|
||||
{
|
||||
return ProxyObject::New(cx, handler, priv, TaggedProto(proto_), parent_,
|
||||
@ -2853,7 +2853,7 @@ js::NewProxyObject(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, J
|
||||
}
|
||||
|
||||
void
|
||||
ProxyObject::renew(JSContext *cx, BaseProxyHandler *handler, Value priv)
|
||||
ProxyObject::renew(JSContext *cx, const BaseProxyHandler *handler, Value priv)
|
||||
{
|
||||
JS_ASSERT_IF(IsCrossCompartmentWrapper(this), IsDeadProxyObject(this));
|
||||
JS_ASSERT(getParent() == cx->global());
|
||||
@ -2861,7 +2861,7 @@ ProxyObject::renew(JSContext *cx, BaseProxyHandler *handler, Value priv)
|
||||
JS_ASSERT(!getClass()->ext.innerObject);
|
||||
JS_ASSERT(getTaggedProto().isLazy());
|
||||
|
||||
setSlot(HANDLER_SLOT, PrivateValue(handler));
|
||||
setHandler(handler);
|
||||
setCrossCompartmentSlot(PRIVATE_SLOT, priv);
|
||||
setSlot(EXTRA_SLOT + 0, UndefinedValue());
|
||||
setSlot(EXTRA_SLOT + 1, UndefinedValue());
|
||||
|
@ -121,15 +121,15 @@ class JS_FRIEND_API(BaseProxyHandler)
|
||||
bool hasSecurityPolicy = false);
|
||||
virtual ~BaseProxyHandler();
|
||||
|
||||
bool hasPrototype() {
|
||||
bool hasPrototype() const {
|
||||
return mHasPrototype;
|
||||
}
|
||||
|
||||
bool hasSecurityPolicy() {
|
||||
bool hasSecurityPolicy() const {
|
||||
return mHasSecurityPolicy;
|
||||
}
|
||||
|
||||
inline const void *family() {
|
||||
inline const void *family() const {
|
||||
return mFamily;
|
||||
}
|
||||
static size_t offsetOfFamily() {
|
||||
@ -459,7 +459,7 @@ class MOZ_STACK_CLASS ProxyOptions {
|
||||
};
|
||||
|
||||
JS_FRIEND_API(JSObject *)
|
||||
NewProxyObject(JSContext *cx, BaseProxyHandler *handler, HandleValue priv,
|
||||
NewProxyObject(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv,
|
||||
JSObject *proto, JSObject *parent, const ProxyOptions &options = ProxyOptions());
|
||||
|
||||
JSObject *
|
||||
|
@ -39,7 +39,7 @@ Wrapper::defaultValue(JSContext *cx, HandleObject proxy, JSType hint, MutableHan
|
||||
}
|
||||
|
||||
JSObject *
|
||||
Wrapper::New(JSContext *cx, JSObject *obj, JSObject *parent, Wrapper *handler,
|
||||
Wrapper::New(JSContext *cx, JSObject *obj, JSObject *parent, const Wrapper *handler,
|
||||
const WrapperOptions *options)
|
||||
{
|
||||
JS_ASSERT(parent);
|
||||
@ -57,7 +57,7 @@ Wrapper::New(JSContext *cx, JSObject *obj, JSObject *parent, Wrapper *handler,
|
||||
}
|
||||
|
||||
JSObject *
|
||||
Wrapper::Renew(JSContext *cx, JSObject *existing, JSObject *obj, Wrapper *handler)
|
||||
Wrapper::Renew(JSContext *cx, JSObject *existing, JSObject *obj, const Wrapper *handler)
|
||||
{
|
||||
JS_ASSERT(!obj->isCallable());
|
||||
existing->as<ProxyObject>().renew(cx, handler, ObjectValue(*obj));
|
||||
@ -137,8 +137,8 @@ Wrapper::~Wrapper()
|
||||
{
|
||||
}
|
||||
|
||||
Wrapper Wrapper::singleton((unsigned)0);
|
||||
Wrapper Wrapper::singletonWithPrototype((unsigned)0, true);
|
||||
const Wrapper Wrapper::singleton((unsigned)0);
|
||||
const Wrapper Wrapper::singletonWithPrototype((unsigned)0, true);
|
||||
JSObject *Wrapper::defaultProto = TaggedProto::LazyProto;
|
||||
|
||||
/* Compartments. */
|
||||
@ -603,7 +603,7 @@ CrossCompartmentWrapper::setPrototypeOf(JSContext *cx, HandleObject wrapper,
|
||||
NOTHING);
|
||||
}
|
||||
|
||||
CrossCompartmentWrapper CrossCompartmentWrapper::singleton(0u);
|
||||
const CrossCompartmentWrapper CrossCompartmentWrapper::singleton(0u);
|
||||
|
||||
/* Security wrappers. */
|
||||
|
||||
@ -859,7 +859,7 @@ DeadObjectProxy::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandle
|
||||
return true;
|
||||
}
|
||||
|
||||
DeadObjectProxy DeadObjectProxy::singleton;
|
||||
const DeadObjectProxy DeadObjectProxy::singleton;
|
||||
const char DeadObjectProxy::sDeadObjectFamily = 0;
|
||||
|
||||
bool
|
||||
|
@ -68,10 +68,10 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler
|
||||
virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint,
|
||||
MutableHandleValue vp) MOZ_OVERRIDE;
|
||||
|
||||
static JSObject *New(JSContext *cx, JSObject *obj, JSObject *parent, Wrapper *handler,
|
||||
static JSObject *New(JSContext *cx, JSObject *obj, JSObject *parent, const Wrapper *handler,
|
||||
const WrapperOptions *options = nullptr);
|
||||
|
||||
static JSObject *Renew(JSContext *cx, JSObject *existing, JSObject *obj, Wrapper *handler);
|
||||
static JSObject *Renew(JSContext *cx, JSObject *existing, JSObject *obj, const Wrapper *handler);
|
||||
|
||||
static Wrapper *wrapperHandler(JSObject *wrapper);
|
||||
|
||||
@ -87,8 +87,8 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler
|
||||
|
||||
virtual bool finalizeInBackground(Value priv) MOZ_OVERRIDE;
|
||||
|
||||
static Wrapper singleton;
|
||||
static Wrapper singletonWithPrototype;
|
||||
static const Wrapper singleton;
|
||||
static const Wrapper singletonWithPrototype;
|
||||
|
||||
static JSObject *defaultProto;
|
||||
};
|
||||
@ -151,8 +151,8 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper
|
||||
virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto,
|
||||
bool *bp) MOZ_OVERRIDE;
|
||||
|
||||
static CrossCompartmentWrapper singleton;
|
||||
static CrossCompartmentWrapper singletonWithPrototype;
|
||||
static const CrossCompartmentWrapper singleton;
|
||||
static const CrossCompartmentWrapper singletonWithPrototype;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -241,7 +241,7 @@ class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler
|
||||
virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy,
|
||||
MutableHandleObject protop) MOZ_OVERRIDE;
|
||||
|
||||
static DeadObjectProxy singleton;
|
||||
static const DeadObjectProxy singleton;
|
||||
};
|
||||
|
||||
extern JSObject *
|
||||
|
@ -14,7 +14,7 @@
|
||||
using namespace js;
|
||||
|
||||
/* static */ ProxyObject *
|
||||
ProxyObject::New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, TaggedProto proto_,
|
||||
ProxyObject::New(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv, TaggedProto proto_,
|
||||
JSObject *parent_, const ProxyOptions &options)
|
||||
{
|
||||
Rooted<TaggedProto> proto(cx, proto_);
|
||||
@ -69,9 +69,9 @@ ProxyObject::initCrossCompartmentPrivate(HandleValue priv)
|
||||
}
|
||||
|
||||
void
|
||||
ProxyObject::initHandler(BaseProxyHandler *handler)
|
||||
ProxyObject::initHandler(const BaseProxyHandler *handler)
|
||||
{
|
||||
initSlot(HANDLER_SLOT, PrivateValue(handler));
|
||||
initSlot(HANDLER_SLOT, PrivateValue(const_cast<BaseProxyHandler*>(handler)));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -88,7 +88,7 @@ NukeSlot(ProxyObject *proxy, uint32_t slot)
|
||||
}
|
||||
|
||||
void
|
||||
ProxyObject::nuke(BaseProxyHandler *handler)
|
||||
ProxyObject::nuke(const BaseProxyHandler *handler)
|
||||
{
|
||||
/* Allow people to add their own number of reserved slots beyond the expected 4 */
|
||||
unsigned numSlots = JSCLASS_RESERVED_SLOTS(getClass());
|
||||
|
@ -23,7 +23,7 @@ class ProxyObject : public JSObject
|
||||
static const uint32_t EXTRA_SLOT = PROXY_EXTRA_SLOT;
|
||||
|
||||
public:
|
||||
static ProxyObject *New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv,
|
||||
static ProxyObject *New(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv,
|
||||
TaggedProto proto_, JSObject *parent_,
|
||||
const ProxyOptions &options);
|
||||
|
||||
@ -45,10 +45,10 @@ class ProxyObject : public JSObject
|
||||
return static_cast<BaseProxyHandler*>(GetReservedSlot(this, HANDLER_SLOT).toPrivate());
|
||||
}
|
||||
|
||||
void initHandler(BaseProxyHandler *handler);
|
||||
void initHandler(const BaseProxyHandler *handler);
|
||||
|
||||
void setHandler(BaseProxyHandler *handler) {
|
||||
SetReservedSlot(this, HANDLER_SLOT, PrivateValue(handler));
|
||||
void setHandler(const BaseProxyHandler *handler) {
|
||||
SetReservedSlot(this, HANDLER_SLOT, PrivateValue(const_cast<BaseProxyHandler*>(handler)));
|
||||
}
|
||||
|
||||
static size_t offsetOfHandler() {
|
||||
@ -93,11 +93,11 @@ class ProxyObject : public JSObject
|
||||
public:
|
||||
static unsigned grayLinkSlot(JSObject *obj);
|
||||
|
||||
void renew(JSContext *cx, BaseProxyHandler *handler, Value priv);
|
||||
void renew(JSContext *cx, const BaseProxyHandler *handler, Value priv);
|
||||
|
||||
static void trace(JSTracer *trc, JSObject *obj);
|
||||
|
||||
void nuke(BaseProxyHandler *handler);
|
||||
void nuke(const BaseProxyHandler *handler);
|
||||
|
||||
static const Class callableClass_;
|
||||
static const Class uncallableClass_;
|
||||
|
@ -1314,7 +1314,7 @@ class DebugScopeProxy : public BaseProxyHandler
|
||||
|
||||
public:
|
||||
static int family;
|
||||
static DebugScopeProxy singleton;
|
||||
static const DebugScopeProxy singleton;
|
||||
|
||||
DebugScopeProxy() : BaseProxyHandler(&family) {}
|
||||
|
||||
@ -1583,7 +1583,7 @@ class DebugScopeProxy : public BaseProxyHandler
|
||||
} /* anonymous namespace */
|
||||
|
||||
int DebugScopeProxy::family = 0;
|
||||
DebugScopeProxy DebugScopeProxy::singleton;
|
||||
const DebugScopeProxy DebugScopeProxy::singleton;
|
||||
|
||||
/* static */ DebugScopeObject *
|
||||
DebugScopeObject::create(JSContext *cx, ScopeObject &scope, HandleObject enclosing)
|
||||
|
@ -511,7 +511,7 @@ NS_IMPL_RELEASE(nsXPCComponents_utils_Sandbox)
|
||||
#define XPC_MAP_FLAGS 0
|
||||
#include "xpc_map_end.h" /* This #undef's the above. */
|
||||
|
||||
xpc::SandboxProxyHandler xpc::sandboxProxyHandler;
|
||||
const xpc::SandboxProxyHandler xpc::sandboxProxyHandler;
|
||||
|
||||
bool
|
||||
xpc::IsSandboxPrototypeProxy(JSObject *obj)
|
||||
@ -575,7 +575,7 @@ xpc::SandboxCallableProxyHandler::call(JSContext *cx, JS::Handle<JSObject*> prox
|
||||
return JS::Call(cx, thisVal, func, args, args.rval());
|
||||
}
|
||||
|
||||
xpc::SandboxCallableProxyHandler xpc::sandboxCallableProxyHandler;
|
||||
const xpc::SandboxCallableProxyHandler xpc::sandboxCallableProxyHandler;
|
||||
|
||||
/*
|
||||
* Wrap a callable such that if we're called with oldThisObj as the
|
||||
|
@ -21,7 +21,7 @@ namespace xpc {
|
||||
// chromeArray.forEach(..) to Just Work without explicitly listing them in
|
||||
// __exposedProps__. Since proxies don't automatically inherit behavior from
|
||||
// their prototype, we have to instrument the traps to do this manually.
|
||||
ChromeObjectWrapper ChromeObjectWrapper::singleton;
|
||||
const ChromeObjectWrapper ChromeObjectWrapper::singleton;
|
||||
|
||||
using js::assertEnteredPolicy;
|
||||
|
||||
@ -32,7 +32,8 @@ AllowedByBase(JSContext *cx, HandleObject wrapper, HandleId id,
|
||||
MOZ_ASSERT(js::Wrapper::wrapperHandler(wrapper) ==
|
||||
&ChromeObjectWrapper::singleton);
|
||||
bool bp;
|
||||
ChromeObjectWrapper *handler = &ChromeObjectWrapper::singleton;
|
||||
ChromeObjectWrapper *handler =
|
||||
const_cast<ChromeObjectWrapper*>(&ChromeObjectWrapper::singleton);
|
||||
return handler->ChromeObjectWrapperBase::enter(cx, wrapper, id, act, &bp);
|
||||
}
|
||||
|
||||
@ -56,7 +57,8 @@ PropIsFromStandardPrototype(JSContext *cx, HandleObject wrapper,
|
||||
MOZ_ASSERT(js::Wrapper::wrapperHandler(wrapper) ==
|
||||
&ChromeObjectWrapper::singleton);
|
||||
Rooted<JSPropertyDescriptor> desc(cx);
|
||||
ChromeObjectWrapper *handler = &ChromeObjectWrapper::singleton;
|
||||
ChromeObjectWrapper *handler =
|
||||
const_cast<ChromeObjectWrapper*>(&ChromeObjectWrapper::singleton);
|
||||
if (!handler->ChromeObjectWrapperBase::getPropertyDescriptor(cx, wrapper, id,
|
||||
&desc) ||
|
||||
!desc.object())
|
||||
|
@ -51,7 +51,7 @@ class ChromeObjectWrapper : public ChromeObjectWrapperBase
|
||||
// never be anything more to enumerate up the prototype chain. So we can
|
||||
// atually skip these.
|
||||
|
||||
static ChromeObjectWrapper singleton;
|
||||
static const ChromeObjectWrapper singleton;
|
||||
};
|
||||
|
||||
} /* namespace xpc */
|
||||
|
@ -191,12 +191,12 @@ FilteringWrapper<Base, Policy>::enter(JSContext *cx, HandleObject wrapper,
|
||||
#define NNXOW FilteringWrapper<CrossCompartmentSecurityWrapper, Opaque>
|
||||
#define NNXOWC FilteringWrapper<CrossCompartmentSecurityWrapper, OpaqueWithCall>
|
||||
#define GO FilteringWrapper<CrossCompartmentSecurityWrapper, GentlyOpaque>
|
||||
template<> XOW XOW::singleton(0);
|
||||
template<> DXOW DXOW::singleton(0);
|
||||
template<> NNXOW NNXOW::singleton(0);
|
||||
template<> NNXOWC NNXOWC::singleton(0);
|
||||
template<> const XOW XOW::singleton(0);
|
||||
template<> const DXOW DXOW::singleton(0);
|
||||
template<> const NNXOW NNXOW::singleton(0);
|
||||
template<> const NNXOWC NNXOWC::singleton(0);
|
||||
|
||||
template<> GO GO::singleton(0);
|
||||
template<> const GO GO::singleton(0);
|
||||
|
||||
template class XOW;
|
||||
template class DXOW;
|
||||
|
@ -47,7 +47,7 @@ class FilteringWrapper : public Base {
|
||||
virtual bool enter(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
|
||||
js::Wrapper::Action act, bool *bp) MOZ_OVERRIDE;
|
||||
|
||||
static FilteringWrapper singleton;
|
||||
static const FilteringWrapper singleton;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class WaiveXrayWrapper : public js::CrossCompartmentWrapper {
|
||||
virtual bool getPrototypeOf(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||
JS::MutableHandle<JSObject*> protop) MOZ_OVERRIDE;
|
||||
|
||||
static WaiveXrayWrapper singleton;
|
||||
static const WaiveXrayWrapper singleton;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -32,13 +32,13 @@ namespace xpc {
|
||||
// transparent wrapper in the origin (non-chrome) compartment. When
|
||||
// an object with that special wrapper applied crosses into chrome,
|
||||
// we know to not apply an X-ray wrapper.
|
||||
Wrapper XrayWaiver(WrapperFactory::WAIVE_XRAY_WRAPPER_FLAG);
|
||||
const Wrapper XrayWaiver(WrapperFactory::WAIVE_XRAY_WRAPPER_FLAG);
|
||||
|
||||
// When objects for which we waived the X-ray wrapper cross into
|
||||
// chrome, we wrap them into a special cross-compartment wrapper
|
||||
// that transitively extends the waiver to all properties we get
|
||||
// off it.
|
||||
WaiveXrayWrapper WaiveXrayWrapper::singleton(0);
|
||||
const WaiveXrayWrapper WaiveXrayWrapper::singleton(0);
|
||||
|
||||
bool
|
||||
WrapperFactory::IsCOW(JSObject *obj)
|
||||
@ -325,7 +325,7 @@ WrapperFactory::PrepareForWrapping(JSContext *cx, HandleObject scope,
|
||||
|
||||
#ifdef DEBUG
|
||||
static void
|
||||
DEBUG_CheckUnwrapSafety(HandleObject obj, js::Wrapper *handler,
|
||||
DEBUG_CheckUnwrapSafety(HandleObject obj, const js::Wrapper *handler,
|
||||
JSCompartment *origin, JSCompartment *target)
|
||||
{
|
||||
if (AccessCheck::isChrome(target) || xpc::IsUniversalXPConnectEnabled(target)) {
|
||||
@ -344,7 +344,7 @@ DEBUG_CheckUnwrapSafety(HandleObject obj, js::Wrapper *handler,
|
||||
#define DEBUG_CheckUnwrapSafety(obj, handler, origin, target) {}
|
||||
#endif
|
||||
|
||||
static Wrapper *
|
||||
static const Wrapper *
|
||||
SelectWrapper(bool securityWrapper, bool wantXrays, XrayType xrayType,
|
||||
bool waiveXrays, bool originIsXBLScope)
|
||||
{
|
||||
@ -420,7 +420,7 @@ WrapperFactory::Rewrap(JSContext *cx, HandleObject existing, HandleObject obj,
|
||||
XrayType xrayType = GetXrayType(obj);
|
||||
bool waiveXrayFlag = flags & WAIVE_XRAY_WRAPPER_FLAG;
|
||||
|
||||
Wrapper *wrapper;
|
||||
const Wrapper *wrapper;
|
||||
CompartmentPrivate *targetdata = EnsureCompartmentPrivate(target);
|
||||
|
||||
//
|
||||
|
@ -64,7 +64,7 @@ class WrapperFactory {
|
||||
static bool XrayWrapperNotShadowing(JSObject *wrapper, jsid id);
|
||||
};
|
||||
|
||||
extern js::Wrapper XrayWaiver;
|
||||
extern const js::Wrapper XrayWaiver;
|
||||
|
||||
}
|
||||
|
||||
|
@ -2575,7 +2575,8 @@ bool
|
||||
XrayWrapper<Base, Traits>::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args)
|
||||
{
|
||||
assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::CALL);
|
||||
return Traits::call(cx, wrapper, args, Base::singleton);
|
||||
// Hard cast the singleton since SecurityWrapper doesn't have one.
|
||||
return Traits::call(cx, wrapper, args, (js::Wrapper&)Base::singleton);
|
||||
}
|
||||
|
||||
template <typename Base, typename Traits>
|
||||
@ -2583,7 +2584,8 @@ bool
|
||||
XrayWrapper<Base, Traits>::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args)
|
||||
{
|
||||
assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::CALL);
|
||||
return Traits::construct(cx, wrapper, args, Base::singleton);
|
||||
// Hard cast the singleton since SecurityWrapper doesn't have one.
|
||||
return Traits::construct(cx, wrapper, args, (js::Wrapper&)Base::singleton);
|
||||
}
|
||||
|
||||
template <typename Base, typename Traits>
|
||||
@ -2663,27 +2665,27 @@ XrayWrapper<Base, Traits>::setPrototypeOf(JSContext *cx, JS::HandleObject wrappe
|
||||
*/
|
||||
|
||||
template<>
|
||||
PermissiveXrayXPCWN PermissiveXrayXPCWN::singleton(0);
|
||||
const PermissiveXrayXPCWN PermissiveXrayXPCWN::singleton(0);
|
||||
template class PermissiveXrayXPCWN;
|
||||
|
||||
template<>
|
||||
SecurityXrayXPCWN SecurityXrayXPCWN::singleton(0);
|
||||
const SecurityXrayXPCWN SecurityXrayXPCWN::singleton(0);
|
||||
template class SecurityXrayXPCWN;
|
||||
|
||||
template<>
|
||||
PermissiveXrayDOM PermissiveXrayDOM::singleton(0);
|
||||
const PermissiveXrayDOM PermissiveXrayDOM::singleton(0);
|
||||
template class PermissiveXrayDOM;
|
||||
|
||||
template<>
|
||||
SecurityXrayDOM SecurityXrayDOM::singleton(0);
|
||||
const SecurityXrayDOM SecurityXrayDOM::singleton(0);
|
||||
template class SecurityXrayDOM;
|
||||
|
||||
template<>
|
||||
PermissiveXrayJS PermissiveXrayJS::singleton(0);
|
||||
const PermissiveXrayJS PermissiveXrayJS::singleton(0);
|
||||
template class PermissiveXrayJS;
|
||||
|
||||
template<>
|
||||
SCSecurityXrayXPCWN SCSecurityXrayXPCWN::singleton(0);
|
||||
const SCSecurityXrayXPCWN SCSecurityXrayXPCWN::singleton(0);
|
||||
template class SCSecurityXrayXPCWN;
|
||||
|
||||
static nsQueryInterface
|
||||
|
@ -111,7 +111,7 @@ class XrayWrapper : public Base {
|
||||
virtual bool setPrototypeOf(JSContext *cx, JS::HandleObject wrapper,
|
||||
JS::HandleObject proto, bool *bp) MOZ_OVERRIDE;
|
||||
|
||||
static XrayWrapper singleton;
|
||||
static const XrayWrapper singleton;
|
||||
|
||||
private:
|
||||
template <bool HasPrototype>
|
||||
@ -175,7 +175,7 @@ public:
|
||||
JS::MutableHandle<JS::Value> vp) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
extern SandboxProxyHandler sandboxProxyHandler;
|
||||
extern const SandboxProxyHandler sandboxProxyHandler;
|
||||
|
||||
// A proxy handler that lets us wrap callables and invoke them with
|
||||
// the correct this object, while forwarding all other operations down
|
||||
@ -190,7 +190,7 @@ public:
|
||||
const JS::CallArgs &args) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
extern SandboxCallableProxyHandler sandboxCallableProxyHandler;
|
||||
extern const SandboxCallableProxyHandler sandboxCallableProxyHandler;
|
||||
|
||||
class AutoSetWrapperNotShadowing;
|
||||
class XPCWrappedNativeXrayTraits;
|
||||
|
Loading…
x
Reference in New Issue
Block a user