Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dom/bindings/PannerNodeBinding.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM PannerNode.webidl BY Codegen.py - DO NOT EDIT */
2
3
#include "AtomList.h"
4
#include "AudioNodeBinding.h"
5
#include "PannerNodeBinding.h"
6
#include "WrapperFactory.h"
7
#include "jsapi.h"
8
#include "mozilla/FloatingPoint.h"
9
#include "mozilla/OwningNonNull.h"
10
#include "mozilla/Preferences.h"
11
#include "mozilla/dom/AudioContext.h"
12
#include "mozilla/dom/AudioParam.h"
13
#include "mozilla/dom/BindingUtils.h"
14
#include "mozilla/dom/DOMJSClass.h"
15
#include "mozilla/dom/NonRefcountedDOMObject.h"
16
#include "mozilla/dom/PannerNode.h"
17
#include "mozilla/dom/PrimitiveConversions.h"
18
#include "mozilla/dom/ScriptSettings.h"
19
#include "mozilla/dom/SimpleGlobalObject.h"
20
#include "mozilla/dom/XrayExpandoClass.h"
21
#include "nsContentUtils.h"
22
23
namespace mozilla {
24
namespace dom {
25
26
namespace binding_detail {}; // Just to make sure it's known as a namespace
27
using namespace mozilla::dom::binding_detail;
28
29
30
namespace PanningModelTypeValues {
31
extern const EnumEntry strings[3] = {
32
  {"equalpower", 10},
33
  {"HRTF", 4},
34
  { nullptr, 0 }
35
};
36
} // namespace PanningModelTypeValues
37
38
bool
39
ToJSValue(JSContext* aCx, PanningModelType aArgument, JS::MutableHandle<JS::Value> aValue)
40
0
{
41
0
  MOZ_ASSERT(uint32_t(aArgument) < ArrayLength(PanningModelTypeValues::strings));
42
0
  JSString* resultStr =
43
0
    JS_NewStringCopyN(aCx, PanningModelTypeValues::strings[uint32_t(aArgument)].value,
44
0
                      PanningModelTypeValues::strings[uint32_t(aArgument)].length);
45
0
  if (!resultStr) {
46
0
    return false;
47
0
  }
48
0
  aValue.setString(resultStr);
49
0
  return true;
50
0
}
51
52
53
namespace DistanceModelTypeValues {
54
extern const EnumEntry strings[4] = {
55
  {"linear", 6},
56
  {"inverse", 7},
57
  {"exponential", 11},
58
  { nullptr, 0 }
59
};
60
} // namespace DistanceModelTypeValues
61
62
bool
63
ToJSValue(JSContext* aCx, DistanceModelType aArgument, JS::MutableHandle<JS::Value> aValue)
64
0
{
65
0
  MOZ_ASSERT(uint32_t(aArgument) < ArrayLength(DistanceModelTypeValues::strings));
66
0
  JSString* resultStr =
67
0
    JS_NewStringCopyN(aCx, DistanceModelTypeValues::strings[uint32_t(aArgument)].value,
68
0
                      DistanceModelTypeValues::strings[uint32_t(aArgument)].length);
69
0
  if (!resultStr) {
70
0
    return false;
71
0
  }
72
0
  aValue.setString(resultStr);
73
0
  return true;
74
0
}
75
76
77
78
PannerOptions::PannerOptions()
79
  : AudioNodeOptions(FastDictionaryInitializer())
80
0
{
81
0
  // Safe to pass a null context if we pass a null value
82
0
  Init(nullptr, JS::NullHandleValue);
83
0
}
84
85
86
87
bool
88
PannerOptions::InitIds(JSContext* cx, PannerOptionsAtoms* atomsCache)
89
0
{
90
0
  MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache));
91
0
92
0
  // Initialize these in reverse order so that any failure leaves the first one
93
0
  // uninitialized.
94
0
  if (!atomsCache->rolloffFactor_id.init(cx, "rolloffFactor") ||
95
0
      !atomsCache->refDistance_id.init(cx, "refDistance") ||
96
0
      !atomsCache->positionZ_id.init(cx, "positionZ") ||
97
0
      !atomsCache->positionY_id.init(cx, "positionY") ||
98
0
      !atomsCache->positionX_id.init(cx, "positionX") ||
99
0
      !atomsCache->panningModel_id.init(cx, "panningModel") ||
100
0
      !atomsCache->orientationZ_id.init(cx, "orientationZ") ||
101
0
      !atomsCache->orientationY_id.init(cx, "orientationY") ||
102
0
      !atomsCache->orientationX_id.init(cx, "orientationX") ||
103
0
      !atomsCache->maxDistance_id.init(cx, "maxDistance") ||
104
0
      !atomsCache->distanceModel_id.init(cx, "distanceModel") ||
105
0
      !atomsCache->coneOuterGain_id.init(cx, "coneOuterGain") ||
106
0
      !atomsCache->coneOuterAngle_id.init(cx, "coneOuterAngle") ||
107
0
      !atomsCache->coneInnerAngle_id.init(cx, "coneInnerAngle")) {
108
0
    return false;
109
0
  }
110
0
  return true;
111
0
}
112
113
bool
114
PannerOptions::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
115
0
{
116
0
  // Passing a null JSContext is OK only if we're initing from null,
117
0
  // Since in that case we will not have to do any property gets
118
0
  // Also evaluate isNullOrUndefined in order to avoid false-positive
119
0
  // checkers by static analysis tools
120
0
  MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
121
0
  PannerOptionsAtoms* atomsCache = nullptr;
122
0
  if (cx) {
123
0
    atomsCache = GetAtomCache<PannerOptionsAtoms>(cx);
124
0
    if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
125
0
      return false;
126
0
    }
127
0
  }
128
0
129
0
  // Per spec, we init the parent's members first
130
0
  if (!AudioNodeOptions::Init(cx, val)) {
131
0
    return false;
132
0
  }
133
0
134
0
  bool isNull = val.isNullOrUndefined();
135
0
  // We only need these if !isNull, in which case we have |cx|.
136
0
  Maybe<JS::Rooted<JSObject *> > object;
137
0
  Maybe<JS::Rooted<JS::Value> > temp;
138
0
  if (!isNull) {
139
0
    MOZ_ASSERT(cx);
140
0
    object.emplace(cx, &val.toObject());
141
0
    temp.emplace(cx);
142
0
  }
143
0
  if (!isNull) {
144
0
    if (!JS_GetPropertyById(cx, *object, atomsCache->coneInnerAngle_id, temp.ptr())) {
145
0
      return false;
146
0
    }
147
0
  }
148
0
  if (!isNull && !temp->isUndefined()) {
149
0
    if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mConeInnerAngle)) {
150
0
      return false;
151
0
    } else if (!mozilla::IsFinite(mConeInnerAngle)) {
152
0
      ThrowErrorMessage(cx, MSG_NOT_FINITE, "'coneInnerAngle' member of PannerOptions");
153
0
      return false;
154
0
    }
155
0
  } else {
156
0
    mConeInnerAngle = 360.0;
157
0
  }
158
0
  mIsAnyMemberPresent = true;
159
0
160
0
  if (!isNull) {
161
0
    if (!JS_GetPropertyById(cx, *object, atomsCache->coneOuterAngle_id, temp.ptr())) {
162
0
      return false;
163
0
    }
164
0
  }
165
0
  if (!isNull && !temp->isUndefined()) {
166
0
    if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mConeOuterAngle)) {
167
0
      return false;
168
0
    } else if (!mozilla::IsFinite(mConeOuterAngle)) {
169
0
      ThrowErrorMessage(cx, MSG_NOT_FINITE, "'coneOuterAngle' member of PannerOptions");
170
0
      return false;
171
0
    }
172
0
  } else {
173
0
    mConeOuterAngle = 360.0;
174
0
  }
175
0
  mIsAnyMemberPresent = true;
176
0
177
0
  if (!isNull) {
178
0
    if (!JS_GetPropertyById(cx, *object, atomsCache->coneOuterGain_id, temp.ptr())) {
179
0
      return false;
180
0
    }
181
0
  }
182
0
  if (!isNull && !temp->isUndefined()) {
183
0
    if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mConeOuterGain)) {
184
0
      return false;
185
0
    } else if (!mozilla::IsFinite(mConeOuterGain)) {
186
0
      ThrowErrorMessage(cx, MSG_NOT_FINITE, "'coneOuterGain' member of PannerOptions");
187
0
      return false;
188
0
    }
189
0
  } else {
190
0
    mConeOuterGain = 0.0;
191
0
  }
192
0
  mIsAnyMemberPresent = true;
193
0
194
0
  if (!isNull) {
195
0
    if (!JS_GetPropertyById(cx, *object, atomsCache->distanceModel_id, temp.ptr())) {
196
0
      return false;
197
0
    }
198
0
  }
199
0
  if (!isNull && !temp->isUndefined()) {
200
0
    {
201
0
      int index;
202
0
      if (!FindEnumStringIndex<true>(cx, temp.ref(), DistanceModelTypeValues::strings, "DistanceModelType", "'distanceModel' member of PannerOptions", &index)) {
203
0
        return false;
204
0
      }
205
0
      MOZ_ASSERT(index >= 0);
206
0
      mDistanceModel = static_cast<DistanceModelType>(index);
207
0
    }
208
0
  } else {
209
0
    mDistanceModel = DistanceModelType::Inverse;
210
0
  }
211
0
  mIsAnyMemberPresent = true;
212
0
213
0
  if (!isNull) {
214
0
    if (!JS_GetPropertyById(cx, *object, atomsCache->maxDistance_id, temp.ptr())) {
215
0
      return false;
216
0
    }
217
0
  }
218
0
  if (!isNull && !temp->isUndefined()) {
219
0
    if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mMaxDistance)) {
220
0
      return false;
221
0
    } else if (!mozilla::IsFinite(mMaxDistance)) {
222
0
      ThrowErrorMessage(cx, MSG_NOT_FINITE, "'maxDistance' member of PannerOptions");
223
0
      return false;
224
0
    }
225
0
  } else {
226
0
    mMaxDistance = 10000.0;
227
0
  }
228
0
  mIsAnyMemberPresent = true;
