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