/work/obj-fuzz/dist/include/mozilla/dom/XULPopupElementBinding.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM XULPopupElement.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #ifndef mozilla_dom_XULPopupElementBinding_h |
4 | | #define mozilla_dom_XULPopupElementBinding_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/Event.h" |
12 | | #include "mozilla/dom/FakeString.h" |
13 | | #include "mozilla/dom/Nullable.h" |
14 | | #include "mozilla/dom/PrototypeList.h" |
15 | | #include "mozilla/dom/UnionMember.h" |
16 | | |
17 | | namespace mozilla { |
18 | | namespace dom { |
19 | | |
20 | | class Event; |
21 | | struct NativePropertyHooks; |
22 | | struct OpenPopupOptionsAtoms; |
23 | | class OwningStringOrOpenPopupOptions; |
24 | | class ProtoAndIfaceCache; |
25 | | class XULPopupElement; |
26 | | struct XULPopupElementAtoms; |
27 | | |
28 | | } // namespace dom |
29 | | } // namespace mozilla |
30 | | |
31 | | namespace mozilla { |
32 | | namespace dom { |
33 | | |
34 | | void |
35 | | ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningStringOrOpenPopupOptions& aUnion, const char* aName, uint32_t aFlags = 0); |
36 | | |
37 | | |
38 | | void |
39 | | ImplCycleCollectionUnlink(OwningStringOrOpenPopupOptions& aUnion); |
40 | | |
41 | | |
42 | | struct OpenPopupOptions : public DictionaryBase |
43 | | { |
44 | | MOZ_INIT_OUTSIDE_CTOR bool mAttributesOverride; |
45 | | MOZ_INIT_OUTSIDE_CTOR bool mIsContextMenu; |
46 | | MOZ_INIT_OUTSIDE_CTOR nsString mPosition; |
47 | | MOZ_INIT_OUTSIDE_CTOR RefPtr<mozilla::dom::Event> mTriggerEvent; |
48 | | MOZ_INIT_OUTSIDE_CTOR int32_t mX; |
49 | | MOZ_INIT_OUTSIDE_CTOR int32_t mY; |
50 | | |
51 | | OpenPopupOptions(); |
52 | | |
53 | | explicit inline OpenPopupOptions(const FastDictionaryInitializer& ) |
54 | 0 | { |
55 | 0 | // Do nothing here; this is used by our "Fast" subclass |
56 | 0 | } |
57 | | |
58 | | explicit inline OpenPopupOptions(const OpenPopupOptions& aOther) |
59 | 0 | { |
60 | 0 | *this = aOther; |
61 | 0 | } |
62 | | |
63 | | bool |
64 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
65 | | |
66 | | bool |
67 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
68 | | |
69 | | void |
70 | | TraceDictionary(JSTracer* trc); |
71 | | |
72 | | inline void |
73 | | TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags) |
74 | 0 | { |
75 | 0 | ImplCycleCollectionTraverse(aCallback, mTriggerEvent, "mTriggerEvent", aFlags); |
76 | 0 | } |
77 | | |
78 | | inline void |
79 | | UnlinkForCC() |
80 | 0 | { |
81 | 0 | ImplCycleCollectionUnlink(mTriggerEvent); |
82 | 0 | } |
83 | | |
84 | | OpenPopupOptions& |
85 | | operator=(const OpenPopupOptions& aOther); |
86 | | |
87 | | private: |
88 | | static bool |
89 | | InitIds(JSContext* cx, OpenPopupOptionsAtoms* atomsCache); |
90 | | }; |
91 | | |
92 | | namespace binding_detail { |
93 | | struct FastOpenPopupOptions : public OpenPopupOptions |
94 | | { |
95 | | inline FastOpenPopupOptions() |
96 | | : OpenPopupOptions(FastDictionaryInitializer()) |
97 | 0 | { |
98 | 0 | // Doesn't matter what int we pass to the parent constructor |
99 | 0 | } |
100 | | }; |
101 | | } // namespace binding_detail |
102 | | |
103 | | |
104 | | class StringOrOpenPopupOptions |
105 | | { |
106 | | friend class StringOrOpenPopupOptionsArgument; |
107 | | enum Type |
108 | | { |
109 | | eUninitialized, |
110 | | eString, |
111 | | eOpenPopupOptions |
112 | | }; |
113 | | |
114 | | union Value |
115 | | { |
116 | | UnionMember<binding_detail::FakeString > mString; |
117 | | UnionMember<binding_detail::FastOpenPopupOptions > mOpenPopupOptions; |
118 | | |
119 | | }; |
120 | | |
121 | | Type mType; |
122 | | Value mValue; |
123 | | |
124 | | StringOrOpenPopupOptions(const StringOrOpenPopupOptions&) = delete; |
125 | | StringOrOpenPopupOptions& operator=(const StringOrOpenPopupOptions&) = delete; |
126 | | public: |
127 | | explicit inline StringOrOpenPopupOptions() |
128 | | : mType(eUninitialized) |
129 | 0 | { |
130 | 0 | } |
131 | | |
132 | | inline ~StringOrOpenPopupOptions() |
133 | 0 | { |
134 | 0 | Uninit(); |
135 | 0 | } |
136 | | |
137 | | inline binding_detail::FakeString& |
138 | | RawSetAsString() |
139 | 0 | { |
140 | 0 | if (mType == eString) { |
141 | 0 | return mValue.mString.Value(); |
142 | 0 | } |
143 | 0 | MOZ_ASSERT(mType == eUninitialized); |
144 | 0 | mType = eString; |
145 | 0 | return mValue.mString.SetValue(); |
146 | 0 | } |
147 | | |
148 | | inline binding_detail::FakeString& |
149 | | SetAsString() |
150 | 0 | { |
151 | 0 | if (mType == eString) { |
152 | 0 | return mValue.mString.Value(); |
153 | 0 | } |
154 | 0 | Uninit(); |
155 | 0 | mType = eString; |
156 | 0 | return mValue.mString.SetValue(); |
157 | 0 | } |
158 | | |
159 | | inline bool |
160 | | IsString() const |
161 | 0 | { |
162 | 0 | return mType == eString; |
163 | 0 | } |
164 | | |
165 | | inline binding_detail::FakeString& |
166 | | GetAsString() |
167 | 0 | { |
168 | 0 | MOZ_ASSERT(IsString(), "Wrong type!"); |
169 | 0 | return mValue.mString.Value(); |
170 | 0 | } |
171 | | |
172 | | inline const nsAString& |
173 | | GetAsString() const |
174 | 0 | { |
175 | 0 | MOZ_ASSERT(IsString(), "Wrong type!"); |
176 | 0 | return mValue.mString.Value(); |
177 | 0 | } |
178 | | |
179 | | inline binding_detail::FastOpenPopupOptions& |
180 | | RawSetAsOpenPopupOptions() |
181 | 0 | { |
182 | 0 | if (mType == eOpenPopupOptions) { |
183 | 0 | return mValue.mOpenPopupOptions.Value(); |
184 | 0 | } |
185 | 0 | MOZ_ASSERT(mType == eUninitialized); |
186 | 0 | mType = eOpenPopupOptions; |
187 | 0 | return mValue.mOpenPopupOptions.SetValue(); |
188 | 0 | } |
189 | | |
190 | | inline binding_detail::FastOpenPopupOptions& |
191 | | SetAsOpenPopupOptions() |
192 | 0 | { |
193 | 0 | if (mType == eOpenPopupOptions) { |
194 | 0 | return mValue.mOpenPopupOptions.Value(); |
195 | 0 | } |
196 | 0 | Uninit(); |
197 | 0 | mType = eOpenPopupOptions; |
198 | 0 | return mValue.mOpenPopupOptions.SetValue(); |
199 | 0 | } |
200 | | |
201 | | inline bool |
202 | | IsOpenPopupOptions() const |
203 | 0 | { |
204 | 0 | return mType == eOpenPopupOptions; |
205 | 0 | } |
206 | | |
207 | | inline binding_detail::FastOpenPopupOptions& |
208 | | GetAsOpenPopupOptions() |
209 | 0 | { |
210 | 0 | MOZ_ASSERT(IsOpenPopupOptions(), "Wrong type!"); |
211 | 0 | return mValue.mOpenPopupOptions.Value(); |
212 | 0 | } |
213 | | |
214 | | inline const OpenPopupOptions& |
215 | | GetAsOpenPopupOptions() const |
216 | 0 | { |
217 | 0 | MOZ_ASSERT(IsOpenPopupOptions(), "Wrong type!"); |
218 | 0 | return mValue.mOpenPopupOptions.Value(); |
219 | 0 | } |
220 | | |
221 | | inline void |
222 | | Uninit() |
223 | | { |
224 | | switch (mType) { |
225 | | case eUninitialized: { |
226 | | break; |
227 | | } |
228 | | case eString: { |
229 | | DestroyString(); |
230 | | break; |
231 | | } |
232 | | case eOpenPopupOptions: { |
233 | | DestroyOpenPopupOptions(); |
234 | | break; |
235 | | } |
236 | | } |
237 | | } |
238 | | |
239 | | bool |
240 | | ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const; |
241 | | |
242 | | private: |
243 | | inline void |
244 | | DestroyString() |
245 | 0 | { |
246 | 0 | MOZ_ASSERT(IsString(), "Wrong type!"); |
247 | 0 | mValue.mString.Destroy(); |
248 | 0 | mType = eUninitialized; |
249 | 0 | } |
250 | | |
251 | | inline void |
252 | | DestroyOpenPopupOptions() |
253 | 0 | { |
254 | 0 | MOZ_ASSERT(IsOpenPopupOptions(), "Wrong type!"); |
255 | 0 | mValue.mOpenPopupOptions.Destroy(); |
256 | 0 | mType = eUninitialized; |
257 | 0 | } |
258 | | }; |
259 | | |
260 | | |
261 | | class OwningStringOrOpenPopupOptions : public AllOwningUnionBase |
262 | | { |
263 | | friend void ImplCycleCollectionUnlink(OwningStringOrOpenPopupOptions& aUnion); |
264 | | enum Type |
265 | | { |
266 | | eUninitialized, |
267 | | eString, |
268 | | eOpenPopupOptions |
269 | | }; |
270 | | |
271 | | union Value |
272 | | { |
273 | | UnionMember<nsString > mString; |
274 | | UnionMember<OpenPopupOptions > mOpenPopupOptions; |
275 | | |
276 | | }; |
277 | | |
278 | | Type mType; |
279 | | Value mValue; |
280 | | |
281 | | public: |
282 | | explicit inline OwningStringOrOpenPopupOptions() |
283 | | : mType(eUninitialized) |
284 | 0 | { |
285 | 0 | } |
286 | | |
287 | | explicit inline OwningStringOrOpenPopupOptions(const OwningStringOrOpenPopupOptions& aOther) |
288 | | : mType(eUninitialized) |
289 | 0 | { |
290 | 0 | *this = aOther; |
291 | 0 | } |
292 | | |
293 | | inline ~OwningStringOrOpenPopupOptions() |
294 | 0 | { |
295 | 0 | Uninit(); |
296 | 0 | } |
297 | | |
298 | | nsString& |
299 | | RawSetAsString(); |
300 | | |
301 | | nsString& |
302 | | SetAsString(); |
303 | | |
304 | | bool |
305 | | TrySetToString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false); |
306 | | |
307 | | inline void |
308 | | SetStringData(const nsString::char_type* aData, nsString::size_type aLength) |
309 | 0 | { |
310 | 0 | RawSetAsString().Assign(aData, aLength); |
311 | 0 | } |
312 | | |
313 | | inline bool |
314 | | IsString() const |
315 | 0 | { |
316 | 0 | return mType == eString; |
317 | 0 | } |
318 | | |
319 | | inline nsString& |
320 | | GetAsString() |
321 | 0 | { |
322 | 0 | MOZ_ASSERT(IsString(), "Wrong type!"); |
323 | 0 | return mValue.mString.Value(); |
324 | 0 | } |
325 | | |
326 | | inline nsString const & |
327 | | GetAsString() const |
328 | 0 | { |
329 | 0 | MOZ_ASSERT(IsString(), "Wrong type!"); |
330 | 0 | return mValue.mString.Value(); |
331 | 0 | } |
332 | | |
333 | | OpenPopupOptions& |
334 | | RawSetAsOpenPopupOptions(); |
335 | | |
336 | | OpenPopupOptions& |
337 | | SetAsOpenPopupOptions(); |
338 | | |
339 | | bool |
340 | | TrySetToOpenPopupOptions(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false); |
341 | | |
342 | | inline bool |
343 | | IsOpenPopupOptions() const |
344 | 0 | { |
345 | 0 | return mType == eOpenPopupOptions; |
346 | 0 | } |
347 | | |
348 | | inline OpenPopupOptions& |
349 | | GetAsOpenPopupOptions() |
350 | 0 | { |
351 | 0 | MOZ_ASSERT(IsOpenPopupOptions(), "Wrong type!"); |
352 | 0 | return mValue.mOpenPopupOptions.Value(); |
353 | 0 | } |
354 | | |
355 | | inline OpenPopupOptions const & |
356 | | GetAsOpenPopupOptions() const |
357 | 0 | { |
358 | 0 | MOZ_ASSERT(IsOpenPopupOptions(), "Wrong type!"); |
359 | 0 | return mValue.mOpenPopupOptions.Value(); |
360 | 0 | } |
361 | | |
362 | | void |
363 | | Uninit(); |
364 | | |
365 | | bool |
366 | | ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const; |
367 | | |
368 | | void |
369 | | TraceUnion(JSTracer* trc); |
370 | | |
371 | | OwningStringOrOpenPopupOptions& |
372 | | operator=(const OwningStringOrOpenPopupOptions& aOther); |
373 | | |
374 | | private: |
375 | | void |
376 | | DestroyString(); |
377 | | |
378 | | void |
379 | | DestroyOpenPopupOptions(); |
380 | | }; |
381 | | |
382 | | |
383 | | namespace XULPopupElement_Binding { |
384 | | |
385 | | typedef mozilla::dom::XULPopupElement NativeType; |
386 | | |
387 | | bool |
388 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
389 | | |
390 | | const JSClass* |
391 | | GetJSClass(); |
392 | | |
393 | | bool |
394 | | Wrap(JSContext* aCx, mozilla::dom::XULPopupElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
395 | | |
396 | | template <class T> |
397 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
398 | 0 | { |
399 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
400 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
401 | 0 | } |
402 | | |
403 | | // We declare this as an array so that retrieving a pointer to this |
404 | | // binding's property hooks only requires compile/link-time resolvable |
405 | | // address arithmetic. Declaring it as a pointer instead would require |
406 | | // doing a run-time load to fetch a pointer to this binding's property |
407 | | // hooks. And then structures which embedded a pointer to this structure |
408 | | // would require a run-time load for proper initialization, which would |
409 | | // then induce static constructors. Lots of static constructors. |
410 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
411 | | |
412 | | void |
413 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
414 | | |
415 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
416 | 0 | { |
417 | 0 | /* Get the interface prototype object for this class. This will create the |
418 | 0 | object as needed. */ |
419 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::XULPopupElement, |
420 | 0 | &CreateInterfaceObjects, |
421 | 0 | /* aDefineOnGlobal = */ true); |
422 | 0 |
|
423 | 0 | } |
424 | | |
425 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
426 | 0 | { |
427 | 0 | /* Get the interface object for this class. This will create the object as |
428 | 0 | needed. */ |
429 | 0 |
|
430 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::XULPopupElement, |
431 | 0 | &CreateInterfaceObjects, |
432 | 0 | aDefineOnGlobal); |
433 | 0 | } |
434 | | |
435 | | JSObject* |
436 | | GetConstructorObject(JSContext* aCx); |
437 | | |
438 | | } // namespace XULPopupElement_Binding |
439 | | |
440 | | |
441 | | |
442 | | } // namespace dom |
443 | | } // namespace mozilla |
444 | | |
445 | | #endif // mozilla_dom_XULPopupElementBinding_h |