/work/obj-fuzz/dist/include/mozilla/dom/PermissionsBinding.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM Permissions.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #ifndef mozilla_dom_PermissionsBinding_h |
4 | | #define mozilla_dom_PermissionsBinding_h |
5 | | |
6 | | #include "GeckoProfiler.h" |
7 | | #include "js/RootingAPI.h" |
8 | | #include "jspubtd.h" |
9 | | #include "mozilla/ErrorResult.h" |
10 | | #include "mozilla/dom/BindingDeclarations.h" |
11 | | #include "mozilla/dom/Nullable.h" |
12 | | #include "mozilla/dom/PrototypeList.h" |
13 | | |
14 | | namespace mozilla { |
15 | | namespace dom { |
16 | | |
17 | | struct NativePropertyHooks; |
18 | | struct PermissionDescriptorAtoms; |
19 | | class Permissions; |
20 | | struct PermissionsAtoms; |
21 | | class ProtoAndIfaceCache; |
22 | | |
23 | | } // namespace dom |
24 | | } // namespace mozilla |
25 | | |
26 | | namespace mozilla { |
27 | | namespace dom { |
28 | | |
29 | | enum class PermissionName : uint8_t { |
30 | | Geolocation, |
31 | | Notifications, |
32 | | Push, |
33 | | Persistent_storage, |
34 | | EndGuard_ |
35 | | }; |
36 | | |
37 | | namespace PermissionNameValues { |
38 | | extern const EnumEntry strings[5]; |
39 | | } // namespace PermissionNameValues |
40 | | |
41 | | bool |
42 | | ToJSValue(JSContext* aCx, PermissionName aArgument, JS::MutableHandle<JS::Value> aValue); |
43 | | |
44 | | |
45 | | struct PermissionDescriptor : public DictionaryBase |
46 | | { |
47 | | MOZ_INIT_OUTSIDE_CTOR PermissionName mName; |
48 | | |
49 | | PermissionDescriptor(); |
50 | | |
51 | | explicit inline PermissionDescriptor(const FastDictionaryInitializer& ) |
52 | 0 | { |
53 | 0 | // Do nothing here; this is used by our "Fast" subclass |
54 | 0 | } |
55 | | |
56 | | explicit inline PermissionDescriptor(const PermissionDescriptor& aOther) |
57 | 0 | { |
58 | 0 | *this = aOther; |
59 | 0 | } |
60 | | |
61 | | bool |
62 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
63 | | |
64 | | bool |
65 | | Init(const nsAString& aJSON); |
66 | | |
67 | | bool |
68 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
69 | | |
70 | | bool |
71 | | ToJSON(nsAString& aJSON) const; |
72 | | |
73 | | void |
74 | | TraceDictionary(JSTracer* trc); |
75 | | |
76 | | PermissionDescriptor& |
77 | | operator=(const PermissionDescriptor& aOther); |
78 | | |
79 | | private: |
80 | | static bool |
81 | | InitIds(JSContext* cx, PermissionDescriptorAtoms* atomsCache); |
82 | | }; |
83 | | |
84 | | namespace binding_detail { |
85 | | struct FastPermissionDescriptor : public PermissionDescriptor |
86 | | { |
87 | | inline FastPermissionDescriptor() |
88 | | : PermissionDescriptor(FastDictionaryInitializer()) |
89 | 0 | { |
90 | 0 | // Doesn't matter what int we pass to the parent constructor |
91 | 0 | } |
92 | | }; |
93 | | } // namespace binding_detail |
94 | | |
95 | | |
96 | | namespace Permissions_Binding { |
97 | | |
98 | | typedef mozilla::dom::Permissions NativeType; |
99 | | |
100 | | const JSClass* |
101 | | GetJSClass(); |
102 | | |
103 | | bool |
104 | | Wrap(JSContext* aCx, mozilla::dom::Permissions* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
105 | | |
106 | | template <class T> |
107 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
108 | 0 | { |
109 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
110 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
111 | 0 | } |
112 | | |
113 | | // We declare this as an array so that retrieving a pointer to this |
114 | | // binding's property hooks only requires compile/link-time resolvable |
115 | | // address arithmetic. Declaring it as a pointer instead would require |
116 | | // doing a run-time load to fetch a pointer to this binding's property |
117 | | // hooks. And then structures which embedded a pointer to this structure |
118 | | // would require a run-time load for proper initialization, which would |
119 | | // then induce static constructors. Lots of static constructors. |
120 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
121 | | |
122 | | void |
123 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
124 | | |
125 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
126 | 0 | { |
127 | 0 | /* Get the interface prototype object for this class. This will create the |
128 | 0 | object as needed. */ |
129 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::Permissions, |
130 | 0 | &CreateInterfaceObjects, |
131 | 0 | /* aDefineOnGlobal = */ true); |
132 | 0 |
|
133 | 0 | } |
134 | | |
135 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
136 | 0 | { |
137 | 0 | /* Get the interface object for this class. This will create the object as |
138 | 0 | needed. */ |
139 | 0 |
|
140 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::Permissions, |
141 | 0 | &CreateInterfaceObjects, |
142 | 0 | aDefineOnGlobal); |
143 | 0 | } |
144 | | |
145 | | JSObject* |
146 | | GetConstructorObject(JSContext* aCx); |
147 | | |
148 | | } // namespace Permissions_Binding |
149 | | |
150 | | |
151 | | |
152 | | } // namespace dom |
153 | | } // namespace mozilla |
154 | | |
155 | | #endif // mozilla_dom_PermissionsBinding_h |