2010-07-03 01:09:48 +04: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 15:12:37 +04: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-03 01:09:48 +04:00
|
|
|
|
|
|
|
#include "nsJSPrincipals.h"
|
|
|
|
|
|
|
|
#include "XPCWrapper.h"
|
|
|
|
|
2012-07-16 21:22:51 +04:00
|
|
|
#include "WaiveXrayWrapper.h"
|
2011-08-07 01:05:25 +04:00
|
|
|
#include "AccessCheck.h"
|
2010-10-11 02:48:29 +04:00
|
|
|
#include "WrapperFactory.h"
|
|
|
|
|
2010-07-03 01:09:48 +04:00
|
|
|
namespace xpc {
|
|
|
|
|
2012-07-16 19:53:16 +04:00
|
|
|
WaiveXrayWrapper::WaiveXrayWrapper(unsigned flags) : js::CrossCompartmentWrapper(flags)
|
2010-07-03 01:09:48 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-07-16 19:53:16 +04:00
|
|
|
WaiveXrayWrapper::~WaiveXrayWrapper()
|
2010-07-03 01:09:48 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-10-11 02:48:29 +04:00
|
|
|
bool
|
2013-03-22 02:23:47 +04:00
|
|
|
WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *>wrapper,
|
|
|
|
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
|
|
|
unsigned flags)
|
2010-10-11 02:48:29 +04:00
|
|
|
{
|
2013-01-04 01:31:36 +04:00
|
|
|
return CrossCompartmentWrapper::getPropertyDescriptor(cx, wrapper, id, desc, flags) &&
|
2011-09-20 22:40:24 +04:00
|
|
|
WrapperFactory::WaiveXrayAndWrap(cx, &desc->value);
|
2010-10-11 02:48:29 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-03-22 02:23:47 +04:00
|
|
|
WaiveXrayWrapper::getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
|
|
|
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
|
|
|
unsigned flags)
|
2010-10-11 02:48:29 +04:00
|
|
|
{
|
2013-01-04 01:31:36 +04:00
|
|
|
return CrossCompartmentWrapper::getOwnPropertyDescriptor(cx, wrapper, id, desc, flags) &&
|
2011-09-20 22:40:24 +04:00
|
|
|
WrapperFactory::WaiveXrayAndWrap(cx, &desc->value);
|
2010-10-11 02:48:29 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2012-07-16 19:53:16 +04:00
|
|
|
WaiveXrayWrapper::get(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id,
|
2010-10-11 02:48:29 +04:00
|
|
|
js::Value *vp)
|
|
|
|
{
|
2011-09-09 07:29:15 +04:00
|
|
|
return CrossCompartmentWrapper::get(cx, wrapper, receiver, id, vp) &&
|
2011-09-20 22:40:24 +04:00
|
|
|
WrapperFactory::WaiveXrayAndWrap(cx, vp);
|
2010-10-11 02:48:29 +04:00
|
|
|
}
|
|
|
|
|
2010-12-04 06:00:23 +03:00
|
|
|
bool
|
2012-07-16 19:53:16 +04:00
|
|
|
WaiveXrayWrapper::call(JSContext *cx, JSObject *wrapper, unsigned argc, js::Value *vp)
|
2010-12-04 06:00:23 +03:00
|
|
|
{
|
2011-09-09 07:29:15 +04:00
|
|
|
return CrossCompartmentWrapper::call(cx, wrapper, argc, vp) &&
|
2011-09-20 22:40:24 +04:00
|
|
|
WrapperFactory::WaiveXrayAndWrap(cx, vp);
|
2010-12-04 06:00:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2012-07-16 19:53:16 +04:00
|
|
|
WaiveXrayWrapper::construct(JSContext *cx, JSObject *wrapper,
|
2012-02-29 03:11:11 +04:00
|
|
|
unsigned argc, js::Value *argv, js::Value *rval)
|
2010-12-04 06:00:23 +03:00
|
|
|
{
|
2011-09-09 07:29:15 +04:00
|
|
|
return CrossCompartmentWrapper::construct(cx, wrapper, argc, argv, rval) &&
|
2011-09-20 22:40:24 +04:00
|
|
|
WrapperFactory::WaiveXrayAndWrap(cx, rval);
|
2010-12-04 06:00:23 +03:00
|
|
|
}
|
|
|
|
|
2010-07-03 01:09:48 +04:00
|
|
|
}
|