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