Coverage Report

Created: 2018-09-25 14:53

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