Backout changeset 20b0bce4c165 (bug 703537) under the suspicion of breaking Linux32 mochitest-chrome without framepointers

This commit is contained in:
Ehsan Akhgari 2012-07-04 19:24:04 -04:00
Родитель 08d847e633
Коммит e5bda87adc
5 изменённых файлов: 29 добавлений и 100 удалений

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

@ -15,36 +15,7 @@ namespace js {
class Wrapper;
/*
* A proxy is a JSObject that implements generic behavior by providing custom
* implementations for each object trap. The implementation for each trap is
* provided by a C++ object stored on the proxy, known as its handler.
*
* A major use case for proxies is to forward each trap to another JSObject,
* known as its target. Not every proxy have the notion of a target, however.
*
* Proxy traps are grouped into fundamental and derived traps. Every proxy has
* to at least provide implementations for the fundamental traps, but the
* derived traps can be implemented in terms of the fundamental ones.
*
* To minimize code duplication, a set of abstract proxy handler classes is
* provided, from which other handlers may inherit. These abstract classes
* are organized in the following hierarchy:
*
* BaseProxyHandler
* |
* IndirectProxyHandler
* |
* DirectProxyHandler
*/
/*
* BaseProxyHandler is the most generic kind of proxy handler. It does not have
* the notion of a target. Consequently, it does not provide any default
* implementation for the fundamental traps. It does, however, implement the
* derived traps in terms of the fundamental ones. This allows consumers of this
* class to define any custom behavior they want.
*/
/* Base class for all C++ proxy handlers. */
class JS_FRIEND_API(BaseProxyHandler) {
void *mFamily;
public:
@ -74,29 +45,24 @@ class JS_FRIEND_API(BaseProxyHandler) {
}
/* ES5 Harmony fundamental proxy traps. */
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id,
bool set, PropertyDescriptor *desc) = 0;
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy,
jsid id, bool set,
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, bool set,
PropertyDescriptor *desc) = 0;
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, bool set,
PropertyDescriptor *desc) = 0;
virtual bool defineProperty(JSContext *cx, JSObject *proxy, jsid id,
PropertyDescriptor *desc) = 0;
virtual bool getOwnPropertyNames(JSContext *cx, JSObject *proxy,
AutoIdVector &props) = 0;
virtual bool getOwnPropertyNames(JSContext *cx, JSObject *proxy, AutoIdVector &props) = 0;
virtual bool delete_(JSContext *cx, JSObject *proxy, jsid id, bool *bp) = 0;
virtual bool enumerate(JSContext *cx, JSObject *proxy,
AutoIdVector &props) = 0;
virtual bool enumerate(JSContext *cx, JSObject *proxy, AutoIdVector &props) = 0;
/* ES5 Harmony derived proxy traps. */
virtual bool has(JSContext *cx, JSObject *proxy, jsid id, bool *bp);
virtual bool hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp);
virtual bool get(JSContext *cx, JSObject *proxy, JSObject *receiver,
jsid id, Value *vp);
virtual bool set(JSContext *cx, JSObject *proxy, JSObject *receiver,
jsid id, bool strict, Value *vp);
virtual bool get(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, Value *vp);
virtual bool set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, bool strict,
Value *vp);
virtual bool keys(JSContext *cx, JSObject *proxy, AutoIdVector &props);
virtual bool iterate(JSContext *cx, JSObject *proxy, unsigned flags,
Value *vp);
virtual bool iterate(JSContext *cx, JSObject *proxy, unsigned flags, Value *vp);
/* Spidermonkey extensions. */
virtual bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value *vp);
@ -115,14 +81,6 @@ class JS_FRIEND_API(BaseProxyHandler) {
uint32_t index, Value *vp, bool *present);
};
/*
* IndirectProxyHandler assumes the existence of a target. Consequently, it
* provides default implementations for the fundamental traps that forward their
* behavior to the target. The derived traps, however, are inherited from
* BaseProxyHandler, and therefore still implemented in terms of the fundamental
* ones. This allows consumers of this class to define custom behavior without
* implementing the entire gamut of proxy traps.
*/
class JS_PUBLIC_API(IndirectProxyHandler) : public BaseProxyHandler {
public:
explicit IndirectProxyHandler(void *family);
@ -143,6 +101,8 @@ class JS_PUBLIC_API(IndirectProxyHandler) : public BaseProxyHandler {
virtual bool enumerate(JSContext *cx, JSObject *proxy,
AutoIdVector &props) MOZ_OVERRIDE;
/* Derived traps are implemented in terms of fundamental traps */
/* Spidermonkey extensions. */
virtual bool call(JSContext *cx, JSObject *proxy, unsigned argc,
Value *vp) MOZ_OVERRIDE;
@ -166,14 +126,6 @@ class JS_PUBLIC_API(IndirectProxyHandler) : public BaseProxyHandler {
Value *vp) MOZ_OVERRIDE;
};
/*
* DirectProxyHandler has the same assumptions about the target as its base,
* IndirectProxyHandler. Its fundamental traps are inherited from this class,
* and therefore forward their behavior to the target. The derived traps,
* however, are overrided so that, they too, forward their behavior to the
* target. This allows consumers of this class to forward to another object as
* transparently as possible.
*/
class JS_PUBLIC_API(DirectProxyHandler) : public IndirectProxyHandler {
public:
explicit DirectProxyHandler(void *family);

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

@ -125,7 +125,7 @@ js::IsCrossCompartmentWrapper(const JSObject *wrapper)
!!(Wrapper::wrapperHandler(wrapper)->flags() & Wrapper::CROSS_COMPARTMENT);
}
IndirectWrapper::IndirectWrapper(unsigned flags) : Wrapper(flags),
AbstractWrapper::AbstractWrapper(unsigned flags) : Wrapper(flags),
IndirectProxyHandler(&sWrapperFamily)
{
}
@ -144,7 +144,7 @@ IndirectWrapper::IndirectWrapper(unsigned flags) : Wrapper(flags),
#define GET(action) CHECKED(action, GET)
bool
IndirectWrapper::getPropertyDescriptor(JSContext *cx, JSObject *wrapper,
AbstractWrapper::getPropertyDescriptor(JSContext *cx, JSObject *wrapper,
jsid id, bool set,
PropertyDescriptor *desc)
{
@ -154,7 +154,7 @@ IndirectWrapper::getPropertyDescriptor(JSContext *cx, JSObject *wrapper,
}
bool
IndirectWrapper::getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper,
AbstractWrapper::getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper,
jsid id, bool set,
PropertyDescriptor *desc)
{
@ -163,14 +163,14 @@ IndirectWrapper::getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper,
}
bool
IndirectWrapper::defineProperty(JSContext *cx, JSObject *wrapper, jsid id,
AbstractWrapper::defineProperty(JSContext *cx, JSObject *wrapper, jsid id,
PropertyDescriptor *desc)
{
SET(IndirectProxyHandler::defineProperty(cx, wrapper, id, desc));
}
bool
IndirectWrapper::getOwnPropertyNames(JSContext *cx, JSObject *wrapper,
AbstractWrapper::getOwnPropertyNames(JSContext *cx, JSObject *wrapper,
AutoIdVector &props)
{
// if we refuse to perform this action, props remains empty
@ -179,14 +179,14 @@ IndirectWrapper::getOwnPropertyNames(JSContext *cx, JSObject *wrapper,
}
bool
IndirectWrapper::delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
AbstractWrapper::delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
{
*bp = true; // default result if we refuse to perform this action
SET(IndirectProxyHandler::delete_(cx, wrapper, id, bp));
}
bool
IndirectWrapper::enumerate(JSContext *cx, JSObject *wrapper, AutoIdVector &props)
AbstractWrapper::enumerate(JSContext *cx, JSObject *wrapper, AutoIdVector &props)
{
// if we refuse to perform this action, props remains empty
static jsid id = JSID_VOID;

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

@ -17,27 +17,7 @@ namespace js {
class DummyFrameGuard;
/*
* A wrapper is essentially a proxy that restricts access to certain traps. The
* way in which a wrapper restricts access to its traps depends on the
* particular policy for that wrapper. To allow a wrapper's policy to be
* customized, the Wrapper base class contains two functions, enter/leave, which
* are called as a policy enforcement check before/after each trap is forwarded.
*
* To minimize code duplication, a set of abstract wrapper classes is
* provided, from which other wrappers may inherit. These abstract classes are
* organized in the following hierarchy:
*
* BaseProxyHandler Wrapper
* | | |
* IndirectProxyHandler | |
* | | | |
* | IndirectWrapper |
* | |
* DirectProxyHandler |
* | |
* DirectWrapper
*/
/* Base class for all C++ wrappers. */
class JS_FRIEND_API(Wrapper)
{
unsigned mFlags;
@ -124,16 +104,14 @@ class JS_FRIEND_API(Wrapper)
};
/*
* IndirectWrapper forwards its traps by forwarding them to
* IndirectProxyHandler. In effect, IndirectWrapper behaves the same as
* IndirectProxyHandler, except that it adds policy enforcement checks to each
* fundamental trap.
* AbstractWrappers forward their fundamental traps to the wrapped object, and
* implement their derived traps in terms of the fundamental traps.
*/
class JS_FRIEND_API(IndirectWrapper) : public Wrapper,
class JS_FRIEND_API(AbstractWrapper) : public Wrapper,
public IndirectProxyHandler
{
public:
explicit IndirectWrapper(unsigned flags);
explicit AbstractWrapper(unsigned flags);
virtual BaseProxyHandler* toBaseProxyHandler() {
return this;
@ -161,9 +139,8 @@ class JS_FRIEND_API(IndirectWrapper) : public Wrapper,
};
/*
* 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.
* DirectWrappers forward both their fundamental and derived traps to the
* wrapped object.
*/
class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHandler
{

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

@ -458,7 +458,7 @@ static inline JSObject *
FindWrapper(JSObject *wrapper)
{
while (!js::IsWrapper(wrapper) ||
!(Wrapper::wrapperHandler(wrapper)->flags() &
!(AbstractWrapper::wrapperHandler(wrapper)->flags() &
WrapperFactory::IS_XRAY_WRAPPER_FLAG)) {
if (js::IsWrapper(wrapper) &&
js::GetProxyHandler(wrapper) == &sandboxProxyHandler) {

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

@ -86,9 +86,9 @@ class XrayWrapper : public Base {
typedef XrayWrapper<js::CrossCompartmentWrapper, ProxyXrayTraits > XrayProxy;
typedef XrayWrapper<js::CrossCompartmentWrapper, DOMXrayTraits > XrayDOM;
class SandboxProxyHandler : public js::IndirectWrapper {
class SandboxProxyHandler : public js::AbstractWrapper {
public:
SandboxProxyHandler() : js::IndirectWrapper(0)
SandboxProxyHandler() : js::AbstractWrapper(0)
{
}