Bug 1941128 - Turn off network.dns.native_https_query on Mac again
[gecko.git] / js / xpconnect / wrappers / FilteringWrapper.h
blob620837cc1b7121d1298ebfda93414a0bba1266db
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 #ifndef __FilteringWrapper_h__
8 #define __FilteringWrapper_h__
10 #include "XrayWrapper.h"
11 #include "mozilla/Attributes.h"
12 #include "mozilla/Maybe.h"
13 #include "js/CallNonGenericMethod.h"
14 #include "js/Wrapper.h"
16 namespace xpc {
18 template <typename Base, typename Policy>
19 class FilteringWrapper : public Base {
20 public:
21 constexpr explicit FilteringWrapper(unsigned flags) : Base(flags) {}
23 virtual bool enter(JSContext* cx, JS::Handle<JSObject*> wrapper,
24 JS::Handle<jsid> id, js::Wrapper::Action act,
25 bool mayThrow, bool* bp) const override;
27 virtual bool getOwnPropertyDescriptor(
28 JSContext* cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
29 JS::MutableHandle<mozilla::Maybe<JS::PropertyDescriptor>> desc)
30 const override;
31 virtual bool ownPropertyKeys(JSContext* cx, JS::Handle<JSObject*> wrapper,
32 JS::MutableHandleIdVector props) const override;
34 virtual bool getOwnEnumerablePropertyKeys(
35 JSContext* cx, JS::Handle<JSObject*> wrapper,
36 JS::MutableHandleIdVector props) const override;
37 virtual bool enumerate(JSContext* cx, JS::Handle<JSObject*> wrapper,
38 JS::MutableHandleIdVector props) const override;
40 virtual bool call(JSContext* cx, JS::Handle<JSObject*> wrapper,
41 const JS::CallArgs& args) const override;
42 virtual bool construct(JSContext* cx, JS::Handle<JSObject*> wrapper,
43 const JS::CallArgs& args) const override;
45 virtual bool nativeCall(JSContext* cx, JS::IsAcceptableThis test,
46 JS::NativeImpl impl,
47 const JS::CallArgs& args) const override;
49 virtual bool getPrototype(JSContext* cx, JS::HandleObject wrapper,
50 JS::MutableHandleObject protop) const override;
52 static const FilteringWrapper singleton;
55 } // namespace xpc
57 #endif /* __FilteringWrapper_h__ */