229
0
230
0
  if (!isNull) {
231
0
    if (!JS_GetPropertyById(cx, *object, atomsCache->orientationX_id, temp.ptr())) {
232
0
      return false;
233
0
    }
234
0
  }
235
0
  if (!isNull && !temp->isUndefined()) {
236
0
    if (!ValueToPrimitive<float, eDefault>(cx, temp.ref(), &mOrientationX)) {
237
0
      return false;
238
0
    } else if (!mozilla::IsFinite(mOrientationX)) {
239
0
      ThrowErrorMessage(cx, MSG_NOT_FINITE, "'orientationX' member of PannerOptions");
240
0
      return false;
241
0
    }
242
0
  } else {
243
0
    mOrientationX = 1.0F;
244
0
  }
245
0
  mIsAnyMemberPresent = true;
246
0
247
0
  if (!isNull) {
248
0
    if (!JS_GetPropertyById(cx, *object, atomsCache->orientationY_id, temp.ptr())) {
249
0
      return false;
250
0
    }
251
0
  }
252
0
  if (!isNull && !temp->isUndefined()) {
253
0
    if (!ValueToPrimitive<float, eDefault>(cx, temp.ref(), &mOrientationY)) {
254
0
      return false;
255
0
    } else if (!mozilla::IsFinite(mOrientationY)) {
256
0
      ThrowErrorMessage(cx, MSG_NOT_FINITE, "'orientationY' member of PannerOptions");
257
0
      return false;
258
0
    }
259
0
  } else {
260
0
    mOrientationY = 0.0F;
261
0
  }
262
0
  mIsAnyMemberPresent = true;
263
0
264
0
  if (!isNull) {
265
0
    if (!JS_GetPropertyById(cx, *object, atomsCache->orientationZ_id, temp.ptr())) {
266
0
      return false;
267
0
    }
268
0
  }
269
0
  if (!isNull && !temp->isUndefined()) {
270
0
    if (!ValueToPrimitive<float, eDefault>(cx, temp.ref(), &mOrientationZ)) {
271
0
      return false;
272
0
    } else if (!mozilla::IsFinite(mOrientationZ)) {
273
0
      ThrowErrorMessage(cx, MSG_NOT_FINITE, "'orientationZ' member of PannerOptions");
274
0
      return false;
275
0
    }
276
0
  } else {
277
0
    mOrientationZ = 0.0F;
278
0
  }
279
0
  mIsAnyMemberPresent = true;
280
0
281
0
  if (!isNull) {
282
0
    if (!JS_GetPropertyById(cx, *object, atomsCache->panningModel_id, temp.ptr())) {
283
0
      return false;
284
0
    }
285
0
  }
286
0
  if (!isNull && !temp->isUndefined()) {
287
0
    {
288
0
      int index;
289
0
      if (!FindEnumStringIndex<true>(cx, temp.ref(), PanningModelTypeValues::strings, "PanningModelType", "'panningModel' member of PannerOptions", &index)) {
290
0
        return false;
291
0
      }
292
0
      MOZ_ASSERT(index >= 0);
293
0
      mPanningModel = static_cast<PanningModelType>(index);
294
0
    }
295
0
  } else {
296
0
    mPanningModel = PanningModelType::Equalpower;
297
0
  }
298
0
  mIsAnyMemberPresent = true;
299
0
300
0
  if (!isNull) {
301
0
    if (!JS_GetPropertyById(cx, *object, atomsCache->positionX_id, temp.ptr())) {
302
0
      return false;
303
0
    }
304
0
  }
305
0
  if (!isNull && !temp->isUndefined()) {
306
0
    if (!ValueToPrimitive<float, eDefault>(cx, temp.ref(), &mPositionX)) {
307
0
      return false;
308
0
    } else if (!mozilla::IsFinite(mPositionX)) {
309
0
      ThrowErrorMessage(cx, MSG_NOT_FINITE, "'positionX' member of PannerOptions");
310
0
      return false;
311
0
    }
312
0
  } else {
313
0
    mPositionX = 0.0F;
314
0
  }
315
0
  mIsAnyMemberPresent = true;
316
0
317
0
  if (!isNull) {
318
0
    if (!JS_GetPropertyById(cx, *object, atomsCache->positionY_id, temp.ptr())) {
319
0
      return false;
320
0
    }
321
0
  }
322
0
  if (!isNull && !temp->isUndefined()) {
323
0
    if (!ValueToPrimitive<float, eDefault>(cx, temp.ref(), &mPositionY)) {
324
0
      return false;
325
0
    } else if (!mozilla::IsFinite(mPositionY)) {
326
0
      ThrowErrorMessage(cx, MSG_NOT_FINITE, "'positionY' member of PannerOptions");
327
0
      return false;
328
0
    }
329
0
  } else {
330
0
    mPositionY = 0.0F;
331
0
  }
332
0
  mIsAnyMemberPresent = true;
333
0
334
0
  if (!isNull) {
335
0
    if (!JS_GetPropertyById(cx, *object, atomsCache->positionZ_id, temp.ptr())) {
336
0
      return false;
337
0
    }
338
0
  }
339
0
  if (!isNull && !temp->isUndefined()) {
340
0
    if (!ValueToPrimitive<float, eDefault>(cx, temp.ref(), &mPositionZ)) {
341
0
      return false;
342
0
    } else if (!mozilla::IsFinite(mPositionZ)) {
343
0
      ThrowErrorMessage(cx, MSG_NOT_FINITE, "'positionZ' member of PannerOptions");
344
0
      return false;
345
0
    }
346
0
  } else {
347
0
    mPositionZ = 0.0F;
348
0
  }
349
0
  mIsAnyMemberPresent = true;
350
0
351
0
  if (!isNull) {
352
0
    if (!JS_GetPropertyById(cx, *object, atomsCache->refDistance_id, temp.ptr())) {
353
0
      return false;
354
0
    }
355
0
  }
356
0
  if (!isNull && !temp->isUndefined()) {
357
0
    if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mRefDistance)) {
358
0
      return false;
359
0
    } else if (!mozilla::IsFinite(mRefDistance)) {
360
0
      ThrowErrorMessage(cx, MSG_NOT_FINITE, "'refDistance' member of PannerOptions");
361
0
      return false;
362
0
    }
363
0
  } else {
364
0
    mRefDistance = 1.0;
365
0
  }
366
0
  mIsAnyMemberPresent = true;
367
0
368
0
  if (!isNull) {
369
0
    if (!JS_GetPropertyById(cx, *object, atomsCache->rolloffFactor_id, temp.ptr())) {
370
0
      return false;
371
0
    }
372
0
  }
373
0
  if (!isNull && !temp->isUndefined()) {
374
0
    if (!ValueToPrimitive<double, eDefault>(cx, temp.ref(), &mRolloffFactor)) {
375
0
      return false;
376
0
    } else if (!mozilla::IsFinite(mRolloffFactor)) {
377
0
      ThrowErrorMessage(cx, MSG_NOT_FINITE, "'rolloffFactor' member of PannerOptions");
378
0
      return false;
379
0
    }
380
0
  } else {
381
0
    mRolloffFactor = 1.0;
382
0
  }
383
0
  mIsAnyMemberPresent = true;
384
0
  return true;
385
0
}
386
387
bool
388
PannerOptions::Init(const nsAString& aJSON)
389
0
{
390
0
  AutoJSAPI jsapi;
391
0
  JSObject* cleanGlobal = SimpleGlobalObject::Create(SimpleGlobalObject::GlobalType::BindingDetail);
392
0
  if (!cleanGlobal) {
393
0
    return false;
394
0
  }
395
0
  if (!jsapi.Init(cleanGlobal)) {
396
0
    return false;
397
0
  }
398
0
  JSContext* cx = jsapi.cx();
399
0
  JS::Rooted<JS::Value> json(cx);
400
0
  bool ok = ParseJSON(cx, aJSON, &json);
401
0
  NS_ENSURE_TRUE(ok, false);
402
0
  return Init(cx, json);
403
0
}
404
405
bool
406
PannerOptions::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
407
0
{
408
0
  PannerOptionsAtoms* atomsCache = GetAtomCache<PannerOptionsAtoms>(cx);
409
0
  if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
410
0
    return false;
411
0
  }
412
0
413
0
  // Per spec, we define the parent's members first
414
0
  if (!AudioNodeOptions::ToObjectInternal(cx, rval)) {
415
0
    return false;
416
0
  }
417
0
  JS::Rooted<JSObject*> obj(cx, &rval.toObject());
418
0
419
0
  do {
420
0
    // block for our 'break' successCode and scope for 'temp' and 'currentValue'
421
0
    JS::Rooted<JS::Value> temp(cx);
422
0
    double const & currentValue = mConeInnerAngle;
423
0
    temp.set(JS_NumberValue(double(currentValue)));
424
0
    if (!JS_DefinePropertyById(cx, obj, atomsCache->coneInnerAngle_id, temp, JSPROP_ENUMERATE)) {
425
0
      return false;
426
0
    }
427
0
    break;
428
0
  } while(false);
429
0
430
0
  do {
431
0
    // block for our 'break' successCode and scope for 'temp' and 'currentValue'
432
0
    JS::Rooted<JS::Value> temp(cx);
433
0
    double const & currentValue = mConeOuterAngle;
434
0
    temp.set(JS_NumberValue(double(currentValue)));
435
0
    if (!JS_DefinePropertyById(cx, obj, atomsCache->coneOuterAngle_id, temp, JSPROP_ENUMERATE)) {
436
0
      return false;
437
0
    }
438
0
    break;
439
0
  } while(false);
440
0
441
0
  do {
442
0
    // block for our 'break' successCode and scope for 'temp' and 'currentValue'
443
0
    JS::Rooted<JS::Value> temp(cx);
444
0
    double const & currentValue = mConeOuterGain;
445
0
    temp.set(JS_NumberValue(double(currentValue)));
446
0
    if (!JS_DefinePropertyById(cx, obj, atomsCache->coneOuterGain_id, temp, JSPROP_ENUMERATE)) {
447
0
      return false;
448
0
    }
449
0
    break;
450
0
  } while(false);
