1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "ChromeObjectWrapper.h"
8 #include "WrapperFactory.h"
9 #include "AccessCheck.h"
10 #include "xpcprivate.h"
12 #include "js/Wrapper.h"
13 #include "nsXULAppAPI.h"
19 const ChromeObjectWrapper
ChromeObjectWrapper::singleton
;
21 bool ChromeObjectWrapper::defineProperty(JSContext
* cx
, HandleObject wrapper
,
23 Handle
<PropertyDescriptor
> desc
,
24 ObjectOpResult
& result
) const {
25 if (desc
.hasValue() &&
26 !AccessCheck::checkPassToPrivilegedCode(cx
, wrapper
, desc
.value())) {
29 return ChromeObjectWrapperBase::defineProperty(cx
, wrapper
, id
, desc
, result
);
32 bool ChromeObjectWrapper::set(JSContext
* cx
, HandleObject wrapper
, HandleId id
,
33 HandleValue v
, HandleValue receiver
,
34 ObjectOpResult
& result
) const {
35 if (!AccessCheck::checkPassToPrivilegedCode(cx
, wrapper
, v
)) {
38 return ChromeObjectWrapperBase::set(cx
, wrapper
, id
, v
, receiver
, result
);