/work/obj-fuzz/dist/include/mozilla/dom/HTMLCanvasElementBinding.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM HTMLCanvasElement.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #ifndef mozilla_dom_HTMLCanvasElementBinding_h |
4 | | #define mozilla_dom_HTMLCanvasElementBinding_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/CallbackFunction.h" |
12 | | #include "mozilla/dom/Nullable.h" |
13 | | #include "mozilla/dom/PrototypeList.h" |
14 | | #include "mozilla/dom/ToJSValue.h" |
15 | | |
16 | | namespace mozilla { |
17 | | namespace dom { |
18 | | |
19 | | class Blob; |
20 | | class BlobCallback; |
21 | | class HTMLCanvasElement; |
22 | | struct HTMLCanvasElementAtoms; |
23 | | class HTMLCanvasPrintState; |
24 | | struct HTMLCanvasPrintStateAtoms; |
25 | | struct NativePropertyHooks; |
26 | | class PrintCallback; |
27 | | class ProtoAndIfaceCache; |
28 | | |
29 | | } // namespace dom |
30 | | } // namespace mozilla |
31 | | |
32 | | namespace mozilla { |
33 | | namespace dom { |
34 | | |
35 | | class PrintCallback : public CallbackFunction |
36 | | { |
37 | | public: |
38 | | explicit inline PrintCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal) |
39 | | : CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) |
40 | 0 | { |
41 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
42 | 0 | } |
43 | | |
44 | | explicit inline PrintCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& ) |
45 | | : CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
46 | 0 | { |
47 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
48 | 0 | } |
49 | | |
50 | | explicit inline PrintCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal) |
51 | | : CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal) |
52 | 0 | { |
53 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
54 | 0 | } |
55 | | |
56 | | explicit inline PrintCallback(CallbackFunction* aOther) |
57 | | : CallbackFunction(aOther) |
58 | 0 | { |
59 | 0 | } |
60 | | |
61 | | template <typename T> |
62 | | inline void |
63 | | Call(const T& thisVal, HTMLCanvasPrintState& ctx, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
64 | | { |
65 | | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
66 | | if (!aExecutionReason) { |
67 | | aExecutionReason = "PrintCallback"; |
68 | | } |
69 | | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
70 | | if (!s.GetContext()) { |
71 | | MOZ_ASSERT(aRv.Failed()); |
72 | | return; |
73 | | } |
74 | | JS::Rooted<JS::Value> thisValJS(s.GetContext()); |
75 | | if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) { |
76 | | aRv.Throw(NS_ERROR_FAILURE); |
77 | | return; |
78 | | } |
79 | | return Call(s.GetContext(), thisValJS, ctx, aRv); |
80 | | } |
81 | | |
82 | | inline void |
83 | | Call(HTMLCanvasPrintState& ctx, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
84 | 0 | { |
85 | 0 | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
86 | 0 | if (!aExecutionReason) { |
87 | 0 | aExecutionReason = "PrintCallback"; |
88 | 0 | } |
89 | 0 | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
90 | 0 | if (!s.GetContext()) { |
91 | 0 | MOZ_ASSERT(aRv.Failed()); |
92 | 0 | return; |
93 | 0 | } |
94 | 0 | return Call(s.GetContext(), JS::UndefinedHandleValue, ctx, aRv); |
95 | 0 | } |
96 | | |
97 | | template <typename T> |
98 | | inline void |
99 | | Call(const T& thisVal, HTMLCanvasPrintState& ctx, const char* aExecutionReason = nullptr) |
100 | | { |
101 | | return Call(thisVal, ctx, IgnoreErrors(), aExecutionReason); |
102 | | } |
103 | | |
104 | | inline void |
105 | | Call(HTMLCanvasPrintState& ctx, const char* aExecutionReason = nullptr) |
106 | 0 | { |
107 | 0 | return Call(ctx, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr); |
108 | 0 | } |
109 | | |
110 | | inline bool |
111 | | operator==(const PrintCallback& aOther) const |
112 | 0 | { |
113 | 0 | return CallbackFunction::operator==(aOther); |
114 | 0 | } |
115 | | |
116 | | private: |
117 | | void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, HTMLCanvasPrintState& ctx, ErrorResult& aRv); |
118 | | }; |
119 | | |
120 | | |
121 | | class BlobCallback : public CallbackFunction |
122 | | { |
123 | | public: |
124 | | explicit inline BlobCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal) |
125 | | : CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) |
126 | 0 | { |
127 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
128 | 0 | } |
129 | | |
130 | | explicit inline BlobCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& ) |
131 | | : CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
132 | 0 | { |
133 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
134 | 0 | } |
135 | | |
136 | | explicit inline BlobCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal) |
137 | | : CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal) |
138 | 0 | { |
139 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
140 | 0 | } |
141 | | |
142 | | explicit inline BlobCallback(CallbackFunction* aOther) |
143 | | : CallbackFunction(aOther) |
144 | 0 | { |
145 | 0 | } |
146 | | |
147 | | template <typename T> |
148 | | inline void |
149 | | Call(const T& thisVal, Blob* blob, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
150 | | { |
151 | | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
152 | | if (!aExecutionReason) { |
153 | | aExecutionReason = "BlobCallback"; |
154 | | } |
155 | | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
156 | | if (!s.GetContext()) { |
157 | | MOZ_ASSERT(aRv.Failed()); |
158 | | return; |
159 | | } |
160 | | JS::Rooted<JS::Value> thisValJS(s.GetContext()); |
161 | | if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) { |
162 | | aRv.Throw(NS_ERROR_FAILURE); |
163 | | return; |
164 | | } |
165 | | return Call(s.GetContext(), thisValJS, blob, aRv); |
166 | | } |
167 | | |
168 | | inline void |
169 | | Call(Blob* blob, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
170 | 0 | { |
171 | 0 | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
172 | 0 | if (!aExecutionReason) { |
173 | 0 | aExecutionReason = "BlobCallback"; |
174 | 0 | } |
175 | 0 | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
176 | 0 | if (!s.GetContext()) { |
177 | 0 | MOZ_ASSERT(aRv.Failed()); |
178 | 0 | return; |
179 | 0 | } |
180 | 0 | return Call(s.GetContext(), JS::UndefinedHandleValue, blob, aRv); |
181 | 0 | } |
182 | | |
183 | | template <typename T> |
184 | | inline void |
185 | | Call(const T& thisVal, Blob* blob, const char* aExecutionReason = nullptr) |
186 | | { |
187 | | return Call(thisVal, blob, IgnoreErrors(), aExecutionReason); |
188 | | } |
189 | | |
190 | | inline void |
191 | | Call(Blob* blob, const char* aExecutionReason = nullptr) |
192 | 0 | { |
193 | 0 | return Call(blob, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr); |
194 | 0 | } |
195 | | |
196 | | inline bool |
197 | | operator==(const BlobCallback& aOther) const |
198 | 0 | { |
199 | 0 | return CallbackFunction::operator==(aOther); |
200 | 0 | } |
201 | | |
202 | | private: |
203 | | void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, Blob* blob, ErrorResult& aRv); |
204 | | }; |
205 | | |
206 | | |
207 | | namespace binding_detail { |
208 | | class FastPrintCallback : public PrintCallback |
209 | | { |
210 | | public: |
211 | | explicit inline FastPrintCallback(JSObject* aCallback, JSObject* aCallbackGlobal) |
212 | | : PrintCallback(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
213 | 0 | { |
214 | 0 | } |
215 | | |
216 | | inline void |
217 | | Trace(JSTracer* aTracer) |
218 | 0 | { |
219 | 0 | PrintCallback::Trace(aTracer); |
220 | 0 | } |
221 | | |
222 | | inline void |
223 | | FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx) |
224 | 0 | { |
225 | 0 | PrintCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx); |
226 | 0 | } |
227 | | }; |
228 | | } // namespace binding_detail |
229 | | |
230 | | |
231 | | namespace binding_detail { |
232 | | class FastBlobCallback : public BlobCallback |
233 | | { |
234 | | public: |
235 | | explicit inline FastBlobCallback(JSObject* aCallback, JSObject* aCallbackGlobal) |
236 | | : BlobCallback(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
237 | 0 | { |
238 | 0 | } |
239 | | |
240 | | inline void |
241 | | Trace(JSTracer* aTracer) |
242 | 0 | { |
243 | 0 | BlobCallback::Trace(aTracer); |
244 | 0 | } |
245 | | |
246 | | inline void |
247 | | FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx) |
248 | 0 | { |
249 | 0 | BlobCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx); |
250 | 0 | } |
251 | | }; |
252 | | } // namespace binding_detail |
253 | | |
254 | | |
255 | | namespace HTMLCanvasElement_Binding { |
256 | | |
257 | | typedef mozilla::dom::HTMLCanvasElement NativeType; |
258 | | |
259 | | const JSClass* |
260 | | GetJSClass(); |
261 | | |
262 | | bool |
263 | | Wrap(JSContext* aCx, mozilla::dom::HTMLCanvasElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
264 | | |
265 | | template <class T> |
266 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
267 | 0 | { |
268 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
269 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
270 | 0 | } |
271 | | |
272 | | // We declare this as an array so that retrieving a pointer to this |
273 | | // binding's property hooks only requires compile/link-time resolvable |
274 | | // address arithmetic. Declaring it as a pointer instead would require |
275 | | // doing a run-time load to fetch a pointer to this binding's property |
276 | | // hooks. And then structures which embedded a pointer to this structure |
277 | | // would require a run-time load for proper initialization, which would |
278 | | // then induce static constructors. Lots of static constructors. |
279 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
280 | | |
281 | | void |
282 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
283 | | |
284 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
285 | 0 | { |
286 | 0 | /* Get the interface prototype object for this class. This will create the |
287 | 0 | object as needed. */ |
288 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::HTMLCanvasElement, |
289 | 0 | &CreateInterfaceObjects, |
290 | 0 | /* aDefineOnGlobal = */ true); |
291 | 0 |
|
292 | 0 | } |
293 | | |
294 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
295 | 0 | { |
296 | 0 | /* Get the interface object for this class. This will create the object as |
297 | 0 | needed. */ |
298 | 0 |
|
299 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::HTMLCanvasElement, |
300 | 0 | &CreateInterfaceObjects, |
301 | 0 | aDefineOnGlobal); |
302 | 0 | } |
303 | | |
304 | | JSObject* |
305 | | GetConstructorObject(JSContext* aCx); |
306 | | |
307 | | } // namespace HTMLCanvasElement_Binding |
308 | | |
309 | | |
310 | | |
311 | | namespace MozCanvasPrintState_Binding { |
312 | | |
313 | | typedef mozilla::dom::HTMLCanvasPrintState NativeType; |
314 | | |
315 | | bool |
316 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
317 | | |
318 | | const JSClass* |
319 | | GetJSClass(); |
320 | | |
321 | | bool |
322 | | Wrap(JSContext* aCx, mozilla::dom::HTMLCanvasPrintState* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
323 | | |
324 | | template <class T> |
325 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
326 | 0 | { |
327 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
328 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
329 | 0 | } |
330 | | |
331 | | // We declare this as an array so that retrieving a pointer to this |
332 | | // binding's property hooks only requires compile/link-time resolvable |
333 | | // address arithmetic. Declaring it as a pointer instead would require |
334 | | // doing a run-time load to fetch a pointer to this binding's property |
335 | | // hooks. And then structures which embedded a pointer to this structure |
336 | | // would require a run-time load for proper initialization, which would |
337 | | // then induce static constructors. Lots of static constructors. |
338 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
339 | | |
340 | | void |
341 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
342 | | |
343 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
344 | 0 | { |
345 | 0 | /* Get the interface prototype object for this class. This will create the |
346 | 0 | object as needed. */ |
347 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::MozCanvasPrintState, |
348 | 0 | &CreateInterfaceObjects, |
349 | 0 | /* aDefineOnGlobal = */ true); |
350 | 0 |
|
351 | 0 | } |
352 | | |
353 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
354 | 0 | { |
355 | 0 | /* Get the interface object for this class. This will create the object as |
356 | 0 | needed. */ |
357 | 0 |
|
358 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::MozCanvasPrintState, |
359 | 0 | &CreateInterfaceObjects, |
360 | 0 | aDefineOnGlobal); |
361 | 0 | } |
362 | | |
363 | | JSObject* |
364 | | GetConstructorObject(JSContext* aCx); |
365 | | |
366 | | } // namespace MozCanvasPrintState_Binding |
367 | | |
368 | | |
369 | | |
370 | | } // namespace dom |
371 | | } // namespace mozilla |
372 | | |
373 | | #endif // mozilla_dom_HTMLCanvasElementBinding_h |