451
0
452
0
  do {
453
0
    // block for our 'break' successCode and scope for 'temp' and 'currentValue'
454
0
    JS::Rooted<JS::Value> temp(cx);
455
0
    DistanceModelType const & currentValue = mDistanceModel;
456
0
    if (!ToJSValue(cx, currentValue, &temp)) {
457
0
      return false;
458
0
    }
459
0
    if (!JS_DefinePropertyById(cx, obj, atomsCache->distanceModel_id, temp, JSPROP_ENUMERATE)) {
460
0
      return false;
461
0
    }
462
0
    break;
463
0
  } while(false);
464
0
465
0
  do {
466
0
    // block for our 'break' successCode and scope for 'temp' and 'currentValue'
467
0
    JS::Rooted<JS::Value> temp(cx);
468
0
    double const & currentValue = mMaxDistance;
469
0
    temp.set(JS_NumberValue(double(currentValue)));
470
0
    if (!JS_DefinePropertyById(cx, obj, atomsCache->maxDistance_id, temp, JSPROP_ENUMERATE)) {
471
0
      return false;
472
0
    }
473
0
    break;
474
0
  } while(false);
475
0
476
0
  do {
477
0
    // block for our 'break' successCode and scope for 'temp' and 'currentValue'
478
0
    JS::Rooted<JS::Value> temp(cx);
479
0
    float const & currentValue = mOrientationX;
480
0
    temp.set(JS_NumberValue(double(currentValue)));
481
0
    if (!JS_DefinePropertyById(cx, obj, atomsCache->orientationX_id, temp, JSPROP_ENUMERATE)) {
482
0
      return false;
483
0
    }
484
0
    break;
485
0
  } while(false);
486
0
487
0
  do {
488
0
    // block for our 'break' successCode and scope for 'temp' and 'currentValue'
489
0
    JS::Rooted<JS::Value> temp(cx);
490
0
    float const & currentValue = mOrientationY;
491
0
    temp.set(JS_NumberValue(double(currentValue)));
492
0
    if (!JS_DefinePropertyById(cx, obj, atomsCache->orientationY_id, temp, JSPROP_ENUMERATE)) {
493
0
      return false;
494
0
    }
495
0
    break;
496
0
  } while(false);
497
0
498
0
  do {
499
0
    // block for our 'break' successCode and scope for 'temp' and 'currentValue'
500
0
    JS::Rooted<JS::Value> temp(cx);
501
0
    float const & currentValue = mOrientationZ;
502
0
    temp.set(JS_NumberValue(double(currentValue)));
503
0
    if (!JS_DefinePropertyById(cx, obj, atomsCache->orientationZ_id, temp, JSPROP_ENUMERATE)) {
504
0
      return false;
505
0
    }
506
0
    break;
507
0
  } while(false);
508
0
509
0
  do {
510
0
    // block for our 'break' successCode and scope for 'temp' and 'currentValue'
511
0
    JS::Rooted<JS::Value> temp(cx);
512
0
    PanningModelType const & currentValue = mPanningModel;
513
0
    if (!ToJSValue(cx, currentValue, &temp)) {
514
0
      return false;
515
0
    }
516
0
    if (!JS_DefinePropertyById(cx, obj, atomsCache->panningModel_id, temp, JSPROP_ENUMERATE)) {
517
0
      return false;
518
0
    }
519
0
    break;
520
0
  } while(false);
521
0
522
0
  do {
523
0
    // block for our 'break' successCode and scope for 'temp' and 'currentValue'
524
0
    JS::Rooted<JS::Value> temp(cx);
525
0
    float const & currentValue = mPositionX;
526
0
    temp.set(JS_NumberValue(double(currentValue)));
527
0
    if (!JS_DefinePropertyById(cx, obj, atomsCache->positionX_id, temp, JSPROP_ENUMERATE)) {
528
0
      return false;
529
0
    }
530
0
    break;
531
0
  } while(false);
532
0
533
0
  do {
534
0
    // block for our 'break' successCode and scope for 'temp' and 'currentValue'
535
0
    JS::Rooted<JS::Value> temp(cx);
536
0
    float const & currentValue = mPositionY;
537
0
    temp.set(JS_NumberValue(double(currentValue)));
538
0
    if (!JS_DefinePropertyById(cx, obj, atomsCache->positionY_id, temp, JSPROP_ENUMERATE)) {
539
0
      return false;
540
0
    }
541
0
    break;
542
0
  } while(false);
543
0
544
0
  do {
545
0
    // block for our 'break' successCode and scope for 'temp' and 'currentValue'
546
0
    JS::Rooted<JS::Value> temp(cx);
547
0
    float const & currentValue = mPositionZ;
548
0
    temp.set(JS_NumberValue(double(currentValue)));
549
0
    if (!JS_DefinePropertyById(cx, obj, atomsCache->positionZ_id, temp, JSPROP_ENUMERATE)) {
550
0
      return false;
551
0
    }
552
0
    break;
553
0
  } while(false);
554
0
555
0
  do {
556
0
    // block for our 'break' successCode and scope for 'temp' and 'currentValue'
557
0
    JS::Rooted<JS::Value> temp(cx);
558
0
    double const & currentValue = mRefDistance;
559
0
    temp.set(JS_NumberValue(double(currentValue)));
560
0
    if (!JS_DefinePropertyById(cx, obj, atomsCache->refDistance_id, temp, JSPROP_ENUMERATE)) {
561
0
      return false;
562
0
    }
563
0
    break;
564
0
  } while(false);
565
0
566
0
  do {
567
0
    // block for our 'break' successCode and scope for 'temp' and 'currentValue'
568
0
    JS::Rooted<JS::Value> temp(cx);
569
0
    double const & currentValue = mRolloffFactor;
570
0
    temp.set(JS_NumberValue(double(currentValue)));
571
0
    if (!JS_DefinePropertyById(cx, obj, atomsCache->rolloffFactor_id, temp, JSPROP_ENUMERATE)) {
572
0
      return false;
573
0
    }
574
0
    break;
575
0
  } while(false);
576
0
577
0
  return true;
578
0
}
579
580
bool
581
PannerOptions::ToJSON(nsAString& aJSON) const
582
0
{
583
0
  AutoJSAPI jsapi;
584
0
  jsapi.Init();
585
0
  JSContext *cx = jsapi.cx();
586
0
  // It's safe to use UnprivilegedJunkScopeOrWorkerGlobal here
587
0
  // because we'll only be creating objects, in ways that have no
588
0
  // side-effects, followed by a call to JS::ToJSONMaybeSafely,
589
0
  // which likewise guarantees no side-effects for the sorts of
590
0
  // things we will pass it.
591
0
  JSAutoRealm ar(cx, UnprivilegedJunkScopeOrWorkerGlobal());
592
0
  JS::Rooted<JS::Value> val(cx);
593
0
  if (!ToObjectInternal(cx, &val)) {
594
0
    return false;
595
0
  }
596
0
  JS::Rooted<JSObject*> obj(cx, &val.toObject());
597
0
  return StringifyToJSON(cx, obj, aJSON);
598
0
}
599
600
void
601
PannerOptions::TraceDictionary(JSTracer* trc)
602
0
{
603
0
  AudioNodeOptions::TraceDictionary(trc);
604
0
}
605
606
PannerOptions&
607
PannerOptions::operator=(const PannerOptions& aOther)
608
0
{
609
0
  AudioNodeOptions::operator=(aOther);
610
0
  mConeInnerAngle = aOther.mConeInnerAngle;
611
0
  mConeOuterAngle = aOther.mConeOuterAngle;
612
0
  mConeOuterGain = aOther.mConeOuterGain;
613
0
  mDistanceModel = aOther.mDistanceModel;
614
0
  mMaxDistance = aOther.mMaxDistance;
615
0
  mOrientationX = aOther.mOrientationX;
616
0
  mOrientationY = aOther.mOrientationY;
617
0
  mOrientationZ = aOther.mOrientationZ;
618
0
  mPanningModel = aOther.mPanningModel;
619
0
  mPositionX = aOther.mPositionX;
620
0
  mPositionY = aOther.mPositionY;
621
0
  mPositionZ = aOther.mPositionZ;
622
0
  mRefDistance = aOther.mRefDistance;
623
0
  mRolloffFactor = aOther.mRolloffFactor;
624
0
  return *this;
625
0
}
626
627
namespace binding_detail {
628
} // namespace binding_detail
629
630
631
namespace PannerNode_Binding {
632
633
static_assert(IsRefcounted<NativeType>::value == IsRefcounted<AudioNode_Binding::NativeType>::value,
634
              "Can't inherit from an interface with a different ownership model.");
635
636
MOZ_CAN_RUN_SCRIPT static bool
637
get_panningModel(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitGetterCallArgs args)
638
0
{
639
0
  AUTO_PROFILER_LABEL_FAST("get PannerNode.panningModel", DOM, cx);
640
0
641
0
  PanningModelType result(self->PanningModel());
642
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
643
0
  if (!ToJSValue(cx, result, args.rval())) {
644
0
    return false;
645
0
  }
646
0
  return true;
647
0
}
648
649
MOZ_CAN_RUN_SCRIPT static bool
650
set_panningModel(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitSetterCallArgs args)
651
0
{
652
0
  AUTO_PROFILER_LABEL_FAST("set PannerNode.panningModel", DOM, cx);
653
0
654
0
  PanningModelType arg0;
655
0
  {
656
0
    int index;
657
0
    if (!FindEnumStringIndex<false>(cx, args[0], PanningModelTypeValues::strings, "PanningModelType", "Value being assigned to PannerNode.panningModel", &index)) {
658
0
      return false;
659
0
    }
660
0
    if (index < 0) {
661
0
      return true;
662
0
    }
663
0
    arg0 = static_cast<PanningModelType>(index);
664
0
  }
665
0
  self->SetPanningModel(arg0);
666
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
667
0
668
0
  return true;
669
0
}
670
671
static const JSJitInfo panningModel_getterinfo = {
672
  { (JSJitGetterOp)get_panningModel },
673
  { prototypes::id::PannerNode },
674
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
675
  JSJitInfo::Getter,
676
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
677
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
678
  false,  /* isInfallible. False in setters. */
679
  false,  /* isMovable.  Not relevant for setters. */
680
  false, /* isEliminatable.  Not relevant for setters. */
681
  false, /* isAlwaysInSlot.  Only relevant for getters. */
682
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
683
  false,  /* isTypedMethod.  Only relevant for methods. */
684
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
685
};
686
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
687
static_assert(0 < 1, "There is no slot for us");
688
static const JSJitInfo panningModel_setterinfo = {
689
  { (JSJitGetterOp)set_panningModel },
690
  { prototypes::id::PannerNode },
691
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
692
  JSJitInfo::Setter,
693
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
694
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
695
  false,  /* isInfallible. False in setters. */
696
  false,  /* isMovable.  Not relevant for setters. */
697
  false, /* isEliminatable.  Not relevant for setters. */
698
  false, /* isAlwaysInSlot.  Only relevant for getters. */
699
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
700
  false,  /* isTypedMethod.  Only relevant for methods. */
701
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
702
};
703
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
704
static_assert(0 < 1, "There is no slot for us");
705
706
MOZ_CAN_RUN_SCRIPT static bool
707
setPosition(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, const JSJitMethodCallArgs& args)
708
0
{
709
0
  AUTO_PROFILER_LABEL_FAST("PannerNode.setPosition", DOM, cx);
710
0
711
0
  if (MOZ_UNLIKELY(args.length() < 3)) {
712
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PannerNode.setPosition");
713
0
  }
714
0
  double arg0;
715
0
  if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
716
0
    return false;
717
0
  } else if (!mozilla::IsFinite(arg0)) {
718
0
    ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of PannerNode.setPosition");
719
0
    return false;
720
0
  }
721
0
  double arg1;
722
0
  if (!ValueToPrimitive<double, eDefault>(cx, args[1], &arg1)) {
723
0
    return false;
724
0
  } else if (!mozilla::IsFinite(arg1)) {
725
0
    ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of PannerNode.setPosition");
726
0
    return false;
727
0
  }
728
0
  double arg2;
729
0
  if (!ValueToPrimitive<double, eDefault>(cx, args[2], &arg2)) {
730
0
    return false;
731
0
  } else if (!mozilla::IsFinite(arg2)) {
732
0
    ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 3 of PannerNode.setPosition");
733
0
    return false;
734
0
  }
735
0
  self->SetPosition(arg0, arg1, arg2);
736
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
737
0
  args.rval().setUndefined();
738
0
  return true;
739
0
}
740
741
static const JSJitInfo setPosition_methodinfo = {
742
  { (JSJitGetterOp)setPosition },
743
  { prototypes::id::PannerNode },
744
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
745
  JSJitInfo::Method,
746
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
747
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
748
  false,  /* isInfallible. False in setters. */
749
  false,  /* isMovable.  Not relevant for setters. */
750
  false, /* isEliminatable.  Not relevant for setters. */
751
  false, /* isAlwaysInSlot.  Only relevant for getters. */
752
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
753
  false,  /* isTypedMethod.  Only relevant for methods. */
754
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
755
};
756
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
757
static_assert(0 < 1, "There is no slot for us");
758
759
MOZ_CAN_RUN_SCRIPT static bool
760
setOrientation(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, const JSJitMethodCallArgs& args)
761
0
{
762
0
  AUTO_PROFILER_LABEL_FAST("PannerNode.setOrientation", DOM, cx);
763
0
764
0
  if (MOZ_UNLIKELY(args.length() < 3)) {
765
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PannerNode.setOrientation");
766
0
  }
767
0
  double arg0;
768
0
  if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
769
0
    return false;
770
0
  } else if (!mozilla::IsFinite(arg0)) {
771
0
    ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of PannerNode.setOrientation");
772
0
    return false;
773
0
  }
