Bug 803068 - Merge DirectWrapper and Wrapper. r=ejpbruel

--HG--
extra : rebase_source : a2b98a9585c6f7761747cfaf55684e6eeed91344
This commit is contained in:
Bobby Holley 2012-10-29 16:52:53 +01:00
parent a0d19fc627
commit b4461f0bed
11 changed files with 77 additions and 106 deletions

View File

@ -588,10 +588,10 @@ nsPIDOMWindow::~nsPIDOMWindow() {}
// nsOuterWindowProxy: Outer Window Proxy
//*****************************************************************************
class nsOuterWindowProxy : public js::DirectWrapper
class nsOuterWindowProxy : public js::Wrapper
{
public:
nsOuterWindowProxy() : js::DirectWrapper(0) {}
nsOuterWindowProxy() : js::Wrapper(0) {}
virtual bool isOuterWindow() {
return true;

View File

@ -14,9 +14,9 @@
#include "jsobjinlines.h"
struct OuterWrapper : js::DirectWrapper
struct OuterWrapper : js::Wrapper
{
OuterWrapper() : DirectWrapper(0) {}
OuterWrapper() : Wrapper(0) {}
virtual bool isOuterWindow() {
return true;

View File

@ -129,7 +129,7 @@ class ScriptFrameIter;
class Proxy;
class JS_FRIEND_API(BaseProxyHandler);
class JS_FRIEND_API(DirectWrapper);
class JS_FRIEND_API(Wrapper);
class JS_FRIEND_API(CrossCompartmentWrapper);
class TempAllocPolicy;

View File

@ -34,7 +34,7 @@ int sWrapperFamily;
}
void *
DirectWrapper::getWrapperFamily()
Wrapper::getWrapperFamily()
{
return &sWrapperFamily;
}
@ -70,10 +70,6 @@ Wrapper::wrappedObject(RawObject wrapper)
return GetProxyTargetObject(wrapper);
}
Wrapper::Wrapper(unsigned flags) : mFlags(flags)
{
}
bool
Wrapper::enter(JSContext *cx, JSObject *wrapper, jsid id, Action act, bool *bp)
{
@ -145,20 +141,20 @@ js::IsCrossCompartmentWrapper(RawObject wrapper)
#define SET(action) CHECKED(action, SET)
#define GET(action) CHECKED(action, GET)
DirectWrapper::DirectWrapper(unsigned flags, bool hasPrototype) : Wrapper(flags),
DirectProxyHandler(&sWrapperFamily)
Wrapper::Wrapper(unsigned flags, bool hasPrototype) : DirectProxyHandler(&sWrapperFamily)
, mFlags(flags)
{
setHasPrototype(hasPrototype);
}
DirectWrapper::~DirectWrapper()
Wrapper::~Wrapper()
{
}
bool
DirectWrapper::getPropertyDescriptor(JSContext *cx, JSObject *wrapper,
jsid id, bool set,
PropertyDescriptor *desc)
Wrapper::getPropertyDescriptor(JSContext *cx, JSObject *wrapper,
jsid id, bool set,
PropertyDescriptor *desc)
{
JS_ASSERT(!hasPrototype()); // Should never be called when there's a prototype.
desc->obj = NULL; // default result if we refuse to perform this action
@ -167,24 +163,24 @@ DirectWrapper::getPropertyDescriptor(JSContext *cx, JSObject *wrapper,
}
bool
DirectWrapper::getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper,
jsid id, bool set,
PropertyDescriptor *desc)
Wrapper::getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper,
jsid id, bool set,
PropertyDescriptor *desc)
{
desc->obj = NULL; // default result if we refuse to perform this action
CHECKED(DirectProxyHandler::getOwnPropertyDescriptor(cx, wrapper, id, set, desc), GET);
}
bool
DirectWrapper::defineProperty(JSContext *cx, JSObject *wrapper, jsid id,
PropertyDescriptor *desc)
Wrapper::defineProperty(JSContext *cx, JSObject *wrapper, jsid id,
PropertyDescriptor *desc)
{
SET(DirectProxyHandler::defineProperty(cx, wrapper, id, desc));
}
bool
DirectWrapper::getOwnPropertyNames(JSContext *cx, JSObject *wrapper,
AutoIdVector &props)
Wrapper::getOwnPropertyNames(JSContext *cx, JSObject *wrapper,
AutoIdVector &props)
{
// if we refuse to perform this action, props remains empty
jsid id = JSID_VOID;
@ -192,14 +188,14 @@ DirectWrapper::getOwnPropertyNames(JSContext *cx, JSObject *wrapper,
}
bool
DirectWrapper::delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
Wrapper::delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
{
*bp = true; // default result if we refuse to perform this action
SET(DirectProxyHandler::delete_(cx, wrapper, id, bp));
}
bool
DirectWrapper::enumerate(JSContext *cx, JSObject *wrapper, AutoIdVector &props)
Wrapper::enumerate(JSContext *cx, JSObject *wrapper, AutoIdVector &props)
{
JS_ASSERT(!hasPrototype()); // Should never be called when there's a prototype.
// if we refuse to perform this action, props remains empty
@ -219,7 +215,7 @@ DirectWrapper::enumerate(JSContext *cx, JSObject *wrapper, AutoIdVector &props)
* PUNCTURE fails.
*/
bool
DirectWrapper::defaultValue(JSContext *cx, JSObject *wrapper_, JSType hint, Value *vp)
Wrapper::defaultValue(JSContext *cx, JSObject *wrapper_, JSType hint, Value *vp)
{
RootedObject wrapper(cx, wrapper_);
@ -245,7 +241,7 @@ DirectWrapper::defaultValue(JSContext *cx, JSObject *wrapper_, JSType hint, Valu
}
bool
DirectWrapper::has(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
Wrapper::has(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
{
JS_ASSERT(!hasPrototype()); // Should never be called when there's a prototype.
*bp = false; // default result if we refuse to perform this action
@ -253,28 +249,28 @@ DirectWrapper::has(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
}
bool
DirectWrapper::hasOwn(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
Wrapper::hasOwn(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
{
*bp = false; // default result if we refuse to perform this action
GET(DirectProxyHandler::hasOwn(cx, wrapper, id, bp));
}
bool
DirectWrapper::get(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id, Value *vp)
Wrapper::get(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id, Value *vp)
{
vp->setUndefined(); // default result if we refuse to perform this action
GET(DirectProxyHandler::get(cx, wrapper, receiver, id, vp));
}
bool
DirectWrapper::set(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id, bool strict,
Value *vp)
Wrapper::set(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id, bool strict,
Value *vp)
{
SET(DirectProxyHandler::set(cx, wrapper, receiver, id, strict, vp));
}
bool
DirectWrapper::keys(JSContext *cx, JSObject *wrapper, AutoIdVector &props)
Wrapper::keys(JSContext *cx, JSObject *wrapper, AutoIdVector &props)
{
// if we refuse to perform this action, props remains empty
const jsid id = JSID_VOID;
@ -282,7 +278,7 @@ DirectWrapper::keys(JSContext *cx, JSObject *wrapper, AutoIdVector &props)
}
bool
DirectWrapper::iterate(JSContext *cx, JSObject *wrapper, unsigned flags, Value *vp)
Wrapper::iterate(JSContext *cx, JSObject *wrapper, unsigned flags, Value *vp)
{
JS_ASSERT(!hasPrototype()); // Should never be called when there's a prototype.
vp->setUndefined(); // default result if we refuse to perform this action
@ -291,7 +287,7 @@ DirectWrapper::iterate(JSContext *cx, JSObject *wrapper, unsigned flags, Value *
}
bool
DirectWrapper::call(JSContext *cx, JSObject *wrapper, unsigned argc, Value *vp)
Wrapper::call(JSContext *cx, JSObject *wrapper, unsigned argc, Value *vp)
{
vp->setUndefined(); // default result if we refuse to perform this action
const jsid id = JSID_VOID;
@ -299,7 +295,7 @@ DirectWrapper::call(JSContext *cx, JSObject *wrapper, unsigned argc, Value *vp)
}
bool
DirectWrapper::construct(JSContext *cx, JSObject *wrapper, unsigned argc, Value *argv, Value *vp)
Wrapper::construct(JSContext *cx, JSObject *wrapper, unsigned argc, Value *argv, Value *vp)
{
vp->setUndefined(); // default result if we refuse to perform this action
const jsid id = JSID_VOID;
@ -307,7 +303,7 @@ DirectWrapper::construct(JSContext *cx, JSObject *wrapper, unsigned argc, Value
}
bool
DirectWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args)
Wrapper::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args)
{
const jsid id = JSID_VOID;
Rooted<JSObject*> wrapper(cx, &args.thisv().toObject());
@ -315,7 +311,7 @@ DirectWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl,
}
bool
DirectWrapper::hasInstance(JSContext *cx, HandleObject wrapper, MutableHandleValue v, bool *bp)
Wrapper::hasInstance(JSContext *cx, HandleObject wrapper, MutableHandleValue v, bool *bp)
{
*bp = false; // default result if we refuse to perform this action
const jsid id = JSID_VOID;
@ -323,7 +319,7 @@ DirectWrapper::hasInstance(JSContext *cx, HandleObject wrapper, MutableHandleVal
}
JSString *
DirectWrapper::obj_toString(JSContext *cx, JSObject *wrapper)
Wrapper::obj_toString(JSContext *cx, JSObject *wrapper)
{
bool status;
if (!enter(cx, wrapper, JSID_VOID, GET, &status)) {
@ -338,7 +334,7 @@ DirectWrapper::obj_toString(JSContext *cx, JSObject *wrapper)
}
JSString *
DirectWrapper::fun_toString(JSContext *cx, JSObject *wrapper, unsigned indent)
Wrapper::fun_toString(JSContext *cx, JSObject *wrapper, unsigned indent)
{
bool status;
if (!enter(cx, wrapper, JSID_VOID, GET, &status)) {
@ -355,8 +351,8 @@ DirectWrapper::fun_toString(JSContext *cx, JSObject *wrapper, unsigned indent)
return str;
}
DirectWrapper DirectWrapper::singleton((unsigned)0);
DirectWrapper DirectWrapper::singletonWithPrototype((unsigned)0, true);
Wrapper Wrapper::singleton((unsigned)0);
Wrapper Wrapper::singletonWithPrototype((unsigned)0, true);
/* Compartments. */
@ -392,7 +388,7 @@ ErrorCopier::~ErrorCopier()
/* Cross compartment wrappers. */
CrossCompartmentWrapper::CrossCompartmentWrapper(unsigned flags, bool hasPrototype)
: DirectWrapper(CROSS_COMPARTMENT | flags, hasPrototype)
: Wrapper(CROSS_COMPARTMENT | flags, hasPrototype)
{
}
@ -418,7 +414,7 @@ CrossCompartmentWrapper::getPropertyDescriptor(JSContext *cx, JSObject *wrapper,
{
PIERCE(cx, wrapper, set ? SET : GET,
cx->compartment->wrapId(cx, &id),
DirectWrapper::getPropertyDescriptor(cx, wrapper, id, set, desc),
Wrapper::getPropertyDescriptor(cx, wrapper, id, set, desc),
cx->compartment->wrap(cx, desc));
}
@ -428,7 +424,7 @@ CrossCompartmentWrapper::getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapp
{
PIERCE(cx, wrapper, set ? SET : GET,
cx->compartment->wrapId(cx, &id),
DirectWrapper::getOwnPropertyDescriptor(cx, wrapper, id, set, desc),
Wrapper::getOwnPropertyDescriptor(cx, wrapper, id, set, desc),
cx->compartment->wrap(cx, desc));
}
@ -438,7 +434,7 @@ CrossCompartmentWrapper::defineProperty(JSContext *cx, JSObject *wrapper, jsid i
AutoPropertyDescriptorRooter desc2(cx, desc);
PIERCE(cx, wrapper, SET,
cx->compartment->wrapId(cx, &id) && cx->compartment->wrap(cx, &desc2),
DirectWrapper::defineProperty(cx, wrapper, id, &desc2),
Wrapper::defineProperty(cx, wrapper, id, &desc2),
NOTHING);
}
@ -447,7 +443,7 @@ CrossCompartmentWrapper::getOwnPropertyNames(JSContext *cx, JSObject *wrapper, A
{
PIERCE(cx, wrapper, GET,
NOTHING,
DirectWrapper::getOwnPropertyNames(cx, wrapper, props),
Wrapper::getOwnPropertyNames(cx, wrapper, props),
cx->compartment->wrap(cx, props));
}
@ -456,7 +452,7 @@ CrossCompartmentWrapper::delete_(JSContext *cx, JSObject *wrapper, jsid id, bool
{
PIERCE(cx, wrapper, SET,
cx->compartment->wrapId(cx, &id),
DirectWrapper::delete_(cx, wrapper, id, bp),
Wrapper::delete_(cx, wrapper, id, bp),
NOTHING);
}
@ -465,7 +461,7 @@ CrossCompartmentWrapper::enumerate(JSContext *cx, JSObject *wrapper, AutoIdVecto
{
PIERCE(cx, wrapper, GET,
NOTHING,
DirectWrapper::enumerate(cx, wrapper, props),
Wrapper::enumerate(cx, wrapper, props),
cx->compartment->wrap(cx, props));
}
@ -474,7 +470,7 @@ CrossCompartmentWrapper::has(JSContext *cx, JSObject *wrapper, jsid id, bool *bp
{
PIERCE(cx, wrapper, GET,
cx->compartment->wrapId(cx, &id),
DirectWrapper::has(cx, wrapper, id, bp),
Wrapper::has(cx, wrapper, id, bp),
NOTHING);
}
@ -483,7 +479,7 @@ CrossCompartmentWrapper::hasOwn(JSContext *cx, JSObject *wrapper, jsid id, bool
{
PIERCE(cx, wrapper, GET,
cx->compartment->wrapId(cx, &id),
DirectWrapper::hasOwn(cx, wrapper, id, bp),
Wrapper::hasOwn(cx, wrapper, id, bp),
NOTHING);
}
@ -496,7 +492,7 @@ CrossCompartmentWrapper::get(JSContext *cx, JSObject *wrapperArg, JSObject *rece
RootedId id(cx, idArg);
PIERCE(cx, wrapper, GET,
cx->compartment->wrap(cx, receiver.address()) && cx->compartment->wrapId(cx, id.address()),
DirectWrapper::get(cx, wrapper, receiver, id, vp),
Wrapper::get(cx, wrapper, receiver, id, vp),
cx->compartment->wrap(cx, vp));
}
@ -511,7 +507,7 @@ CrossCompartmentWrapper::set(JSContext *cx, JSObject *wrapper_, JSObject *receiv
cx->compartment->wrap(cx, receiver.address()) &&
cx->compartment->wrapId(cx, id.address()) &&
cx->compartment->wrap(cx, value.address()),
DirectWrapper::set(cx, wrapper, receiver, id, strict, value.address()),
Wrapper::set(cx, wrapper, receiver, id, strict, value.address()),
NOTHING);
}
@ -520,7 +516,7 @@ CrossCompartmentWrapper::keys(JSContext *cx, JSObject *wrapper, AutoIdVector &pr
{
PIERCE(cx, wrapper, GET,
NOTHING,
DirectWrapper::keys(cx, wrapper, props),
Wrapper::keys(cx, wrapper, props),
cx->compartment->wrap(cx, props));
}
@ -607,7 +603,7 @@ CrossCompartmentWrapper::iterate(JSContext *cx, JSObject *wrapper, unsigned flag
{
PIERCE(cx, wrapper, GET,
NOTHING,
DirectWrapper::iterate(cx, wrapper, flags, vp),
Wrapper::iterate(cx, wrapper, flags, vp),
CanReify(vp) ? Reify(cx, cx->compartment, vp) : cx->compartment->wrap(cx, vp));
}
@ -627,7 +623,7 @@ CrossCompartmentWrapper::call(JSContext *cx, JSObject *wrapper_, unsigned argc,
if (!cx->compartment->wrap(cx, &argv[n]))
return false;
}
if (!DirectWrapper::call(cx, wrapper, argc, vp))
if (!Wrapper::call(cx, wrapper, argc, vp))
return false;
}
return cx->compartment->wrap(cx, vp);
@ -646,7 +642,7 @@ CrossCompartmentWrapper::construct(JSContext *cx, JSObject *wrapper_, unsigned a
if (!cx->compartment->wrap(cx, &argv[n]))
return false;
}
if (!DirectWrapper::construct(cx, wrapper, argc, argv, rval))
if (!Wrapper::construct(cx, wrapper, argc, argv, rval))
return false;
}
return cx->compartment->wrap(cx, rval);
@ -691,7 +687,7 @@ CrossCompartmentWrapper::hasInstance(JSContext *cx, HandleObject wrapper, Mutabl
AutoCompartment call(cx, wrappedObject(wrapper));
if (!cx->compartment->wrap(cx, v.address()))
return false;
return DirectWrapper::hasInstance(cx, wrapper, v, bp);
return Wrapper::hasInstance(cx, wrapper, v, bp);
}
JSString *
@ -700,7 +696,7 @@ CrossCompartmentWrapper::obj_toString(JSContext *cx, JSObject *wrapper)
JSString *str = NULL;
{
AutoCompartment call(cx, wrappedObject(wrapper));
str = DirectWrapper::obj_toString(cx, wrapper);
str = Wrapper::obj_toString(cx, wrapper);
if (!str)
return NULL;
}
@ -715,7 +711,7 @@ CrossCompartmentWrapper::fun_toString(JSContext *cx, JSObject *wrapper, unsigned
JSString *str = NULL;
{
AutoCompartment call(cx, wrappedObject(wrapper));
str = DirectWrapper::fun_toString(cx, wrapper, indent);
str = Wrapper::fun_toString(cx, wrapper, indent);
if (!str)
return NULL;
}
@ -728,13 +724,13 @@ bool
CrossCompartmentWrapper::regexp_toShared(JSContext *cx, JSObject *wrapper, RegExpGuard *g)
{
AutoCompartment call(cx, wrappedObject(wrapper));
return DirectWrapper::regexp_toShared(cx, wrapper, g);
return Wrapper::regexp_toShared(cx, wrapper, g);
}
bool
CrossCompartmentWrapper::defaultValue(JSContext *cx, JSObject *wrapper, JSType hint, Value *vp)
{
if (!DirectWrapper::defaultValue(cx, wrapper, hint, vp))
if (!Wrapper::defaultValue(cx, wrapper, hint, vp))
return false;
return cx->compartment->wrap(cx, vp);
}
@ -815,7 +811,7 @@ SecurityWrapper<Base>::regexp_toShared(JSContext *cx, JSObject *obj, RegExpGuard
}
template class js::SecurityWrapper<DirectWrapper>;
template class js::SecurityWrapper<Wrapper>;
template class js::SecurityWrapper<CrossCompartmentWrapper>;
namespace js {

View File

@ -26,7 +26,7 @@ class DummyFrameGuard;
* expect to expose this object via any kind of unwrapping operation). Callers
* should be careful to avoid unwrapping security wrappers in the wrong context.
*/
class JS_FRIEND_API(Wrapper)
class JS_FRIEND_API(Wrapper) : public DirectProxyHandler
{
unsigned mFlags;
@ -56,26 +56,10 @@ class JS_FRIEND_API(Wrapper)
static JSObject *wrappedObject(RawObject wrapper);
explicit Wrapper(unsigned flags);
unsigned flags() const {
return mFlags;
}
/*
* The function Wrapper::New takes a pointer to a Wrapper as the handler
* object. It then passes it on to the function NewProxyObject, which
* expects a pointer to a BaseProxyHandler as the handler object. We don't
* want to change Wrapper::New to take a pointer to a BaseProxyHandler,
* because that would allow the creation of wrappers with non-wrapper
* handlers. Unfortunately, we can't inherit Wrapper from BaseProxyHandler,
* since that would create a dreaded diamond, and we can't use dynamic_cast
* to cast Wrapper to BaseProxyHandler, since that would require us to
* compile with run time type information. Hence the need for this virtual
* function.
*/
virtual BaseProxyHandler *toBaseProxyHandler() = 0;
/* Policy enforcement traps.
*
* enter() allows the policy to specify whether the caller may perform |act|
@ -103,19 +87,10 @@ class JS_FRIEND_API(Wrapper)
*/
virtual bool enter(JSContext *cx, JSObject *wrapper, jsid id, Action act,
bool *bp);
};
/*
* DirectWrapper forwards its traps by forwarding them to DirectProxyHandler.
* In effect, DirectWrapper behaves the same as DirectProxyHandler, except that
* it adds policy enforcement checks to each trap.
*/
class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHandler
{
public:
explicit DirectWrapper(unsigned flags, bool hasPrototype = false);
explicit Wrapper(unsigned flags, bool hasPrototype = false);
virtual ~DirectWrapper();
virtual ~Wrapper();
virtual BaseProxyHandler* toBaseProxyHandler() {
return this;
@ -161,14 +136,14 @@ class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHandler
virtual bool defaultValue(JSContext *cx, JSObject *wrapper_, JSType hint,
Value *vp) MOZ_OVERRIDE;
static DirectWrapper singleton;
static DirectWrapper singletonWithPrototype;
static Wrapper singleton;
static Wrapper singletonWithPrototype;
static void *getWrapperFamily();
};
/* Base class for all cross compartment wrapper handlers. */
class JS_FRIEND_API(CrossCompartmentWrapper) : public DirectWrapper
class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper
{
public:
CrossCompartmentWrapper(unsigned flags, bool hasPrototype = false);
@ -233,7 +208,7 @@ class JS_FRIEND_API(SecurityWrapper) : public Base
virtual bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuard *g) MOZ_OVERRIDE;
};
typedef SecurityWrapper<DirectWrapper> SameCompartmentSecurityWrapper;
typedef SecurityWrapper<Wrapper> SameCompartmentSecurityWrapper;
typedef SecurityWrapper<CrossCompartmentWrapper> CrossCompartmentSecurityWrapper;
class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler

View File

@ -3281,7 +3281,7 @@ Wrap(JSContext *cx, unsigned argc, jsval *vp)
if (!JSObject::getProto(cx, obj, &proto))
return false;
JSObject *wrapped = Wrapper::New(cx, obj, proto, &obj->global(),
&DirectWrapper::singleton);
&Wrapper::singleton);
if (!wrapped)
return false;
@ -3305,7 +3305,7 @@ WrapWithProto(JSContext *cx, unsigned argc, jsval *vp)
JSObject *wrapped = Wrapper::New(cx, &obj.toObject(), proto.toObjectOrNull(),
&obj.toObject().global(),
&DirectWrapper::singletonWithPrototype);
&Wrapper::singletonWithPrototype);
if (!wrapped)
return false;

View File

@ -3057,9 +3057,9 @@ xpc::SandboxProxyHandler xpc::sandboxProxyHandler;
// A proxy handler that lets us wrap callables and invoke them with
// the correct this object, while forwarding all other operations down
// to them directly.
class SandboxCallableProxyHandler : public js::DirectWrapper {
class SandboxCallableProxyHandler : public js::Wrapper {
public:
SandboxCallableProxyHandler() : js::DirectWrapper(0)
SandboxCallableProxyHandler() : js::Wrapper(0)
{
}

View File

@ -29,7 +29,7 @@ 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.
DirectWrapper XrayWaiver(WrapperFactory::WAIVE_XRAY_WRAPPER_FLAG);
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
@ -560,9 +560,9 @@ WrapperFactory::WrapForSameCompartmentXray(JSContext *cx, JSObject *obj)
// Select the appropriate proxy handler.
Wrapper *wrapper = NULL;
if (type == XrayForWrappedNative)
wrapper = &XrayWrapper<DirectWrapper>::singleton;
wrapper = &XrayWrapper<Wrapper>::singleton;
else if (type == XrayForDOMObject)
wrapper = &XrayWrapper<DirectWrapper, DOMXrayTraits>::singleton;
wrapper = &XrayWrapper<Wrapper, DOMXrayTraits>::singleton;
else
MOZ_NOT_REACHED("Bad Xray type");

View File

@ -93,7 +93,7 @@ class WrapperFactory {
static bool XrayWrapperNotShadowing(JSObject *wrapper, jsid id);
};
extern js::DirectWrapper XrayWaiver;
extern js::Wrapper XrayWaiver;
}

View File

@ -1730,12 +1730,12 @@ template class XRAY;
/* Same-compartment non-filtering versions. */
#define XRAY XrayWrapper<DirectWrapper, XPCWrappedNativeXrayTraits >
#define XRAY XrayWrapper<Wrapper, XPCWrappedNativeXrayTraits >
template <> XRAY XRAY::singleton(0);
template class XRAY;
#undef XRAY
#define XRAY XrayWrapper<DirectWrapper, DOMXrayTraits >
#define XRAY XrayWrapper<Wrapper, DOMXrayTraits >
template <> XRAY XRAY::singleton(0);
template class XRAY;
#undef XRAY

View File

@ -95,9 +95,9 @@ class XrayWrapper : public Base {
typedef XrayWrapper<js::CrossCompartmentWrapper, DOMXrayTraits > XrayDOM;
class SandboxProxyHandler : public js::DirectWrapper {
class SandboxProxyHandler : public js::Wrapper {
public:
SandboxProxyHandler() : js::DirectWrapper(0)
SandboxProxyHandler() : js::Wrapper(0)
{
}