Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM AudioParam.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "AudioParamBinding.h"
4 : #include "WrapperFactory.h"
5 : #include "jsfriendapi.h"
6 : #include "mozilla/FloatingPoint.h"
7 : #include "mozilla/OwningNonNull.h"
8 : #include "mozilla/Preferences.h"
9 : #include "mozilla/dom/AudioParam.h"
10 : #include "mozilla/dom/BindingUtils.h"
11 : #include "mozilla/dom/DOMJSClass.h"
12 : #include "mozilla/dom/NonRefcountedDOMObject.h"
13 : #include "mozilla/dom/PrimitiveConversions.h"
14 : #include "mozilla/dom/TypedArray.h"
15 : #include "mozilla/dom/XrayExpandoClass.h"
16 : #include "nsContentUtils.h"
17 :
18 : namespace mozilla {
19 : namespace dom {
20 :
21 : namespace AudioParamBinding {
22 :
23 : static bool
24 0 : get_value(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioParam* self, JSJitGetterCallArgs args)
25 : {
26 0 : float result(self->Value());
27 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
28 0 : args.rval().set(JS_NumberValue(double(result)));
29 0 : return true;
30 : }
31 :
32 : static bool
33 0 : set_value(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioParam* self, JSJitSetterCallArgs args)
34 : {
35 : float arg0;
36 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
37 0 : return false;
38 0 : } else if (!mozilla::IsFinite(arg0)) {
39 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to AudioParam.value");
40 0 : return false;
41 : }
42 0 : self->SetValue(arg0);
43 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
44 :
45 0 : return true;
46 : }
47 :
48 : static const JSJitInfo value_getterinfo = {
49 : { (JSJitGetterOp)get_value },
50 : { prototypes::id::AudioParam },
51 : { PrototypeTraits<prototypes::id::AudioParam>::Depth },
52 : JSJitInfo::Getter,
53 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
54 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
55 : true, /* isInfallible. False in setters. */
56 : false, /* isMovable. Not relevant for setters. */
57 : false, /* isEliminatable. Not relevant for setters. */
58 : false, /* isAlwaysInSlot. Only relevant for getters. */
59 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
60 : false, /* isTypedMethod. Only relevant for methods. */
61 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
62 : };
63 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
64 : static_assert(0 < 1, "There is no slot for us");
65 : static const JSJitInfo value_setterinfo = {
66 : { (JSJitGetterOp)set_value },
67 : { prototypes::id::AudioParam },
68 : { PrototypeTraits<prototypes::id::AudioParam>::Depth },
69 : JSJitInfo::Setter,
70 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
71 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
72 : false, /* isInfallible. False in setters. */
73 : false, /* isMovable. Not relevant for setters. */
74 : false, /* isEliminatable. Not relevant for setters. */
75 : false, /* isAlwaysInSlot. Only relevant for getters. */
76 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
77 : false, /* isTypedMethod. Only relevant for methods. */
78 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
79 : };
80 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
81 : static_assert(0 < 1, "There is no slot for us");
82 :
83 : static bool
84 0 : get_defaultValue(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioParam* self, JSJitGetterCallArgs args)
85 : {
86 0 : float result(self->DefaultValue());
87 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
88 0 : args.rval().set(JS_NumberValue(double(result)));
89 0 : return true;
90 : }
91 :
92 : static const JSJitInfo defaultValue_getterinfo = {
93 : { (JSJitGetterOp)get_defaultValue },
94 : { prototypes::id::AudioParam },
95 : { PrototypeTraits<prototypes::id::AudioParam>::Depth },
96 : JSJitInfo::Getter,
97 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
98 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
99 : true, /* isInfallible. False in setters. */
100 : false, /* isMovable. Not relevant for setters. */
101 : false, /* isEliminatable. Not relevant for setters. */
102 : false, /* isAlwaysInSlot. Only relevant for getters. */
103 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
104 : false, /* isTypedMethod. Only relevant for methods. */
105 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
106 : };
107 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
108 : static_assert(0 < 1, "There is no slot for us");
109 :
110 : static bool
111 0 : get_minValue(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioParam* self, JSJitGetterCallArgs args)
112 : {
113 0 : float result(self->MinValue());
114 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
115 0 : args.rval().set(JS_NumberValue(double(result)));
116 0 : return true;
117 : }
118 :
119 : static const JSJitInfo minValue_getterinfo = {
120 : { (JSJitGetterOp)get_minValue },
121 : { prototypes::id::AudioParam },
122 : { PrototypeTraits<prototypes::id::AudioParam>::Depth },
123 : JSJitInfo::Getter,
124 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
125 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
126 : true, /* isInfallible. False in setters. */
127 : false, /* isMovable. Not relevant for setters. */
128 : false, /* isEliminatable. Not relevant for setters. */
129 : false, /* isAlwaysInSlot. Only relevant for getters. */
130 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
131 : false, /* isTypedMethod. Only relevant for methods. */
132 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
133 : };
134 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
135 : static_assert(0 < 1, "There is no slot for us");
136 :
137 : static bool
138 0 : get_maxValue(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioParam* self, JSJitGetterCallArgs args)
139 : {
140 0 : float result(self->MaxValue());
141 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
142 0 : args.rval().set(JS_NumberValue(double(result)));
143 0 : return true;
144 : }
145 :
146 : static const JSJitInfo maxValue_getterinfo = {
147 : { (JSJitGetterOp)get_maxValue },
148 : { prototypes::id::AudioParam },
149 : { PrototypeTraits<prototypes::id::AudioParam>::Depth },
150 : JSJitInfo::Getter,
151 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
152 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
153 : true, /* isInfallible. False in setters. */
154 : false, /* isMovable. Not relevant for setters. */
155 : false, /* isEliminatable. Not relevant for setters. */
156 : false, /* isAlwaysInSlot. Only relevant for getters. */
157 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
158 : false, /* isTypedMethod. Only relevant for methods. */
159 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
160 : };
161 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
162 : static_assert(0 < 1, "There is no slot for us");
163 :
164 : static bool
165 0 : setValueAtTime(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioParam* self, const JSJitMethodCallArgs& args)
166 : {
167 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
168 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "AudioParam.setValueAtTime");
169 : }
170 : float arg0;
171 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
172 0 : return false;
173 0 : } else if (!mozilla::IsFinite(arg0)) {
174 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of AudioParam.setValueAtTime");
175 0 : return false;
176 : }
177 : double arg1;
178 0 : if (!ValueToPrimitive<double, eDefault>(cx, args[1], &arg1)) {
179 0 : return false;
180 0 : } else if (!mozilla::IsFinite(arg1)) {
181 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of AudioParam.setValueAtTime");
182 0 : return false;
183 : }
184 0 : binding_detail::FastErrorResult rv;
185 0 : auto result(StrongOrRawPtr<mozilla::dom::AudioParam>(self->SetValueAtTime(arg0, arg1, rv)));
186 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
187 0 : return false;
188 : }
189 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
190 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
191 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
192 0 : return false;
193 : }
194 0 : return true;
195 : }
196 :
197 : static const JSJitInfo setValueAtTime_methodinfo = {
198 : { (JSJitGetterOp)setValueAtTime },
199 : { prototypes::id::AudioParam },
200 : { PrototypeTraits<prototypes::id::AudioParam>::Depth },
201 : JSJitInfo::Method,
202 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
203 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
204 : false, /* isInfallible. False in setters. */
205 : false, /* isMovable. Not relevant for setters. */
206 : false, /* isEliminatable. Not relevant for setters. */
207 : false, /* isAlwaysInSlot. Only relevant for getters. */
208 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
209 : false, /* isTypedMethod. Only relevant for methods. */
210 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
211 : };
212 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
213 : static_assert(0 < 1, "There is no slot for us");
214 :
215 : static bool
216 0 : linearRampToValueAtTime(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioParam* self, const JSJitMethodCallArgs& args)
217 : {
218 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
219 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "AudioParam.linearRampToValueAtTime");
220 : }
221 : float arg0;
222 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
223 0 : return false;
224 0 : } else if (!mozilla::IsFinite(arg0)) {
225 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of AudioParam.linearRampToValueAtTime");
226 0 : return false;
227 : }
228 : double arg1;
229 0 : if (!ValueToPrimitive<double, eDefault>(cx, args[1], &arg1)) {
230 0 : return false;
231 0 : } else if (!mozilla::IsFinite(arg1)) {
232 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of AudioParam.linearRampToValueAtTime");
233 0 : return false;
234 : }
235 0 : binding_detail::FastErrorResult rv;
236 0 : auto result(StrongOrRawPtr<mozilla::dom::AudioParam>(self->LinearRampToValueAtTime(arg0, arg1, rv)));
237 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
238 0 : return false;
239 : }
240 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
241 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
242 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
243 0 : return false;
244 : }
245 0 : return true;
246 : }
247 :
248 : static const JSJitInfo linearRampToValueAtTime_methodinfo = {
249 : { (JSJitGetterOp)linearRampToValueAtTime },
250 : { prototypes::id::AudioParam },
251 : { PrototypeTraits<prototypes::id::AudioParam>::Depth },
252 : JSJitInfo::Method,
253 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
254 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
255 : false, /* isInfallible. False in setters. */
256 : false, /* isMovable. Not relevant for setters. */
257 : false, /* isEliminatable. Not relevant for setters. */
258 : false, /* isAlwaysInSlot. Only relevant for getters. */
259 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
260 : false, /* isTypedMethod. Only relevant for methods. */
261 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
262 : };
263 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
264 : static_assert(0 < 1, "There is no slot for us");
265 :
266 : static bool
267 0 : exponentialRampToValueAtTime(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioParam* self, const JSJitMethodCallArgs& args)
268 : {
269 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
270 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "AudioParam.exponentialRampToValueAtTime");
271 : }
272 : float arg0;
273 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
274 0 : return false;
275 0 : } else if (!mozilla::IsFinite(arg0)) {
276 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of AudioParam.exponentialRampToValueAtTime");
277 0 : return false;
278 : }
279 : double arg1;
280 0 : if (!ValueToPrimitive<double, eDefault>(cx, args[1], &arg1)) {
281 0 : return false;
282 0 : } else if (!mozilla::IsFinite(arg1)) {
283 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of AudioParam.exponentialRampToValueAtTime");
284 0 : return false;
285 : }
286 0 : binding_detail::FastErrorResult rv;
287 0 : auto result(StrongOrRawPtr<mozilla::dom::AudioParam>(self->ExponentialRampToValueAtTime(arg0, arg1, rv)));
288 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
289 0 : return false;
290 : }
291 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
292 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
293 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
294 0 : return false;
295 : }
296 0 : return true;
297 : }
298 :
299 : static const JSJitInfo exponentialRampToValueAtTime_methodinfo = {
300 : { (JSJitGetterOp)exponentialRampToValueAtTime },
301 : { prototypes::id::AudioParam },
302 : { PrototypeTraits<prototypes::id::AudioParam>::Depth },
303 : JSJitInfo::Method,
304 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
305 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
306 : false, /* isInfallible. False in setters. */
307 : false, /* isMovable. Not relevant for setters. */
308 : false, /* isEliminatable. Not relevant for setters. */
309 : false, /* isAlwaysInSlot. Only relevant for getters. */
310 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
311 : false, /* isTypedMethod. Only relevant for methods. */
312 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
313 : };
314 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
315 : static_assert(0 < 1, "There is no slot for us");
316 :
317 : static bool
318 0 : setTargetAtTime(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioParam* self, const JSJitMethodCallArgs& args)
319 : {
320 0 : if (MOZ_UNLIKELY(args.length() < 3)) {
321 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "AudioParam.setTargetAtTime");
322 : }
323 : float arg0;
324 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
325 0 : return false;
326 0 : } else if (!mozilla::IsFinite(arg0)) {
327 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of AudioParam.setTargetAtTime");
328 0 : return false;
329 : }
330 : double arg1;
331 0 : if (!ValueToPrimitive<double, eDefault>(cx, args[1], &arg1)) {
332 0 : return false;
333 0 : } else if (!mozilla::IsFinite(arg1)) {
334 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of AudioParam.setTargetAtTime");
335 0 : return false;
336 : }
337 : double arg2;
338 0 : if (!ValueToPrimitive<double, eDefault>(cx, args[2], &arg2)) {
339 0 : return false;
340 0 : } else if (!mozilla::IsFinite(arg2)) {
341 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 3 of AudioParam.setTargetAtTime");
342 0 : return false;
343 : }
344 0 : binding_detail::FastErrorResult rv;
345 0 : auto result(StrongOrRawPtr<mozilla::dom::AudioParam>(self->SetTargetAtTime(arg0, arg1, arg2, rv)));
346 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
347 0 : return false;
348 : }
349 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
350 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
351 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
352 0 : return false;
353 : }
354 0 : return true;
355 : }
356 :
357 : static const JSJitInfo setTargetAtTime_methodinfo = {
358 : { (JSJitGetterOp)setTargetAtTime },
359 : { prototypes::id::AudioParam },
360 : { PrototypeTraits<prototypes::id::AudioParam>::Depth },
361 : JSJitInfo::Method,
362 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
363 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
364 : false, /* isInfallible. False in setters. */
365 : false, /* isMovable. Not relevant for setters. */
366 : false, /* isEliminatable. Not relevant for setters. */
367 : false, /* isAlwaysInSlot. Only relevant for getters. */
368 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
369 : false, /* isTypedMethod. Only relevant for methods. */
370 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
371 : };
372 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
373 : static_assert(0 < 1, "There is no slot for us");
374 :
375 : static bool
376 0 : setValueCurveAtTime(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioParam* self, const JSJitMethodCallArgs& args)
377 : {
378 0 : if (MOZ_UNLIKELY(args.length() < 3)) {
379 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "AudioParam.setValueCurveAtTime");
380 : }
381 0 : RootedTypedArray<Float32Array> arg0(cx);
382 0 : if (args[0].isObject()) {
383 0 : if (!arg0.Init(&args[0].toObject())) {
384 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of AudioParam.setValueCurveAtTime", "Float32Array");
385 0 : return false;
386 : }
387 : } else {
388 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of AudioParam.setValueCurveAtTime");
389 0 : return false;
390 : }
391 : double arg1;
392 0 : if (!ValueToPrimitive<double, eDefault>(cx, args[1], &arg1)) {
393 0 : return false;
394 0 : } else if (!mozilla::IsFinite(arg1)) {
395 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of AudioParam.setValueCurveAtTime");
396 0 : return false;
397 : }
398 : double arg2;
399 0 : if (!ValueToPrimitive<double, eDefault>(cx, args[2], &arg2)) {
400 0 : return false;
401 0 : } else if (!mozilla::IsFinite(arg2)) {
402 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 3 of AudioParam.setValueCurveAtTime");
403 0 : return false;
404 : }
405 0 : binding_detail::FastErrorResult rv;
406 0 : auto result(StrongOrRawPtr<mozilla::dom::AudioParam>(self->SetValueCurveAtTime(Constify(arg0), arg1, arg2, rv)));
407 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
408 0 : return false;
409 : }
410 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
411 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
412 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
413 0 : return false;
414 : }
415 0 : return true;
416 : }
417 :
418 : static const JSJitInfo setValueCurveAtTime_methodinfo = {
419 : { (JSJitGetterOp)setValueCurveAtTime },
420 : { prototypes::id::AudioParam },
421 : { PrototypeTraits<prototypes::id::AudioParam>::Depth },
422 : JSJitInfo::Method,
423 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
424 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
425 : false, /* isInfallible. False in setters. */
426 : false, /* isMovable. Not relevant for setters. */
427 : false, /* isEliminatable. Not relevant for setters. */
428 : false, /* isAlwaysInSlot. Only relevant for getters. */
429 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
430 : false, /* isTypedMethod. Only relevant for methods. */
431 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
432 : };
433 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
434 : static_assert(0 < 1, "There is no slot for us");
435 :
436 : static bool
437 0 : cancelScheduledValues(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioParam* self, const JSJitMethodCallArgs& args)
438 : {
439 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
440 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "AudioParam.cancelScheduledValues");
441 : }
442 : double arg0;
443 0 : if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
444 0 : return false;
445 0 : } else if (!mozilla::IsFinite(arg0)) {
446 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of AudioParam.cancelScheduledValues");
447 0 : return false;
448 : }
449 0 : binding_detail::FastErrorResult rv;
450 0 : auto result(StrongOrRawPtr<mozilla::dom::AudioParam>(self->CancelScheduledValues(arg0, rv)));
451 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
452 0 : return false;
453 : }
454 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
455 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
456 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
457 0 : return false;
458 : }
459 0 : return true;
460 : }
461 :
462 : static const JSJitInfo cancelScheduledValues_methodinfo = {
463 : { (JSJitGetterOp)cancelScheduledValues },
464 : { prototypes::id::AudioParam },
465 : { PrototypeTraits<prototypes::id::AudioParam>::Depth },
466 : JSJitInfo::Method,
467 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
468 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
469 : false, /* isInfallible. False in setters. */
470 : false, /* isMovable. Not relevant for setters. */
471 : false, /* isEliminatable. Not relevant for setters. */
472 : false, /* isAlwaysInSlot. Only relevant for getters. */
473 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
474 : false, /* isTypedMethod. Only relevant for methods. */
475 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
476 : };
477 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
478 : static_assert(0 < 1, "There is no slot for us");
479 :
480 : static bool
481 0 : get_parentNodeId(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioParam* self, JSJitGetterCallArgs args)
482 : {
483 0 : uint32_t result(self->ParentNodeId());
484 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
485 0 : args.rval().setNumber(result);
486 0 : return true;
487 : }
488 :
489 : static const JSJitInfo parentNodeId_getterinfo = {
490 : { (JSJitGetterOp)get_parentNodeId },
491 : { prototypes::id::AudioParam },
492 : { PrototypeTraits<prototypes::id::AudioParam>::Depth },
493 : JSJitInfo::Getter,
494 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
495 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
496 : true, /* isInfallible. False in setters. */
497 : false, /* isMovable. Not relevant for setters. */
498 : false, /* isEliminatable. Not relevant for setters. */
499 : false, /* isAlwaysInSlot. Only relevant for getters. */
500 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
501 : false, /* isTypedMethod. Only relevant for methods. */
502 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
503 : };
504 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
505 : static_assert(0 < 1, "There is no slot for us");
506 :
507 : static bool
508 0 : get_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioParam* self, JSJitGetterCallArgs args)
509 : {
510 0 : DOMString result;
511 0 : self->GetName(result);
512 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
513 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
514 0 : return false;
515 : }
516 0 : return true;
517 : }
518 :
519 : static const JSJitInfo name_getterinfo = {
520 : { (JSJitGetterOp)get_name },
521 : { prototypes::id::AudioParam },
522 : { PrototypeTraits<prototypes::id::AudioParam>::Depth },
523 : JSJitInfo::Getter,
524 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
525 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
526 : false, /* isInfallible. False in setters. */
527 : false, /* isMovable. Not relevant for setters. */
528 : false, /* isEliminatable. Not relevant for setters. */
529 : false, /* isAlwaysInSlot. Only relevant for getters. */
530 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
531 : false, /* isTypedMethod. Only relevant for methods. */
532 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
533 : };
534 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
535 : static_assert(0 < 1, "There is no slot for us");
536 :
537 : static bool
538 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
539 : {
540 0 : mozilla::dom::AudioParam* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::AudioParam>(obj);
541 : // We don't want to preserve if we don't have a wrapper, and we
542 : // obviously can't preserve if we're not initialized.
543 0 : if (self && self->GetWrapperPreserveColor()) {
544 0 : PreserveWrapper(self);
545 : }
546 0 : return true;
547 : }
548 :
549 : static void
550 0 : _finalize(js::FreeOp* fop, JSObject* obj)
551 : {
552 0 : mozilla::dom::AudioParam* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::AudioParam>(obj);
553 0 : if (self) {
554 0 : ClearWrapper(self, self, obj);
555 0 : AddForDeferredFinalization<mozilla::dom::AudioParam>(self);
556 : }
557 0 : }
558 :
559 : static void
560 0 : _objectMoved(JSObject* obj, const JSObject* old)
561 : {
562 0 : mozilla::dom::AudioParam* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::AudioParam>(obj);
563 0 : if (self) {
564 0 : UpdateWrapper(self, self, obj, old);
565 : }
566 0 : }
567 :
568 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
569 : #if defined(__clang__)
570 : #pragma clang diagnostic push
571 : #pragma clang diagnostic ignored "-Wmissing-braces"
572 : #endif
573 : static const JSFunctionSpec sMethods_specs[] = {
574 : JS_FNSPEC("setValueAtTime", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setValueAtTime_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
575 : JS_FNSPEC("linearRampToValueAtTime", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&linearRampToValueAtTime_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
576 : JS_FNSPEC("exponentialRampToValueAtTime", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&exponentialRampToValueAtTime_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
577 : JS_FNSPEC("setTargetAtTime", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setTargetAtTime_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
578 : JS_FNSPEC("setValueCurveAtTime", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setValueCurveAtTime_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
579 : JS_FNSPEC("cancelScheduledValues", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&cancelScheduledValues_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
580 : JS_FS_END
581 : };
582 : #if defined(__clang__)
583 : #pragma clang diagnostic pop
584 : #endif
585 :
586 :
587 : // Can't be const because the pref-enabled boolean needs to be writable
588 : static Prefable<const JSFunctionSpec> sMethods[] = {
589 : { nullptr, &sMethods_specs[0] },
590 : { nullptr, nullptr }
591 : };
592 :
593 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
594 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
595 : static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
596 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
597 :
598 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
599 : #if defined(__clang__)
600 : #pragma clang diagnostic push
601 : #pragma clang diagnostic ignored "-Wmissing-braces"
602 : #endif
603 : static const JSPropertySpec sAttributes_specs[] = {
604 : { "value", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &value_getterinfo, GenericBindingSetter, &value_setterinfo },
605 : { "defaultValue", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &defaultValue_getterinfo, nullptr, nullptr },
606 : { "minValue", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &minValue_getterinfo, nullptr, nullptr },
607 : { "maxValue", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &maxValue_getterinfo, nullptr, nullptr },
608 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
609 : };
610 : #if defined(__clang__)
611 : #pragma clang diagnostic pop
612 : #endif
613 :
614 :
615 : // Can't be const because the pref-enabled boolean needs to be writable
616 : static Prefable<const JSPropertySpec> sAttributes[] = {
617 : { nullptr, &sAttributes_specs[0] },
618 : { nullptr, nullptr }
619 : };
620 :
621 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
622 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
623 : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
624 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
625 :
626 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
627 : #if defined(__clang__)
628 : #pragma clang diagnostic push
629 : #pragma clang diagnostic ignored "-Wmissing-braces"
630 : #endif
631 : static const JSPropertySpec sChromeAttributes_specs[] = {
632 : { "parentNodeId", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &parentNodeId_getterinfo, nullptr, nullptr },
633 : { "name", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &name_getterinfo, nullptr, nullptr },
634 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
635 : };
636 : #if defined(__clang__)
637 : #pragma clang diagnostic pop
638 : #endif
639 :
640 :
641 : // Can't be const because the pref-enabled boolean needs to be writable
642 : static Prefable<const JSPropertySpec> sChromeAttributes[] = {
643 : { nullptr, &sChromeAttributes_specs[0] },
644 : { nullptr, nullptr }
645 : };
646 :
647 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
648 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
649 : static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
650 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
651 :
652 :
653 : static uint16_t sNativeProperties_sortedPropertyIndices[10];
654 : static PropertyInfo sNativeProperties_propertyInfos[10];
655 :
656 : static const NativePropertiesN<2> sNativeProperties = {
657 : false, 0,
658 : false, 0,
659 : true, 0 /* sMethods */,
660 : true, 1 /* sAttributes */,
661 : false, 0,
662 : false, 0,
663 : false, 0,
664 : -1,
665 : 10,
666 : sNativeProperties_sortedPropertyIndices,
667 : {
668 : { sMethods, &sNativeProperties_propertyInfos[0] },
669 : { sAttributes, &sNativeProperties_propertyInfos[6] }
670 : }
671 : };
672 : static_assert(10 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
673 : "We have a property info count that is oversized");
674 :
675 : static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[2];
676 : static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[2];
677 :
678 : static const NativePropertiesN<1> sChromeOnlyNativeProperties = {
679 : false, 0,
680 : false, 0,
681 : false, 0,
682 : true, 0 /* sChromeAttributes */,
683 : false, 0,
684 : false, 0,
685 : false, 0,
686 : -1,
687 : 2,
688 : sChromeOnlyNativeProperties_sortedPropertyIndices,
689 : {
690 : { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[0] }
691 : }
692 : };
693 : static_assert(2 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount),
694 : "We have a property info count that is oversized");
695 :
696 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
697 : {
698 : "Function",
699 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
700 : &sBoringInterfaceObjectClassClassOps,
701 : JS_NULL_CLASS_SPEC,
702 : JS_NULL_CLASS_EXT,
703 : &sInterfaceObjectClassObjectOps
704 : },
705 : eInterface,
706 : true,
707 : prototypes::id::AudioParam,
708 : PrototypeTraits<prototypes::id::AudioParam>::Depth,
709 : sNativePropertyHooks,
710 : "function AudioParam() {\n [native code]\n}",
711 : JS::GetRealmFunctionPrototype
712 : };
713 :
714 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
715 : {
716 : "AudioParamPrototype",
717 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
718 : JS_NULL_CLASS_OPS,
719 : JS_NULL_CLASS_SPEC,
720 : JS_NULL_CLASS_EXT,
721 : JS_NULL_OBJECT_OPS
722 : },
723 : eInterfacePrototype,
724 : false,
725 : prototypes::id::AudioParam,
726 : PrototypeTraits<prototypes::id::AudioParam>::Depth,
727 : sNativePropertyHooks,
728 : "[object AudioParamPrototype]",
729 : JS::GetRealmObjectPrototype
730 : };
731 :
732 : bool
733 0 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
734 : {
735 : static bool sPrefValue;
736 : static bool sPrefCacheSetUp = false;
737 0 : if (!sPrefCacheSetUp) {
738 0 : sPrefCacheSetUp = true;
739 0 : Preferences::AddBoolVarCache(&sPrefValue, "dom.webaudio.enabled");
740 : }
741 :
742 0 : return sPrefValue;
743 : }
744 :
745 : JSObject*
746 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
747 : {
748 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
749 : }
750 :
751 : static const js::ClassOps sClassOps = {
752 : _addProperty, /* addProperty */
753 : nullptr, /* delProperty */
754 : nullptr, /* getProperty */
755 : nullptr, /* setProperty */
756 : nullptr, /* enumerate */
757 : nullptr, /* newEnumerate */
758 : nullptr, /* resolve */
759 : nullptr, /* mayResolve */
760 : _finalize, /* finalize */
761 : nullptr, /* call */
762 : nullptr, /* hasInstance */
763 : nullptr, /* construct */
764 : nullptr, /* trace */
765 : };
766 :
767 : static const js::ClassExtension sClassExtension = {
768 : nullptr, /* weakmapKeyDelegateOp */
769 : _objectMoved /* objectMovedOp */
770 : };
771 :
772 : static const DOMJSClass sClass = {
773 : { "AudioParam",
774 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
775 : &sClassOps,
776 : JS_NULL_CLASS_SPEC,
777 : &sClassExtension,
778 : JS_NULL_OBJECT_OPS
779 : },
780 : { prototypes::id::AudioParam, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
781 : IsBaseOf<nsISupports, mozilla::dom::AudioParam >::value,
782 : sNativePropertyHooks,
783 : FindAssociatedGlobalForNative<mozilla::dom::AudioParam>::Get,
784 : GetProtoObjectHandle,
785 : GetCCParticipant<mozilla::dom::AudioParam>::Get()
786 : };
787 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
788 : "Must have the right minimal number of reserved slots.");
789 : static_assert(1 >= 1,
790 : "Must have enough reserved slots.");
791 :
792 : const JSClass*
793 0 : GetJSClass()
794 : {
795 0 : return sClass.ToJSClass();
796 : }
797 :
798 : bool
799 0 : Wrap(JSContext* aCx, mozilla::dom::AudioParam* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
800 : {
801 : MOZ_ASSERT(static_cast<mozilla::dom::AudioParam*>(aObject) ==
802 : reinterpret_cast<mozilla::dom::AudioParam*>(aObject),
803 : "Multiple inheritance for mozilla::dom::AudioParam is broken.");
804 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
805 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
806 0 : MOZ_ASSERT(!aCache->GetWrapper(),
807 : "You should probably not be using Wrap() directly; use "
808 : "GetOrCreateDOMReflector instead");
809 :
810 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
811 : "nsISupports must be on our primary inheritance chain");
812 :
813 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
814 0 : if (!global) {
815 0 : return false;
816 : }
817 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
818 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
819 :
820 : // That might have ended up wrapping us already, due to the wonders
821 : // of XBL. Check for that, and bail out as needed.
822 0 : aReflector.set(aCache->GetWrapper());
823 0 : if (aReflector) {
824 : #ifdef DEBUG
825 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
826 : #endif // DEBUG
827 0 : return true;
828 : }
829 :
830 0 : JSAutoCompartment ac(aCx, global);
831 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
832 0 : if (!canonicalProto) {
833 0 : return false;
834 : }
835 0 : JS::Rooted<JSObject*> proto(aCx);
836 0 : if (aGivenProto) {
837 0 : proto = aGivenProto;
838 : // Unfortunately, while aGivenProto was in the compartment of aCx
839 : // coming in, we changed compartments to that of "parent" so may need
840 : // to wrap the proto here.
841 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
842 0 : if (!JS_WrapObject(aCx, &proto)) {
843 0 : return false;
844 : }
845 : }
846 : } else {
847 0 : proto = canonicalProto;
848 : }
849 :
850 0 : BindingJSObjectCreator<mozilla::dom::AudioParam> creator(aCx);
851 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
852 0 : if (!aReflector) {
853 0 : return false;
854 : }
855 :
856 0 : aCache->SetWrapper(aReflector);
857 0 : creator.InitializationSucceeded();
858 :
859 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
860 : aCache->GetWrapperPreserveColor() == aReflector);
861 : // If proto != canonicalProto, we have to preserve our wrapper;
862 : // otherwise we won't be able to properly recreate it later, since
863 : // we won't know what proto to use. Note that we don't check
864 : // aGivenProto here, since it's entirely possible (and even
865 : // somewhat common) to have a non-null aGivenProto which is the
866 : // same as canonicalProto.
867 0 : if (proto != canonicalProto) {
868 0 : PreserveWrapper(aObject);
869 : }
870 :
871 0 : return true;
872 : }
873 :
874 : const NativePropertyHooks sNativePropertyHooks[] = { {
875 : nullptr,
876 : nullptr,
877 : nullptr,
878 : { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() },
879 : prototypes::id::AudioParam,
880 : constructors::id::AudioParam,
881 : nullptr,
882 : &DefaultXrayExpandoObjectClass
883 : } };
884 :
885 : void
886 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
887 : {
888 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
889 0 : if (!parentProto) {
890 0 : return;
891 : }
892 :
893 0 : JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
894 0 : if (!constructorProto) {
895 0 : return;
896 : }
897 :
898 : static bool sIdsInited = false;
899 0 : if (!sIdsInited && NS_IsMainThread()) {
900 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
901 0 : return;
902 : }
903 0 : if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) {
904 0 : return;
905 : }
906 0 : sIdsInited = true;
907 : }
908 :
909 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::AudioParam);
910 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::AudioParam);
911 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
912 : &sPrototypeClass.mBase, protoCache,
913 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
914 : interfaceCache,
915 : sNativeProperties.Upcast(),
916 0 : nsContentUtils::ThreadsafeIsSystemCaller(aCx) ? sChromeOnlyNativeProperties.Upcast() : nullptr,
917 : "AudioParam", aDefineOnGlobal,
918 : nullptr,
919 0 : false);
920 : }
921 :
922 : JS::Handle<JSObject*>
923 0 : GetProtoObjectHandle(JSContext* aCx)
924 : {
925 : /* Get the interface prototype object for this class. This will create the
926 : object as needed. */
927 0 : bool aDefineOnGlobal = true;
928 :
929 : /* Make sure our global is sane. Hopefully we can remove this sometime */
930 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
931 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
932 0 : return nullptr;
933 : }
934 :
935 : /* Check to see whether the interface objects are already installed */
936 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
937 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::AudioParam)) {
938 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
939 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
940 : }
941 :
942 : /*
943 : * The object might _still_ be null, but that's OK.
944 : *
945 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
946 : * traced by TraceProtoAndIfaceCache() and its contents are never
947 : * changed after they have been set.
948 : *
949 : * Calling address() avoids the read read barrier that does gray
950 : * unmarking, but it's not possible for the object to be gray here.
951 : */
952 :
953 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::AudioParam);
954 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
955 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
956 : }
957 :
958 : JS::Handle<JSObject*>
959 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
960 : {
961 : /* Get the interface object for this class. This will create the object as
962 : needed. */
963 :
964 : /* Make sure our global is sane. Hopefully we can remove this sometime */
965 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
966 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
967 0 : return nullptr;
968 : }
969 :
970 : /* Check to see whether the interface objects are already installed */
971 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
972 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::AudioParam)) {
973 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
974 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
975 : }
976 :
977 : /*
978 : * The object might _still_ be null, but that's OK.
979 : *
980 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
981 : * traced by TraceProtoAndIfaceCache() and its contents are never
982 : * changed after they have been set.
983 : *
984 : * Calling address() avoids the read read barrier that does gray
985 : * unmarking, but it's not possible for the object to be gray here.
986 : */
987 :
988 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::AudioParam);
989 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
990 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
991 : }
992 :
993 : JSObject*
994 0 : GetConstructorObject(JSContext* aCx)
995 : {
996 0 : return GetConstructorObjectHandle(aCx);
997 : }
998 :
999 : } // namespace AudioParamBinding
1000 :
1001 :
1002 :
1003 : } // namespace dom
1004 : } // namespace mozilla
|