774
0
  double arg1;
775
0
  if (!ValueToPrimitive<double, eDefault>(cx, args[1], &arg1)) {
776
0
    return false;
777
0
  } else if (!mozilla::IsFinite(arg1)) {
778
0
    ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of PannerNode.setOrientation");
779
0
    return false;
780
0
  }
781
0
  double arg2;
782
0
  if (!ValueToPrimitive<double, eDefault>(cx, args[2], &arg2)) {
783
0
    return false;
784
0
  } else if (!mozilla::IsFinite(arg2)) {
785
0
    ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 3 of PannerNode.setOrientation");
786
0
    return false;
787
0
  }
788
0
  self->SetOrientation(arg0, arg1, arg2);
789
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
790
0
  args.rval().setUndefined();
791
0
  return true;
792
0
}
793
794
static const JSJitInfo setOrientation_methodinfo = {
795
  { (JSJitGetterOp)setOrientation },
796
  { prototypes::id::PannerNode },
797
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
798
  JSJitInfo::Method,
799
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
800
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
801
  false,  /* isInfallible. False in setters. */
802
  false,  /* isMovable.  Not relevant for setters. */
803
  false, /* isEliminatable.  Not relevant for setters. */
804
  false, /* isAlwaysInSlot.  Only relevant for getters. */
805
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
806
  false,  /* isTypedMethod.  Only relevant for methods. */
807
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
808
};
809
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
810
static_assert(0 < 1, "There is no slot for us");
811
812
MOZ_CAN_RUN_SCRIPT static bool
813
get_positionX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitGetterCallArgs args)
814
0
{
815
0
  AUTO_PROFILER_LABEL_FAST("get PannerNode.positionX", DOM, cx);
816
0
817
0
  auto result(StrongOrRawPtr<mozilla::dom::AudioParam>(self->PositionX()));
818
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
819
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
820
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
821
0
    return false;
822
0
  }
823
0
  return true;
824
0
}
825
826
static const JSJitInfo positionX_getterinfo = {
827
  { (JSJitGetterOp)get_positionX },
828
  { prototypes::id::PannerNode },
829
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
830
  JSJitInfo::Getter,
831
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
832
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
833
  false,  /* isInfallible. False in setters. */
834
  false,  /* isMovable.  Not relevant for setters. */
835
  false, /* isEliminatable.  Not relevant for setters. */
836
  false, /* isAlwaysInSlot.  Only relevant for getters. */
837
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
838
  false,  /* isTypedMethod.  Only relevant for methods. */
839
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
840
};
841
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
842
static_assert(0 < 1, "There is no slot for us");
843
844
MOZ_CAN_RUN_SCRIPT static bool
845
get_positionY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitGetterCallArgs args)
846
0
{
847
0
  AUTO_PROFILER_LABEL_FAST("get PannerNode.positionY", DOM, cx);
848
0
849
0
  auto result(StrongOrRawPtr<mozilla::dom::AudioParam>(self->PositionY()));
850
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
851
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
852
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
853
0
    return false;
854
0
  }
855
0
  return true;
856
0
}
857
858
static const JSJitInfo positionY_getterinfo = {
859
  { (JSJitGetterOp)get_positionY },
860
  { prototypes::id::PannerNode },
861
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
862
  JSJitInfo::Getter,
863
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
864
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
865
  false,  /* isInfallible. False in setters. */
866
  false,  /* isMovable.  Not relevant for setters. */
867
  false, /* isEliminatable.  Not relevant for setters. */
868
  false, /* isAlwaysInSlot.  Only relevant for getters. */
869
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
870
  false,  /* isTypedMethod.  Only relevant for methods. */
871
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
872
};
873
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
874
static_assert(0 < 1, "There is no slot for us");
875
876
MOZ_CAN_RUN_SCRIPT static bool
877
get_positionZ(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitGetterCallArgs args)
878
0
{
879
0
  AUTO_PROFILER_LABEL_FAST("get PannerNode.positionZ", DOM, cx);
880
0
881
0
  auto result(StrongOrRawPtr<mozilla::dom::AudioParam>(self->PositionZ()));
882
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
883
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
884
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
885
0
    return false;
886
0
  }
887
0
  return true;
888
0
}
889
890
static const JSJitInfo positionZ_getterinfo = {
891
  { (JSJitGetterOp)get_positionZ },
892
  { prototypes::id::PannerNode },
893
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
894
  JSJitInfo::Getter,
895
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
896
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
897
  false,  /* isInfallible. False in setters. */
898
  false,  /* isMovable.  Not relevant for setters. */
899
  false, /* isEliminatable.  Not relevant for setters. */
900
  false, /* isAlwaysInSlot.  Only relevant for getters. */
901
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
902
  false,  /* isTypedMethod.  Only relevant for methods. */
903
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
904
};
905
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
906
static_assert(0 < 1, "There is no slot for us");
907
908
MOZ_CAN_RUN_SCRIPT static bool
909
get_orientationX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitGetterCallArgs args)
910
0
{
911
0
  AUTO_PROFILER_LABEL_FAST("get PannerNode.orientationX", DOM, cx);
912
0
913
0
  auto result(StrongOrRawPtr<mozilla::dom::AudioParam>(self->OrientationX()));
914
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
915
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
916
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
917
0
    return false;
918
0
  }
919
0
  return true;
920
0
}
921
922
static const JSJitInfo orientationX_getterinfo = {
923
  { (JSJitGetterOp)get_orientationX },
924
  { prototypes::id::PannerNode },
925
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
926
  JSJitInfo::Getter,
927
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
928
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
929
  false,  /* isInfallible. False in setters. */
930
  false,  /* isMovable.  Not relevant for setters. */
931
  false, /* isEliminatable.  Not relevant for setters. */
932
  false, /* isAlwaysInSlot.  Only relevant for getters. */
933
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
934
  false,  /* isTypedMethod.  Only relevant for methods. */
935
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
936
};
937
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
938
static_assert(0 < 1, "There is no slot for us");
939
940
MOZ_CAN_RUN_SCRIPT static bool
941
get_orientationY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitGetterCallArgs args)
942
0
{
943
0
  AUTO_PROFILER_LABEL_FAST("get PannerNode.orientationY", DOM, cx);
944
0
945
0
  auto result(StrongOrRawPtr<mozilla::dom::AudioParam>(self->OrientationY()));
946
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
947
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
948
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
949
0
    return false;
950
0
  }
951
0
  return true;
