/work/obj-fuzz/dist/include/mozilla/dom/EventTargetBinding.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM EventTarget.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #ifndef mozilla_dom_EventTargetBinding_h |
4 | | #define mozilla_dom_EventTargetBinding_h |
5 | | |
6 | | #include "EventTargetBinding.h" |
7 | | #include "GeckoProfiler.h" |
8 | | #include "js/RootingAPI.h" |
9 | | #include "jspubtd.h" |
10 | | #include "mozilla/ErrorResult.h" |
11 | | #include "mozilla/dom/BindingDeclarations.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 | | struct AddEventListenerOptionsAtoms; |
21 | | struct EventListenerOptionsAtoms; |
22 | | class EventTarget; |
23 | | struct EventTargetAtoms; |
24 | | struct NativePropertyHooks; |
25 | | class ProtoAndIfaceCache; |
26 | | |
27 | | } // namespace dom |
28 | | } // namespace mozilla |
29 | | |
30 | | namespace mozilla { |
31 | | namespace dom { |
32 | | |
33 | | struct EventListenerOptions : public DictionaryBase |
34 | | { |
35 | | MOZ_INIT_OUTSIDE_CTOR bool mCapture; |
36 | | MOZ_INIT_OUTSIDE_CTOR bool mMozSystemGroup; |
37 | | |
38 | | EventListenerOptions(); |
39 | | |
40 | | explicit inline EventListenerOptions(const FastDictionaryInitializer& ) |
41 | 0 | { |
42 | 0 | // Do nothing here; this is used by our "Fast" subclass |
43 | 0 | } |
44 | | |
45 | | explicit inline EventListenerOptions(const EventListenerOptions& aOther) |
46 | 0 | { |
47 | 0 | *this = aOther; |
48 | 0 | } |
49 | | |
50 | | bool |
51 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
52 | | |
53 | | bool |
54 | | Init(const nsAString& aJSON); |
55 | | |
56 | | bool |
57 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
58 | | |
59 | | bool |
60 | | ToJSON(nsAString& aJSON) const; |
61 | | |
62 | | void |
63 | | TraceDictionary(JSTracer* trc); |
64 | | |
65 | | EventListenerOptions& |
66 | | operator=(const EventListenerOptions& aOther); |
67 | | |
68 | | private: |
69 | | static bool |
70 | | InitIds(JSContext* cx, EventListenerOptionsAtoms* atomsCache); |
71 | | }; |
72 | | |
73 | | namespace binding_detail { |
74 | | struct FastEventListenerOptions : public EventListenerOptions |
75 | | { |
76 | | inline FastEventListenerOptions() |
77 | | : EventListenerOptions(FastDictionaryInitializer()) |
78 | 0 | { |
79 | 0 | // Doesn't matter what int we pass to the parent constructor |
80 | 0 | } |
81 | | }; |
82 | | } // namespace binding_detail |
83 | | |
84 | | |
85 | | struct AddEventListenerOptions : public EventListenerOptions |
86 | | { |
87 | | MOZ_INIT_OUTSIDE_CTOR bool mOnce; |
88 | | MOZ_INIT_OUTSIDE_CTOR Optional<bool> mPassive; |
89 | | MOZ_INIT_OUTSIDE_CTOR Optional<bool> mWantUntrusted; |
90 | | |
91 | | AddEventListenerOptions(); |
92 | | |
93 | | explicit inline AddEventListenerOptions(const FastDictionaryInitializer& ) |
94 | | : EventListenerOptions(FastDictionaryInitializer()) |
95 | 0 | { |
96 | 0 | // Do nothing here; this is used by our "Fast" subclass |
97 | 0 | } |
98 | | |
99 | | explicit inline AddEventListenerOptions(const AddEventListenerOptions& aOther) |
100 | 0 | { |
101 | 0 | *this = aOther; |
102 | 0 | } |
103 | | |
104 | | bool |
105 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
106 | | |
107 | | bool |
108 | | Init(const nsAString& aJSON); |
109 | | |
110 | | bool |
111 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
112 | | |
113 | | bool |
114 | | ToJSON(nsAString& aJSON) const; |
115 | | |
116 | | void |
117 | | TraceDictionary(JSTracer* trc); |
118 | | |
119 | | AddEventListenerOptions& |
120 | | operator=(const AddEventListenerOptions& aOther); |
121 | | |
122 | | private: |
123 | | static bool |
124 | | InitIds(JSContext* cx, AddEventListenerOptionsAtoms* atomsCache); |
125 | | }; |
126 | | |
127 | | namespace binding_detail { |
128 | | struct FastAddEventListenerOptions : public AddEventListenerOptions |
129 | | { |
130 | | inline FastAddEventListenerOptions() |
131 | | : AddEventListenerOptions(FastDictionaryInitializer()) |
132 | 0 | { |
133 | 0 | // Doesn't matter what int we pass to the parent constructor |
134 | 0 | } |
135 | | }; |
136 | | } // namespace binding_detail |
137 | | |
138 | | |
139 | | class EventListenerOptionsOrBoolean |
140 | | { |
141 | | friend class EventListenerOptionsOrBooleanArgument; |
142 | | enum Type |
143 | | { |
144 | | eUninitialized, |
145 | | eEventListenerOptions, |
146 | | eBoolean |
147 | | }; |
148 | | |
149 | | union Value |
150 | | { |
151 | | UnionMember<binding_detail::FastEventListenerOptions > mEventListenerOptions; |
152 | | UnionMember<bool > mBoolean; |
153 | | |
154 | | }; |
155 | | |
156 | | Type mType; |
157 | | Value mValue; |
158 | | |
159 | | EventListenerOptionsOrBoolean(const EventListenerOptionsOrBoolean&) = delete; |
160 | | EventListenerOptionsOrBoolean& operator=(const EventListenerOptionsOrBoolean&) = delete; |
161 | | public: |
162 | | explicit inline EventListenerOptionsOrBoolean() |
163 | | : mType(eUninitialized) |
164 | 0 | { |
165 | 0 | } |
166 | | |
167 | | inline ~EventListenerOptionsOrBoolean() |
168 | 0 | { |
169 | 0 | Uninit(); |
170 | 0 | } |
171 | | |
172 | | inline binding_detail::FastEventListenerOptions& |
173 | | RawSetAsEventListenerOptions() |
174 | 0 | { |
175 | 0 | if (mType == eEventListenerOptions) { |
176 | 0 | return mValue.mEventListenerOptions.Value(); |
177 | 0 | } |
178 | 0 | MOZ_ASSERT(mType == eUninitialized); |
179 | 0 | mType = eEventListenerOptions; |
180 | 0 | return mValue.mEventListenerOptions.SetValue(); |
181 | 0 | } |
182 | | |
183 | | inline binding_detail::FastEventListenerOptions& |
184 | | SetAsEventListenerOptions() |
185 | 0 | { |
186 | 0 | if (mType == eEventListenerOptions) { |
187 | 0 | return mValue.mEventListenerOptions.Value(); |
188 | 0 | } |
189 | 0 | Uninit(); |
190 | 0 | mType = eEventListenerOptions; |
191 | 0 | return mValue.mEventListenerOptions.SetValue(); |
192 | 0 | } |
193 | | |
194 | | inline bool |
195 | | IsEventListenerOptions() const |
196 | 0 | { |
197 | 0 | return mType == eEventListenerOptions; |
198 | 0 | } |
199 | | |
200 | | inline binding_detail::FastEventListenerOptions& |
201 | | GetAsEventListenerOptions() |
202 | 0 | { |
203 | 0 | MOZ_ASSERT(IsEventListenerOptions(), "Wrong type!"); |
204 | 0 | return mValue.mEventListenerOptions.Value(); |
205 | 0 | } |
206 | | |
207 | | inline const EventListenerOptions& |
208 | | GetAsEventListenerOptions() const |
209 | 0 | { |
210 | 0 | MOZ_ASSERT(IsEventListenerOptions(), "Wrong type!"); |
211 | 0 | return mValue.mEventListenerOptions.Value(); |
212 | 0 | } |
213 | | |
214 | | inline bool& |
215 | | RawSetAsBoolean() |
216 | 0 | { |
217 | 0 | if (mType == eBoolean) { |
218 | 0 | return mValue.mBoolean.Value(); |
219 | 0 | } |
220 | 0 | MOZ_ASSERT(mType == eUninitialized); |
221 | 0 | mType = eBoolean; |
222 | 0 | return mValue.mBoolean.SetValue(); |
223 | 0 | } |
224 | | |
225 | | inline bool& |
226 | | SetAsBoolean() |
227 | 0 | { |
228 | 0 | if (mType == eBoolean) { |
229 | 0 | return mValue.mBoolean.Value(); |
230 | 0 | } |
231 | 0 | Uninit(); |
232 | 0 | mType = eBoolean; |
233 | 0 | return mValue.mBoolean.SetValue(); |
234 | 0 | } |
235 | | |
236 | | inline bool |
237 | | IsBoolean() const |
238 | 0 | { |
239 | 0 | return mType == eBoolean; |
240 | 0 | } |
241 | | |
242 | | inline bool& |
243 | | GetAsBoolean() |
244 | 0 | { |
245 | 0 | MOZ_ASSERT(IsBoolean(), "Wrong type!"); |
246 | 0 | return mValue.mBoolean.Value(); |
247 | 0 | } |
248 | | |
249 | | inline bool |
250 | | GetAsBoolean() const |
251 | 0 | { |
252 | 0 | MOZ_ASSERT(IsBoolean(), "Wrong type!"); |
253 | 0 | return mValue.mBoolean.Value(); |
254 | 0 | } |
255 | | |
256 | | inline void |
257 | | Uninit() |
258 | | { |
259 | | switch (mType) { |
260 | | case eUninitialized: { |
261 | | break; |
262 | | } |
263 | | case eEventListenerOptions: { |
264 | | DestroyEventListenerOptions(); |
265 | | break; |
266 | | } |
267 | | case eBoolean: { |
268 | | DestroyBoolean(); |
269 | | break; |
270 | | } |
271 | | } |
272 | | } |
273 | | |
274 | | bool |
275 | | ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const; |
276 | | |
277 | | private: |
278 | | inline void |
279 | | DestroyEventListenerOptions() |
280 | 0 | { |
281 | 0 | MOZ_ASSERT(IsEventListenerOptions(), "Wrong type!"); |
282 | 0 | mValue.mEventListenerOptions.Destroy(); |
283 | 0 | mType = eUninitialized; |
284 | 0 | } |
285 | | |
286 | | inline void |
287 | | DestroyBoolean() |
288 | 0 | { |
289 | 0 | MOZ_ASSERT(IsBoolean(), "Wrong type!"); |
290 | 0 | mValue.mBoolean.Destroy(); |
291 | 0 | mType = eUninitialized; |
292 | 0 | } |
293 | | }; |
294 | | |
295 | | |
296 | | class OwningEventListenerOptionsOrBoolean : public AllOwningUnionBase |
297 | | { |
298 | | friend void ImplCycleCollectionUnlink(OwningEventListenerOptionsOrBoolean& aUnion); |
299 | | enum Type |
300 | | { |
301 | | eUninitialized, |
302 | | eEventListenerOptions, |
303 | | eBoolean |
304 | | }; |
305 | | |
306 | | union Value |
307 | | { |
308 | | UnionMember<EventListenerOptions > mEventListenerOptions; |
309 | | UnionMember<bool > mBoolean; |
310 | | |
311 | | }; |
312 | | |
313 | | Type mType; |
314 | | Value mValue; |
315 | | |
316 | | public: |
317 | | explicit inline OwningEventListenerOptionsOrBoolean() |
318 | | : mType(eUninitialized) |
319 | 0 | { |
320 | 0 | } |
321 | | |
322 | | explicit inline OwningEventListenerOptionsOrBoolean(const OwningEventListenerOptionsOrBoolean& aOther) |
323 | | : mType(eUninitialized) |
324 | 0 | { |
325 | 0 | *this = aOther; |
326 | 0 | } |
327 | | |
328 | | inline ~OwningEventListenerOptionsOrBoolean() |
329 | 0 | { |
330 | 0 | Uninit(); |
331 | 0 | } |
332 | | |
333 | | EventListenerOptions& |
334 | | RawSetAsEventListenerOptions(); |
335 | | |
336 | | EventListenerOptions& |
337 | | SetAsEventListenerOptions(); |
338 | | |
339 | | bool |
340 | | TrySetToEventListenerOptions(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false); |
341 | | |
342 | | inline bool |
343 | | IsEventListenerOptions() const |
344 | 0 | { |
345 | 0 | return mType == eEventListenerOptions; |
346 | 0 | } |
347 | | |
348 | | inline EventListenerOptions& |
349 | | GetAsEventListenerOptions() |
350 | 0 | { |
351 | 0 | MOZ_ASSERT(IsEventListenerOptions(), "Wrong type!"); |
352 | 0 | return mValue.mEventListenerOptions.Value(); |
353 | 0 | } |
354 | | |
355 | | inline EventListenerOptions const & |
356 | | GetAsEventListenerOptions() const |
357 | 0 | { |
358 | 0 | MOZ_ASSERT(IsEventListenerOptions(), "Wrong type!"); |
359 | 0 | return mValue.mEventListenerOptions.Value(); |
360 | 0 | } |
361 | | |
362 | | bool& |
363 | | RawSetAsBoolean(); |
364 | | |
365 | | bool& |
366 | | SetAsBoolean(); |
367 | | |
368 | | bool |
369 | | TrySetToBoolean(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false); |
370 | | |
371 | | inline bool |
372 | | IsBoolean() const |
373 | 0 | { |
374 | 0 | return mType == eBoolean; |
375 | 0 | } |
376 | | |
377 | | inline bool& |
378 | | GetAsBoolean() |
379 | 0 | { |
380 | 0 | MOZ_ASSERT(IsBoolean(), "Wrong type!"); |
381 | 0 | return mValue.mBoolean.Value(); |
382 | 0 | } |
383 | | |
384 | | inline bool const & |
385 | | GetAsBoolean() const |
386 | 0 | { |
387 | 0 | MOZ_ASSERT(IsBoolean(), "Wrong type!"); |
388 | 0 | return mValue.mBoolean.Value(); |
389 | 0 | } |
390 | | |
391 | | void |
392 | | Uninit(); |
393 | | |
394 | | bool |
395 | | ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const; |
396 | | |
397 | | void |
398 | | TraceUnion(JSTracer* trc); |
399 | | |
400 | | OwningEventListenerOptionsOrBoolean& |
401 | | operator=(const OwningEventListenerOptionsOrBoolean& aOther); |
402 | | |
403 | | private: |
404 | | void |
405 | | DestroyEventListenerOptions(); |
406 | | |
407 | | void |
408 | | DestroyBoolean(); |
409 | | }; |
410 | | |
411 | | |
412 | | class AddEventListenerOptionsOrBoolean |
413 | | { |
414 | | friend class AddEventListenerOptionsOrBooleanArgument; |
415 | | enum Type |
416 | | { |
417 | | eUninitialized, |
418 | | eAddEventListenerOptions, |
419 | | eBoolean |
420 | | }; |
421 | | |
422 | | union Value |
423 | | { |
424 | | UnionMember<binding_detail::FastAddEventListenerOptions > mAddEventListenerOptions; |
425 | | UnionMember<bool > mBoolean; |
426 | | |
427 | | }; |
428 | | |
429 | | Type mType; |
430 | | Value mValue; |
431 | | |
432 | | AddEventListenerOptionsOrBoolean(const AddEventListenerOptionsOrBoolean&) = delete; |
433 | | AddEventListenerOptionsOrBoolean& operator=(const AddEventListenerOptionsOrBoolean&) = delete; |
434 | | public: |
435 | | explicit inline AddEventListenerOptionsOrBoolean() |
436 | | : mType(eUninitialized) |
437 | 0 | { |
438 | 0 | } |
439 | | |
440 | | inline ~AddEventListenerOptionsOrBoolean() |
441 | 0 | { |
442 | 0 | Uninit(); |
443 | 0 | } |
444 | | |
445 | | inline binding_detail::FastAddEventListenerOptions& |
446 | | RawSetAsAddEventListenerOptions() |
447 | 0 | { |
448 | 0 | if (mType == eAddEventListenerOptions) { |
449 | 0 | return mValue.mAddEventListenerOptions.Value(); |
450 | 0 | } |
451 | 0 | MOZ_ASSERT(mType == eUninitialized); |
452 | 0 | mType = eAddEventListenerOptions; |
453 | 0 | return mValue.mAddEventListenerOptions.SetValue(); |
454 | 0 | } |
455 | | |
456 | | inline binding_detail::FastAddEventListenerOptions& |
457 | | SetAsAddEventListenerOptions() |
458 | 0 | { |
459 | 0 | if (mType == eAddEventListenerOptions) { |
460 | 0 | return mValue.mAddEventListenerOptions.Value(); |
461 | 0 | } |
462 | 0 | Uninit(); |
463 | 0 | mType = eAddEventListenerOptions; |
464 | 0 | return mValue.mAddEventListenerOptions.SetValue(); |
465 | 0 | } |
466 | | |
467 | | inline bool |
468 | | IsAddEventListenerOptions() const |
469 | 0 | { |
470 | 0 | return mType == eAddEventListenerOptions; |
471 | 0 | } |
472 | | |
473 | | inline binding_detail::FastAddEventListenerOptions& |
474 | | GetAsAddEventListenerOptions() |
475 | 0 | { |
476 | 0 | MOZ_ASSERT(IsAddEventListenerOptions(), "Wrong type!"); |
477 | 0 | return mValue.mAddEventListenerOptions.Value(); |
478 | 0 | } |
479 | | |
480 | | inline const AddEventListenerOptions& |
481 | | GetAsAddEventListenerOptions() const |
482 | 0 | { |
483 | 0 | MOZ_ASSERT(IsAddEventListenerOptions(), "Wrong type!"); |
484 | 0 | return mValue.mAddEventListenerOptions.Value(); |
485 | 0 | } |
486 | | |
487 | | inline bool& |
488 | | RawSetAsBoolean() |
489 | 0 | { |
490 | 0 | if (mType == eBoolean) { |
491 | 0 | return mValue.mBoolean.Value(); |
492 | 0 | } |
493 | 0 | MOZ_ASSERT(mType == eUninitialized); |
494 | 0 | mType = eBoolean; |
495 | 0 | return mValue.mBoolean.SetValue(); |
496 | 0 | } |
497 | | |
498 | | inline bool& |
499 | | SetAsBoolean() |
500 | 0 | { |
501 | 0 | if (mType == eBoolean) { |
502 | 0 | return mValue.mBoolean.Value(); |
503 | 0 | } |
504 | 0 | Uninit(); |
505 | 0 | mType = eBoolean; |
506 | 0 | return mValue.mBoolean.SetValue(); |
507 | 0 | } |
508 | | |
509 | | inline bool |
510 | | IsBoolean() const |
511 | 0 | { |
512 | 0 | return mType == eBoolean; |
513 | 0 | } |
514 | | |
515 | | inline bool& |
516 | | GetAsBoolean() |
517 | 0 | { |
518 | 0 | MOZ_ASSERT(IsBoolean(), "Wrong type!"); |
519 | 0 | return mValue.mBoolean.Value(); |
520 | 0 | } |
521 | | |
522 | | inline bool |
523 | | GetAsBoolean() const |
524 | 0 | { |
525 | 0 | MOZ_ASSERT(IsBoolean(), "Wrong type!"); |
526 | 0 | return mValue.mBoolean.Value(); |
527 | 0 | } |
528 | | |
529 | | inline void |
530 | | Uninit() |
531 | | { |
532 | | switch (mType) { |
533 | | case eUninitialized: { |
534 | | break; |
535 | | } |
536 | | case eAddEventListenerOptions: { |
537 | | DestroyAddEventListenerOptions(); |
538 | | break; |
539 | | } |
540 | | case eBoolean: { |
541 | | DestroyBoolean(); |
542 | | break; |
543 | | } |
544 | | } |
545 | | } |
546 | | |
547 | | bool |
548 | | ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const; |
549 | | |
550 | | private: |
551 | | inline void |
552 | | DestroyAddEventListenerOptions() |
553 | 0 | { |
554 | 0 | MOZ_ASSERT(IsAddEventListenerOptions(), "Wrong type!"); |
555 | 0 | mValue.mAddEventListenerOptions.Destroy(); |
556 | 0 | mType = eUninitialized; |
557 | 0 | } |
558 | | |
559 | | inline void |
560 | | DestroyBoolean() |
561 | 0 | { |
562 | 0 | MOZ_ASSERT(IsBoolean(), "Wrong type!"); |
563 | 0 | mValue.mBoolean.Destroy(); |
564 | 0 | mType = eUninitialized; |
565 | 0 | } |
566 | | }; |
567 | | |
568 | | |
569 | | class OwningAddEventListenerOptionsOrBoolean : public AllOwningUnionBase |
570 | | { |
571 | | friend void ImplCycleCollectionUnlink(OwningAddEventListenerOptionsOrBoolean& aUnion); |
572 | | enum Type |
573 | | { |
574 | | eUninitialized, |
575 | | eAddEventListenerOptions, |
576 | | eBoolean |
577 | | }; |
578 | | |
579 | | union Value |
580 | | { |
581 | | UnionMember<AddEventListenerOptions > mAddEventListenerOptions; |
582 | | UnionMember<bool > mBoolean; |
583 | | |
584 | | }; |
585 | | |
586 | | Type mType; |
587 | | Value mValue; |
588 | | |
589 | | public: |
590 | | explicit inline OwningAddEventListenerOptionsOrBoolean() |
591 | | : mType(eUninitialized) |
592 | 0 | { |
593 | 0 | } |
594 | | |
595 | | explicit inline OwningAddEventListenerOptionsOrBoolean(const OwningAddEventListenerOptionsOrBoolean& aOther) |
596 | | : mType(eUninitialized) |
597 | 0 | { |
598 | 0 | *this = aOther; |
599 | 0 | } |
600 | | |
601 | | inline ~OwningAddEventListenerOptionsOrBoolean() |
602 | 0 | { |
603 | 0 | Uninit(); |
604 | 0 | } |
605 | | |
606 | | AddEventListenerOptions& |
607 | | RawSetAsAddEventListenerOptions(); |
608 | | |
609 | | AddEventListenerOptions& |
610 | | SetAsAddEventListenerOptions(); |
611 | | |
612 | | bool |
613 | | TrySetToAddEventListenerOptions(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false); |
614 | | |
615 | | inline bool |
616 | | IsAddEventListenerOptions() const |
617 | 0 | { |
618 | 0 | return mType == eAddEventListenerOptions; |
619 | 0 | } |
620 | | |
621 | | inline AddEventListenerOptions& |
622 | | GetAsAddEventListenerOptions() |
623 | 0 | { |
624 | 0 | MOZ_ASSERT(IsAddEventListenerOptions(), "Wrong type!"); |
625 | 0 | return mValue.mAddEventListenerOptions.Value(); |
626 | 0 | } |
627 | | |
628 | | inline AddEventListenerOptions const & |
629 | | GetAsAddEventListenerOptions() const |
630 | 0 | { |
631 | 0 | MOZ_ASSERT(IsAddEventListenerOptions(), "Wrong type!"); |
632 | 0 | return mValue.mAddEventListenerOptions.Value(); |
633 | 0 | } |
634 | | |
635 | | bool& |
636 | | RawSetAsBoolean(); |
637 | | |
638 | | bool& |
639 | | SetAsBoolean(); |
640 | | |
641 | | bool |
642 | | TrySetToBoolean(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false); |
643 | | |
644 | | inline bool |
645 | | IsBoolean() const |
646 | 0 | { |
647 | 0 | return mType == eBoolean; |
648 | 0 | } |
649 | | |
650 | | inline bool& |
651 | | GetAsBoolean() |
652 | 0 | { |
653 | 0 | MOZ_ASSERT(IsBoolean(), "Wrong type!"); |
654 | 0 | return mValue.mBoolean.Value(); |
655 | 0 | } |
656 | | |
657 | | inline bool const & |
658 | | GetAsBoolean() const |
659 | 0 | { |
660 | 0 | MOZ_ASSERT(IsBoolean(), "Wrong type!"); |
661 | 0 | return mValue.mBoolean.Value(); |
662 | 0 | } |
663 | | |
664 | | void |
665 | | Uninit(); |
666 | | |
667 | | bool |
668 | | ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const; |
669 | | |
670 | | void |
671 | | TraceUnion(JSTracer* trc); |
672 | | |
673 | | OwningAddEventListenerOptionsOrBoolean& |
674 | | operator=(const OwningAddEventListenerOptionsOrBoolean& aOther); |
675 | | |
676 | | private: |
677 | | void |
678 | | DestroyAddEventListenerOptions(); |
679 | | |
680 | | void |
681 | | DestroyBoolean(); |
682 | | }; |
683 | | |
684 | | |
685 | | namespace EventTarget_Binding { |
686 | | |
687 | | typedef mozilla::dom::EventTarget NativeType; |
688 | | |
689 | | const JSClass* |
690 | | GetJSClass(); |
691 | | |
692 | | bool |
693 | | Wrap(JSContext* aCx, mozilla::dom::EventTarget* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
694 | | |
695 | | template <class T> |
696 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
697 | 0 | { |
698 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
699 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
700 | 0 | } |
701 | | |
702 | | // We declare this as an array so that retrieving a pointer to this |
703 | | // binding's property hooks only requires compile/link-time resolvable |
704 | | // address arithmetic. Declaring it as a pointer instead would require |
705 | | // doing a run-time load to fetch a pointer to this binding's property |
706 | | // hooks. And then structures which embedded a pointer to this structure |
707 | | // would require a run-time load for proper initialization, which would |
708 | | // then induce static constructors. Lots of static constructors. |
709 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
710 | | |
711 | | void |
712 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
713 | | |
714 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
715 | 0 | { |
716 | 0 | /* Get the interface prototype object for this class. This will create the |
717 | 0 | object as needed. */ |
718 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::EventTarget, |
719 | 0 | &CreateInterfaceObjects, |
720 | 0 | /* aDefineOnGlobal = */ true); |
721 | 0 |
|
722 | 0 | } |
723 | | |
724 | | JSObject* |
725 | | GetProtoObject(JSContext* aCx); |
726 | | |
727 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
728 | 0 | { |
729 | 0 | /* Get the interface object for this class. This will create the object as |
730 | 0 | needed. */ |
731 | 0 |
|
732 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::EventTarget, |
733 | 0 | &CreateInterfaceObjects, |
734 | 0 | aDefineOnGlobal); |
735 | 0 | } |
736 | | |
737 | | JSObject* |
738 | | GetConstructorObject(JSContext* aCx); |
739 | | |
740 | | } // namespace EventTarget_Binding |
741 | | |
742 | | |
743 | | |
744 | | } // namespace dom |
745 | | } // namespace mozilla |
746 | | |
747 | | #endif // mozilla_dom_EventTargetBinding_h |