Coverage Report

Created: 2018-09-25 14:53

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