952
0
}
953
954
static const JSJitInfo orientationY_getterinfo = {
955
  { (JSJitGetterOp)get_orientationY },
956
  { prototypes::id::PannerNode },
957
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
958
  JSJitInfo::Getter,
959
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
960
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
961
  false,  /* isInfallible. False in setters. */
962
  false,  /* isMovable.  Not relevant for setters. */
963
  false, /* isEliminatable.  Not relevant for setters. */
964
  false, /* isAlwaysInSlot.  Only relevant for getters. */
965
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
966
  false,  /* isTypedMethod.  Only relevant for methods. */
967
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
968
};
969
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
970
static_assert(0 < 1, "There is no slot for us");
971
972
MOZ_CAN_RUN_SCRIPT static bool
973
get_orientationZ(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitGetterCallArgs args)
974
0
{
975
0
  AUTO_PROFILER_LABEL_FAST("get PannerNode.orientationZ", DOM, cx);
976
0
977
0
  auto result(StrongOrRawPtr<mozilla::dom::AudioParam>(self->OrientationZ()));
978
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
979
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
980
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
981
0
    return false;
982
0
  }
983
0
  return true;
984
0
}
985
986
static const JSJitInfo orientationZ_getterinfo = {
987
  { (JSJitGetterOp)get_orientationZ },
988
  { prototypes::id::PannerNode },
989
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
990
  JSJitInfo::Getter,
991
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
992
  JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
993
  false,  /* isInfallible. False in setters. */
994
  false,  /* isMovable.  Not relevant for setters. */
995
  false, /* isEliminatable.  Not relevant for setters. */
996
  false, /* isAlwaysInSlot.  Only relevant for getters. */
997
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
998
  false,  /* isTypedMethod.  Only relevant for methods. */
999
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1000
};
1001
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1002
static_assert(0 < 1, "There is no slot for us");
1003
1004
MOZ_CAN_RUN_SCRIPT static bool
1005
get_distanceModel(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitGetterCallArgs args)
1006
0
{
1007
0
  AUTO_PROFILER_LABEL_FAST("get PannerNode.distanceModel", DOM, cx);
1008
0
1009
0
  DistanceModelType result(self->DistanceModel());
1010
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1011
0
  if (!ToJSValue(cx, result, args.rval())) {
1012
0
    return false;
1013
0
  }
1014
0
  return true;
1015
0
}
1016
1017
MOZ_CAN_RUN_SCRIPT static bool
1018
set_distanceModel(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitSetterCallArgs args)
1019
0
{
1020
0
  AUTO_PROFILER_LABEL_FAST("set PannerNode.distanceModel", DOM, cx);
1021
0
1022
0
  DistanceModelType arg0;
1023
0
  {
1024
0
    int index;
1025
0
    if (!FindEnumStringIndex<false>(cx, args[0], DistanceModelTypeValues::strings, "DistanceModelType", "Value being assigned to PannerNode.distanceModel", &index)) {
1026
0
      return false;
1027
0
    }
1028
0
    if (index < 0) {
1029
0
      return true;
1030
0
    }
1031
0
    arg0 = static_cast<DistanceModelType>(index);
1032
0
  }
1033
0
  self->SetDistanceModel(arg0);
1034
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1035
0
1036
0
  return true;
1037
0
}
1038
1039
static const JSJitInfo distanceModel_getterinfo = {
1040
  { (JSJitGetterOp)get_distanceModel },
1041
  { prototypes::id::PannerNode },
1042
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1043
  JSJitInfo::Getter,
1044
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1045
  JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
1046
  false,  /* isInfallible. False in setters. */
1047
  false,  /* isMovable.  Not relevant for setters. */
1048
  false, /* isEliminatable.  Not relevant for setters. */
1049
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1050
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1051
  false,  /* isTypedMethod.  Only relevant for methods. */
1052
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1053
};
1054
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1055
static_assert(0 < 1, "There is no slot for us");
1056
static const JSJitInfo distanceModel_setterinfo = {
1057
  { (JSJitGetterOp)set_distanceModel },
1058
  { prototypes::id::PannerNode },
1059
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1060
  JSJitInfo::Setter,
1061
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1062
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
1063
  false,  /* isInfallible. False in setters. */
1064
  false,  /* isMovable.  Not relevant for setters. */
1065
  false, /* isEliminatable.  Not relevant for setters. */
1066
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1067
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1068
  false,  /* isTypedMethod.  Only relevant for methods. */
1069
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1070
};
1071
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1072
static_assert(0 < 1, "There is no slot for us");
1073
1074
MOZ_CAN_RUN_SCRIPT static bool
1075
get_refDistance(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitGetterCallArgs args)
1076
0
{
1077
0
  AUTO_PROFILER_LABEL_FAST("get PannerNode.refDistance", DOM, cx);
1078
0
1079
0
  double result(self->RefDistance());
1080
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1081
0
  args.rval().set(JS_NumberValue(double(result)));
1082
0
  return true;
1083
0
}
1084
1085
MOZ_CAN_RUN_SCRIPT static bool
1086
set_refDistance(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitSetterCallArgs args)
1087
0
{
1088
0
  AUTO_PROFILER_LABEL_FAST("set PannerNode.refDistance", DOM, cx);
1089
0
1090
0
  double arg0;
1091
0
  if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
1092
0
    return false;
1093
0
  } else if (!mozilla::IsFinite(arg0)) {
1094
0
    ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to PannerNode.refDistance");
1095
0
    return false;
1096
0
  }
1097
0
  FastErrorResult rv;
1098
0
  self->SetRefDistance(arg0, rv);
1099
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1100
0
    return false;
1101
0
  }
1102
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1103
0
1104
0
  return true;
1105
0
}
1106
1107
static const JSJitInfo refDistance_getterinfo = {
1108
  { (JSJitGetterOp)get_refDistance },
1109
  { prototypes::id::PannerNode },
1110
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1111
  JSJitInfo::Getter,
1112
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1113
  JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
1114
  true,  /* isInfallible. False in setters. */
1115
  false,  /* isMovable.  Not relevant for setters. */
1116
  false, /* isEliminatable.  Not relevant for setters. */
1117
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1118
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1119
  false,  /* isTypedMethod.  Only relevant for methods. */
1120
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1121
};
1122
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1123
static_assert(0 < 1, "There is no slot for us");
1124
static const JSJitInfo refDistance_setterinfo = {
1125
  { (JSJitGetterOp)set_refDistance },
1126
  { prototypes::id::PannerNode },
1127
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1128
  JSJitInfo::Setter,
1129
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1130
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
1131
  false,  /* isInfallible. False in setters. */
1132
  false,  /* isMovable.  Not relevant for setters. */
1133
  false, /* isEliminatable.  Not relevant for setters. */
1134
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1135
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1136
  false,  /* isTypedMethod.  Only relevant for methods. */
1137
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1138
};
1139
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1140
static_assert(0 < 1, "There is no slot for us");
1141
1142
MOZ_CAN_RUN_SCRIPT static bool
1143
get_maxDistance(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitGetterCallArgs args)
1144
0
{
1145
0
  AUTO_PROFILER_LABEL_FAST("get PannerNode.maxDistance", DOM, cx);
1146
0
1147
0
  double result(self->MaxDistance());
1148
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1149
0
  args.rval().set(JS_NumberValue(double(result)));
1150
0
  return true;
1151
0
}
1152
1153
MOZ_CAN_RUN_SCRIPT static bool
1154
set_maxDistance(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitSetterCallArgs args)
1155
0
{
1156
0
  AUTO_PROFILER_LABEL_FAST("set PannerNode.maxDistance", DOM, cx);
1157
0
1158
0
  double arg0;
1159
0
  if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
1160
0
    return false;
1161
0
  } else if (!mozilla::IsFinite(arg0)) {
1162
0
    ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to PannerNode.maxDistance");
1163
0
    return false;
1164
0
  }
1165
0
  FastErrorResult rv;
1166
0
  self->SetMaxDistance(arg0, rv);
1167
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1168
0
    return false;
1169
0
  }
1170
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1171
0
1172
0
  return true;
1173
0
}
1174
1175
static const JSJitInfo maxDistance_getterinfo = {
1176
  { (JSJitGetterOp)get_maxDistance },
1177
  { prototypes::id::PannerNode },
1178
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1179
  JSJitInfo::Getter,
1180
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1181
  JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
1182
  true,  /* isInfallible. False in setters. */
1183
  false,  /* isMovable.  Not relevant for setters. */
1184
  false, /* isEliminatable.  Not relevant for setters. */
1185
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1186
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1187
  false,  /* isTypedMethod.  Only relevant for methods. */
1188
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1189
};
1190
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1191
static_assert(0 < 1, "There is no slot for us");
1192
static const JSJitInfo maxDistance_setterinfo = {
1193
  { (JSJitGetterOp)set_maxDistance },
1194
  { prototypes::id::PannerNode },
1195
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1196
  JSJitInfo::Setter,
1197
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1198
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
1199
  false,  /* isInfallible. False in setters. */
1200
  false,  /* isMovable.  Not relevant for setters. */
1201
  false, /* isEliminatable.  Not relevant for setters. */
1202
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1203
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1204
  false,  /* isTypedMethod.  Only relevant for methods. */
1205
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1206
};
1207
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1208
static_assert(0 < 1, "There is no slot for us");
1209
1210
MOZ_CAN_RUN_SCRIPT static bool
1211
get_rolloffFactor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitGetterCallArgs args)
1212
0
{
1213
0
  AUTO_PROFILER_LABEL_FAST("get PannerNode.rolloffFactor", DOM, cx);
1214
0
1215
0
  double result(self->RolloffFactor());
1216
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1217
0
  args.rval().set(JS_NumberValue(double(result)));
1218
0
  return true;
1219
0
}
1220
1221
MOZ_CAN_RUN_SCRIPT static bool
1222
set_rolloffFactor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitSetterCallArgs args)
1223
0
{
1224
0
  AUTO_PROFILER_LABEL_FAST("set PannerNode.rolloffFactor", DOM, cx);
1225
0
1226
0
  double arg0;
1227
0
  if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
1228
0
    return false;
1229
0
  } else if (!mozilla::IsFinite(arg0)) {
1230
0
    ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to PannerNode.rolloffFactor");
1231
0
    return false;
1232
0
  }
1233
0
  FastErrorResult rv;
1234
0
  self->SetRolloffFactor(arg0, rv);
1235
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1236
0
    return false;
1237
0
  }
1238
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1239
0
1240
0
  return true;
