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