2010-07-02 14:09:48 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
* vim: set ts=4 sw=4 et tw=99 ft=cpp:
|
|
|
|
*
|
2012-05-21 04:12:37 -07:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-07-02 14:09:48 -07:00
|
|
|
|
|
|
|
#include "nsJSPrincipals.h"
|
|
|
|
|
|
|
|
#include "XPCWrapper.h"
|
|
|
|
|
2012-07-16 10:22:51 -07:00
|
|
|
#include "WaiveXrayWrapper.h"
|
2011-08-06 14:05:25 -07:00
|
|
|
#include "AccessCheck.h"
|
2010-10-10 15:48:29 -07:00
|
|
|
#include "WrapperFactory.h"
|
|
|
|
|
2010-07-02 14:09:48 -07:00
|
|
|
namespace xpc {
|
|
|
|
|
2012-07-16 08:53:16 -07:00
|
|
|
WaiveXrayWrapper::WaiveXrayWrapper(unsigned flags) : js::CrossCompartmentWrapper(flags)
|
2010-07-02 14:09:48 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-07-16 08:53:16 -07:00
|
|
|
WaiveXrayWrapper::~WaiveXrayWrapper()
|
2010-07-02 14:09:48 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-10-10 15:48:29 -07:00
|
|
|
bool
|
2012-07-16 08:53:16 -07:00
|
|
|
WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
2013-01-03 13:31:36 -08:00
|
|
|
js::PropertyDescriptor *desc, unsigned flags)
|
2010-10-10 15:48:29 -07:00
|
|
|
{
|
2013-01-03 13:31:36 -08:00
|
|
|
return CrossCompartmentWrapper::getPropertyDescriptor(cx, wrapper, id, desc, flags) &&
|
2011-09-20 11:40:24 -07:00
|
|
|
WrapperFactory::WaiveXrayAndWrap(cx, &desc->value);
|
2010-10-10 15:48:29 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2012-07-16 08:53:16 -07:00
|
|
|
WaiveXrayWrapper::getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
2013-01-03 13:31:36 -08:00
|
|
|
js::PropertyDescriptor *desc, unsigned flags)
|
2010-10-10 15:48:29 -07:00
|
|
|
{
|
2013-01-03 13:31:36 -08:00
|
|
|
return CrossCompartmentWrapper::getOwnPropertyDescriptor(cx, wrapper, id, desc, flags) &&
|
2011-09-20 11:40:24 -07:00
|
|
|
WrapperFactory::WaiveXrayAndWrap(cx, &desc->value);
|
2010-10-10 15:48:29 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2012-07-16 08:53:16 -07:00
|
|
|
WaiveXrayWrapper::get(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id,
|
2010-10-10 15:48:29 -07:00
|
|
|
js::Value *vp)
|
|
|
|
{
|
2011-09-08 20:29:15 -07:00
|
|
|
return CrossCompartmentWrapper::get(cx, wrapper, receiver, id, vp) &&
|
2011-09-20 11:40:24 -07:00
|
|
|
WrapperFactory::WaiveXrayAndWrap(cx, vp);
|
2010-10-10 15:48:29 -07:00
|
|
|
}
|
|
|
|
|
2010-12-03 19:00:23 -08:00
|
|
|
bool
|
2012-07-16 08:53:16 -07:00
|
|
|
WaiveXrayWrapper::call(JSContext *cx, JSObject *wrapper, unsigned argc, js::Value *vp)
|
2010-12-03 19:00:23 -08:00
|
|
|
{
|
2011-09-08 20:29:15 -07:00
|
|
|
return CrossCompartmentWrapper::call(cx, wrapper, argc, vp) &&
|
2011-09-20 11:40:24 -07:00
|
|
|
WrapperFactory::WaiveXrayAndWrap(cx, vp);
|
2010-12-03 19:00:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2012-07-16 08:53:16 -07:00
|
|
|
WaiveXrayWrapper::construct(JSContext *cx, JSObject *wrapper,
|
2012-02-28 15:11:11 -08:00
|
|
|
unsigned argc, js::Value *argv, js::Value *rval)
|
2010-12-03 19:00:23 -08:00
|
|
|
{
|
2011-09-08 20:29:15 -07:00
|
|
|
return CrossCompartmentWrapper::construct(cx, wrapper, argc, argv, rval) &&
|
2011-09-20 11:40:24 -07:00
|
|
|
WrapperFactory::WaiveXrayAndWrap(cx, rval);
|
2010-12-03 19:00:23 -08:00
|
|
|
}
|
|
|
|
|
2010-07-02 14:09:48 -07:00
|
|
|
}
|