1241
0
}
1242
1243
static const JSJitInfo rolloffFactor_getterinfo = {
1244
  { (JSJitGetterOp)get_rolloffFactor },
1245
  { prototypes::id::PannerNode },
1246
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1247
  JSJitInfo::Getter,
1248
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1249
  JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
1250
  true,  /* isInfallible. False in setters. */
1251
  false,  /* isMovable.  Not relevant for setters. */
1252
  false, /* isEliminatable.  Not relevant for setters. */
1253
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1254
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1255
  false,  /* isTypedMethod.  Only relevant for methods. */
1256
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1257
};
1258
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1259
static_assert(0 < 1, "There is no slot for us");
1260
static const JSJitInfo rolloffFactor_setterinfo = {
1261
  { (JSJitGetterOp)set_rolloffFactor },
1262
  { prototypes::id::PannerNode },
1263
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1264
  JSJitInfo::Setter,
1265
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1266
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
1267
  false,  /* isInfallible. False in setters. */
1268
  false,  /* isMovable.  Not relevant for setters. */
1269
  false, /* isEliminatable.  Not relevant for setters. */
1270
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1271
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1272
  false,  /* isTypedMethod.  Only relevant for methods. */
1273
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1274
};
1275
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1276
static_assert(0 < 1, "There is no slot for us");
1277
1278
MOZ_CAN_RUN_SCRIPT static bool
1279
get_coneInnerAngle(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitGetterCallArgs args)
1280
0
{
1281
0
  AUTO_PROFILER_LABEL_FAST("get PannerNode.coneInnerAngle", DOM, cx);
1282
0
1283
0
  double result(self->ConeInnerAngle());
1284
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1285
0
  args.rval().set(JS_NumberValue(double(result)));
1286
0
  return true;
1287
0
}
1288
1289
MOZ_CAN_RUN_SCRIPT static bool
1290
set_coneInnerAngle(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitSetterCallArgs args)
1291
0
{
1292
0
  AUTO_PROFILER_LABEL_FAST("set PannerNode.coneInnerAngle", DOM, cx);
1293
0
1294
0
  double arg0;
1295
0
  if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
1296
0
    return false;
1297
0
  } else if (!mozilla::IsFinite(arg0)) {
1298
0
    ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to PannerNode.coneInnerAngle");
1299
0
    return false;
1300
0
  }
1301
0
  self->SetConeInnerAngle(arg0);
1302
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1303
0
1304
0
  return true;
1305
0
}
1306
1307
static const JSJitInfo coneInnerAngle_getterinfo = {
1308
  { (JSJitGetterOp)get_coneInnerAngle },
1309
  { prototypes::id::PannerNode },
1310
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1311
  JSJitInfo::Getter,
1312
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1313
  JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
1314
  true,  /* isInfallible. False in setters. */
1315
  false,  /* isMovable.  Not relevant for setters. */
1316
  false, /* isEliminatable.  Not relevant for setters. */
1317
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1318
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1319
  false,  /* isTypedMethod.  Only relevant for methods. */
1320
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1321
};
1322
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1323
static_assert(0 < 1, "There is no slot for us");
1324
static const JSJitInfo coneInnerAngle_setterinfo = {
1325
  { (JSJitGetterOp)set_coneInnerAngle },
1326
  { prototypes::id::PannerNode },
1327
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1328
  JSJitInfo::Setter,
1329
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1330
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
1331
  false,  /* isInfallible. False in setters. */
1332
  false,  /* isMovable.  Not relevant for setters. */
1333
  false, /* isEliminatable.  Not relevant for setters. */
1334
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1335
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1336
  false,  /* isTypedMethod.  Only relevant for methods. */
1337
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1338
};
1339
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1340
static_assert(0 < 1, "There is no slot for us");
1341
1342
MOZ_CAN_RUN_SCRIPT static bool
1343
get_coneOuterAngle(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitGetterCallArgs args)
1344
0
{
1345
0
  AUTO_PROFILER_LABEL_FAST("get PannerNode.coneOuterAngle", DOM, cx);
1346
0
1347
0
  double result(self->ConeOuterAngle());
1348
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1349
0
  args.rval().set(JS_NumberValue(double(result)));
1350
0
  return true;
1351
0
}
1352
1353
MOZ_CAN_RUN_SCRIPT static bool
1354
set_coneOuterAngle(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitSetterCallArgs args)
1355
0
{
1356
0
  AUTO_PROFILER_LABEL_FAST("set PannerNode.coneOuterAngle", DOM, cx);
1357
0
1358
0
  double arg0;
1359
0
  if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
1360
0
    return false;
1361
0
  } else if (!mozilla::IsFinite(arg0)) {
1362
0
    ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to PannerNode.coneOuterAngle");
1363
0
    return false;
1364
0
  }
1365
0
  self->SetConeOuterAngle(arg0);
1366
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1367
0
1368
0
  return true;
1369
0
}
1370
1371
static const JSJitInfo coneOuterAngle_getterinfo = {
1372
  { (JSJitGetterOp)get_coneOuterAngle },
1373
  { prototypes::id::PannerNode },
1374
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1375
  JSJitInfo::Getter,
1376
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1377
  JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
1378
  true,  /* isInfallible. False in setters. */
1379
  false,  /* isMovable.  Not relevant for setters. */
1380
  false, /* isEliminatable.  Not relevant for setters. */
1381
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1382
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1383
  false,  /* isTypedMethod.  Only relevant for methods. */
1384
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1385
};
1386
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1387
static_assert(0 < 1, "There is no slot for us");
1388
static const JSJitInfo coneOuterAngle_setterinfo = {
1389
  { (JSJitGetterOp)set_coneOuterAngle },
1390
  { prototypes::id::PannerNode },
1391
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1392
  JSJitInfo::Setter,
1393
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1394
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
1395
  false,  /* isInfallible. False in setters. */
1396
  false,  /* isMovable.  Not relevant for setters. */
1397
  false, /* isEliminatable.  Not relevant for setters. */
1398
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1399
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1400
  false,  /* isTypedMethod.  Only relevant for methods. */
1401
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1402
};
1403
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1404
static_assert(0 < 1, "There is no slot for us");
1405
1406
MOZ_CAN_RUN_SCRIPT static bool
1407
get_coneOuterGain(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitGetterCallArgs args)
1408
0
{
1409
0
  AUTO_PROFILER_LABEL_FAST("get PannerNode.coneOuterGain", DOM, cx);
1410
0
1411
0
  double result(self->ConeOuterGain());
1412
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1413
0
  args.rval().set(JS_NumberValue(double(result)));
1414
0
  return true;
1415
0
}
1416
1417
MOZ_CAN_RUN_SCRIPT static bool
1418
set_coneOuterGain(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitSetterCallArgs args)
1419
0
{
1420
0
  AUTO_PROFILER_LABEL_FAST("set PannerNode.coneOuterGain", DOM, cx);
1421
0
1422
0
  double arg0;
1423
0
  if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
1424
0
    return false;
1425
0
  } else if (!mozilla::IsFinite(arg0)) {
1426
0
    ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to PannerNode.coneOuterGain");
1427
0
    return false;
1428
0
  }
1429
0
  FastErrorResult rv;
1430
0
  self->SetConeOuterGain(arg0, rv);
1431
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1432
0
    return false;
1433
0
  }
1434
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1435
0
1436
0
  return true;
1437
0
}
1438
1439
static const JSJitInfo coneOuterGain_getterinfo = {
1440
  { (JSJitGetterOp)get_coneOuterGain },
1441
  { prototypes::id::PannerNode },
1442
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1443
  JSJitInfo::Getter,
1444
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1445
  JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
1446
  true,  /* isInfallible. False in setters. */
1447
  false,  /* isMovable.  Not relevant for setters. */
1448
  false, /* isEliminatable.  Not relevant for setters. */
1449
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1450
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1451
  false,  /* isTypedMethod.  Only relevant for methods. */
1452
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1453
};
1454
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1455
static_assert(0 < 1, "There is no slot for us");
1456
static const JSJitInfo coneOuterGain_setterinfo = {
1457
  { (JSJitGetterOp)set_coneOuterGain },
1458
  { prototypes::id::PannerNode },
1459
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1460
  JSJitInfo::Setter,
1461
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1462
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
1463
  false,  /* isInfallible. False in setters. */
1464
  false,  /* isMovable.  Not relevant for setters. */
1465
  false, /* isEliminatable.  Not relevant for setters. */
1466
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1467
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1468
  false,  /* isTypedMethod.  Only relevant for methods. */
1469
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1470
};
1471
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1472
static_assert(0 < 1, "There is no slot for us");
1473
1474
MOZ_CAN_RUN_SCRIPT static bool
1475
get_passThrough(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitGetterCallArgs args)
1476
0
{
1477
0
  AUTO_PROFILER_LABEL_FAST("get PannerNode.passThrough", DOM, cx);
1478
0
1479
0
  bool result(self->PassThrough());
1480
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1481
0
  args.rval().setBoolean(result);
1482
0
  return true;
1483
0
}
1484
1485
MOZ_CAN_RUN_SCRIPT static bool
1486
set_passThrough(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PannerNode* self, JSJitSetterCallArgs args)
1487
0
{
1488
0
  AUTO_PROFILER_LABEL_FAST("set PannerNode.passThrough", DOM, cx);
1489
0
1490
0
  bool arg0;
1491
0
  if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
1492
0
    return false;
1493
0
  }
1494
0
  self->SetPassThrough(arg0);
1495
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1496
0
1497
0
  return true;
