/src/mozilla-central/js/xpconnect/wrappers/ChromeObjectWrapper.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* vim: set ts=8 sts=4 et sw=4 tw=99: */ |
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/. */ |
6 | | |
7 | | #include "ChromeObjectWrapper.h" |
8 | | #include "WrapperFactory.h" |
9 | | #include "AccessCheck.h" |
10 | | #include "xpcprivate.h" |
11 | | #include "jsapi.h" |
12 | | #include "js/Wrapper.h" |
13 | | #include "nsXULAppAPI.h" |
14 | | |
15 | | using namespace JS; |
16 | | |
17 | | namespace xpc { |
18 | | |
19 | | const ChromeObjectWrapper ChromeObjectWrapper::singleton; |
20 | | |
21 | | bool |
22 | | ChromeObjectWrapper::defineProperty(JSContext* cx, HandleObject wrapper, |
23 | | HandleId id, |
24 | | Handle<PropertyDescriptor> desc, |
25 | | ObjectOpResult& result) const |
26 | 0 | { |
27 | 0 | if (!AccessCheck::checkPassToPrivilegedCode(cx, wrapper, desc.value())) { |
28 | 0 | return false; |
29 | 0 | } |
30 | 0 | return ChromeObjectWrapperBase::defineProperty(cx, wrapper, id, desc, result); |
31 | 0 | } |
32 | | |
33 | | bool |
34 | | ChromeObjectWrapper::set(JSContext* cx, HandleObject wrapper, HandleId id, HandleValue v, |
35 | | HandleValue receiver, ObjectOpResult& result) const |
36 | 0 | { |
37 | 0 | if (!AccessCheck::checkPassToPrivilegedCode(cx, wrapper, v)) { |
38 | 0 | return false; |
39 | 0 | } |
40 | 0 | return ChromeObjectWrapperBase::set(cx, wrapper, id, v, receiver, result); |
41 | 0 | } |
42 | | |
43 | | } // namespace xpc |