Bug 803068 - Manually grab the BaseProxyHandler derived traps in SandboxProxyHandler. r=ejpbruel

Let's just bite the bullet and do this here. It will let us get rid of
IndirectProxyHandler, which has really overcomplicated our proxy hierarchy.

--HG--
extra : rebase_source : 7e81529936bc256d672e40537eb6abca6374e52c
This commit is contained in:
Bobby Holley 2012-10-29 16:52:53 +01:00
Родитель 2412de3249
Коммит b871af67e5
2 изменённых файлов: 61 добавлений и 4 удалений

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

@ -3219,6 +3219,51 @@ xpc::SandboxProxyHandler::getOwnPropertyDescriptor(JSContext *cx,
return true;
}
/*
* Reuse the BaseProxyHandler versions of the derived traps that are implemented
* in terms of the fundamental traps.
*/
bool
xpc::SandboxProxyHandler::has(JSContext *cx, JSObject *proxy, jsid id, bool *bp)
{
return BaseProxyHandler::has(cx, proxy, id, bp);
}
bool
xpc::SandboxProxyHandler::hasOwn(JSContext *cx, JSObject *proxy, jsid id,
bool *bp)
{
return BaseProxyHandler::hasOwn(cx, proxy, id, bp);
}
bool
xpc::SandboxProxyHandler::get(JSContext *cx, JSObject *proxy, JSObject *receiver,
jsid id, Value *vp)
{
return BaseProxyHandler::get(cx, proxy, receiver, id, vp);
}
bool
xpc::SandboxProxyHandler::set(JSContext *cx, JSObject *proxy, JSObject *receiver,
jsid id, bool strict, Value *vp)
{
return BaseProxyHandler::set(cx, proxy, receiver, id, strict, vp);
}
bool
xpc::SandboxProxyHandler::keys(JSContext *cx, JSObject *proxy,
AutoIdVector &props)
{
return BaseProxyHandler::keys(cx, proxy, props);
}
bool
xpc::SandboxProxyHandler::iterate(JSContext *cx, JSObject *proxy, unsigned flags,
Value *vp)
{
return BaseProxyHandler::iterate(cx, proxy, flags, vp);
}
nsresult
xpc_CreateSandboxObject(JSContext *cx, jsval *vp, nsISupports *prinOrSop, SandboxOptions& options)
{

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

@ -95,17 +95,29 @@ class XrayWrapper : public Base {
typedef XrayWrapper<js::CrossCompartmentWrapper, DOMXrayTraits > XrayDOM;
class SandboxProxyHandler : public js::IndirectWrapper {
class SandboxProxyHandler : public js::DirectWrapper {
public:
SandboxProxyHandler() : js::IndirectWrapper(0)
SandboxProxyHandler() : js::DirectWrapper(0)
{
}
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id,
bool set, js::PropertyDescriptor *desc);
bool set, js::PropertyDescriptor *desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy,
jsid id, bool set,
js::PropertyDescriptor *desc);
js::PropertyDescriptor *desc) MOZ_OVERRIDE;
// We just forward the derived traps to the BaseProxyHandler versions which
// implement them in terms of the fundamental traps.
virtual bool has(JSContext *cx, JSObject *proxy, jsid id, bool *bp) MOZ_OVERRIDE;
virtual bool hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp) MOZ_OVERRIDE;
virtual bool get(JSContext *cx, JSObject *proxy, JSObject *receiver,
jsid id, JS::Value *vp) MOZ_OVERRIDE;
virtual bool set(JSContext *cx, JSObject *proxy, JSObject *receiver,
jsid id, bool strict, JS::Value *vp) MOZ_OVERRIDE;
virtual bool keys(JSContext *cx, JSObject *proxy, JS::AutoIdVector &props) MOZ_OVERRIDE;
virtual bool iterate(JSContext *cx, JSObject *proxy, unsigned flags,
JS::Value *vp) MOZ_OVERRIDE;
};
extern SandboxProxyHandler sandboxProxyHandler;