1498
0
}
1499
1500
static const JSJitInfo passThrough_getterinfo = {
1501
  { (JSJitGetterOp)get_passThrough },
1502
  { prototypes::id::PannerNode },
1503
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1504
  JSJitInfo::Getter,
1505
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1506
  JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
1507
  true,  /* isInfallible. False in setters. */
1508
  false,  /* isMovable.  Not relevant for setters. */
1509
  false, /* isEliminatable.  Not relevant for setters. */
1510
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1511
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1512
  false,  /* isTypedMethod.  Only relevant for methods. */
1513
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1514
};
1515
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1516
static_assert(0 < 1, "There is no slot for us");
1517
static const JSJitInfo passThrough_setterinfo = {
1518
  { (JSJitGetterOp)set_passThrough },
1519
  { prototypes::id::PannerNode },
1520
  { PrototypeTraits<prototypes::id::PannerNode>::Depth },
1521
  JSJitInfo::Setter,
1522
  JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
1523
  JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
1524
  false,  /* isInfallible. False in setters. */
1525
  false,  /* isMovable.  Not relevant for setters. */
1526
  false, /* isEliminatable.  Not relevant for setters. */
1527
  false, /* isAlwaysInSlot.  Only relevant for getters. */
1528
  false, /* isLazilyCachedInSlot.  Only relevant for getters. */
1529
  false,  /* isTypedMethod.  Only relevant for methods. */
1530
  0   /* Reserved slot index, if we're stored in a slot, else 0. */
1531
};
1532
static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1533
static_assert(0 < 1, "There is no slot for us");
1534
1535
static bool
1536
_addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
1537
0
{
1538
0
  mozilla::dom::PannerNode* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::PannerNode>(obj);
1539
0
  // We don't want to preserve if we don't have a wrapper, and we
1540
0
  // obviously can't preserve if we're not initialized.
1541
0
  if (self && self->GetWrapperPreserveColor()) {
1542
0
    PreserveWrapper(self);
1543
0
  }
1544
0
  return true;
1545
0
}
1546
1547
static void
1548
_finalize(js::FreeOp* fop, JSObject* obj)
1549
0
{
1550
0
  mozilla::dom::PannerNode* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::PannerNode>(obj);
1551
0
  if (self) {
1552
0
    ClearWrapper(self, self, obj);
1553
0
    AddForDeferredFinalization<mozilla::dom::PannerNode>(self);
1554
0
  }
1555
0
}
1556
1557
static size_t
1558
_objectMoved(JSObject* obj, JSObject* old)
1559
0
{
1560
0
  mozilla::dom::PannerNode* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::PannerNode>(obj);
1561
0
  if (self) {
1562
0
    UpdateWrapper(self, self, obj, old);
1563
0
  }
1564
0
1565
0
  return 0;
1566
0
}
1567
1568
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
1569
#if defined(__clang__)
1570
#pragma clang diagnostic push
1571
#pragma clang diagnostic ignored "-Wmissing-braces"
1572
#endif
1573
static const JSFunctionSpec sMethods_specs[] = {
1574
  JS_FNSPEC("setPosition", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setPosition_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
1575
  JS_FNSPEC("setOrientation", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setOrientation_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
1576
  JS_FS_END
1577
};
1578
#if defined(__clang__)
1579
#pragma clang diagnostic pop
1580
#endif
1581
1582
1583
static const Prefable<const JSFunctionSpec> sMethods[] = {
1584
  { nullptr, &sMethods_specs[0] },
1585
  { nullptr, nullptr }
1586
};
1587
1588
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1589
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1590
static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1591
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1592
1593
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
1594
#if defined(__clang__)
1595
#pragma clang diagnostic push
1596
#pragma clang diagnostic ignored "-Wmissing-braces"
1597
#endif
1598
static const JSPropertySpec sAttributes_specs[] = {
1599
  { "panningModel", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &panningModel_getterinfo, GenericSetter<NormalThisPolicy>, &panningModel_setterinfo },
1600
  { "positionX", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &positionX_getterinfo, nullptr, nullptr },
1601
  { "positionY", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &positionY_getterinfo, nullptr, nullptr },
1602
  { "positionZ", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &positionZ_getterinfo, nullptr, nullptr },
1603
  { "orientationX", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &orientationX_getterinfo, nullptr, nullptr },
1604
  { "orientationY", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &orientationY_getterinfo, nullptr, nullptr },
1605
  { "orientationZ", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &orientationZ_getterinfo, nullptr, nullptr },
1606
  { "distanceModel", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &distanceModel_getterinfo, GenericSetter<NormalThisPolicy>, &distanceModel_setterinfo },
1607
  { "refDistance", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &refDistance_getterinfo, GenericSetter<NormalThisPolicy>, &refDistance_setterinfo },
1608
  { "maxDistance", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &maxDistance_getterinfo, GenericSetter<NormalThisPolicy>, &maxDistance_setterinfo },
1609
  { "rolloffFactor", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &rolloffFactor_getterinfo, GenericSetter<NormalThisPolicy>, &rolloffFactor_setterinfo },
1610
  { "coneInnerAngle", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &coneInnerAngle_getterinfo, GenericSetter<NormalThisPolicy>, &coneInnerAngle_setterinfo },
1611
  { "coneOuterAngle", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &coneOuterAngle_getterinfo, GenericSetter<NormalThisPolicy>, &coneOuterAngle_setterinfo },
1612
  { "coneOuterGain", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &coneOuterGain_getterinfo, GenericSetter<NormalThisPolicy>, &coneOuterGain_setterinfo },
1613
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
1614
};
1615
#if defined(__clang__)
1616
#pragma clang diagnostic pop
1617
#endif
1618
1619
1620
static const Prefable<const JSPropertySpec> sAttributes[] = {
1621
  { nullptr, &sAttributes_specs[0] },
1622
  { nullptr, nullptr }
1623
};
1624
1625
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1626
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1627
static_assert(14 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1628
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1629
1630
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
1631
#if defined(__clang__)
1632
#pragma clang diagnostic push
1633
#pragma clang diagnostic ignored "-Wmissing-braces"
1634
#endif
1635
static const JSPropertySpec sChromeAttributes_specs[] = {
1636
  { "passThrough", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &passThrough_getterinfo, GenericSetter<NormalThisPolicy>, &passThrough_setterinfo },
1637
  { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
1638
};
1639
#if defined(__clang__)
1640
#pragma clang diagnostic pop
1641
#endif
1642
1643
1644
static const Prefable<const JSPropertySpec> sChromeAttributes[] = {
1645
  { nullptr, &sChromeAttributes_specs[0] },
1646
  { nullptr, nullptr }
1647
};
1648
1649
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1650
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1651
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1652
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1653
1654
1655
static uint16_t sNativeProperties_sortedPropertyIndices[16];
1656
static PropertyInfo sNativeProperties_propertyInfos[16];
1657
1658
static const NativePropertiesN<2> sNativeProperties = {
1659
  false, 0,
1660
  false, 0,
1661
  true,  0 /* sMethods */,
1662
  true,  1 /* sAttributes */,
1663
  false, 0,
1664
  false, 0,
1665
  false, 0,
1666
  -1,
1667
  16,
1668
  sNativeProperties_sortedPropertyIndices,
1669
  {
1670
    { sMethods, &sNativeProperties_propertyInfos[0] },
1671
    { sAttributes, &sNativeProperties_propertyInfos[2] }
1672
  }
1673
};
1674
static_assert(16 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
1675
    "We have a property info count that is oversized");
1676
1677
static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[1];
1678
static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[1];
1679
1680
static const NativePropertiesN<1> sChromeOnlyNativeProperties = {
1681
  false, 0,
1682
  false, 0,
1683
  false, 0,
1684
  true,  0 /* sChromeAttributes */,
1685
  false, 0,
1686
  false, 0,
1687
  false, 0,
1688
  -1,
1689
  1,
1690
  sChromeOnlyNativeProperties_sortedPropertyIndices,
1691
  {
1692
    { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[0] }
1693
  }
1694
};
1695
static_assert(1 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount),
1696
    "We have a property info count that is oversized");
1697
1698
static bool
1699
_constructor(JSContext* cx, unsigned argc, JS::Value* vp)
1700
0
{
1701
0
  AUTO_PROFILER_LABEL_FAST("PannerNode constructor", DOM, cx);
1702
0
1703
0
  JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
1704
0
  JS::Rooted<JSObject*> obj(cx, &args.callee());
1705
0
  if (!args.isConstructing()) {
1706
0
    // XXXbz wish I could get the name from the callee instead of
1707
0
    // Adding more relocations
1708
0
    return ThrowConstructorWithoutNew(cx, "PannerNode");
1709
0
  }
1710
0
1711
0
  JS::Rooted<JSObject*> desiredProto(cx);
1712
0
  if (!GetDesiredProto(cx, args, &desiredProto)) {
1713
0
    return false;
1714
0
  }
1715
0
1716
0
  if (MOZ_UNLIKELY(args.length() < 1)) {
1717
0
    return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PannerNode");
1718
0
  }
1719
0
  GlobalObject global(cx, obj);
1720
0
  if (global.Failed()) {
1721
0
    return false;
1722
0
  }
1723
0
1724
0
  bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
1725
0
  NonNull<mozilla::dom::AudioContext> arg0;
1726
0
  if (args[0].isObject()) {
1727
0
    {
1728
0
      nsresult rv = UnwrapObject<prototypes::id::BaseAudioContext, mozilla::dom::AudioContext>(args[0], arg0);
1729
0
      if (NS_FAILED(rv)) {
1730
0
        ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PannerNode.constructor", "BaseAudioContext");
1731
0
        return false;
1732
0
      }
1733
0
    }
1734
0
  } else {
1735
0
    ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PannerNode.constructor");
1736
0
    return false;
1737
0
  }
1738
0
  binding_detail::FastPannerOptions arg1;
1739
0
  if (!arg1.Init(cx, (args.hasDefined(1)) ? args[1] : JS::NullHandleValue,  "Argument 2 of PannerNode.constructor", false)) {
1740
0
    return false;
1741
0
  }
1742
0
  Maybe<JSAutoRealm> ar;
1743
0
  if (objIsXray) {
1744
0
    obj = js::CheckedUnwrap(obj);
1745
0
    if (!obj) {
1746
0
      return false;
1747
0
    }
1748
0
    ar.emplace(cx, obj);
1749
0
    if (!JS_WrapObject(cx, &desiredProto)) {
1750
0
      return false;
1751
0
    }
1752
0
  }
1753
0
  FastErrorResult rv;
1754
0
  auto result(StrongOrRawPtr<mozilla::dom::PannerNode>(mozilla::dom::PannerNode::Constructor(global, MOZ_KnownLive(NonNullHelper(arg0)), Constify(arg1), rv)));
1755
0
  if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1756
0
    return false;
1757
0
  }
1758
0
  MOZ_ASSERT(!JS_IsExceptionPending(cx));
1759
0
  static_assert(!IsPointer<decltype(result)>::value,
1760
0
                "NewObject implies that we need to keep the object alive with a strong reference.");
1761
0
  if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) {
1762
0
    MOZ_ASSERT(JS_IsExceptionPending(cx));
1763
0
    return false;
1764
0
  }
1765
0
  return true;
1766
0
}
1767
1768
static const js::ClassOps sInterfaceObjectClassOps = {
1769
    nullptr,               /* addProperty */
1770
    nullptr,               /* delProperty */
1771
    nullptr,               /* enumerate */
1772
    nullptr,               /* newEnumerate */
1773
    nullptr,               /* resolve */
1774
    nullptr,               /* mayResolve */
1775
    nullptr,               /* finalize */
1776
    _constructor, /* call */
1777
    nullptr,               /* hasInstance */
1778
    _constructor, /* construct */
1779
    nullptr,               /* trace */
1780
};
1781
1782
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
1783
  {
1784
    "Function",
1785
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
1786
    &sInterfaceObjectClassOps,
1787
    JS_NULL_CLASS_SPEC,
1788
    JS_NULL_CLASS_EXT,
1789
    &sInterfaceObjectClassObjectOps
1790
  },
1791
  eInterface,
1792
  true,
1793
  prototypes::id::PannerNode,
1794
  PrototypeTraits<prototypes::id::PannerNode>::Depth,
1795
  sNativePropertyHooks,
1796
  "function PannerNode() {\n    [native code]\n}",
1797
  AudioNode_Binding::GetConstructorObject
1798
};
1799
1800
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
1801
  {
1802
    "PannerNodePrototype",
1803
    JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
1804
    JS_NULL_CLASS_OPS,
1805
    JS_NULL_CLASS_SPEC,
1806
    JS_NULL_CLASS_EXT,
1807
    JS_NULL_OBJECT_OPS
1808
  },
1809
  eInterfacePrototype,
1810
  false,
1811
  prototypes::id::PannerNode,
1812
  PrototypeTraits<prototypes::id::PannerNode>::Depth,
1813
  sNativePropertyHooks,
1814
  "[object PannerNodePrototype]",
1815
  AudioNode_Binding::GetProtoObject
1816
};
1817
1818
bool
1819
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
1820
0
{
1821
0
  static bool sPrefValue;
1822
0
  static bool sPrefCacheSetUp = false;
1823
0
  if (!sPrefCacheSetUp) {
1824
0
    sPrefCacheSetUp = true;
1825
0
    Preferences::AddBoolVarCache(&sPrefValue, "dom.webaudio.enabled");
1826
0
  }
1827
0
1828
0
  return sPrefValue;
1829
0
}
1830
1831
static const js::ClassOps sClassOps = {
1832
  _addProperty, /* addProperty */
1833
  nullptr,               /* delProperty */
1834
  nullptr,               /* enumerate */
1835
  nullptr, /* newEnumerate */
1836
  nullptr, /* resolve */
1837
  nullptr, /* mayResolve */
1838
  _finalize, /* finalize */
1839
  nullptr, /* call */
1840
  nullptr,               /* hasInstance */
1841
  nullptr,               /* construct */
1842
  nullptr, /* trace */
1843
};
1844
1845
static const js::ClassExtension sClassExtension = {
1846
  nullptr, /* weakmapKeyDelegateOp */
1847
  _objectMoved /* objectMovedOp */
1848
};
1849
1850
static const DOMJSClass sClass = {
1851
  { "PannerNode",
1852
    JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
1853
    &sClassOps,
1854
    JS_NULL_CLASS_SPEC,
1855
    &sClassExtension,
1856
    JS_NULL_OBJECT_OPS
1857
  },
1858
  { prototypes::id::EventTarget, prototypes::id::AudioNode, prototypes::id::PannerNode, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
1859
  IsBaseOf<nsISupports, mozilla::dom::PannerNode >::value,
1860
  sNativePropertyHooks,
1861
  FindAssociatedGlobalForNative<mozilla::dom::PannerNode>::Get,
1862
  GetProtoObjectHandle,
1863
  GetCCParticipant<mozilla::dom::PannerNode>::Get()
1864
};
1865
static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
1866
              "Must have the right minimal number of reserved slots.");
1867
static_assert(1 >= 1,
1868
              "Must have enough reserved slots.");
1869
1870
const JSClass*
1871
GetJSClass()
1872
0
{
1873
0
  return sClass.ToJSClass();
1874
0
}
1875
1876
bool
1877
Wrap(JSContext* aCx, mozilla::dom::PannerNode* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
1878
0
{
1879
0
  static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::PannerNode>::value,
1880
0
                "Shouldn't have wrappercached things that are not refcounted.");
1881
0
  MOZ_ASSERT(static_cast<mozilla::dom::PannerNode*>(aObject) ==
1882
0
             reinterpret_cast<mozilla::dom::PannerNode*>(aObject),
1883
0
             "Multiple inheritance for mozilla::dom::PannerNode is broken.");
1884
0
  MOZ_ASSERT(static_cast<mozilla::dom::AudioNode*>(aObject) ==
1885
0
             reinterpret_cast<mozilla::dom::AudioNode*>(aObject),
1886
0
             "Multiple inheritance for mozilla::dom::AudioNode is broken.");
1887
0
  MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
1888
0
             reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
1889
0
             "Multiple inheritance for mozilla::dom::EventTarget is broken.");
1890
0
  MOZ_ASSERT(ToSupportsIsCorrect(aObject));
1891
0
  MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
1892
0
  MOZ_ASSERT(!aCache->GetWrapper(),
1893
0
             "You should probably not be using Wrap() directly; use "
1894
0
             "GetOrCreateDOMReflector instead");
1895
0
1896
0
  MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
1897
0
             "nsISupports must be on our primary inheritance chain");
1898
0
1899
0
  JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
1900
0
  if (!global) {
1901
0
    return false;
1902
0
  }
1903
0
  MOZ_ASSERT(JS_IsGlobalObject(global));
1904
0
  MOZ_ASSERT(JS::ObjectIsNotGray(global));
1905
0
1906
0
  // That might have ended up wrapping us already, due to the wonders
1907
0
  // of XBL.  Check for that, and bail out as needed.
1908
0
  aReflector.set(aCache->GetWrapper());
1909
0
  if (aReflector) {
1910
#ifdef DEBUG
1911
    AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
1912
#endif // DEBUG
1913
    return true;
1914
0
  }
1915
0
1916
0
  JSAutoRealm ar(aCx, global);
1917
0
  JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
1918
0
  if (!canonicalProto) {
1919
0
    return false;
1920
0
  }
1921
0
  JS::Rooted<JSObject*> proto(aCx);
1922
0
  if (aGivenProto) {
1923
0
    proto = aGivenProto;
1924
0
    // Unfortunately, while aGivenProto was in the compartment of aCx
1925
0
    // coming in, we changed compartments to that of "parent" so may need
1926
0
    // to wrap the proto here.
1927
0
    if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
1928
0
      if (!JS_WrapObject(aCx, &proto)) {
1929
0
        return false;
1930
0
      }
1931
0
    }
1932
0
  } else {
1933
0
    proto = canonicalProto;
1934
0
  }
1935
0
1936
0
  BindingJSObjectCreator<mozilla::dom::PannerNode> creator(aCx);
1937
0
  creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
1938
0
  if (!aReflector) {
1939
0
    return false;
1940
0
  }
1941
0
1942
0
  aCache->SetWrapper(aReflector);
1943
0
  creator.InitializationSucceeded();
1944
0
1945
0
  MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
1946
0
             aCache->GetWrapperPreserveColor() == aReflector);
1947
0
  // If proto != canonicalProto, we have to preserve our wrapper;
1948
0
  // otherwise we won't be able to properly recreate it later, since
1949
0
  // we won't know what proto to use.  Note that we don't check
1950
0
  // aGivenProto here, since it's entirely possible (and even
1951
0
  // somewhat common) to have a non-null aGivenProto which is the
1952
0
  // same as canonicalProto.
1953
0
  if (proto != canonicalProto) {
1954
0
    PreserveWrapper(aObject);
1955
0
  }
1956
0
1957
0
  return true;
1958
0
}
1959
1960
const NativePropertyHooks sNativePropertyHooks[] = { {
1961
  nullptr,
1962
  nullptr,
1963
  nullptr,
1964
  { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() },
1965
  prototypes::id::PannerNode,
1966
  constructors::id::PannerNode,
1967
  AudioNode_Binding::sNativePropertyHooks,
1968
  &DefaultXrayExpandoObjectClass
1969
} };
1970
1971
void
1972
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
1973
0
{
1974
0
  JS::Handle<JSObject*> parentProto(AudioNode_Binding::GetProtoObjectHandle(aCx));
1975
0
  if (!parentProto) {
1976
0
    return;
1977
0
  }
1978
0
1979
0
  JS::Handle<JSObject*> constructorProto(AudioNode_Binding::GetConstructorObjectHandle(aCx));
1980
0
  if (!constructorProto) {
1981
0
    return;
1982
0
  }
1983
0
1984
0
  static bool sIdsInited = false;
1985
0
  if (!sIdsInited && NS_IsMainThread()) {
1986
0
    if (!InitIds(aCx, sNativeProperties.Upcast())) {
1987
0
      return;
1988
0
    }
1989
0
    if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) {
1990
0
      return;
1991
0
    }
1992
0
    sIdsInited = true;
1993
0
  }
1994
0
1995
0
  JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::PannerNode);
1996
0
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::PannerNode);
1997
0
  dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
1998
0
                              &sPrototypeClass.mBase, protoCache,
1999
0
                              nullptr,
2000
0
                              constructorProto, &sInterfaceObjectClass.mBase, 1, nullptr,
2001
0
                              interfaceCache,
2002
0
                              sNativeProperties.Upcast(),
2003
0
                              sChromeOnlyNativeProperties.Upcast(),
2004
0
                              "PannerNode", aDefineOnGlobal,
2005
0
                              nullptr,
2006
0
                              false);
2007
0
}
2008
2009
JSObject*
2010
GetConstructorObject(JSContext* aCx)
2011
0
{
2012
0
  return GetConstructorObjectHandle(aCx);
2013
0
}
2014
2015
} // namespace PannerNode_Binding
2016
2017
2018
2019
} // namespace dom
2020
} // namespace mozilla