Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM WebGLRenderingContext.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "AtomList.h"
4 : #include "WebGLActiveInfo.h"
5 : #include "WebGLBuffer.h"
6 : #include "WebGLContext.h"
7 : #include "WebGLExtensions.h"
8 : #include "WebGLFramebuffer.h"
9 : #include "WebGLProgram.h"
10 : #include "WebGLQuery.h"
11 : #include "WebGLRenderbuffer.h"
12 : #include "WebGLRenderingContextBinding.h"
13 : #include "WebGLShader.h"
14 : #include "WebGLShaderPrecisionFormat.h"
15 : #include "WebGLTexture.h"
16 : #include "WebGLUniformLocation.h"
17 : #include "WebGLVertexArray.h"
18 : #include "WrapperFactory.h"
19 : #include "jsfriendapi.h"
20 : #include "mozilla/OwningNonNull.h"
21 : #include "mozilla/dom/BindingUtils.h"
22 : #include "mozilla/dom/DOMJSClass.h"
23 : #include "mozilla/dom/HTMLCanvasElement.h"
24 : #include "mozilla/dom/HTMLImageElement.h"
25 : #include "mozilla/dom/HTMLVideoElement.h"
26 : #include "mozilla/dom/ImageBitmap.h"
27 : #include "mozilla/dom/ImageData.h"
28 : #include "mozilla/dom/NonRefcountedDOMObject.h"
29 : #include "mozilla/dom/Nullable.h"
30 : #include "mozilla/dom/OffscreenCanvas.h"
31 : #include "mozilla/dom/PrimitiveConversions.h"
32 : #include "mozilla/dom/ScriptSettings.h"
33 : #include "mozilla/dom/SimpleGlobalObject.h"
34 : #include "mozilla/dom/TypedArray.h"
35 : #include "mozilla/dom/UnionConversions.h"
36 : #include "mozilla/dom/XrayExpandoClass.h"
37 : #include "nsContentUtils.h"
38 :
39 : namespace mozilla {
40 : namespace dom {
41 :
42 : void
43 0 : ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningHTMLCanvasElementOrOffscreenCanvas& aUnion, const char* aName, uint32_t aFlags)
44 : {
45 0 : if (aUnion.IsHTMLCanvasElement()) {
46 0 : ImplCycleCollectionTraverse(aCallback, aUnion.GetAsHTMLCanvasElement(), "mHTMLCanvasElement", aFlags);
47 0 : } else if (aUnion.IsOffscreenCanvas()) {
48 0 : ImplCycleCollectionTraverse(aCallback, aUnion.GetAsOffscreenCanvas(), "mOffscreenCanvas", aFlags);
49 : }
50 0 : }
51 :
52 :
53 : void
54 0 : ImplCycleCollectionUnlink(OwningHTMLCanvasElementOrOffscreenCanvas& aUnion)
55 : {
56 0 : aUnion.Uninit();
57 0 : }
58 :
59 :
60 : bool
61 0 : Float32ArrayOrUnrestrictedFloatSequence::ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const
62 : {
63 0 : switch (mType) {
64 : case eUninitialized: {
65 0 : return false;
66 : break;
67 : }
68 : case eFloat32Array: {
69 0 : rval.setObject(*mValue.mFloat32Array.Value().Obj());
70 0 : if (!MaybeWrapNonDOMObjectValue(cx, rval)) {
71 0 : return false;
72 : }
73 0 : return true;
74 : break;
75 : }
76 : case eUnrestrictedFloatSequence: {
77 :
78 0 : uint32_t length = mValue.mUnrestrictedFloatSequence.Value().Length();
79 0 : JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
80 0 : if (!returnArray) {
81 0 : return false;
82 : }
83 : // Scope for 'tmp'
84 : {
85 0 : JS::Rooted<JS::Value> tmp(cx);
86 0 : for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
87 : // Control block to let us common up the JS_DefineElement calls when there
88 : // are different ways to succeed at wrapping the object.
89 : do {
90 0 : tmp.set(JS_NumberValue(double(mValue.mUnrestrictedFloatSequence.Value()[sequenceIdx0])));
91 0 : break;
92 : } while (0);
93 0 : if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
94 : JSPROP_ENUMERATE)) {
95 0 : return false;
96 : }
97 : }
98 : }
99 0 : rval.setObject(*returnArray);
100 0 : return true;
101 : break;
102 : }
103 : default: {
104 0 : return false;
105 : break;
106 : }
107 : }
108 :
109 : return false;
110 : }
111 :
112 :
113 : Float32Array&
114 0 : OwningFloat32ArrayOrUnrestrictedFloatSequence::RawSetAsFloat32Array()
115 : {
116 0 : if (mType == eFloat32Array) {
117 0 : return mValue.mFloat32Array.Value();
118 : }
119 0 : MOZ_ASSERT(mType == eUninitialized);
120 0 : mType = eFloat32Array;
121 0 : return mValue.mFloat32Array.SetValue();
122 : }
123 :
124 : Float32Array&
125 0 : OwningFloat32ArrayOrUnrestrictedFloatSequence::SetAsFloat32Array()
126 : {
127 0 : if (mType == eFloat32Array) {
128 0 : return mValue.mFloat32Array.Value();
129 : }
130 0 : Uninit();
131 0 : mType = eFloat32Array;
132 0 : return mValue.mFloat32Array.SetValue();
133 : }
134 :
135 : bool
136 0 : OwningFloat32ArrayOrUnrestrictedFloatSequence::TrySetToFloat32Array(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl)
137 : {
138 0 : tryNext = false;
139 : { // scope for memberSlot
140 0 : Float32Array& memberSlot = RawSetAsFloat32Array();
141 0 : if (!memberSlot.Init(&value.toObject())) {
142 0 : DestroyFloat32Array();
143 0 : tryNext = true;
144 0 : return true;
145 : }
146 : }
147 0 : return true;
148 : }
149 :
150 : void
151 0 : OwningFloat32ArrayOrUnrestrictedFloatSequence::DestroyFloat32Array()
152 : {
153 0 : MOZ_ASSERT(IsFloat32Array(), "Wrong type!");
154 0 : mValue.mFloat32Array.Destroy();
155 0 : mType = eUninitialized;
156 0 : }
157 :
158 :
159 :
160 :
161 : Sequence<float>&
162 0 : OwningFloat32ArrayOrUnrestrictedFloatSequence::RawSetAsUnrestrictedFloatSequence()
163 : {
164 0 : if (mType == eUnrestrictedFloatSequence) {
165 0 : return mValue.mUnrestrictedFloatSequence.Value();
166 : }
167 0 : MOZ_ASSERT(mType == eUninitialized);
168 0 : mType = eUnrestrictedFloatSequence;
169 0 : return mValue.mUnrestrictedFloatSequence.SetValue();
170 : }
171 :
172 : Sequence<float>&
173 0 : OwningFloat32ArrayOrUnrestrictedFloatSequence::SetAsUnrestrictedFloatSequence()
174 : {
175 0 : if (mType == eUnrestrictedFloatSequence) {
176 0 : return mValue.mUnrestrictedFloatSequence.Value();
177 : }
178 0 : Uninit();
179 0 : mType = eUnrestrictedFloatSequence;
180 0 : return mValue.mUnrestrictedFloatSequence.SetValue();
181 : }
182 :
183 : bool
184 0 : OwningFloat32ArrayOrUnrestrictedFloatSequence::TrySetToUnrestrictedFloatSequence(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl)
185 : {
186 0 : tryNext = false;
187 : { // scope for memberSlot
188 0 : Sequence<float>& memberSlot = RawSetAsUnrestrictedFloatSequence();
189 0 : JS::ForOfIterator iter(cx);
190 0 : if (!iter.init(value, JS::ForOfIterator::AllowNonIterable)) {
191 0 : return false;
192 : }
193 0 : if (!iter.valueIsIterable()) {
194 0 : DestroyUnrestrictedFloatSequence();
195 0 : tryNext = true;
196 0 : return true;
197 : }
198 0 : Sequence<float> &arr = memberSlot;
199 0 : JS::Rooted<JS::Value> temp(cx);
200 : while (true) {
201 : bool done;
202 0 : if (!iter.next(&temp, &done)) {
203 0 : return false;
204 : }
205 0 : if (done) {
206 0 : break;
207 : }
208 0 : float* slotPtr = arr.AppendElement(mozilla::fallible);
209 0 : if (!slotPtr) {
210 0 : JS_ReportOutOfMemory(cx);
211 0 : return false;
212 : }
213 0 : float& slot = *slotPtr;
214 0 : if (!ValueToPrimitive<float, eDefault>(cx, temp, &slot)) {
215 0 : return false;
216 : }
217 0 : }
218 : }
219 0 : return true;
220 : }
221 :
222 : void
223 0 : OwningFloat32ArrayOrUnrestrictedFloatSequence::DestroyUnrestrictedFloatSequence()
224 : {
225 0 : MOZ_ASSERT(IsUnrestrictedFloatSequence(), "Wrong type!");
226 0 : mValue.mUnrestrictedFloatSequence.Destroy();
227 0 : mType = eUninitialized;
228 0 : }
229 :
230 :
231 :
232 :
233 : void
234 0 : OwningFloat32ArrayOrUnrestrictedFloatSequence::Uninit()
235 : {
236 0 : switch (mType) {
237 : case eUninitialized: {
238 0 : break;
239 : }
240 : case eFloat32Array: {
241 0 : DestroyFloat32Array();
242 0 : break;
243 : }
244 : case eUnrestrictedFloatSequence: {
245 0 : DestroyUnrestrictedFloatSequence();
246 0 : break;
247 : }
248 : }
249 0 : }
250 :
251 : bool
252 0 : OwningFloat32ArrayOrUnrestrictedFloatSequence::ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const
253 : {
254 0 : switch (mType) {
255 : case eUninitialized: {
256 0 : return false;
257 : break;
258 : }
259 : case eFloat32Array: {
260 0 : rval.setObject(*mValue.mFloat32Array.Value().Obj());
261 0 : if (!MaybeWrapNonDOMObjectValue(cx, rval)) {
262 0 : return false;
263 : }
264 0 : return true;
265 : break;
266 : }
267 : case eUnrestrictedFloatSequence: {
268 :
269 0 : uint32_t length = mValue.mUnrestrictedFloatSequence.Value().Length();
270 0 : JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
271 0 : if (!returnArray) {
272 0 : return false;
273 : }
274 : // Scope for 'tmp'
275 : {
276 0 : JS::Rooted<JS::Value> tmp(cx);
277 0 : for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
278 : // Control block to let us common up the JS_DefineElement calls when there
279 : // are different ways to succeed at wrapping the object.
280 : do {
281 0 : tmp.set(JS_NumberValue(double(mValue.mUnrestrictedFloatSequence.Value()[sequenceIdx0])));
282 0 : break;
283 : } while (0);
284 0 : if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
285 : JSPROP_ENUMERATE)) {
286 0 : return false;
287 : }
288 : }
289 : }
290 0 : rval.setObject(*returnArray);
291 0 : return true;
292 : break;
293 : }
294 : default: {
295 0 : return false;
296 : break;
297 : }
298 : }
299 :
300 : return false;
301 : }
302 :
303 : void
304 0 : OwningFloat32ArrayOrUnrestrictedFloatSequence::TraceUnion(JSTracer* trc)
305 : {
306 0 : switch (mType) {
307 : case eFloat32Array: {
308 0 : mValue.mFloat32Array.Value().TraceSelf(trc);
309 0 : break;
310 : }
311 : default: {
312 0 : break;
313 : }
314 : }
315 0 : }
316 :
317 :
318 : bool
319 0 : HTMLCanvasElementOrOffscreenCanvas::ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const
320 : {
321 0 : switch (mType) {
322 : case eUninitialized: {
323 0 : return false;
324 : break;
325 : }
326 : case eHTMLCanvasElement: {
327 0 : if (!GetOrCreateDOMReflector(cx, mValue.mHTMLCanvasElement.Value(), rval)) {
328 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
329 0 : return false;
330 : }
331 0 : return true;
332 : break;
333 : }
334 : case eOffscreenCanvas: {
335 0 : if (!GetOrCreateDOMReflector(cx, mValue.mOffscreenCanvas.Value(), rval)) {
336 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
337 0 : return false;
338 : }
339 0 : return true;
340 : break;
341 : }
342 : default: {
343 0 : return false;
344 : break;
345 : }
346 : }
347 :
348 : return false;
349 : }
350 :
351 :
352 : OwningNonNull<mozilla::dom::HTMLCanvasElement>&
353 0 : OwningHTMLCanvasElementOrOffscreenCanvas::RawSetAsHTMLCanvasElement()
354 : {
355 0 : if (mType == eHTMLCanvasElement) {
356 0 : return mValue.mHTMLCanvasElement.Value();
357 : }
358 0 : MOZ_ASSERT(mType == eUninitialized);
359 0 : mType = eHTMLCanvasElement;
360 0 : return mValue.mHTMLCanvasElement.SetValue();
361 : }
362 :
363 : OwningNonNull<mozilla::dom::HTMLCanvasElement>&
364 0 : OwningHTMLCanvasElementOrOffscreenCanvas::SetAsHTMLCanvasElement()
365 : {
366 0 : if (mType == eHTMLCanvasElement) {
367 0 : return mValue.mHTMLCanvasElement.Value();
368 : }
369 0 : Uninit();
370 0 : mType = eHTMLCanvasElement;
371 0 : return mValue.mHTMLCanvasElement.SetValue();
372 : }
373 :
374 : bool
375 0 : OwningHTMLCanvasElementOrOffscreenCanvas::TrySetToHTMLCanvasElement(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl)
376 : {
377 0 : tryNext = false;
378 : { // scope for memberSlot
379 0 : OwningNonNull<mozilla::dom::HTMLCanvasElement>& memberSlot = RawSetAsHTMLCanvasElement();
380 : static_assert(IsRefcounted<mozilla::dom::HTMLCanvasElement>::value, "We can only store refcounted classes.");{
381 0 : nsresult rv = UnwrapObject<prototypes::id::HTMLCanvasElement, mozilla::dom::HTMLCanvasElement>(value, memberSlot);
382 0 : if (NS_FAILED(rv)) {
383 0 : DestroyHTMLCanvasElement();
384 0 : tryNext = true;
385 0 : return true;
386 : }
387 : }
388 : }
389 0 : return true;
390 : }
391 :
392 : void
393 0 : OwningHTMLCanvasElementOrOffscreenCanvas::DestroyHTMLCanvasElement()
394 : {
395 0 : MOZ_ASSERT(IsHTMLCanvasElement(), "Wrong type!");
396 0 : mValue.mHTMLCanvasElement.Destroy();
397 0 : mType = eUninitialized;
398 0 : }
399 :
400 :
401 :
402 :
403 : OwningNonNull<mozilla::dom::OffscreenCanvas>&
404 0 : OwningHTMLCanvasElementOrOffscreenCanvas::RawSetAsOffscreenCanvas()
405 : {
406 0 : if (mType == eOffscreenCanvas) {
407 0 : return mValue.mOffscreenCanvas.Value();
408 : }
409 0 : MOZ_ASSERT(mType == eUninitialized);
410 0 : mType = eOffscreenCanvas;
411 0 : return mValue.mOffscreenCanvas.SetValue();
412 : }
413 :
414 : OwningNonNull<mozilla::dom::OffscreenCanvas>&
415 0 : OwningHTMLCanvasElementOrOffscreenCanvas::SetAsOffscreenCanvas()
416 : {
417 0 : if (mType == eOffscreenCanvas) {
418 0 : return mValue.mOffscreenCanvas.Value();
419 : }
420 0 : Uninit();
421 0 : mType = eOffscreenCanvas;
422 0 : return mValue.mOffscreenCanvas.SetValue();
423 : }
424 :
425 : bool
426 0 : OwningHTMLCanvasElementOrOffscreenCanvas::TrySetToOffscreenCanvas(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl)
427 : {
428 0 : tryNext = false;
429 : { // scope for memberSlot
430 0 : OwningNonNull<mozilla::dom::OffscreenCanvas>& memberSlot = RawSetAsOffscreenCanvas();
431 : static_assert(IsRefcounted<mozilla::dom::OffscreenCanvas>::value, "We can only store refcounted classes.");{
432 0 : nsresult rv = UnwrapObject<prototypes::id::OffscreenCanvas, mozilla::dom::OffscreenCanvas>(value, memberSlot);
433 0 : if (NS_FAILED(rv)) {
434 0 : DestroyOffscreenCanvas();
435 0 : tryNext = true;
436 0 : return true;
437 : }
438 : }
439 : }
440 0 : return true;
441 : }
442 :
443 : void
444 0 : OwningHTMLCanvasElementOrOffscreenCanvas::DestroyOffscreenCanvas()
445 : {
446 0 : MOZ_ASSERT(IsOffscreenCanvas(), "Wrong type!");
447 0 : mValue.mOffscreenCanvas.Destroy();
448 0 : mType = eUninitialized;
449 0 : }
450 :
451 :
452 :
453 :
454 : void
455 0 : OwningHTMLCanvasElementOrOffscreenCanvas::Uninit()
456 : {
457 0 : switch (mType) {
458 : case eUninitialized: {
459 0 : break;
460 : }
461 : case eHTMLCanvasElement: {
462 0 : DestroyHTMLCanvasElement();
463 0 : break;
464 : }
465 : case eOffscreenCanvas: {
466 0 : DestroyOffscreenCanvas();
467 0 : break;
468 : }
469 : }
470 0 : }
471 :
472 : bool
473 0 : OwningHTMLCanvasElementOrOffscreenCanvas::ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const
474 : {
475 0 : switch (mType) {
476 : case eUninitialized: {
477 0 : return false;
478 : break;
479 : }
480 : case eHTMLCanvasElement: {
481 0 : if (!GetOrCreateDOMReflector(cx, mValue.mHTMLCanvasElement.Value(), rval)) {
482 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
483 0 : return false;
484 : }
485 0 : return true;
486 : break;
487 : }
488 : case eOffscreenCanvas: {
489 0 : if (!GetOrCreateDOMReflector(cx, mValue.mOffscreenCanvas.Value(), rval)) {
490 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
491 0 : return false;
492 : }
493 0 : return true;
494 : break;
495 : }
496 : default: {
497 0 : return false;
498 : break;
499 : }
500 : }
501 :
502 : return false;
503 : }
504 :
505 : void
506 0 : OwningHTMLCanvasElementOrOffscreenCanvas::TraceUnion(JSTracer* trc)
507 : {
508 0 : }
509 :
510 : OwningHTMLCanvasElementOrOffscreenCanvas&
511 0 : OwningHTMLCanvasElementOrOffscreenCanvas::operator=(const OwningHTMLCanvasElementOrOffscreenCanvas& aOther)
512 : {
513 0 : switch (aOther.mType) {
514 : case eUninitialized: {
515 0 : MOZ_ASSERT(mType == eUninitialized,
516 : "We need to destroy ourselves?");
517 0 : break;
518 : }
519 : case eHTMLCanvasElement: {
520 0 : SetAsHTMLCanvasElement() = aOther.GetAsHTMLCanvasElement();
521 0 : break;
522 : }
523 : case eOffscreenCanvas: {
524 0 : SetAsOffscreenCanvas() = aOther.GetAsOffscreenCanvas();
525 0 : break;
526 : }
527 : }
528 0 : return *this;
529 : }
530 :
531 :
532 : bool
533 0 : Int32ArrayOrLongSequence::ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const
534 : {
535 0 : switch (mType) {
536 : case eUninitialized: {
537 0 : return false;
538 : break;
539 : }
540 : case eInt32Array: {
541 0 : rval.setObject(*mValue.mInt32Array.Value().Obj());
542 0 : if (!MaybeWrapNonDOMObjectValue(cx, rval)) {
543 0 : return false;
544 : }
545 0 : return true;
546 : break;
547 : }
548 : case eLongSequence: {
549 :
550 0 : uint32_t length = mValue.mLongSequence.Value().Length();
551 0 : JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
552 0 : if (!returnArray) {
553 0 : return false;
554 : }
555 : // Scope for 'tmp'
556 : {
557 0 : JS::Rooted<JS::Value> tmp(cx);
558 0 : for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
559 : // Control block to let us common up the JS_DefineElement calls when there
560 : // are different ways to succeed at wrapping the object.
561 : do {
562 0 : tmp.setInt32(int32_t(mValue.mLongSequence.Value()[sequenceIdx0]));
563 0 : break;
564 : } while (0);
565 0 : if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
566 : JSPROP_ENUMERATE)) {
567 0 : return false;
568 : }
569 : }
570 : }
571 0 : rval.setObject(*returnArray);
572 0 : return true;
573 : break;
574 : }
575 : default: {
576 0 : return false;
577 : break;
578 : }
579 : }
580 :
581 : return false;
582 : }
583 :
584 :
585 : Int32Array&
586 0 : OwningInt32ArrayOrLongSequence::RawSetAsInt32Array()
587 : {
588 0 : if (mType == eInt32Array) {
589 0 : return mValue.mInt32Array.Value();
590 : }
591 0 : MOZ_ASSERT(mType == eUninitialized);
592 0 : mType = eInt32Array;
593 0 : return mValue.mInt32Array.SetValue();
594 : }
595 :
596 : Int32Array&
597 0 : OwningInt32ArrayOrLongSequence::SetAsInt32Array()
598 : {
599 0 : if (mType == eInt32Array) {
600 0 : return mValue.mInt32Array.Value();
601 : }
602 0 : Uninit();
603 0 : mType = eInt32Array;
604 0 : return mValue.mInt32Array.SetValue();
605 : }
606 :
607 : bool
608 0 : OwningInt32ArrayOrLongSequence::TrySetToInt32Array(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl)
609 : {
610 0 : tryNext = false;
611 : { // scope for memberSlot
612 0 : Int32Array& memberSlot = RawSetAsInt32Array();
613 0 : if (!memberSlot.Init(&value.toObject())) {
614 0 : DestroyInt32Array();
615 0 : tryNext = true;
616 0 : return true;
617 : }
618 : }
619 0 : return true;
620 : }
621 :
622 : void
623 0 : OwningInt32ArrayOrLongSequence::DestroyInt32Array()
624 : {
625 0 : MOZ_ASSERT(IsInt32Array(), "Wrong type!");
626 0 : mValue.mInt32Array.Destroy();
627 0 : mType = eUninitialized;
628 0 : }
629 :
630 :
631 :
632 :
633 : Sequence<int32_t>&
634 0 : OwningInt32ArrayOrLongSequence::RawSetAsLongSequence()
635 : {
636 0 : if (mType == eLongSequence) {
637 0 : return mValue.mLongSequence.Value();
638 : }
639 0 : MOZ_ASSERT(mType == eUninitialized);
640 0 : mType = eLongSequence;
641 0 : return mValue.mLongSequence.SetValue();
642 : }
643 :
644 : Sequence<int32_t>&
645 0 : OwningInt32ArrayOrLongSequence::SetAsLongSequence()
646 : {
647 0 : if (mType == eLongSequence) {
648 0 : return mValue.mLongSequence.Value();
649 : }
650 0 : Uninit();
651 0 : mType = eLongSequence;
652 0 : return mValue.mLongSequence.SetValue();
653 : }
654 :
655 : bool
656 0 : OwningInt32ArrayOrLongSequence::TrySetToLongSequence(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl)
657 : {
658 0 : tryNext = false;
659 : { // scope for memberSlot
660 0 : Sequence<int32_t>& memberSlot = RawSetAsLongSequence();
661 0 : JS::ForOfIterator iter(cx);
662 0 : if (!iter.init(value, JS::ForOfIterator::AllowNonIterable)) {
663 0 : return false;
664 : }
665 0 : if (!iter.valueIsIterable()) {
666 0 : DestroyLongSequence();
667 0 : tryNext = true;
668 0 : return true;
669 : }
670 0 : Sequence<int32_t> &arr = memberSlot;
671 0 : JS::Rooted<JS::Value> temp(cx);
672 : while (true) {
673 : bool done;
674 0 : if (!iter.next(&temp, &done)) {
675 0 : return false;
676 : }
677 0 : if (done) {
678 0 : break;
679 : }
680 0 : int32_t* slotPtr = arr.AppendElement(mozilla::fallible);
681 0 : if (!slotPtr) {
682 0 : JS_ReportOutOfMemory(cx);
683 0 : return false;
684 : }
685 0 : int32_t& slot = *slotPtr;
686 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, temp, &slot)) {
687 0 : return false;
688 : }
689 0 : }
690 : }
691 0 : return true;
692 : }
693 :
694 : void
695 0 : OwningInt32ArrayOrLongSequence::DestroyLongSequence()
696 : {
697 0 : MOZ_ASSERT(IsLongSequence(), "Wrong type!");
698 0 : mValue.mLongSequence.Destroy();
699 0 : mType = eUninitialized;
700 0 : }
701 :
702 :
703 :
704 :
705 : void
706 0 : OwningInt32ArrayOrLongSequence::Uninit()
707 : {
708 0 : switch (mType) {
709 : case eUninitialized: {
710 0 : break;
711 : }
712 : case eInt32Array: {
713 0 : DestroyInt32Array();
714 0 : break;
715 : }
716 : case eLongSequence: {
717 0 : DestroyLongSequence();
718 0 : break;
719 : }
720 : }
721 0 : }
722 :
723 : bool
724 0 : OwningInt32ArrayOrLongSequence::ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const
725 : {
726 0 : switch (mType) {
727 : case eUninitialized: {
728 0 : return false;
729 : break;
730 : }
731 : case eInt32Array: {
732 0 : rval.setObject(*mValue.mInt32Array.Value().Obj());
733 0 : if (!MaybeWrapNonDOMObjectValue(cx, rval)) {
734 0 : return false;
735 : }
736 0 : return true;
737 : break;
738 : }
739 : case eLongSequence: {
740 :
741 0 : uint32_t length = mValue.mLongSequence.Value().Length();
742 0 : JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
743 0 : if (!returnArray) {
744 0 : return false;
745 : }
746 : // Scope for 'tmp'
747 : {
748 0 : JS::Rooted<JS::Value> tmp(cx);
749 0 : for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
750 : // Control block to let us common up the JS_DefineElement calls when there
751 : // are different ways to succeed at wrapping the object.
752 : do {
753 0 : tmp.setInt32(int32_t(mValue.mLongSequence.Value()[sequenceIdx0]));
754 0 : break;
755 : } while (0);
756 0 : if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
757 : JSPROP_ENUMERATE)) {
758 0 : return false;
759 : }
760 : }
761 : }
762 0 : rval.setObject(*returnArray);
763 0 : return true;
764 : break;
765 : }
766 : default: {
767 0 : return false;
768 : break;
769 : }
770 : }
771 :
772 : return false;
773 : }
774 :
775 : void
776 0 : OwningInt32ArrayOrLongSequence::TraceUnion(JSTracer* trc)
777 : {
778 0 : switch (mType) {
779 : case eInt32Array: {
780 0 : mValue.mInt32Array.Value().TraceSelf(trc);
781 0 : break;
782 : }
783 : default: {
784 0 : break;
785 : }
786 : }
787 0 : }
788 :
789 :
790 :
791 0 : WebGLContextAttributes::WebGLContextAttributes()
792 : {
793 : // Safe to pass a null context if we pass a null value
794 0 : Init(nullptr, JS::NullHandleValue);
795 0 : }
796 :
797 :
798 :
799 : bool
800 0 : WebGLContextAttributes::InitIds(JSContext* cx, WebGLContextAttributesAtoms* atomsCache)
801 : {
802 0 : MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache));
803 :
804 : // Initialize these in reverse order so that any failure leaves the first one
805 : // uninitialized.
806 0 : if (!atomsCache->stencil_id.init(cx, "stencil") ||
807 0 : !atomsCache->preserveDrawingBuffer_id.init(cx, "preserveDrawingBuffer") ||
808 0 : !atomsCache->premultipliedAlpha_id.init(cx, "premultipliedAlpha") ||
809 0 : !atomsCache->failIfMajorPerformanceCaveat_id.init(cx, "failIfMajorPerformanceCaveat") ||
810 0 : !atomsCache->depth_id.init(cx, "depth") ||
811 0 : !atomsCache->antialias_id.init(cx, "antialias") ||
812 0 : !atomsCache->alpha_id.init(cx, "alpha")) {
813 0 : return false;
814 : }
815 0 : return true;
816 : }
817 :
818 : bool
819 0 : WebGLContextAttributes::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
820 : {
821 : // Passing a null JSContext is OK only if we're initing from null,
822 : // Since in that case we will not have to do any property gets
823 : // Also evaluate isNullOrUndefined in order to avoid false-positive
824 : // checkers by static analysis tools
825 0 : MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
826 0 : WebGLContextAttributesAtoms* atomsCache = nullptr;
827 0 : if (cx) {
828 0 : atomsCache = GetAtomCache<WebGLContextAttributesAtoms>(cx);
829 0 : if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
830 0 : return false;
831 : }
832 : }
833 :
834 0 : if (!IsConvertibleToDictionary(val)) {
835 0 : return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY, sourceDescription);
836 : }
837 :
838 0 : bool isNull = val.isNullOrUndefined();
839 : // We only need these if !isNull, in which case we have |cx|.
840 0 : Maybe<JS::Rooted<JSObject *> > object;
841 0 : Maybe<JS::Rooted<JS::Value> > temp;
842 0 : if (!isNull) {
843 0 : MOZ_ASSERT(cx);
844 0 : object.emplace(cx, &val.toObject());
845 0 : temp.emplace(cx);
846 : }
847 0 : if (!isNull) {
848 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->alpha_id, temp.ptr())) {
849 0 : return false;
850 : }
851 : }
852 0 : if (!isNull && !temp->isUndefined()) {
853 0 : mAlpha.Construct();
854 0 : if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &(mAlpha.Value()))) {
855 0 : return false;
856 : }
857 0 : mIsAnyMemberPresent = true;
858 : }
859 :
860 0 : if (!isNull) {
861 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->antialias_id, temp.ptr())) {
862 0 : return false;
863 : }
864 : }
865 0 : if (!isNull && !temp->isUndefined()) {
866 0 : if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &mAntialias)) {
867 0 : return false;
868 : }
869 : } else {
870 0 : mAntialias = true;
871 : }
872 0 : mIsAnyMemberPresent = true;
873 :
874 0 : if (!isNull) {
875 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->depth_id, temp.ptr())) {
876 0 : return false;
877 : }
878 : }
879 0 : if (!isNull && !temp->isUndefined()) {
880 0 : if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &mDepth)) {
881 0 : return false;
882 : }
883 : } else {
884 0 : mDepth = true;
885 : }
886 0 : mIsAnyMemberPresent = true;
887 :
888 0 : if (!isNull) {
889 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->failIfMajorPerformanceCaveat_id, temp.ptr())) {
890 0 : return false;
891 : }
892 : }
893 0 : if (!isNull && !temp->isUndefined()) {
894 0 : if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &mFailIfMajorPerformanceCaveat)) {
895 0 : return false;
896 : }
897 : } else {
898 0 : mFailIfMajorPerformanceCaveat = false;
899 : }
900 0 : mIsAnyMemberPresent = true;
901 :
902 0 : if (!isNull) {
903 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->premultipliedAlpha_id, temp.ptr())) {
904 0 : return false;
905 : }
906 : }
907 0 : if (!isNull && !temp->isUndefined()) {
908 0 : if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &mPremultipliedAlpha)) {
909 0 : return false;
910 : }
911 : } else {
912 0 : mPremultipliedAlpha = true;
913 : }
914 0 : mIsAnyMemberPresent = true;
915 :
916 0 : if (!isNull) {
917 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->preserveDrawingBuffer_id, temp.ptr())) {
918 0 : return false;
919 : }
920 : }
921 0 : if (!isNull && !temp->isUndefined()) {
922 0 : if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &mPreserveDrawingBuffer)) {
923 0 : return false;
924 : }
925 : } else {
926 0 : mPreserveDrawingBuffer = false;
927 : }
928 0 : mIsAnyMemberPresent = true;
929 :
930 0 : if (!isNull) {
931 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->stencil_id, temp.ptr())) {
932 0 : return false;
933 : }
934 : }
935 0 : if (!isNull && !temp->isUndefined()) {
936 0 : if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &mStencil)) {
937 0 : return false;
938 : }
939 : } else {
940 0 : mStencil = false;
941 : }
942 0 : mIsAnyMemberPresent = true;
943 0 : return true;
944 : }
945 :
946 : bool
947 0 : WebGLContextAttributes::Init(const nsAString& aJSON)
948 : {
949 0 : AutoJSAPI jsapi;
950 0 : JSObject* cleanGlobal = SimpleGlobalObject::Create(SimpleGlobalObject::GlobalType::BindingDetail);
951 0 : if (!cleanGlobal) {
952 0 : return false;
953 : }
954 0 : if (!jsapi.Init(cleanGlobal)) {
955 0 : return false;
956 : }
957 0 : JSContext* cx = jsapi.cx();
958 0 : JS::Rooted<JS::Value> json(cx);
959 0 : bool ok = ParseJSON(cx, aJSON, &json);
960 0 : NS_ENSURE_TRUE(ok, false);
961 0 : return Init(cx, json);
962 : }
963 :
964 : bool
965 0 : WebGLContextAttributes::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
966 : {
967 0 : WebGLContextAttributesAtoms* atomsCache = GetAtomCache<WebGLContextAttributesAtoms>(cx);
968 0 : if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
969 0 : return false;
970 : }
971 :
972 0 : JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
973 0 : if (!obj) {
974 0 : return false;
975 : }
976 0 : rval.set(JS::ObjectValue(*obj));
977 :
978 0 : if (mAlpha.WasPassed()) {
979 : do {
980 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
981 0 : JS::Rooted<JS::Value> temp(cx);
982 0 : bool const & currentValue = mAlpha.InternalValue();
983 0 : temp.setBoolean(currentValue);
984 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->alpha_id, temp, JSPROP_ENUMERATE)) {
985 0 : return false;
986 : }
987 0 : break;
988 : } while(0);
989 : }
990 :
991 : do {
992 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
993 0 : JS::Rooted<JS::Value> temp(cx);
994 0 : bool const & currentValue = mAntialias;
995 0 : temp.setBoolean(currentValue);
996 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->antialias_id, temp, JSPROP_ENUMERATE)) {
997 0 : return false;
998 : }
999 0 : break;
1000 : } while(0);
1001 :
1002 : do {
1003 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
1004 0 : JS::Rooted<JS::Value> temp(cx);
1005 0 : bool const & currentValue = mDepth;
1006 0 : temp.setBoolean(currentValue);
1007 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->depth_id, temp, JSPROP_ENUMERATE)) {
1008 0 : return false;
1009 : }
1010 0 : break;
1011 : } while(0);
1012 :
1013 : do {
1014 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
1015 0 : JS::Rooted<JS::Value> temp(cx);
1016 0 : bool const & currentValue = mFailIfMajorPerformanceCaveat;
1017 0 : temp.setBoolean(currentValue);
1018 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->failIfMajorPerformanceCaveat_id, temp, JSPROP_ENUMERATE)) {
1019 0 : return false;
1020 : }
1021 0 : break;
1022 : } while(0);
1023 :
1024 : do {
1025 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
1026 0 : JS::Rooted<JS::Value> temp(cx);
1027 0 : bool const & currentValue = mPremultipliedAlpha;
1028 0 : temp.setBoolean(currentValue);
1029 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->premultipliedAlpha_id, temp, JSPROP_ENUMERATE)) {
1030 0 : return false;
1031 : }
1032 0 : break;
1033 : } while(0);
1034 :
1035 : do {
1036 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
1037 0 : JS::Rooted<JS::Value> temp(cx);
1038 0 : bool const & currentValue = mPreserveDrawingBuffer;
1039 0 : temp.setBoolean(currentValue);
1040 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->preserveDrawingBuffer_id, temp, JSPROP_ENUMERATE)) {
1041 0 : return false;
1042 : }
1043 0 : break;
1044 : } while(0);
1045 :
1046 : do {
1047 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
1048 0 : JS::Rooted<JS::Value> temp(cx);
1049 0 : bool const & currentValue = mStencil;
1050 0 : temp.setBoolean(currentValue);
1051 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->stencil_id, temp, JSPROP_ENUMERATE)) {
1052 0 : return false;
1053 : }
1054 0 : break;
1055 : } while(0);
1056 :
1057 0 : return true;
1058 : }
1059 :
1060 : bool
1061 0 : WebGLContextAttributes::ToJSON(nsAString& aJSON) const
1062 : {
1063 0 : AutoJSAPI jsapi;
1064 0 : jsapi.Init();
1065 0 : JSContext *cx = jsapi.cx();
1066 : // It's safe to use UnprivilegedJunkScopeOrWorkerGlobal here
1067 : // because we'll only be creating objects, in ways that have no
1068 : // side-effects, followed by a call to JS::ToJSONMaybeSafely,
1069 : // which likewise guarantees no side-effects for the sorts of
1070 : // things we will pass it.
1071 0 : JSAutoCompartment ac(cx, binding_detail::UnprivilegedJunkScopeOrWorkerGlobal());
1072 0 : JS::Rooted<JS::Value> val(cx);
1073 0 : if (!ToObjectInternal(cx, &val)) {
1074 0 : return false;
1075 : }
1076 0 : JS::Rooted<JSObject*> obj(cx, &val.toObject());
1077 0 : return StringifyToJSON(cx, obj, aJSON);
1078 : }
1079 :
1080 : void
1081 0 : WebGLContextAttributes::TraceDictionary(JSTracer* trc)
1082 : {
1083 0 : }
1084 :
1085 : WebGLContextAttributes&
1086 0 : WebGLContextAttributes::operator=(const WebGLContextAttributes& aOther)
1087 : {
1088 0 : mAlpha.Reset();
1089 0 : if (aOther.mAlpha.WasPassed()) {
1090 0 : mAlpha.Construct(aOther.mAlpha.Value());
1091 : }
1092 0 : mAntialias = aOther.mAntialias;
1093 0 : mDepth = aOther.mDepth;
1094 0 : mFailIfMajorPerformanceCaveat = aOther.mFailIfMajorPerformanceCaveat;
1095 0 : mPremultipliedAlpha = aOther.mPremultipliedAlpha;
1096 0 : mPreserveDrawingBuffer = aOther.mPreserveDrawingBuffer;
1097 0 : mStencil = aOther.mStencil;
1098 0 : return *this;
1099 : }
1100 :
1101 : namespace binding_detail {
1102 : } // namespace binding_detail
1103 :
1104 :
1105 : namespace ANGLE_instanced_arraysBinding {
1106 :
1107 : static bool
1108 0 : drawArraysInstancedANGLE(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionInstancedArrays* self, const JSJitMethodCallArgs& args)
1109 : {
1110 0 : if (MOZ_UNLIKELY(args.length() < 4)) {
1111 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ANGLE_instanced_arrays.drawArraysInstancedANGLE");
1112 : }
1113 : uint32_t arg0;
1114 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
1115 0 : return false;
1116 : }
1117 : int32_t arg1;
1118 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
1119 0 : return false;
1120 : }
1121 : int32_t arg2;
1122 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
1123 0 : return false;
1124 : }
1125 : int32_t arg3;
1126 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
1127 0 : return false;
1128 : }
1129 0 : self->DrawArraysInstancedANGLE(arg0, arg1, arg2, arg3);
1130 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1131 0 : args.rval().setUndefined();
1132 0 : return true;
1133 : }
1134 :
1135 : static const JSJitInfo drawArraysInstancedANGLE_methodinfo = {
1136 : { (JSJitGetterOp)drawArraysInstancedANGLE },
1137 : { prototypes::id::ANGLE_instanced_arrays },
1138 : { PrototypeTraits<prototypes::id::ANGLE_instanced_arrays>::Depth },
1139 : JSJitInfo::Method,
1140 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1141 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1142 : false, /* isInfallible. False in setters. */
1143 : false, /* isMovable. Not relevant for setters. */
1144 : false, /* isEliminatable. Not relevant for setters. */
1145 : false, /* isAlwaysInSlot. Only relevant for getters. */
1146 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1147 : false, /* isTypedMethod. Only relevant for methods. */
1148 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1149 : };
1150 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1151 : static_assert(0 < 1, "There is no slot for us");
1152 :
1153 : static bool
1154 0 : drawElementsInstancedANGLE(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionInstancedArrays* self, const JSJitMethodCallArgs& args)
1155 : {
1156 0 : if (MOZ_UNLIKELY(args.length() < 5)) {
1157 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ANGLE_instanced_arrays.drawElementsInstancedANGLE");
1158 : }
1159 : uint32_t arg0;
1160 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
1161 0 : return false;
1162 : }
1163 : int32_t arg1;
1164 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
1165 0 : return false;
1166 : }
1167 : uint32_t arg2;
1168 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
1169 0 : return false;
1170 : }
1171 : int64_t arg3;
1172 0 : if (!ValueToPrimitive<int64_t, eDefault>(cx, args[3], &arg3)) {
1173 0 : return false;
1174 : }
1175 : int32_t arg4;
1176 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[4], &arg4)) {
1177 0 : return false;
1178 : }
1179 0 : self->DrawElementsInstancedANGLE(arg0, arg1, arg2, arg3, arg4);
1180 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1181 0 : args.rval().setUndefined();
1182 0 : return true;
1183 : }
1184 :
1185 : static const JSJitInfo drawElementsInstancedANGLE_methodinfo = {
1186 : { (JSJitGetterOp)drawElementsInstancedANGLE },
1187 : { prototypes::id::ANGLE_instanced_arrays },
1188 : { PrototypeTraits<prototypes::id::ANGLE_instanced_arrays>::Depth },
1189 : JSJitInfo::Method,
1190 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1191 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1192 : false, /* isInfallible. False in setters. */
1193 : false, /* isMovable. Not relevant for setters. */
1194 : false, /* isEliminatable. Not relevant for setters. */
1195 : false, /* isAlwaysInSlot. Only relevant for getters. */
1196 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1197 : false, /* isTypedMethod. Only relevant for methods. */
1198 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1199 : };
1200 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1201 : static_assert(0 < 1, "There is no slot for us");
1202 :
1203 : static bool
1204 0 : vertexAttribDivisorANGLE(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionInstancedArrays* self, const JSJitMethodCallArgs& args)
1205 : {
1206 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
1207 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ANGLE_instanced_arrays.vertexAttribDivisorANGLE");
1208 : }
1209 : uint32_t arg0;
1210 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
1211 0 : return false;
1212 : }
1213 : uint32_t arg1;
1214 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
1215 0 : return false;
1216 : }
1217 0 : self->VertexAttribDivisorANGLE(arg0, arg1);
1218 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1219 0 : args.rval().setUndefined();
1220 0 : return true;
1221 : }
1222 :
1223 : static const JSJitInfo vertexAttribDivisorANGLE_methodinfo = {
1224 : { (JSJitGetterOp)vertexAttribDivisorANGLE },
1225 : { prototypes::id::ANGLE_instanced_arrays },
1226 : { PrototypeTraits<prototypes::id::ANGLE_instanced_arrays>::Depth },
1227 : JSJitInfo::Method,
1228 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1229 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1230 : false, /* isInfallible. False in setters. */
1231 : false, /* isMovable. Not relevant for setters. */
1232 : false, /* isEliminatable. Not relevant for setters. */
1233 : false, /* isAlwaysInSlot. Only relevant for getters. */
1234 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1235 : false, /* isTypedMethod. Only relevant for methods. */
1236 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1237 : };
1238 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1239 : static_assert(0 < 1, "There is no slot for us");
1240 :
1241 : static bool
1242 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
1243 : {
1244 0 : mozilla::WebGLExtensionInstancedArrays* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionInstancedArrays>(obj);
1245 : // We don't want to preserve if we don't have a wrapper, and we
1246 : // obviously can't preserve if we're not initialized.
1247 0 : if (self && self->GetWrapperPreserveColor()) {
1248 0 : PreserveWrapper(self);
1249 : }
1250 0 : return true;
1251 : }
1252 :
1253 : static void
1254 0 : _finalize(js::FreeOp* fop, JSObject* obj)
1255 : {
1256 0 : mozilla::WebGLExtensionInstancedArrays* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionInstancedArrays>(obj);
1257 0 : if (self) {
1258 0 : ClearWrapper(self, self, obj);
1259 0 : AddForDeferredFinalization<mozilla::WebGLExtensionInstancedArrays>(self);
1260 : }
1261 0 : }
1262 :
1263 : static void
1264 0 : _objectMoved(JSObject* obj, const JSObject* old)
1265 : {
1266 0 : mozilla::WebGLExtensionInstancedArrays* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionInstancedArrays>(obj);
1267 0 : if (self) {
1268 0 : UpdateWrapper(self, self, obj, old);
1269 : }
1270 0 : }
1271 :
1272 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1273 : #if defined(__clang__)
1274 : #pragma clang diagnostic push
1275 : #pragma clang diagnostic ignored "-Wmissing-braces"
1276 : #endif
1277 : static const JSFunctionSpec sMethods_specs[] = {
1278 : JS_FNSPEC("drawArraysInstancedANGLE", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&drawArraysInstancedANGLE_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
1279 : JS_FNSPEC("drawElementsInstancedANGLE", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&drawElementsInstancedANGLE_methodinfo), 5, JSPROP_ENUMERATE, nullptr),
1280 : JS_FNSPEC("vertexAttribDivisorANGLE", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&vertexAttribDivisorANGLE_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
1281 : JS_FS_END
1282 : };
1283 : #if defined(__clang__)
1284 : #pragma clang diagnostic pop
1285 : #endif
1286 :
1287 :
1288 : // Can't be const because the pref-enabled boolean needs to be writable
1289 : static Prefable<const JSFunctionSpec> sMethods[] = {
1290 : { nullptr, &sMethods_specs[0] },
1291 : { nullptr, nullptr }
1292 : };
1293 :
1294 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1295 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1296 : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1297 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1298 :
1299 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1300 : #if defined(__clang__)
1301 : #pragma clang diagnostic push
1302 : #pragma clang diagnostic ignored "-Wmissing-braces"
1303 : #endif
1304 : static const ConstantSpec sConstants_specs[] = {
1305 : { "VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE", JS::NumberValue(35070U) },
1306 : { 0, JS::UndefinedValue() }
1307 : };
1308 : #if defined(__clang__)
1309 : #pragma clang diagnostic pop
1310 : #endif
1311 :
1312 :
1313 : // Can't be const because the pref-enabled boolean needs to be writable
1314 : static Prefable<const ConstantSpec> sConstants[] = {
1315 : { nullptr, &sConstants_specs[0] },
1316 : { nullptr, nullptr }
1317 : };
1318 :
1319 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1320 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1321 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1322 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1323 :
1324 :
1325 : static uint16_t sNativeProperties_sortedPropertyIndices[4];
1326 : static PropertyInfo sNativeProperties_propertyInfos[4];
1327 :
1328 : static const NativePropertiesN<2> sNativeProperties = {
1329 : false, 0,
1330 : false, 0,
1331 : true, 0 /* sMethods */,
1332 : false, 0,
1333 : false, 0,
1334 : false, 0,
1335 : true, 1 /* sConstants */,
1336 : -1,
1337 : 4,
1338 : sNativeProperties_sortedPropertyIndices,
1339 : {
1340 : { sMethods, &sNativeProperties_propertyInfos[0] },
1341 : { sConstants, &sNativeProperties_propertyInfos[3] }
1342 : }
1343 : };
1344 : static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
1345 : "We have a property info count that is oversized");
1346 :
1347 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
1348 : {
1349 : "ANGLE_instanced_arraysPrototype",
1350 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
1351 : JS_NULL_CLASS_OPS,
1352 : JS_NULL_CLASS_SPEC,
1353 : JS_NULL_CLASS_EXT,
1354 : JS_NULL_OBJECT_OPS
1355 : },
1356 : eInterfacePrototype,
1357 : false,
1358 : prototypes::id::ANGLE_instanced_arrays,
1359 : PrototypeTraits<prototypes::id::ANGLE_instanced_arrays>::Depth,
1360 : sNativePropertyHooks,
1361 : "[object ANGLE_instanced_arraysPrototype]",
1362 : JS::GetRealmObjectPrototype
1363 : };
1364 :
1365 : static const js::ClassOps sClassOps = {
1366 : _addProperty, /* addProperty */
1367 : nullptr, /* delProperty */
1368 : nullptr, /* getProperty */
1369 : nullptr, /* setProperty */
1370 : nullptr, /* enumerate */
1371 : nullptr, /* newEnumerate */
1372 : nullptr, /* resolve */
1373 : nullptr, /* mayResolve */
1374 : _finalize, /* finalize */
1375 : nullptr, /* call */
1376 : nullptr, /* hasInstance */
1377 : nullptr, /* construct */
1378 : nullptr, /* trace */
1379 : };
1380 :
1381 : static const js::ClassExtension sClassExtension = {
1382 : nullptr, /* weakmapKeyDelegateOp */
1383 : _objectMoved /* objectMovedOp */
1384 : };
1385 :
1386 : static const DOMJSClass sClass = {
1387 : { "ANGLE_instanced_arrays",
1388 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
1389 : &sClassOps,
1390 : JS_NULL_CLASS_SPEC,
1391 : &sClassExtension,
1392 : JS_NULL_OBJECT_OPS
1393 : },
1394 : { prototypes::id::ANGLE_instanced_arrays, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
1395 : IsBaseOf<nsISupports, mozilla::WebGLExtensionInstancedArrays >::value,
1396 : sNativePropertyHooks,
1397 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionInstancedArrays>::Get,
1398 : GetProtoObjectHandle,
1399 : GetCCParticipant<mozilla::WebGLExtensionInstancedArrays>::Get()
1400 : };
1401 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
1402 : "Must have the right minimal number of reserved slots.");
1403 : static_assert(1 >= 1,
1404 : "Must have enough reserved slots.");
1405 :
1406 : const JSClass*
1407 0 : GetJSClass()
1408 : {
1409 0 : return sClass.ToJSClass();
1410 : }
1411 :
1412 : bool
1413 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionInstancedArrays* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
1414 : {
1415 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionInstancedArrays*>(aObject) ==
1416 : reinterpret_cast<mozilla::WebGLExtensionInstancedArrays*>(aObject),
1417 : "Multiple inheritance for mozilla::WebGLExtensionInstancedArrays is broken.");
1418 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
1419 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
1420 0 : MOZ_ASSERT(!aCache->GetWrapper(),
1421 : "You should probably not be using Wrap() directly; use "
1422 : "GetOrCreateDOMReflector instead");
1423 :
1424 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
1425 : "nsISupports must be on our primary inheritance chain");
1426 :
1427 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
1428 0 : if (!global) {
1429 0 : return false;
1430 : }
1431 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
1432 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
1433 :
1434 : // That might have ended up wrapping us already, due to the wonders
1435 : // of XBL. Check for that, and bail out as needed.
1436 0 : aReflector.set(aCache->GetWrapper());
1437 0 : if (aReflector) {
1438 : #ifdef DEBUG
1439 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
1440 : #endif // DEBUG
1441 0 : return true;
1442 : }
1443 :
1444 0 : JSAutoCompartment ac(aCx, global);
1445 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
1446 0 : if (!canonicalProto) {
1447 0 : return false;
1448 : }
1449 0 : JS::Rooted<JSObject*> proto(aCx);
1450 0 : if (aGivenProto) {
1451 0 : proto = aGivenProto;
1452 : // Unfortunately, while aGivenProto was in the compartment of aCx
1453 : // coming in, we changed compartments to that of "parent" so may need
1454 : // to wrap the proto here.
1455 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
1456 0 : if (!JS_WrapObject(aCx, &proto)) {
1457 0 : return false;
1458 : }
1459 : }
1460 : } else {
1461 0 : proto = canonicalProto;
1462 : }
1463 :
1464 0 : BindingJSObjectCreator<mozilla::WebGLExtensionInstancedArrays> creator(aCx);
1465 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
1466 0 : if (!aReflector) {
1467 0 : return false;
1468 : }
1469 :
1470 0 : aCache->SetWrapper(aReflector);
1471 0 : creator.InitializationSucceeded();
1472 :
1473 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
1474 : aCache->GetWrapperPreserveColor() == aReflector);
1475 : // If proto != canonicalProto, we have to preserve our wrapper;
1476 : // otherwise we won't be able to properly recreate it later, since
1477 : // we won't know what proto to use. Note that we don't check
1478 : // aGivenProto here, since it's entirely possible (and even
1479 : // somewhat common) to have a non-null aGivenProto which is the
1480 : // same as canonicalProto.
1481 0 : if (proto != canonicalProto) {
1482 0 : PreserveWrapper(aObject);
1483 : }
1484 :
1485 0 : return true;
1486 : }
1487 :
1488 : const NativePropertyHooks sNativePropertyHooks[] = { {
1489 : nullptr,
1490 : nullptr,
1491 : nullptr,
1492 : { sNativeProperties.Upcast(), nullptr },
1493 : prototypes::id::ANGLE_instanced_arrays,
1494 : constructors::id::_ID_Count,
1495 : nullptr,
1496 : &DefaultXrayExpandoObjectClass
1497 : } };
1498 :
1499 : void
1500 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
1501 : {
1502 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
1503 0 : if (!parentProto) {
1504 0 : return;
1505 : }
1506 :
1507 : static bool sIdsInited = false;
1508 0 : if (!sIdsInited && NS_IsMainThread()) {
1509 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
1510 0 : return;
1511 : }
1512 0 : sIdsInited = true;
1513 : }
1514 :
1515 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::ANGLE_instanced_arrays);
1516 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
1517 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
1518 : &sPrototypeClass.mBase, protoCache,
1519 : nullptr, nullptr, 0, nullptr,
1520 : interfaceCache,
1521 : sNativeProperties.Upcast(),
1522 : nullptr,
1523 : nullptr, aDefineOnGlobal,
1524 : nullptr,
1525 0 : false);
1526 : }
1527 :
1528 : JS::Handle<JSObject*>
1529 0 : GetProtoObjectHandle(JSContext* aCx)
1530 : {
1531 : /* Get the interface prototype object for this class. This will create the
1532 : object as needed. */
1533 0 : bool aDefineOnGlobal = true;
1534 :
1535 : /* Make sure our global is sane. Hopefully we can remove this sometime */
1536 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
1537 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
1538 0 : return nullptr;
1539 : }
1540 :
1541 : /* Check to see whether the interface objects are already installed */
1542 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
1543 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::ANGLE_instanced_arrays)) {
1544 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
1545 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
1546 : }
1547 :
1548 : /*
1549 : * The object might _still_ be null, but that's OK.
1550 : *
1551 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
1552 : * traced by TraceProtoAndIfaceCache() and its contents are never
1553 : * changed after they have been set.
1554 : *
1555 : * Calling address() avoids the read read barrier that does gray
1556 : * unmarking, but it's not possible for the object to be gray here.
1557 : */
1558 :
1559 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::ANGLE_instanced_arrays);
1560 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
1561 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
1562 : }
1563 :
1564 : } // namespace ANGLE_instanced_arraysBinding
1565 :
1566 :
1567 :
1568 : namespace EXT_blend_minmaxBinding {
1569 :
1570 : static bool
1571 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
1572 : {
1573 0 : mozilla::WebGLExtensionBlendMinMax* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionBlendMinMax>(obj);
1574 : // We don't want to preserve if we don't have a wrapper, and we
1575 : // obviously can't preserve if we're not initialized.
1576 0 : if (self && self->GetWrapperPreserveColor()) {
1577 0 : PreserveWrapper(self);
1578 : }
1579 0 : return true;
1580 : }
1581 :
1582 : static void
1583 0 : _finalize(js::FreeOp* fop, JSObject* obj)
1584 : {
1585 0 : mozilla::WebGLExtensionBlendMinMax* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionBlendMinMax>(obj);
1586 0 : if (self) {
1587 0 : ClearWrapper(self, self, obj);
1588 0 : AddForDeferredFinalization<mozilla::WebGLExtensionBlendMinMax>(self);
1589 : }
1590 0 : }
1591 :
1592 : static void
1593 0 : _objectMoved(JSObject* obj, const JSObject* old)
1594 : {
1595 0 : mozilla::WebGLExtensionBlendMinMax* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionBlendMinMax>(obj);
1596 0 : if (self) {
1597 0 : UpdateWrapper(self, self, obj, old);
1598 : }
1599 0 : }
1600 :
1601 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1602 : #if defined(__clang__)
1603 : #pragma clang diagnostic push
1604 : #pragma clang diagnostic ignored "-Wmissing-braces"
1605 : #endif
1606 : static const ConstantSpec sConstants_specs[] = {
1607 : { "MIN_EXT", JS::NumberValue(32775U) },
1608 : { "MAX_EXT", JS::NumberValue(32776U) },
1609 : { 0, JS::UndefinedValue() }
1610 : };
1611 : #if defined(__clang__)
1612 : #pragma clang diagnostic pop
1613 : #endif
1614 :
1615 :
1616 : // Can't be const because the pref-enabled boolean needs to be writable
1617 : static Prefable<const ConstantSpec> sConstants[] = {
1618 : { nullptr, &sConstants_specs[0] },
1619 : { nullptr, nullptr }
1620 : };
1621 :
1622 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1623 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1624 : static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1625 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1626 :
1627 :
1628 : static uint16_t sNativeProperties_sortedPropertyIndices[2];
1629 : static PropertyInfo sNativeProperties_propertyInfos[2];
1630 :
1631 : static const NativePropertiesN<1> sNativeProperties = {
1632 : false, 0,
1633 : false, 0,
1634 : false, 0,
1635 : false, 0,
1636 : false, 0,
1637 : false, 0,
1638 : true, 0 /* sConstants */,
1639 : -1,
1640 : 2,
1641 : sNativeProperties_sortedPropertyIndices,
1642 : {
1643 : { sConstants, &sNativeProperties_propertyInfos[0] }
1644 : }
1645 : };
1646 : static_assert(2 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
1647 : "We have a property info count that is oversized");
1648 :
1649 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
1650 : {
1651 : "EXT_blend_minmaxPrototype",
1652 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
1653 : JS_NULL_CLASS_OPS,
1654 : JS_NULL_CLASS_SPEC,
1655 : JS_NULL_CLASS_EXT,
1656 : JS_NULL_OBJECT_OPS
1657 : },
1658 : eInterfacePrototype,
1659 : false,
1660 : prototypes::id::EXT_blend_minmax,
1661 : PrototypeTraits<prototypes::id::EXT_blend_minmax>::Depth,
1662 : sNativePropertyHooks,
1663 : "[object EXT_blend_minmaxPrototype]",
1664 : JS::GetRealmObjectPrototype
1665 : };
1666 :
1667 : static const js::ClassOps sClassOps = {
1668 : _addProperty, /* addProperty */
1669 : nullptr, /* delProperty */
1670 : nullptr, /* getProperty */
1671 : nullptr, /* setProperty */
1672 : nullptr, /* enumerate */
1673 : nullptr, /* newEnumerate */
1674 : nullptr, /* resolve */
1675 : nullptr, /* mayResolve */
1676 : _finalize, /* finalize */
1677 : nullptr, /* call */
1678 : nullptr, /* hasInstance */
1679 : nullptr, /* construct */
1680 : nullptr, /* trace */
1681 : };
1682 :
1683 : static const js::ClassExtension sClassExtension = {
1684 : nullptr, /* weakmapKeyDelegateOp */
1685 : _objectMoved /* objectMovedOp */
1686 : };
1687 :
1688 : static const DOMJSClass sClass = {
1689 : { "EXT_blend_minmax",
1690 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
1691 : &sClassOps,
1692 : JS_NULL_CLASS_SPEC,
1693 : &sClassExtension,
1694 : JS_NULL_OBJECT_OPS
1695 : },
1696 : { prototypes::id::EXT_blend_minmax, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
1697 : IsBaseOf<nsISupports, mozilla::WebGLExtensionBlendMinMax >::value,
1698 : sNativePropertyHooks,
1699 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionBlendMinMax>::Get,
1700 : GetProtoObjectHandle,
1701 : GetCCParticipant<mozilla::WebGLExtensionBlendMinMax>::Get()
1702 : };
1703 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
1704 : "Must have the right minimal number of reserved slots.");
1705 : static_assert(1 >= 1,
1706 : "Must have enough reserved slots.");
1707 :
1708 : const JSClass*
1709 0 : GetJSClass()
1710 : {
1711 0 : return sClass.ToJSClass();
1712 : }
1713 :
1714 : bool
1715 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionBlendMinMax* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
1716 : {
1717 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionBlendMinMax*>(aObject) ==
1718 : reinterpret_cast<mozilla::WebGLExtensionBlendMinMax*>(aObject),
1719 : "Multiple inheritance for mozilla::WebGLExtensionBlendMinMax is broken.");
1720 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
1721 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
1722 0 : MOZ_ASSERT(!aCache->GetWrapper(),
1723 : "You should probably not be using Wrap() directly; use "
1724 : "GetOrCreateDOMReflector instead");
1725 :
1726 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
1727 : "nsISupports must be on our primary inheritance chain");
1728 :
1729 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
1730 0 : if (!global) {
1731 0 : return false;
1732 : }
1733 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
1734 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
1735 :
1736 : // That might have ended up wrapping us already, due to the wonders
1737 : // of XBL. Check for that, and bail out as needed.
1738 0 : aReflector.set(aCache->GetWrapper());
1739 0 : if (aReflector) {
1740 : #ifdef DEBUG
1741 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
1742 : #endif // DEBUG
1743 0 : return true;
1744 : }
1745 :
1746 0 : JSAutoCompartment ac(aCx, global);
1747 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
1748 0 : if (!canonicalProto) {
1749 0 : return false;
1750 : }
1751 0 : JS::Rooted<JSObject*> proto(aCx);
1752 0 : if (aGivenProto) {
1753 0 : proto = aGivenProto;
1754 : // Unfortunately, while aGivenProto was in the compartment of aCx
1755 : // coming in, we changed compartments to that of "parent" so may need
1756 : // to wrap the proto here.
1757 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
1758 0 : if (!JS_WrapObject(aCx, &proto)) {
1759 0 : return false;
1760 : }
1761 : }
1762 : } else {
1763 0 : proto = canonicalProto;
1764 : }
1765 :
1766 0 : BindingJSObjectCreator<mozilla::WebGLExtensionBlendMinMax> creator(aCx);
1767 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
1768 0 : if (!aReflector) {
1769 0 : return false;
1770 : }
1771 :
1772 0 : aCache->SetWrapper(aReflector);
1773 0 : creator.InitializationSucceeded();
1774 :
1775 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
1776 : aCache->GetWrapperPreserveColor() == aReflector);
1777 : // If proto != canonicalProto, we have to preserve our wrapper;
1778 : // otherwise we won't be able to properly recreate it later, since
1779 : // we won't know what proto to use. Note that we don't check
1780 : // aGivenProto here, since it's entirely possible (and even
1781 : // somewhat common) to have a non-null aGivenProto which is the
1782 : // same as canonicalProto.
1783 0 : if (proto != canonicalProto) {
1784 0 : PreserveWrapper(aObject);
1785 : }
1786 :
1787 0 : return true;
1788 : }
1789 :
1790 : const NativePropertyHooks sNativePropertyHooks[] = { {
1791 : nullptr,
1792 : nullptr,
1793 : nullptr,
1794 : { sNativeProperties.Upcast(), nullptr },
1795 : prototypes::id::EXT_blend_minmax,
1796 : constructors::id::_ID_Count,
1797 : nullptr,
1798 : &DefaultXrayExpandoObjectClass
1799 : } };
1800 :
1801 : void
1802 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
1803 : {
1804 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
1805 0 : if (!parentProto) {
1806 0 : return;
1807 : }
1808 :
1809 : static bool sIdsInited = false;
1810 0 : if (!sIdsInited && NS_IsMainThread()) {
1811 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
1812 0 : return;
1813 : }
1814 0 : sIdsInited = true;
1815 : }
1816 :
1817 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::EXT_blend_minmax);
1818 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
1819 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
1820 : &sPrototypeClass.mBase, protoCache,
1821 : nullptr, nullptr, 0, nullptr,
1822 : interfaceCache,
1823 : sNativeProperties.Upcast(),
1824 : nullptr,
1825 : nullptr, aDefineOnGlobal,
1826 : nullptr,
1827 0 : false);
1828 : }
1829 :
1830 : JS::Handle<JSObject*>
1831 0 : GetProtoObjectHandle(JSContext* aCx)
1832 : {
1833 : /* Get the interface prototype object for this class. This will create the
1834 : object as needed. */
1835 0 : bool aDefineOnGlobal = true;
1836 :
1837 : /* Make sure our global is sane. Hopefully we can remove this sometime */
1838 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
1839 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
1840 0 : return nullptr;
1841 : }
1842 :
1843 : /* Check to see whether the interface objects are already installed */
1844 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
1845 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::EXT_blend_minmax)) {
1846 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
1847 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
1848 : }
1849 :
1850 : /*
1851 : * The object might _still_ be null, but that's OK.
1852 : *
1853 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
1854 : * traced by TraceProtoAndIfaceCache() and its contents are never
1855 : * changed after they have been set.
1856 : *
1857 : * Calling address() avoids the read read barrier that does gray
1858 : * unmarking, but it's not possible for the object to be gray here.
1859 : */
1860 :
1861 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::EXT_blend_minmax);
1862 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
1863 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
1864 : }
1865 :
1866 : } // namespace EXT_blend_minmaxBinding
1867 :
1868 :
1869 :
1870 : namespace EXT_color_buffer_half_floatBinding {
1871 :
1872 : static bool
1873 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
1874 : {
1875 0 : mozilla::WebGLExtensionColorBufferHalfFloat* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionColorBufferHalfFloat>(obj);
1876 : // We don't want to preserve if we don't have a wrapper, and we
1877 : // obviously can't preserve if we're not initialized.
1878 0 : if (self && self->GetWrapperPreserveColor()) {
1879 0 : PreserveWrapper(self);
1880 : }
1881 0 : return true;
1882 : }
1883 :
1884 : static void
1885 0 : _finalize(js::FreeOp* fop, JSObject* obj)
1886 : {
1887 0 : mozilla::WebGLExtensionColorBufferHalfFloat* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionColorBufferHalfFloat>(obj);
1888 0 : if (self) {
1889 0 : ClearWrapper(self, self, obj);
1890 0 : AddForDeferredFinalization<mozilla::WebGLExtensionColorBufferHalfFloat>(self);
1891 : }
1892 0 : }
1893 :
1894 : static void
1895 0 : _objectMoved(JSObject* obj, const JSObject* old)
1896 : {
1897 0 : mozilla::WebGLExtensionColorBufferHalfFloat* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionColorBufferHalfFloat>(obj);
1898 0 : if (self) {
1899 0 : UpdateWrapper(self, self, obj, old);
1900 : }
1901 0 : }
1902 :
1903 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1904 : #if defined(__clang__)
1905 : #pragma clang diagnostic push
1906 : #pragma clang diagnostic ignored "-Wmissing-braces"
1907 : #endif
1908 : static const ConstantSpec sConstants_specs[] = {
1909 : { "RGBA16F_EXT", JS::NumberValue(34842U) },
1910 : { "RGB16F_EXT", JS::NumberValue(34843U) },
1911 : { "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT", JS::NumberValue(33297U) },
1912 : { "UNSIGNED_NORMALIZED_EXT", JS::NumberValue(35863U) },
1913 : { 0, JS::UndefinedValue() }
1914 : };
1915 : #if defined(__clang__)
1916 : #pragma clang diagnostic pop
1917 : #endif
1918 :
1919 :
1920 : // Can't be const because the pref-enabled boolean needs to be writable
1921 : static Prefable<const ConstantSpec> sConstants[] = {
1922 : { nullptr, &sConstants_specs[0] },
1923 : { nullptr, nullptr }
1924 : };
1925 :
1926 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1927 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1928 : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1929 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1930 :
1931 :
1932 : static uint16_t sNativeProperties_sortedPropertyIndices[4];
1933 : static PropertyInfo sNativeProperties_propertyInfos[4];
1934 :
1935 : static const NativePropertiesN<1> sNativeProperties = {
1936 : false, 0,
1937 : false, 0,
1938 : false, 0,
1939 : false, 0,
1940 : false, 0,
1941 : false, 0,
1942 : true, 0 /* sConstants */,
1943 : -1,
1944 : 4,
1945 : sNativeProperties_sortedPropertyIndices,
1946 : {
1947 : { sConstants, &sNativeProperties_propertyInfos[0] }
1948 : }
1949 : };
1950 : static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
1951 : "We have a property info count that is oversized");
1952 :
1953 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
1954 : {
1955 : "EXT_color_buffer_half_floatPrototype",
1956 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
1957 : JS_NULL_CLASS_OPS,
1958 : JS_NULL_CLASS_SPEC,
1959 : JS_NULL_CLASS_EXT,
1960 : JS_NULL_OBJECT_OPS
1961 : },
1962 : eInterfacePrototype,
1963 : false,
1964 : prototypes::id::EXT_color_buffer_half_float,
1965 : PrototypeTraits<prototypes::id::EXT_color_buffer_half_float>::Depth,
1966 : sNativePropertyHooks,
1967 : "[object EXT_color_buffer_half_floatPrototype]",
1968 : JS::GetRealmObjectPrototype
1969 : };
1970 :
1971 : static const js::ClassOps sClassOps = {
1972 : _addProperty, /* addProperty */
1973 : nullptr, /* delProperty */
1974 : nullptr, /* getProperty */
1975 : nullptr, /* setProperty */
1976 : nullptr, /* enumerate */
1977 : nullptr, /* newEnumerate */
1978 : nullptr, /* resolve */
1979 : nullptr, /* mayResolve */
1980 : _finalize, /* finalize */
1981 : nullptr, /* call */
1982 : nullptr, /* hasInstance */
1983 : nullptr, /* construct */
1984 : nullptr, /* trace */
1985 : };
1986 :
1987 : static const js::ClassExtension sClassExtension = {
1988 : nullptr, /* weakmapKeyDelegateOp */
1989 : _objectMoved /* objectMovedOp */
1990 : };
1991 :
1992 : static const DOMJSClass sClass = {
1993 : { "EXT_color_buffer_half_float",
1994 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
1995 : &sClassOps,
1996 : JS_NULL_CLASS_SPEC,
1997 : &sClassExtension,
1998 : JS_NULL_OBJECT_OPS
1999 : },
2000 : { prototypes::id::EXT_color_buffer_half_float, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
2001 : IsBaseOf<nsISupports, mozilla::WebGLExtensionColorBufferHalfFloat >::value,
2002 : sNativePropertyHooks,
2003 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionColorBufferHalfFloat>::Get,
2004 : GetProtoObjectHandle,
2005 : GetCCParticipant<mozilla::WebGLExtensionColorBufferHalfFloat>::Get()
2006 : };
2007 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
2008 : "Must have the right minimal number of reserved slots.");
2009 : static_assert(1 >= 1,
2010 : "Must have enough reserved slots.");
2011 :
2012 : const JSClass*
2013 0 : GetJSClass()
2014 : {
2015 0 : return sClass.ToJSClass();
2016 : }
2017 :
2018 : bool
2019 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionColorBufferHalfFloat* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
2020 : {
2021 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionColorBufferHalfFloat*>(aObject) ==
2022 : reinterpret_cast<mozilla::WebGLExtensionColorBufferHalfFloat*>(aObject),
2023 : "Multiple inheritance for mozilla::WebGLExtensionColorBufferHalfFloat is broken.");
2024 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
2025 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
2026 0 : MOZ_ASSERT(!aCache->GetWrapper(),
2027 : "You should probably not be using Wrap() directly; use "
2028 : "GetOrCreateDOMReflector instead");
2029 :
2030 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
2031 : "nsISupports must be on our primary inheritance chain");
2032 :
2033 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
2034 0 : if (!global) {
2035 0 : return false;
2036 : }
2037 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
2038 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
2039 :
2040 : // That might have ended up wrapping us already, due to the wonders
2041 : // of XBL. Check for that, and bail out as needed.
2042 0 : aReflector.set(aCache->GetWrapper());
2043 0 : if (aReflector) {
2044 : #ifdef DEBUG
2045 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
2046 : #endif // DEBUG
2047 0 : return true;
2048 : }
2049 :
2050 0 : JSAutoCompartment ac(aCx, global);
2051 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
2052 0 : if (!canonicalProto) {
2053 0 : return false;
2054 : }
2055 0 : JS::Rooted<JSObject*> proto(aCx);
2056 0 : if (aGivenProto) {
2057 0 : proto = aGivenProto;
2058 : // Unfortunately, while aGivenProto was in the compartment of aCx
2059 : // coming in, we changed compartments to that of "parent" so may need
2060 : // to wrap the proto here.
2061 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
2062 0 : if (!JS_WrapObject(aCx, &proto)) {
2063 0 : return false;
2064 : }
2065 : }
2066 : } else {
2067 0 : proto = canonicalProto;
2068 : }
2069 :
2070 0 : BindingJSObjectCreator<mozilla::WebGLExtensionColorBufferHalfFloat> creator(aCx);
2071 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
2072 0 : if (!aReflector) {
2073 0 : return false;
2074 : }
2075 :
2076 0 : aCache->SetWrapper(aReflector);
2077 0 : creator.InitializationSucceeded();
2078 :
2079 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
2080 : aCache->GetWrapperPreserveColor() == aReflector);
2081 : // If proto != canonicalProto, we have to preserve our wrapper;
2082 : // otherwise we won't be able to properly recreate it later, since
2083 : // we won't know what proto to use. Note that we don't check
2084 : // aGivenProto here, since it's entirely possible (and even
2085 : // somewhat common) to have a non-null aGivenProto which is the
2086 : // same as canonicalProto.
2087 0 : if (proto != canonicalProto) {
2088 0 : PreserveWrapper(aObject);
2089 : }
2090 :
2091 0 : return true;
2092 : }
2093 :
2094 : const NativePropertyHooks sNativePropertyHooks[] = { {
2095 : nullptr,
2096 : nullptr,
2097 : nullptr,
2098 : { sNativeProperties.Upcast(), nullptr },
2099 : prototypes::id::EXT_color_buffer_half_float,
2100 : constructors::id::_ID_Count,
2101 : nullptr,
2102 : &DefaultXrayExpandoObjectClass
2103 : } };
2104 :
2105 : void
2106 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
2107 : {
2108 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
2109 0 : if (!parentProto) {
2110 0 : return;
2111 : }
2112 :
2113 : static bool sIdsInited = false;
2114 0 : if (!sIdsInited && NS_IsMainThread()) {
2115 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
2116 0 : return;
2117 : }
2118 0 : sIdsInited = true;
2119 : }
2120 :
2121 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::EXT_color_buffer_half_float);
2122 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
2123 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
2124 : &sPrototypeClass.mBase, protoCache,
2125 : nullptr, nullptr, 0, nullptr,
2126 : interfaceCache,
2127 : sNativeProperties.Upcast(),
2128 : nullptr,
2129 : nullptr, aDefineOnGlobal,
2130 : nullptr,
2131 0 : false);
2132 : }
2133 :
2134 : JS::Handle<JSObject*>
2135 0 : GetProtoObjectHandle(JSContext* aCx)
2136 : {
2137 : /* Get the interface prototype object for this class. This will create the
2138 : object as needed. */
2139 0 : bool aDefineOnGlobal = true;
2140 :
2141 : /* Make sure our global is sane. Hopefully we can remove this sometime */
2142 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
2143 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
2144 0 : return nullptr;
2145 : }
2146 :
2147 : /* Check to see whether the interface objects are already installed */
2148 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
2149 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::EXT_color_buffer_half_float)) {
2150 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
2151 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
2152 : }
2153 :
2154 : /*
2155 : * The object might _still_ be null, but that's OK.
2156 : *
2157 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
2158 : * traced by TraceProtoAndIfaceCache() and its contents are never
2159 : * changed after they have been set.
2160 : *
2161 : * Calling address() avoids the read read barrier that does gray
2162 : * unmarking, but it's not possible for the object to be gray here.
2163 : */
2164 :
2165 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::EXT_color_buffer_half_float);
2166 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
2167 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
2168 : }
2169 :
2170 : } // namespace EXT_color_buffer_half_floatBinding
2171 :
2172 :
2173 :
2174 : namespace EXT_disjoint_timer_queryBinding {
2175 :
2176 : static bool
2177 0 : createQueryEXT(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionDisjointTimerQuery* self, const JSJitMethodCallArgs& args)
2178 : {
2179 0 : auto result(StrongOrRawPtr<mozilla::WebGLQuery>(self->CreateQueryEXT()));
2180 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2181 0 : if (!result) {
2182 0 : args.rval().setNull();
2183 0 : return true;
2184 : }
2185 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
2186 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
2187 0 : return false;
2188 : }
2189 0 : return true;
2190 : }
2191 :
2192 : static const JSJitInfo createQueryEXT_methodinfo = {
2193 : { (JSJitGetterOp)createQueryEXT },
2194 : { prototypes::id::EXT_disjoint_timer_query },
2195 : { PrototypeTraits<prototypes::id::EXT_disjoint_timer_query>::Depth },
2196 : JSJitInfo::Method,
2197 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2198 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
2199 : false, /* isInfallible. False in setters. */
2200 : false, /* isMovable. Not relevant for setters. */
2201 : false, /* isEliminatable. Not relevant for setters. */
2202 : false, /* isAlwaysInSlot. Only relevant for getters. */
2203 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2204 : false, /* isTypedMethod. Only relevant for methods. */
2205 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2206 : };
2207 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2208 : static_assert(0 < 1, "There is no slot for us");
2209 :
2210 : static bool
2211 0 : deleteQueryEXT(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionDisjointTimerQuery* self, const JSJitMethodCallArgs& args)
2212 : {
2213 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
2214 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "EXT_disjoint_timer_query.deleteQueryEXT");
2215 : }
2216 : mozilla::WebGLQuery* arg0;
2217 0 : if (args[0].isObject()) {
2218 : {
2219 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLQuery, mozilla::WebGLQuery>(args[0], arg0);
2220 0 : if (NS_FAILED(rv)) {
2221 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of EXT_disjoint_timer_query.deleteQueryEXT", "WebGLQuery");
2222 0 : return false;
2223 : }
2224 : }
2225 0 : } else if (args[0].isNullOrUndefined()) {
2226 0 : arg0 = nullptr;
2227 : } else {
2228 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of EXT_disjoint_timer_query.deleteQueryEXT");
2229 0 : return false;
2230 : }
2231 0 : self->DeleteQueryEXT(Constify(arg0));
2232 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2233 0 : args.rval().setUndefined();
2234 0 : return true;
2235 : }
2236 :
2237 : static const JSJitInfo deleteQueryEXT_methodinfo = {
2238 : { (JSJitGetterOp)deleteQueryEXT },
2239 : { prototypes::id::EXT_disjoint_timer_query },
2240 : { PrototypeTraits<prototypes::id::EXT_disjoint_timer_query>::Depth },
2241 : JSJitInfo::Method,
2242 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2243 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
2244 : false, /* isInfallible. False in setters. */
2245 : false, /* isMovable. Not relevant for setters. */
2246 : false, /* isEliminatable. Not relevant for setters. */
2247 : false, /* isAlwaysInSlot. Only relevant for getters. */
2248 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2249 : false, /* isTypedMethod. Only relevant for methods. */
2250 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2251 : };
2252 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2253 : static_assert(0 < 1, "There is no slot for us");
2254 :
2255 : static bool
2256 0 : isQueryEXT(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionDisjointTimerQuery* self, const JSJitMethodCallArgs& args)
2257 : {
2258 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
2259 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "EXT_disjoint_timer_query.isQueryEXT");
2260 : }
2261 : mozilla::WebGLQuery* arg0;
2262 0 : if (args[0].isObject()) {
2263 : {
2264 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLQuery, mozilla::WebGLQuery>(args[0], arg0);
2265 0 : if (NS_FAILED(rv)) {
2266 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of EXT_disjoint_timer_query.isQueryEXT", "WebGLQuery");
2267 0 : return false;
2268 : }
2269 : }
2270 0 : } else if (args[0].isNullOrUndefined()) {
2271 0 : arg0 = nullptr;
2272 : } else {
2273 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of EXT_disjoint_timer_query.isQueryEXT");
2274 0 : return false;
2275 : }
2276 0 : bool result(self->IsQueryEXT(Constify(arg0)));
2277 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2278 0 : args.rval().setBoolean(result);
2279 0 : return true;
2280 : }
2281 :
2282 : static const JSJitInfo isQueryEXT_methodinfo = {
2283 : { (JSJitGetterOp)isQueryEXT },
2284 : { prototypes::id::EXT_disjoint_timer_query },
2285 : { PrototypeTraits<prototypes::id::EXT_disjoint_timer_query>::Depth },
2286 : JSJitInfo::Method,
2287 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2288 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
2289 : false, /* isInfallible. False in setters. */
2290 : false, /* isMovable. Not relevant for setters. */
2291 : false, /* isEliminatable. Not relevant for setters. */
2292 : false, /* isAlwaysInSlot. Only relevant for getters. */
2293 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2294 : false, /* isTypedMethod. Only relevant for methods. */
2295 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2296 : };
2297 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2298 : static_assert(0 < 1, "There is no slot for us");
2299 :
2300 : static bool
2301 0 : beginQueryEXT(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionDisjointTimerQuery* self, const JSJitMethodCallArgs& args)
2302 : {
2303 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
2304 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "EXT_disjoint_timer_query.beginQueryEXT");
2305 : }
2306 : uint32_t arg0;
2307 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
2308 0 : return false;
2309 : }
2310 0 : NonNull<mozilla::WebGLQuery> arg1;
2311 0 : if (args[1].isObject()) {
2312 : {
2313 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLQuery, mozilla::WebGLQuery>(args[1], arg1);
2314 0 : if (NS_FAILED(rv)) {
2315 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of EXT_disjoint_timer_query.beginQueryEXT", "WebGLQuery");
2316 0 : return false;
2317 : }
2318 : }
2319 : } else {
2320 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of EXT_disjoint_timer_query.beginQueryEXT");
2321 0 : return false;
2322 : }
2323 0 : self->BeginQueryEXT(arg0, NonNullHelper(arg1));
2324 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2325 0 : args.rval().setUndefined();
2326 0 : return true;
2327 : }
2328 :
2329 : static const JSJitInfo beginQueryEXT_methodinfo = {
2330 : { (JSJitGetterOp)beginQueryEXT },
2331 : { prototypes::id::EXT_disjoint_timer_query },
2332 : { PrototypeTraits<prototypes::id::EXT_disjoint_timer_query>::Depth },
2333 : JSJitInfo::Method,
2334 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2335 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
2336 : false, /* isInfallible. False in setters. */
2337 : false, /* isMovable. Not relevant for setters. */
2338 : false, /* isEliminatable. Not relevant for setters. */
2339 : false, /* isAlwaysInSlot. Only relevant for getters. */
2340 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2341 : false, /* isTypedMethod. Only relevant for methods. */
2342 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2343 : };
2344 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2345 : static_assert(0 < 1, "There is no slot for us");
2346 :
2347 : static bool
2348 0 : endQueryEXT(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionDisjointTimerQuery* self, const JSJitMethodCallArgs& args)
2349 : {
2350 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
2351 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "EXT_disjoint_timer_query.endQueryEXT");
2352 : }
2353 : uint32_t arg0;
2354 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
2355 0 : return false;
2356 : }
2357 0 : self->EndQueryEXT(arg0);
2358 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2359 0 : args.rval().setUndefined();
2360 0 : return true;
2361 : }
2362 :
2363 : static const JSJitInfo endQueryEXT_methodinfo = {
2364 : { (JSJitGetterOp)endQueryEXT },
2365 : { prototypes::id::EXT_disjoint_timer_query },
2366 : { PrototypeTraits<prototypes::id::EXT_disjoint_timer_query>::Depth },
2367 : JSJitInfo::Method,
2368 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2369 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
2370 : false, /* isInfallible. False in setters. */
2371 : false, /* isMovable. Not relevant for setters. */
2372 : false, /* isEliminatable. Not relevant for setters. */
2373 : false, /* isAlwaysInSlot. Only relevant for getters. */
2374 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2375 : false, /* isTypedMethod. Only relevant for methods. */
2376 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2377 : };
2378 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2379 : static_assert(0 < 1, "There is no slot for us");
2380 :
2381 : static bool
2382 0 : queryCounterEXT(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionDisjointTimerQuery* self, const JSJitMethodCallArgs& args)
2383 : {
2384 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
2385 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "EXT_disjoint_timer_query.queryCounterEXT");
2386 : }
2387 0 : NonNull<mozilla::WebGLQuery> arg0;
2388 0 : if (args[0].isObject()) {
2389 : {
2390 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLQuery, mozilla::WebGLQuery>(args[0], arg0);
2391 0 : if (NS_FAILED(rv)) {
2392 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of EXT_disjoint_timer_query.queryCounterEXT", "WebGLQuery");
2393 0 : return false;
2394 : }
2395 : }
2396 : } else {
2397 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of EXT_disjoint_timer_query.queryCounterEXT");
2398 0 : return false;
2399 : }
2400 : uint32_t arg1;
2401 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
2402 0 : return false;
2403 : }
2404 0 : self->QueryCounterEXT(NonNullHelper(arg0), arg1);
2405 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2406 0 : args.rval().setUndefined();
2407 0 : return true;
2408 : }
2409 :
2410 : static const JSJitInfo queryCounterEXT_methodinfo = {
2411 : { (JSJitGetterOp)queryCounterEXT },
2412 : { prototypes::id::EXT_disjoint_timer_query },
2413 : { PrototypeTraits<prototypes::id::EXT_disjoint_timer_query>::Depth },
2414 : JSJitInfo::Method,
2415 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2416 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
2417 : false, /* isInfallible. False in setters. */
2418 : false, /* isMovable. Not relevant for setters. */
2419 : false, /* isEliminatable. Not relevant for setters. */
2420 : false, /* isAlwaysInSlot. Only relevant for getters. */
2421 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2422 : false, /* isTypedMethod. Only relevant for methods. */
2423 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2424 : };
2425 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2426 : static_assert(0 < 1, "There is no slot for us");
2427 :
2428 : static bool
2429 0 : getQueryEXT(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionDisjointTimerQuery* self, const JSJitMethodCallArgs& args)
2430 : {
2431 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
2432 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "EXT_disjoint_timer_query.getQueryEXT");
2433 : }
2434 : uint32_t arg0;
2435 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
2436 0 : return false;
2437 : }
2438 : uint32_t arg1;
2439 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
2440 0 : return false;
2441 : }
2442 0 : JS::Rooted<JS::Value> result(cx);
2443 0 : self->GetQueryEXT(cx, arg0, arg1, &result);
2444 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2445 0 : JS::ExposeValueToActiveJS(result);
2446 0 : args.rval().set(result);
2447 0 : if (!MaybeWrapValue(cx, args.rval())) {
2448 0 : return false;
2449 : }
2450 0 : return true;
2451 : }
2452 :
2453 : static const JSJitInfo getQueryEXT_methodinfo = {
2454 : { (JSJitGetterOp)getQueryEXT },
2455 : { prototypes::id::EXT_disjoint_timer_query },
2456 : { PrototypeTraits<prototypes::id::EXT_disjoint_timer_query>::Depth },
2457 : JSJitInfo::Method,
2458 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2459 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
2460 : false, /* isInfallible. False in setters. */
2461 : false, /* isMovable. Not relevant for setters. */
2462 : false, /* isEliminatable. Not relevant for setters. */
2463 : false, /* isAlwaysInSlot. Only relevant for getters. */
2464 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2465 : false, /* isTypedMethod. Only relevant for methods. */
2466 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2467 : };
2468 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2469 : static_assert(0 < 1, "There is no slot for us");
2470 :
2471 : static bool
2472 0 : getQueryObjectEXT(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionDisjointTimerQuery* self, const JSJitMethodCallArgs& args)
2473 : {
2474 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
2475 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "EXT_disjoint_timer_query.getQueryObjectEXT");
2476 : }
2477 0 : NonNull<mozilla::WebGLQuery> arg0;
2478 0 : if (args[0].isObject()) {
2479 : {
2480 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLQuery, mozilla::WebGLQuery>(args[0], arg0);
2481 0 : if (NS_FAILED(rv)) {
2482 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of EXT_disjoint_timer_query.getQueryObjectEXT", "WebGLQuery");
2483 0 : return false;
2484 : }
2485 : }
2486 : } else {
2487 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of EXT_disjoint_timer_query.getQueryObjectEXT");
2488 0 : return false;
2489 : }
2490 : uint32_t arg1;
2491 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
2492 0 : return false;
2493 : }
2494 0 : JS::Rooted<JS::Value> result(cx);
2495 0 : self->GetQueryObjectEXT(cx, NonNullHelper(arg0), arg1, &result);
2496 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2497 0 : JS::ExposeValueToActiveJS(result);
2498 0 : args.rval().set(result);
2499 0 : if (!MaybeWrapValue(cx, args.rval())) {
2500 0 : return false;
2501 : }
2502 0 : return true;
2503 : }
2504 :
2505 : static const JSJitInfo getQueryObjectEXT_methodinfo = {
2506 : { (JSJitGetterOp)getQueryObjectEXT },
2507 : { prototypes::id::EXT_disjoint_timer_query },
2508 : { PrototypeTraits<prototypes::id::EXT_disjoint_timer_query>::Depth },
2509 : JSJitInfo::Method,
2510 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
2511 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
2512 : false, /* isInfallible. False in setters. */
2513 : false, /* isMovable. Not relevant for setters. */
2514 : false, /* isEliminatable. Not relevant for setters. */
2515 : false, /* isAlwaysInSlot. Only relevant for getters. */
2516 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
2517 : false, /* isTypedMethod. Only relevant for methods. */
2518 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
2519 : };
2520 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
2521 : static_assert(0 < 1, "There is no slot for us");
2522 :
2523 : static bool
2524 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
2525 : {
2526 0 : mozilla::WebGLExtensionDisjointTimerQuery* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionDisjointTimerQuery>(obj);
2527 : // We don't want to preserve if we don't have a wrapper, and we
2528 : // obviously can't preserve if we're not initialized.
2529 0 : if (self && self->GetWrapperPreserveColor()) {
2530 0 : PreserveWrapper(self);
2531 : }
2532 0 : return true;
2533 : }
2534 :
2535 : static void
2536 0 : _finalize(js::FreeOp* fop, JSObject* obj)
2537 : {
2538 0 : mozilla::WebGLExtensionDisjointTimerQuery* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionDisjointTimerQuery>(obj);
2539 0 : if (self) {
2540 0 : ClearWrapper(self, self, obj);
2541 0 : AddForDeferredFinalization<mozilla::WebGLExtensionDisjointTimerQuery>(self);
2542 : }
2543 0 : }
2544 :
2545 : static void
2546 0 : _objectMoved(JSObject* obj, const JSObject* old)
2547 : {
2548 0 : mozilla::WebGLExtensionDisjointTimerQuery* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionDisjointTimerQuery>(obj);
2549 0 : if (self) {
2550 0 : UpdateWrapper(self, self, obj, old);
2551 : }
2552 0 : }
2553 :
2554 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
2555 : #if defined(__clang__)
2556 : #pragma clang diagnostic push
2557 : #pragma clang diagnostic ignored "-Wmissing-braces"
2558 : #endif
2559 : static const JSFunctionSpec sMethods_specs[] = {
2560 : JS_FNSPEC("createQueryEXT", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createQueryEXT_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
2561 : JS_FNSPEC("deleteQueryEXT", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&deleteQueryEXT_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
2562 : JS_FNSPEC("isQueryEXT", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&isQueryEXT_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
2563 : JS_FNSPEC("beginQueryEXT", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&beginQueryEXT_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
2564 : JS_FNSPEC("endQueryEXT", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&endQueryEXT_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
2565 : JS_FNSPEC("queryCounterEXT", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&queryCounterEXT_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
2566 : JS_FNSPEC("getQueryEXT", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getQueryEXT_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
2567 : JS_FNSPEC("getQueryObjectEXT", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getQueryObjectEXT_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
2568 : JS_FS_END
2569 : };
2570 : #if defined(__clang__)
2571 : #pragma clang diagnostic pop
2572 : #endif
2573 :
2574 :
2575 : // Can't be const because the pref-enabled boolean needs to be writable
2576 : static Prefable<const JSFunctionSpec> sMethods[] = {
2577 : { nullptr, &sMethods_specs[0] },
2578 : { nullptr, nullptr }
2579 : };
2580 :
2581 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
2582 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
2583 : static_assert(8 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
2584 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
2585 :
2586 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
2587 : #if defined(__clang__)
2588 : #pragma clang diagnostic push
2589 : #pragma clang diagnostic ignored "-Wmissing-braces"
2590 : #endif
2591 : static const ConstantSpec sConstants_specs[] = {
2592 : { "QUERY_COUNTER_BITS_EXT", JS::NumberValue(34916U) },
2593 : { "CURRENT_QUERY_EXT", JS::NumberValue(34917U) },
2594 : { "QUERY_RESULT_EXT", JS::NumberValue(34918U) },
2595 : { "QUERY_RESULT_AVAILABLE_EXT", JS::NumberValue(34919U) },
2596 : { "TIME_ELAPSED_EXT", JS::NumberValue(35007U) },
2597 : { "TIMESTAMP_EXT", JS::NumberValue(36392U) },
2598 : { "GPU_DISJOINT_EXT", JS::NumberValue(36795U) },
2599 : { 0, JS::UndefinedValue() }
2600 : };
2601 : #if defined(__clang__)
2602 : #pragma clang diagnostic pop
2603 : #endif
2604 :
2605 :
2606 : // Can't be const because the pref-enabled boolean needs to be writable
2607 : static Prefable<const ConstantSpec> sConstants[] = {
2608 : { nullptr, &sConstants_specs[0] },
2609 : { nullptr, nullptr }
2610 : };
2611 :
2612 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
2613 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
2614 : static_assert(7 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
2615 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
2616 :
2617 :
2618 : static uint16_t sNativeProperties_sortedPropertyIndices[15];
2619 : static PropertyInfo sNativeProperties_propertyInfos[15];
2620 :
2621 : static const NativePropertiesN<2> sNativeProperties = {
2622 : false, 0,
2623 : false, 0,
2624 : true, 0 /* sMethods */,
2625 : false, 0,
2626 : false, 0,
2627 : false, 0,
2628 : true, 1 /* sConstants */,
2629 : -1,
2630 : 15,
2631 : sNativeProperties_sortedPropertyIndices,
2632 : {
2633 : { sMethods, &sNativeProperties_propertyInfos[0] },
2634 : { sConstants, &sNativeProperties_propertyInfos[8] }
2635 : }
2636 : };
2637 : static_assert(15 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
2638 : "We have a property info count that is oversized");
2639 :
2640 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
2641 : {
2642 : "EXT_disjoint_timer_queryPrototype",
2643 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
2644 : JS_NULL_CLASS_OPS,
2645 : JS_NULL_CLASS_SPEC,
2646 : JS_NULL_CLASS_EXT,
2647 : JS_NULL_OBJECT_OPS
2648 : },
2649 : eInterfacePrototype,
2650 : false,
2651 : prototypes::id::EXT_disjoint_timer_query,
2652 : PrototypeTraits<prototypes::id::EXT_disjoint_timer_query>::Depth,
2653 : sNativePropertyHooks,
2654 : "[object EXT_disjoint_timer_queryPrototype]",
2655 : JS::GetRealmObjectPrototype
2656 : };
2657 :
2658 : static const js::ClassOps sClassOps = {
2659 : _addProperty, /* addProperty */
2660 : nullptr, /* delProperty */
2661 : nullptr, /* getProperty */
2662 : nullptr, /* setProperty */
2663 : nullptr, /* enumerate */
2664 : nullptr, /* newEnumerate */
2665 : nullptr, /* resolve */
2666 : nullptr, /* mayResolve */
2667 : _finalize, /* finalize */
2668 : nullptr, /* call */
2669 : nullptr, /* hasInstance */
2670 : nullptr, /* construct */
2671 : nullptr, /* trace */
2672 : };
2673 :
2674 : static const js::ClassExtension sClassExtension = {
2675 : nullptr, /* weakmapKeyDelegateOp */
2676 : _objectMoved /* objectMovedOp */
2677 : };
2678 :
2679 : static const DOMJSClass sClass = {
2680 : { "EXT_disjoint_timer_query",
2681 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
2682 : &sClassOps,
2683 : JS_NULL_CLASS_SPEC,
2684 : &sClassExtension,
2685 : JS_NULL_OBJECT_OPS
2686 : },
2687 : { prototypes::id::EXT_disjoint_timer_query, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
2688 : IsBaseOf<nsISupports, mozilla::WebGLExtensionDisjointTimerQuery >::value,
2689 : sNativePropertyHooks,
2690 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionDisjointTimerQuery>::Get,
2691 : GetProtoObjectHandle,
2692 : GetCCParticipant<mozilla::WebGLExtensionDisjointTimerQuery>::Get()
2693 : };
2694 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
2695 : "Must have the right minimal number of reserved slots.");
2696 : static_assert(1 >= 1,
2697 : "Must have enough reserved slots.");
2698 :
2699 : const JSClass*
2700 0 : GetJSClass()
2701 : {
2702 0 : return sClass.ToJSClass();
2703 : }
2704 :
2705 : bool
2706 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionDisjointTimerQuery* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
2707 : {
2708 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionDisjointTimerQuery*>(aObject) ==
2709 : reinterpret_cast<mozilla::WebGLExtensionDisjointTimerQuery*>(aObject),
2710 : "Multiple inheritance for mozilla::WebGLExtensionDisjointTimerQuery is broken.");
2711 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
2712 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
2713 0 : MOZ_ASSERT(!aCache->GetWrapper(),
2714 : "You should probably not be using Wrap() directly; use "
2715 : "GetOrCreateDOMReflector instead");
2716 :
2717 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
2718 : "nsISupports must be on our primary inheritance chain");
2719 :
2720 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
2721 0 : if (!global) {
2722 0 : return false;
2723 : }
2724 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
2725 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
2726 :
2727 : // That might have ended up wrapping us already, due to the wonders
2728 : // of XBL. Check for that, and bail out as needed.
2729 0 : aReflector.set(aCache->GetWrapper());
2730 0 : if (aReflector) {
2731 : #ifdef DEBUG
2732 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
2733 : #endif // DEBUG
2734 0 : return true;
2735 : }
2736 :
2737 0 : JSAutoCompartment ac(aCx, global);
2738 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
2739 0 : if (!canonicalProto) {
2740 0 : return false;
2741 : }
2742 0 : JS::Rooted<JSObject*> proto(aCx);
2743 0 : if (aGivenProto) {
2744 0 : proto = aGivenProto;
2745 : // Unfortunately, while aGivenProto was in the compartment of aCx
2746 : // coming in, we changed compartments to that of "parent" so may need
2747 : // to wrap the proto here.
2748 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
2749 0 : if (!JS_WrapObject(aCx, &proto)) {
2750 0 : return false;
2751 : }
2752 : }
2753 : } else {
2754 0 : proto = canonicalProto;
2755 : }
2756 :
2757 0 : BindingJSObjectCreator<mozilla::WebGLExtensionDisjointTimerQuery> creator(aCx);
2758 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
2759 0 : if (!aReflector) {
2760 0 : return false;
2761 : }
2762 :
2763 0 : aCache->SetWrapper(aReflector);
2764 0 : creator.InitializationSucceeded();
2765 :
2766 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
2767 : aCache->GetWrapperPreserveColor() == aReflector);
2768 : // If proto != canonicalProto, we have to preserve our wrapper;
2769 : // otherwise we won't be able to properly recreate it later, since
2770 : // we won't know what proto to use. Note that we don't check
2771 : // aGivenProto here, since it's entirely possible (and even
2772 : // somewhat common) to have a non-null aGivenProto which is the
2773 : // same as canonicalProto.
2774 0 : if (proto != canonicalProto) {
2775 0 : PreserveWrapper(aObject);
2776 : }
2777 :
2778 0 : return true;
2779 : }
2780 :
2781 : const NativePropertyHooks sNativePropertyHooks[] = { {
2782 : nullptr,
2783 : nullptr,
2784 : nullptr,
2785 : { sNativeProperties.Upcast(), nullptr },
2786 : prototypes::id::EXT_disjoint_timer_query,
2787 : constructors::id::_ID_Count,
2788 : nullptr,
2789 : &DefaultXrayExpandoObjectClass
2790 : } };
2791 :
2792 : void
2793 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
2794 : {
2795 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
2796 0 : if (!parentProto) {
2797 0 : return;
2798 : }
2799 :
2800 : static bool sIdsInited = false;
2801 0 : if (!sIdsInited && NS_IsMainThread()) {
2802 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
2803 0 : return;
2804 : }
2805 0 : sIdsInited = true;
2806 : }
2807 :
2808 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::EXT_disjoint_timer_query);
2809 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
2810 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
2811 : &sPrototypeClass.mBase, protoCache,
2812 : nullptr, nullptr, 0, nullptr,
2813 : interfaceCache,
2814 : sNativeProperties.Upcast(),
2815 : nullptr,
2816 : nullptr, aDefineOnGlobal,
2817 : nullptr,
2818 0 : false);
2819 : }
2820 :
2821 : JS::Handle<JSObject*>
2822 0 : GetProtoObjectHandle(JSContext* aCx)
2823 : {
2824 : /* Get the interface prototype object for this class. This will create the
2825 : object as needed. */
2826 0 : bool aDefineOnGlobal = true;
2827 :
2828 : /* Make sure our global is sane. Hopefully we can remove this sometime */
2829 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
2830 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
2831 0 : return nullptr;
2832 : }
2833 :
2834 : /* Check to see whether the interface objects are already installed */
2835 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
2836 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::EXT_disjoint_timer_query)) {
2837 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
2838 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
2839 : }
2840 :
2841 : /*
2842 : * The object might _still_ be null, but that's OK.
2843 : *
2844 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
2845 : * traced by TraceProtoAndIfaceCache() and its contents are never
2846 : * changed after they have been set.
2847 : *
2848 : * Calling address() avoids the read read barrier that does gray
2849 : * unmarking, but it's not possible for the object to be gray here.
2850 : */
2851 :
2852 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::EXT_disjoint_timer_query);
2853 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
2854 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
2855 : }
2856 :
2857 : } // namespace EXT_disjoint_timer_queryBinding
2858 :
2859 :
2860 :
2861 : namespace EXT_frag_depthBinding {
2862 :
2863 : static bool
2864 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
2865 : {
2866 0 : mozilla::WebGLExtensionFragDepth* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionFragDepth>(obj);
2867 : // We don't want to preserve if we don't have a wrapper, and we
2868 : // obviously can't preserve if we're not initialized.
2869 0 : if (self && self->GetWrapperPreserveColor()) {
2870 0 : PreserveWrapper(self);
2871 : }
2872 0 : return true;
2873 : }
2874 :
2875 : static void
2876 0 : _finalize(js::FreeOp* fop, JSObject* obj)
2877 : {
2878 0 : mozilla::WebGLExtensionFragDepth* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionFragDepth>(obj);
2879 0 : if (self) {
2880 0 : ClearWrapper(self, self, obj);
2881 0 : AddForDeferredFinalization<mozilla::WebGLExtensionFragDepth>(self);
2882 : }
2883 0 : }
2884 :
2885 : static void
2886 0 : _objectMoved(JSObject* obj, const JSObject* old)
2887 : {
2888 0 : mozilla::WebGLExtensionFragDepth* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionFragDepth>(obj);
2889 0 : if (self) {
2890 0 : UpdateWrapper(self, self, obj, old);
2891 : }
2892 0 : }
2893 :
2894 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
2895 : {
2896 : "EXT_frag_depthPrototype",
2897 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
2898 : JS_NULL_CLASS_OPS,
2899 : JS_NULL_CLASS_SPEC,
2900 : JS_NULL_CLASS_EXT,
2901 : JS_NULL_OBJECT_OPS
2902 : },
2903 : eInterfacePrototype,
2904 : false,
2905 : prototypes::id::EXT_frag_depth,
2906 : PrototypeTraits<prototypes::id::EXT_frag_depth>::Depth,
2907 : sNativePropertyHooks,
2908 : "[object EXT_frag_depthPrototype]",
2909 : JS::GetRealmObjectPrototype
2910 : };
2911 :
2912 : static const js::ClassOps sClassOps = {
2913 : _addProperty, /* addProperty */
2914 : nullptr, /* delProperty */
2915 : nullptr, /* getProperty */
2916 : nullptr, /* setProperty */
2917 : nullptr, /* enumerate */
2918 : nullptr, /* newEnumerate */
2919 : nullptr, /* resolve */
2920 : nullptr, /* mayResolve */
2921 : _finalize, /* finalize */
2922 : nullptr, /* call */
2923 : nullptr, /* hasInstance */
2924 : nullptr, /* construct */
2925 : nullptr, /* trace */
2926 : };
2927 :
2928 : static const js::ClassExtension sClassExtension = {
2929 : nullptr, /* weakmapKeyDelegateOp */
2930 : _objectMoved /* objectMovedOp */
2931 : };
2932 :
2933 : static const DOMJSClass sClass = {
2934 : { "EXT_frag_depth",
2935 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
2936 : &sClassOps,
2937 : JS_NULL_CLASS_SPEC,
2938 : &sClassExtension,
2939 : JS_NULL_OBJECT_OPS
2940 : },
2941 : { prototypes::id::EXT_frag_depth, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
2942 : IsBaseOf<nsISupports, mozilla::WebGLExtensionFragDepth >::value,
2943 : sNativePropertyHooks,
2944 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionFragDepth>::Get,
2945 : GetProtoObjectHandle,
2946 : GetCCParticipant<mozilla::WebGLExtensionFragDepth>::Get()
2947 : };
2948 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
2949 : "Must have the right minimal number of reserved slots.");
2950 : static_assert(1 >= 1,
2951 : "Must have enough reserved slots.");
2952 :
2953 : const JSClass*
2954 0 : GetJSClass()
2955 : {
2956 0 : return sClass.ToJSClass();
2957 : }
2958 :
2959 : bool
2960 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionFragDepth* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
2961 : {
2962 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionFragDepth*>(aObject) ==
2963 : reinterpret_cast<mozilla::WebGLExtensionFragDepth*>(aObject),
2964 : "Multiple inheritance for mozilla::WebGLExtensionFragDepth is broken.");
2965 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
2966 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
2967 0 : MOZ_ASSERT(!aCache->GetWrapper(),
2968 : "You should probably not be using Wrap() directly; use "
2969 : "GetOrCreateDOMReflector instead");
2970 :
2971 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
2972 : "nsISupports must be on our primary inheritance chain");
2973 :
2974 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
2975 0 : if (!global) {
2976 0 : return false;
2977 : }
2978 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
2979 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
2980 :
2981 : // That might have ended up wrapping us already, due to the wonders
2982 : // of XBL. Check for that, and bail out as needed.
2983 0 : aReflector.set(aCache->GetWrapper());
2984 0 : if (aReflector) {
2985 : #ifdef DEBUG
2986 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
2987 : #endif // DEBUG
2988 0 : return true;
2989 : }
2990 :
2991 0 : JSAutoCompartment ac(aCx, global);
2992 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
2993 0 : if (!canonicalProto) {
2994 0 : return false;
2995 : }
2996 0 : JS::Rooted<JSObject*> proto(aCx);
2997 0 : if (aGivenProto) {
2998 0 : proto = aGivenProto;
2999 : // Unfortunately, while aGivenProto was in the compartment of aCx
3000 : // coming in, we changed compartments to that of "parent" so may need
3001 : // to wrap the proto here.
3002 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
3003 0 : if (!JS_WrapObject(aCx, &proto)) {
3004 0 : return false;
3005 : }
3006 : }
3007 : } else {
3008 0 : proto = canonicalProto;
3009 : }
3010 :
3011 0 : BindingJSObjectCreator<mozilla::WebGLExtensionFragDepth> creator(aCx);
3012 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
3013 0 : if (!aReflector) {
3014 0 : return false;
3015 : }
3016 :
3017 0 : aCache->SetWrapper(aReflector);
3018 0 : creator.InitializationSucceeded();
3019 :
3020 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
3021 : aCache->GetWrapperPreserveColor() == aReflector);
3022 : // If proto != canonicalProto, we have to preserve our wrapper;
3023 : // otherwise we won't be able to properly recreate it later, since
3024 : // we won't know what proto to use. Note that we don't check
3025 : // aGivenProto here, since it's entirely possible (and even
3026 : // somewhat common) to have a non-null aGivenProto which is the
3027 : // same as canonicalProto.
3028 0 : if (proto != canonicalProto) {
3029 0 : PreserveWrapper(aObject);
3030 : }
3031 :
3032 0 : return true;
3033 : }
3034 :
3035 : const NativePropertyHooks sNativePropertyHooks[] = { {
3036 : nullptr,
3037 : nullptr,
3038 : nullptr,
3039 : { nullptr, nullptr },
3040 : prototypes::id::EXT_frag_depth,
3041 : constructors::id::_ID_Count,
3042 : nullptr,
3043 : &DefaultXrayExpandoObjectClass
3044 : } };
3045 :
3046 : void
3047 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
3048 : {
3049 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
3050 0 : if (!parentProto) {
3051 0 : return;
3052 : }
3053 :
3054 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::EXT_frag_depth);
3055 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
3056 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
3057 : &sPrototypeClass.mBase, protoCache,
3058 : nullptr, nullptr, 0, nullptr,
3059 : interfaceCache,
3060 : nullptr,
3061 : nullptr,
3062 : nullptr, aDefineOnGlobal,
3063 : nullptr,
3064 0 : false);
3065 : }
3066 :
3067 : JS::Handle<JSObject*>
3068 0 : GetProtoObjectHandle(JSContext* aCx)
3069 : {
3070 : /* Get the interface prototype object for this class. This will create the
3071 : object as needed. */
3072 0 : bool aDefineOnGlobal = true;
3073 :
3074 : /* Make sure our global is sane. Hopefully we can remove this sometime */
3075 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
3076 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
3077 0 : return nullptr;
3078 : }
3079 :
3080 : /* Check to see whether the interface objects are already installed */
3081 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
3082 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::EXT_frag_depth)) {
3083 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
3084 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
3085 : }
3086 :
3087 : /*
3088 : * The object might _still_ be null, but that's OK.
3089 : *
3090 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
3091 : * traced by TraceProtoAndIfaceCache() and its contents are never
3092 : * changed after they have been set.
3093 : *
3094 : * Calling address() avoids the read read barrier that does gray
3095 : * unmarking, but it's not possible for the object to be gray here.
3096 : */
3097 :
3098 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::EXT_frag_depth);
3099 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
3100 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
3101 : }
3102 :
3103 : } // namespace EXT_frag_depthBinding
3104 :
3105 :
3106 :
3107 : namespace EXT_sRGBBinding {
3108 :
3109 : static bool
3110 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
3111 : {
3112 0 : mozilla::WebGLExtensionSRGB* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionSRGB>(obj);
3113 : // We don't want to preserve if we don't have a wrapper, and we
3114 : // obviously can't preserve if we're not initialized.
3115 0 : if (self && self->GetWrapperPreserveColor()) {
3116 0 : PreserveWrapper(self);
3117 : }
3118 0 : return true;
3119 : }
3120 :
3121 : static void
3122 0 : _finalize(js::FreeOp* fop, JSObject* obj)
3123 : {
3124 0 : mozilla::WebGLExtensionSRGB* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionSRGB>(obj);
3125 0 : if (self) {
3126 0 : ClearWrapper(self, self, obj);
3127 0 : AddForDeferredFinalization<mozilla::WebGLExtensionSRGB>(self);
3128 : }
3129 0 : }
3130 :
3131 : static void
3132 0 : _objectMoved(JSObject* obj, const JSObject* old)
3133 : {
3134 0 : mozilla::WebGLExtensionSRGB* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionSRGB>(obj);
3135 0 : if (self) {
3136 0 : UpdateWrapper(self, self, obj, old);
3137 : }
3138 0 : }
3139 :
3140 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
3141 : #if defined(__clang__)
3142 : #pragma clang diagnostic push
3143 : #pragma clang diagnostic ignored "-Wmissing-braces"
3144 : #endif
3145 : static const ConstantSpec sConstants_specs[] = {
3146 : { "SRGB_EXT", JS::NumberValue(35904U) },
3147 : { "SRGB_ALPHA_EXT", JS::NumberValue(35906U) },
3148 : { "SRGB8_ALPHA8_EXT", JS::NumberValue(35907U) },
3149 : { "FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT", JS::NumberValue(33296U) },
3150 : { 0, JS::UndefinedValue() }
3151 : };
3152 : #if defined(__clang__)
3153 : #pragma clang diagnostic pop
3154 : #endif
3155 :
3156 :
3157 : // Can't be const because the pref-enabled boolean needs to be writable
3158 : static Prefable<const ConstantSpec> sConstants[] = {
3159 : { nullptr, &sConstants_specs[0] },
3160 : { nullptr, nullptr }
3161 : };
3162 :
3163 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
3164 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
3165 : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
3166 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
3167 :
3168 :
3169 : static uint16_t sNativeProperties_sortedPropertyIndices[4];
3170 : static PropertyInfo sNativeProperties_propertyInfos[4];
3171 :
3172 : static const NativePropertiesN<1> sNativeProperties = {
3173 : false, 0,
3174 : false, 0,
3175 : false, 0,
3176 : false, 0,
3177 : false, 0,
3178 : false, 0,
3179 : true, 0 /* sConstants */,
3180 : -1,
3181 : 4,
3182 : sNativeProperties_sortedPropertyIndices,
3183 : {
3184 : { sConstants, &sNativeProperties_propertyInfos[0] }
3185 : }
3186 : };
3187 : static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
3188 : "We have a property info count that is oversized");
3189 :
3190 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
3191 : {
3192 : "EXT_sRGBPrototype",
3193 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
3194 : JS_NULL_CLASS_OPS,
3195 : JS_NULL_CLASS_SPEC,
3196 : JS_NULL_CLASS_EXT,
3197 : JS_NULL_OBJECT_OPS
3198 : },
3199 : eInterfacePrototype,
3200 : false,
3201 : prototypes::id::EXT_sRGB,
3202 : PrototypeTraits<prototypes::id::EXT_sRGB>::Depth,
3203 : sNativePropertyHooks,
3204 : "[object EXT_sRGBPrototype]",
3205 : JS::GetRealmObjectPrototype
3206 : };
3207 :
3208 : static const js::ClassOps sClassOps = {
3209 : _addProperty, /* addProperty */
3210 : nullptr, /* delProperty */
3211 : nullptr, /* getProperty */
3212 : nullptr, /* setProperty */
3213 : nullptr, /* enumerate */
3214 : nullptr, /* newEnumerate */
3215 : nullptr, /* resolve */
3216 : nullptr, /* mayResolve */
3217 : _finalize, /* finalize */
3218 : nullptr, /* call */
3219 : nullptr, /* hasInstance */
3220 : nullptr, /* construct */
3221 : nullptr, /* trace */
3222 : };
3223 :
3224 : static const js::ClassExtension sClassExtension = {
3225 : nullptr, /* weakmapKeyDelegateOp */
3226 : _objectMoved /* objectMovedOp */
3227 : };
3228 :
3229 : static const DOMJSClass sClass = {
3230 : { "EXT_sRGB",
3231 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
3232 : &sClassOps,
3233 : JS_NULL_CLASS_SPEC,
3234 : &sClassExtension,
3235 : JS_NULL_OBJECT_OPS
3236 : },
3237 : { prototypes::id::EXT_sRGB, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
3238 : IsBaseOf<nsISupports, mozilla::WebGLExtensionSRGB >::value,
3239 : sNativePropertyHooks,
3240 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionSRGB>::Get,
3241 : GetProtoObjectHandle,
3242 : GetCCParticipant<mozilla::WebGLExtensionSRGB>::Get()
3243 : };
3244 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
3245 : "Must have the right minimal number of reserved slots.");
3246 : static_assert(1 >= 1,
3247 : "Must have enough reserved slots.");
3248 :
3249 : const JSClass*
3250 0 : GetJSClass()
3251 : {
3252 0 : return sClass.ToJSClass();
3253 : }
3254 :
3255 : bool
3256 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionSRGB* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
3257 : {
3258 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionSRGB*>(aObject) ==
3259 : reinterpret_cast<mozilla::WebGLExtensionSRGB*>(aObject),
3260 : "Multiple inheritance for mozilla::WebGLExtensionSRGB is broken.");
3261 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
3262 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
3263 0 : MOZ_ASSERT(!aCache->GetWrapper(),
3264 : "You should probably not be using Wrap() directly; use "
3265 : "GetOrCreateDOMReflector instead");
3266 :
3267 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
3268 : "nsISupports must be on our primary inheritance chain");
3269 :
3270 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
3271 0 : if (!global) {
3272 0 : return false;
3273 : }
3274 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
3275 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
3276 :
3277 : // That might have ended up wrapping us already, due to the wonders
3278 : // of XBL. Check for that, and bail out as needed.
3279 0 : aReflector.set(aCache->GetWrapper());
3280 0 : if (aReflector) {
3281 : #ifdef DEBUG
3282 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
3283 : #endif // DEBUG
3284 0 : return true;
3285 : }
3286 :
3287 0 : JSAutoCompartment ac(aCx, global);
3288 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
3289 0 : if (!canonicalProto) {
3290 0 : return false;
3291 : }
3292 0 : JS::Rooted<JSObject*> proto(aCx);
3293 0 : if (aGivenProto) {
3294 0 : proto = aGivenProto;
3295 : // Unfortunately, while aGivenProto was in the compartment of aCx
3296 : // coming in, we changed compartments to that of "parent" so may need
3297 : // to wrap the proto here.
3298 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
3299 0 : if (!JS_WrapObject(aCx, &proto)) {
3300 0 : return false;
3301 : }
3302 : }
3303 : } else {
3304 0 : proto = canonicalProto;
3305 : }
3306 :
3307 0 : BindingJSObjectCreator<mozilla::WebGLExtensionSRGB> creator(aCx);
3308 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
3309 0 : if (!aReflector) {
3310 0 : return false;
3311 : }
3312 :
3313 0 : aCache->SetWrapper(aReflector);
3314 0 : creator.InitializationSucceeded();
3315 :
3316 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
3317 : aCache->GetWrapperPreserveColor() == aReflector);
3318 : // If proto != canonicalProto, we have to preserve our wrapper;
3319 : // otherwise we won't be able to properly recreate it later, since
3320 : // we won't know what proto to use. Note that we don't check
3321 : // aGivenProto here, since it's entirely possible (and even
3322 : // somewhat common) to have a non-null aGivenProto which is the
3323 : // same as canonicalProto.
3324 0 : if (proto != canonicalProto) {
3325 0 : PreserveWrapper(aObject);
3326 : }
3327 :
3328 0 : return true;
3329 : }
3330 :
3331 : const NativePropertyHooks sNativePropertyHooks[] = { {
3332 : nullptr,
3333 : nullptr,
3334 : nullptr,
3335 : { sNativeProperties.Upcast(), nullptr },
3336 : prototypes::id::EXT_sRGB,
3337 : constructors::id::_ID_Count,
3338 : nullptr,
3339 : &DefaultXrayExpandoObjectClass
3340 : } };
3341 :
3342 : void
3343 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
3344 : {
3345 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
3346 0 : if (!parentProto) {
3347 0 : return;
3348 : }
3349 :
3350 : static bool sIdsInited = false;
3351 0 : if (!sIdsInited && NS_IsMainThread()) {
3352 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
3353 0 : return;
3354 : }
3355 0 : sIdsInited = true;
3356 : }
3357 :
3358 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::EXT_sRGB);
3359 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
3360 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
3361 : &sPrototypeClass.mBase, protoCache,
3362 : nullptr, nullptr, 0, nullptr,
3363 : interfaceCache,
3364 : sNativeProperties.Upcast(),
3365 : nullptr,
3366 : nullptr, aDefineOnGlobal,
3367 : nullptr,
3368 0 : false);
3369 : }
3370 :
3371 : JS::Handle<JSObject*>
3372 0 : GetProtoObjectHandle(JSContext* aCx)
3373 : {
3374 : /* Get the interface prototype object for this class. This will create the
3375 : object as needed. */
3376 0 : bool aDefineOnGlobal = true;
3377 :
3378 : /* Make sure our global is sane. Hopefully we can remove this sometime */
3379 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
3380 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
3381 0 : return nullptr;
3382 : }
3383 :
3384 : /* Check to see whether the interface objects are already installed */
3385 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
3386 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::EXT_sRGB)) {
3387 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
3388 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
3389 : }
3390 :
3391 : /*
3392 : * The object might _still_ be null, but that's OK.
3393 : *
3394 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
3395 : * traced by TraceProtoAndIfaceCache() and its contents are never
3396 : * changed after they have been set.
3397 : *
3398 : * Calling address() avoids the read read barrier that does gray
3399 : * unmarking, but it's not possible for the object to be gray here.
3400 : */
3401 :
3402 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::EXT_sRGB);
3403 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
3404 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
3405 : }
3406 :
3407 : } // namespace EXT_sRGBBinding
3408 :
3409 :
3410 :
3411 : namespace EXT_shader_texture_lodBinding {
3412 :
3413 : static bool
3414 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
3415 : {
3416 0 : mozilla::WebGLExtensionShaderTextureLod* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionShaderTextureLod>(obj);
3417 : // We don't want to preserve if we don't have a wrapper, and we
3418 : // obviously can't preserve if we're not initialized.
3419 0 : if (self && self->GetWrapperPreserveColor()) {
3420 0 : PreserveWrapper(self);
3421 : }
3422 0 : return true;
3423 : }
3424 :
3425 : static void
3426 0 : _finalize(js::FreeOp* fop, JSObject* obj)
3427 : {
3428 0 : mozilla::WebGLExtensionShaderTextureLod* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionShaderTextureLod>(obj);
3429 0 : if (self) {
3430 0 : ClearWrapper(self, self, obj);
3431 0 : AddForDeferredFinalization<mozilla::WebGLExtensionShaderTextureLod>(self);
3432 : }
3433 0 : }
3434 :
3435 : static void
3436 0 : _objectMoved(JSObject* obj, const JSObject* old)
3437 : {
3438 0 : mozilla::WebGLExtensionShaderTextureLod* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionShaderTextureLod>(obj);
3439 0 : if (self) {
3440 0 : UpdateWrapper(self, self, obj, old);
3441 : }
3442 0 : }
3443 :
3444 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
3445 : {
3446 : "EXT_shader_texture_lodPrototype",
3447 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
3448 : JS_NULL_CLASS_OPS,
3449 : JS_NULL_CLASS_SPEC,
3450 : JS_NULL_CLASS_EXT,
3451 : JS_NULL_OBJECT_OPS
3452 : },
3453 : eInterfacePrototype,
3454 : false,
3455 : prototypes::id::EXT_shader_texture_lod,
3456 : PrototypeTraits<prototypes::id::EXT_shader_texture_lod>::Depth,
3457 : sNativePropertyHooks,
3458 : "[object EXT_shader_texture_lodPrototype]",
3459 : JS::GetRealmObjectPrototype
3460 : };
3461 :
3462 : static const js::ClassOps sClassOps = {
3463 : _addProperty, /* addProperty */
3464 : nullptr, /* delProperty */
3465 : nullptr, /* getProperty */
3466 : nullptr, /* setProperty */
3467 : nullptr, /* enumerate */
3468 : nullptr, /* newEnumerate */
3469 : nullptr, /* resolve */
3470 : nullptr, /* mayResolve */
3471 : _finalize, /* finalize */
3472 : nullptr, /* call */
3473 : nullptr, /* hasInstance */
3474 : nullptr, /* construct */
3475 : nullptr, /* trace */
3476 : };
3477 :
3478 : static const js::ClassExtension sClassExtension = {
3479 : nullptr, /* weakmapKeyDelegateOp */
3480 : _objectMoved /* objectMovedOp */
3481 : };
3482 :
3483 : static const DOMJSClass sClass = {
3484 : { "EXT_shader_texture_lod",
3485 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
3486 : &sClassOps,
3487 : JS_NULL_CLASS_SPEC,
3488 : &sClassExtension,
3489 : JS_NULL_OBJECT_OPS
3490 : },
3491 : { prototypes::id::EXT_shader_texture_lod, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
3492 : IsBaseOf<nsISupports, mozilla::WebGLExtensionShaderTextureLod >::value,
3493 : sNativePropertyHooks,
3494 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionShaderTextureLod>::Get,
3495 : GetProtoObjectHandle,
3496 : GetCCParticipant<mozilla::WebGLExtensionShaderTextureLod>::Get()
3497 : };
3498 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
3499 : "Must have the right minimal number of reserved slots.");
3500 : static_assert(1 >= 1,
3501 : "Must have enough reserved slots.");
3502 :
3503 : const JSClass*
3504 0 : GetJSClass()
3505 : {
3506 0 : return sClass.ToJSClass();
3507 : }
3508 :
3509 : bool
3510 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionShaderTextureLod* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
3511 : {
3512 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionShaderTextureLod*>(aObject) ==
3513 : reinterpret_cast<mozilla::WebGLExtensionShaderTextureLod*>(aObject),
3514 : "Multiple inheritance for mozilla::WebGLExtensionShaderTextureLod is broken.");
3515 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
3516 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
3517 0 : MOZ_ASSERT(!aCache->GetWrapper(),
3518 : "You should probably not be using Wrap() directly; use "
3519 : "GetOrCreateDOMReflector instead");
3520 :
3521 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
3522 : "nsISupports must be on our primary inheritance chain");
3523 :
3524 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
3525 0 : if (!global) {
3526 0 : return false;
3527 : }
3528 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
3529 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
3530 :
3531 : // That might have ended up wrapping us already, due to the wonders
3532 : // of XBL. Check for that, and bail out as needed.
3533 0 : aReflector.set(aCache->GetWrapper());
3534 0 : if (aReflector) {
3535 : #ifdef DEBUG
3536 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
3537 : #endif // DEBUG
3538 0 : return true;
3539 : }
3540 :
3541 0 : JSAutoCompartment ac(aCx, global);
3542 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
3543 0 : if (!canonicalProto) {
3544 0 : return false;
3545 : }
3546 0 : JS::Rooted<JSObject*> proto(aCx);
3547 0 : if (aGivenProto) {
3548 0 : proto = aGivenProto;
3549 : // Unfortunately, while aGivenProto was in the compartment of aCx
3550 : // coming in, we changed compartments to that of "parent" so may need
3551 : // to wrap the proto here.
3552 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
3553 0 : if (!JS_WrapObject(aCx, &proto)) {
3554 0 : return false;
3555 : }
3556 : }
3557 : } else {
3558 0 : proto = canonicalProto;
3559 : }
3560 :
3561 0 : BindingJSObjectCreator<mozilla::WebGLExtensionShaderTextureLod> creator(aCx);
3562 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
3563 0 : if (!aReflector) {
3564 0 : return false;
3565 : }
3566 :
3567 0 : aCache->SetWrapper(aReflector);
3568 0 : creator.InitializationSucceeded();
3569 :
3570 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
3571 : aCache->GetWrapperPreserveColor() == aReflector);
3572 : // If proto != canonicalProto, we have to preserve our wrapper;
3573 : // otherwise we won't be able to properly recreate it later, since
3574 : // we won't know what proto to use. Note that we don't check
3575 : // aGivenProto here, since it's entirely possible (and even
3576 : // somewhat common) to have a non-null aGivenProto which is the
3577 : // same as canonicalProto.
3578 0 : if (proto != canonicalProto) {
3579 0 : PreserveWrapper(aObject);
3580 : }
3581 :
3582 0 : return true;
3583 : }
3584 :
3585 : const NativePropertyHooks sNativePropertyHooks[] = { {
3586 : nullptr,
3587 : nullptr,
3588 : nullptr,
3589 : { nullptr, nullptr },
3590 : prototypes::id::EXT_shader_texture_lod,
3591 : constructors::id::_ID_Count,
3592 : nullptr,
3593 : &DefaultXrayExpandoObjectClass
3594 : } };
3595 :
3596 : void
3597 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
3598 : {
3599 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
3600 0 : if (!parentProto) {
3601 0 : return;
3602 : }
3603 :
3604 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::EXT_shader_texture_lod);
3605 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
3606 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
3607 : &sPrototypeClass.mBase, protoCache,
3608 : nullptr, nullptr, 0, nullptr,
3609 : interfaceCache,
3610 : nullptr,
3611 : nullptr,
3612 : nullptr, aDefineOnGlobal,
3613 : nullptr,
3614 0 : false);
3615 : }
3616 :
3617 : JS::Handle<JSObject*>
3618 0 : GetProtoObjectHandle(JSContext* aCx)
3619 : {
3620 : /* Get the interface prototype object for this class. This will create the
3621 : object as needed. */
3622 0 : bool aDefineOnGlobal = true;
3623 :
3624 : /* Make sure our global is sane. Hopefully we can remove this sometime */
3625 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
3626 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
3627 0 : return nullptr;
3628 : }
3629 :
3630 : /* Check to see whether the interface objects are already installed */
3631 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
3632 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::EXT_shader_texture_lod)) {
3633 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
3634 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
3635 : }
3636 :
3637 : /*
3638 : * The object might _still_ be null, but that's OK.
3639 : *
3640 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
3641 : * traced by TraceProtoAndIfaceCache() and its contents are never
3642 : * changed after they have been set.
3643 : *
3644 : * Calling address() avoids the read read barrier that does gray
3645 : * unmarking, but it's not possible for the object to be gray here.
3646 : */
3647 :
3648 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::EXT_shader_texture_lod);
3649 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
3650 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
3651 : }
3652 :
3653 : } // namespace EXT_shader_texture_lodBinding
3654 :
3655 :
3656 :
3657 : namespace EXT_texture_filter_anisotropicBinding {
3658 :
3659 : static bool
3660 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
3661 : {
3662 0 : mozilla::WebGLExtensionTextureFilterAnisotropic* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionTextureFilterAnisotropic>(obj);
3663 : // We don't want to preserve if we don't have a wrapper, and we
3664 : // obviously can't preserve if we're not initialized.
3665 0 : if (self && self->GetWrapperPreserveColor()) {
3666 0 : PreserveWrapper(self);
3667 : }
3668 0 : return true;
3669 : }
3670 :
3671 : static void
3672 0 : _finalize(js::FreeOp* fop, JSObject* obj)
3673 : {
3674 0 : mozilla::WebGLExtensionTextureFilterAnisotropic* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionTextureFilterAnisotropic>(obj);
3675 0 : if (self) {
3676 0 : ClearWrapper(self, self, obj);
3677 0 : AddForDeferredFinalization<mozilla::WebGLExtensionTextureFilterAnisotropic>(self);
3678 : }
3679 0 : }
3680 :
3681 : static void
3682 0 : _objectMoved(JSObject* obj, const JSObject* old)
3683 : {
3684 0 : mozilla::WebGLExtensionTextureFilterAnisotropic* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionTextureFilterAnisotropic>(obj);
3685 0 : if (self) {
3686 0 : UpdateWrapper(self, self, obj, old);
3687 : }
3688 0 : }
3689 :
3690 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
3691 : #if defined(__clang__)
3692 : #pragma clang diagnostic push
3693 : #pragma clang diagnostic ignored "-Wmissing-braces"
3694 : #endif
3695 : static const ConstantSpec sConstants_specs[] = {
3696 : { "TEXTURE_MAX_ANISOTROPY_EXT", JS::NumberValue(34046U) },
3697 : { "MAX_TEXTURE_MAX_ANISOTROPY_EXT", JS::NumberValue(34047U) },
3698 : { 0, JS::UndefinedValue() }
3699 : };
3700 : #if defined(__clang__)
3701 : #pragma clang diagnostic pop
3702 : #endif
3703 :
3704 :
3705 : // Can't be const because the pref-enabled boolean needs to be writable
3706 : static Prefable<const ConstantSpec> sConstants[] = {
3707 : { nullptr, &sConstants_specs[0] },
3708 : { nullptr, nullptr }
3709 : };
3710 :
3711 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
3712 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
3713 : static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
3714 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
3715 :
3716 :
3717 : static uint16_t sNativeProperties_sortedPropertyIndices[2];
3718 : static PropertyInfo sNativeProperties_propertyInfos[2];
3719 :
3720 : static const NativePropertiesN<1> sNativeProperties = {
3721 : false, 0,
3722 : false, 0,
3723 : false, 0,
3724 : false, 0,
3725 : false, 0,
3726 : false, 0,
3727 : true, 0 /* sConstants */,
3728 : -1,
3729 : 2,
3730 : sNativeProperties_sortedPropertyIndices,
3731 : {
3732 : { sConstants, &sNativeProperties_propertyInfos[0] }
3733 : }
3734 : };
3735 : static_assert(2 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
3736 : "We have a property info count that is oversized");
3737 :
3738 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
3739 : {
3740 : "EXT_texture_filter_anisotropicPrototype",
3741 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
3742 : JS_NULL_CLASS_OPS,
3743 : JS_NULL_CLASS_SPEC,
3744 : JS_NULL_CLASS_EXT,
3745 : JS_NULL_OBJECT_OPS
3746 : },
3747 : eInterfacePrototype,
3748 : false,
3749 : prototypes::id::EXT_texture_filter_anisotropic,
3750 : PrototypeTraits<prototypes::id::EXT_texture_filter_anisotropic>::Depth,
3751 : sNativePropertyHooks,
3752 : "[object EXT_texture_filter_anisotropicPrototype]",
3753 : JS::GetRealmObjectPrototype
3754 : };
3755 :
3756 : static const js::ClassOps sClassOps = {
3757 : _addProperty, /* addProperty */
3758 : nullptr, /* delProperty */
3759 : nullptr, /* getProperty */
3760 : nullptr, /* setProperty */
3761 : nullptr, /* enumerate */
3762 : nullptr, /* newEnumerate */
3763 : nullptr, /* resolve */
3764 : nullptr, /* mayResolve */
3765 : _finalize, /* finalize */
3766 : nullptr, /* call */
3767 : nullptr, /* hasInstance */
3768 : nullptr, /* construct */
3769 : nullptr, /* trace */
3770 : };
3771 :
3772 : static const js::ClassExtension sClassExtension = {
3773 : nullptr, /* weakmapKeyDelegateOp */
3774 : _objectMoved /* objectMovedOp */
3775 : };
3776 :
3777 : static const DOMJSClass sClass = {
3778 : { "EXT_texture_filter_anisotropic",
3779 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
3780 : &sClassOps,
3781 : JS_NULL_CLASS_SPEC,
3782 : &sClassExtension,
3783 : JS_NULL_OBJECT_OPS
3784 : },
3785 : { prototypes::id::EXT_texture_filter_anisotropic, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
3786 : IsBaseOf<nsISupports, mozilla::WebGLExtensionTextureFilterAnisotropic >::value,
3787 : sNativePropertyHooks,
3788 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionTextureFilterAnisotropic>::Get,
3789 : GetProtoObjectHandle,
3790 : GetCCParticipant<mozilla::WebGLExtensionTextureFilterAnisotropic>::Get()
3791 : };
3792 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
3793 : "Must have the right minimal number of reserved slots.");
3794 : static_assert(1 >= 1,
3795 : "Must have enough reserved slots.");
3796 :
3797 : const JSClass*
3798 0 : GetJSClass()
3799 : {
3800 0 : return sClass.ToJSClass();
3801 : }
3802 :
3803 : bool
3804 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionTextureFilterAnisotropic* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
3805 : {
3806 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionTextureFilterAnisotropic*>(aObject) ==
3807 : reinterpret_cast<mozilla::WebGLExtensionTextureFilterAnisotropic*>(aObject),
3808 : "Multiple inheritance for mozilla::WebGLExtensionTextureFilterAnisotropic is broken.");
3809 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
3810 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
3811 0 : MOZ_ASSERT(!aCache->GetWrapper(),
3812 : "You should probably not be using Wrap() directly; use "
3813 : "GetOrCreateDOMReflector instead");
3814 :
3815 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
3816 : "nsISupports must be on our primary inheritance chain");
3817 :
3818 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
3819 0 : if (!global) {
3820 0 : return false;
3821 : }
3822 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
3823 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
3824 :
3825 : // That might have ended up wrapping us already, due to the wonders
3826 : // of XBL. Check for that, and bail out as needed.
3827 0 : aReflector.set(aCache->GetWrapper());
3828 0 : if (aReflector) {
3829 : #ifdef DEBUG
3830 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
3831 : #endif // DEBUG
3832 0 : return true;
3833 : }
3834 :
3835 0 : JSAutoCompartment ac(aCx, global);
3836 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
3837 0 : if (!canonicalProto) {
3838 0 : return false;
3839 : }
3840 0 : JS::Rooted<JSObject*> proto(aCx);
3841 0 : if (aGivenProto) {
3842 0 : proto = aGivenProto;
3843 : // Unfortunately, while aGivenProto was in the compartment of aCx
3844 : // coming in, we changed compartments to that of "parent" so may need
3845 : // to wrap the proto here.
3846 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
3847 0 : if (!JS_WrapObject(aCx, &proto)) {
3848 0 : return false;
3849 : }
3850 : }
3851 : } else {
3852 0 : proto = canonicalProto;
3853 : }
3854 :
3855 0 : BindingJSObjectCreator<mozilla::WebGLExtensionTextureFilterAnisotropic> creator(aCx);
3856 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
3857 0 : if (!aReflector) {
3858 0 : return false;
3859 : }
3860 :
3861 0 : aCache->SetWrapper(aReflector);
3862 0 : creator.InitializationSucceeded();
3863 :
3864 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
3865 : aCache->GetWrapperPreserveColor() == aReflector);
3866 : // If proto != canonicalProto, we have to preserve our wrapper;
3867 : // otherwise we won't be able to properly recreate it later, since
3868 : // we won't know what proto to use. Note that we don't check
3869 : // aGivenProto here, since it's entirely possible (and even
3870 : // somewhat common) to have a non-null aGivenProto which is the
3871 : // same as canonicalProto.
3872 0 : if (proto != canonicalProto) {
3873 0 : PreserveWrapper(aObject);
3874 : }
3875 :
3876 0 : return true;
3877 : }
3878 :
3879 : const NativePropertyHooks sNativePropertyHooks[] = { {
3880 : nullptr,
3881 : nullptr,
3882 : nullptr,
3883 : { sNativeProperties.Upcast(), nullptr },
3884 : prototypes::id::EXT_texture_filter_anisotropic,
3885 : constructors::id::_ID_Count,
3886 : nullptr,
3887 : &DefaultXrayExpandoObjectClass
3888 : } };
3889 :
3890 : void
3891 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
3892 : {
3893 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
3894 0 : if (!parentProto) {
3895 0 : return;
3896 : }
3897 :
3898 : static bool sIdsInited = false;
3899 0 : if (!sIdsInited && NS_IsMainThread()) {
3900 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
3901 0 : return;
3902 : }
3903 0 : sIdsInited = true;
3904 : }
3905 :
3906 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::EXT_texture_filter_anisotropic);
3907 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
3908 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
3909 : &sPrototypeClass.mBase, protoCache,
3910 : nullptr, nullptr, 0, nullptr,
3911 : interfaceCache,
3912 : sNativeProperties.Upcast(),
3913 : nullptr,
3914 : nullptr, aDefineOnGlobal,
3915 : nullptr,
3916 0 : false);
3917 : }
3918 :
3919 : JS::Handle<JSObject*>
3920 0 : GetProtoObjectHandle(JSContext* aCx)
3921 : {
3922 : /* Get the interface prototype object for this class. This will create the
3923 : object as needed. */
3924 0 : bool aDefineOnGlobal = true;
3925 :
3926 : /* Make sure our global is sane. Hopefully we can remove this sometime */
3927 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
3928 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
3929 0 : return nullptr;
3930 : }
3931 :
3932 : /* Check to see whether the interface objects are already installed */
3933 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
3934 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::EXT_texture_filter_anisotropic)) {
3935 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
3936 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
3937 : }
3938 :
3939 : /*
3940 : * The object might _still_ be null, but that's OK.
3941 : *
3942 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
3943 : * traced by TraceProtoAndIfaceCache() and its contents are never
3944 : * changed after they have been set.
3945 : *
3946 : * Calling address() avoids the read read barrier that does gray
3947 : * unmarking, but it's not possible for the object to be gray here.
3948 : */
3949 :
3950 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::EXT_texture_filter_anisotropic);
3951 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
3952 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
3953 : }
3954 :
3955 : } // namespace EXT_texture_filter_anisotropicBinding
3956 :
3957 :
3958 :
3959 : namespace MOZ_debugBinding {
3960 :
3961 : static bool
3962 0 : getParameter(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionMOZDebug* self, const JSJitMethodCallArgs& args)
3963 : {
3964 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
3965 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "MOZ_debug.getParameter");
3966 : }
3967 : uint32_t arg0;
3968 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
3969 0 : return false;
3970 : }
3971 0 : binding_detail::FastErrorResult rv;
3972 0 : JS::Rooted<JS::Value> result(cx);
3973 0 : self->GetParameter(cx, arg0, &result, rv);
3974 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
3975 0 : return false;
3976 : }
3977 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
3978 0 : JS::ExposeValueToActiveJS(result);
3979 0 : args.rval().set(result);
3980 0 : if (!MaybeWrapValue(cx, args.rval())) {
3981 0 : return false;
3982 : }
3983 0 : return true;
3984 : }
3985 :
3986 : static const JSJitInfo getParameter_methodinfo = {
3987 : { (JSJitGetterOp)getParameter },
3988 : { prototypes::id::MOZ_debug },
3989 : { PrototypeTraits<prototypes::id::MOZ_debug>::Depth },
3990 : JSJitInfo::Method,
3991 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
3992 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
3993 : false, /* isInfallible. False in setters. */
3994 : false, /* isMovable. Not relevant for setters. */
3995 : false, /* isEliminatable. Not relevant for setters. */
3996 : false, /* isAlwaysInSlot. Only relevant for getters. */
3997 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
3998 : false, /* isTypedMethod. Only relevant for methods. */
3999 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
4000 : };
4001 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
4002 : static_assert(0 < 1, "There is no slot for us");
4003 :
4004 : static bool
4005 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
4006 : {
4007 0 : mozilla::WebGLExtensionMOZDebug* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionMOZDebug>(obj);
4008 : // We don't want to preserve if we don't have a wrapper, and we
4009 : // obviously can't preserve if we're not initialized.
4010 0 : if (self && self->GetWrapperPreserveColor()) {
4011 0 : PreserveWrapper(self);
4012 : }
4013 0 : return true;
4014 : }
4015 :
4016 : static void
4017 0 : _finalize(js::FreeOp* fop, JSObject* obj)
4018 : {
4019 0 : mozilla::WebGLExtensionMOZDebug* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionMOZDebug>(obj);
4020 0 : if (self) {
4021 0 : ClearWrapper(self, self, obj);
4022 0 : AddForDeferredFinalization<mozilla::WebGLExtensionMOZDebug>(self);
4023 : }
4024 0 : }
4025 :
4026 : static void
4027 0 : _objectMoved(JSObject* obj, const JSObject* old)
4028 : {
4029 0 : mozilla::WebGLExtensionMOZDebug* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionMOZDebug>(obj);
4030 0 : if (self) {
4031 0 : UpdateWrapper(self, self, obj, old);
4032 : }
4033 0 : }
4034 :
4035 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
4036 : #if defined(__clang__)
4037 : #pragma clang diagnostic push
4038 : #pragma clang diagnostic ignored "-Wmissing-braces"
4039 : #endif
4040 : static const JSFunctionSpec sMethods_specs[] = {
4041 : JS_FNSPEC("getParameter", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getParameter_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
4042 : JS_FS_END
4043 : };
4044 : #if defined(__clang__)
4045 : #pragma clang diagnostic pop
4046 : #endif
4047 :
4048 :
4049 : // Can't be const because the pref-enabled boolean needs to be writable
4050 : static Prefable<const JSFunctionSpec> sMethods[] = {
4051 : { nullptr, &sMethods_specs[0] },
4052 : { nullptr, nullptr }
4053 : };
4054 :
4055 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
4056 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
4057 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
4058 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
4059 :
4060 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
4061 : #if defined(__clang__)
4062 : #pragma clang diagnostic push
4063 : #pragma clang diagnostic ignored "-Wmissing-braces"
4064 : #endif
4065 : static const ConstantSpec sConstants_specs[] = {
4066 : { "EXTENSIONS", JS::NumberValue(7939U) },
4067 : { "WSI_INFO", JS::NumberValue(65536U) },
4068 : { "UNPACK_REQUIRE_FASTPATH", JS::NumberValue(65537U) },
4069 : { 0, JS::UndefinedValue() }
4070 : };
4071 : #if defined(__clang__)
4072 : #pragma clang diagnostic pop
4073 : #endif
4074 :
4075 :
4076 : // Can't be const because the pref-enabled boolean needs to be writable
4077 : static Prefable<const ConstantSpec> sConstants[] = {
4078 : { nullptr, &sConstants_specs[0] },
4079 : { nullptr, nullptr }
4080 : };
4081 :
4082 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
4083 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
4084 : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
4085 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
4086 :
4087 :
4088 : static uint16_t sNativeProperties_sortedPropertyIndices[4];
4089 : static PropertyInfo sNativeProperties_propertyInfos[4];
4090 :
4091 : static const NativePropertiesN<2> sNativeProperties = {
4092 : false, 0,
4093 : false, 0,
4094 : true, 0 /* sMethods */,
4095 : false, 0,
4096 : false, 0,
4097 : false, 0,
4098 : true, 1 /* sConstants */,
4099 : -1,
4100 : 4,
4101 : sNativeProperties_sortedPropertyIndices,
4102 : {
4103 : { sMethods, &sNativeProperties_propertyInfos[0] },
4104 : { sConstants, &sNativeProperties_propertyInfos[1] }
4105 : }
4106 : };
4107 : static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
4108 : "We have a property info count that is oversized");
4109 :
4110 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
4111 : {
4112 : "MOZ_debugPrototype",
4113 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
4114 : JS_NULL_CLASS_OPS,
4115 : JS_NULL_CLASS_SPEC,
4116 : JS_NULL_CLASS_EXT,
4117 : JS_NULL_OBJECT_OPS
4118 : },
4119 : eInterfacePrototype,
4120 : false,
4121 : prototypes::id::MOZ_debug,
4122 : PrototypeTraits<prototypes::id::MOZ_debug>::Depth,
4123 : sNativePropertyHooks,
4124 : "[object MOZ_debugPrototype]",
4125 : JS::GetRealmObjectPrototype
4126 : };
4127 :
4128 : static const js::ClassOps sClassOps = {
4129 : _addProperty, /* addProperty */
4130 : nullptr, /* delProperty */
4131 : nullptr, /* getProperty */
4132 : nullptr, /* setProperty */
4133 : nullptr, /* enumerate */
4134 : nullptr, /* newEnumerate */
4135 : nullptr, /* resolve */
4136 : nullptr, /* mayResolve */
4137 : _finalize, /* finalize */
4138 : nullptr, /* call */
4139 : nullptr, /* hasInstance */
4140 : nullptr, /* construct */
4141 : nullptr, /* trace */
4142 : };
4143 :
4144 : static const js::ClassExtension sClassExtension = {
4145 : nullptr, /* weakmapKeyDelegateOp */
4146 : _objectMoved /* objectMovedOp */
4147 : };
4148 :
4149 : static const DOMJSClass sClass = {
4150 : { "MOZ_debug",
4151 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
4152 : &sClassOps,
4153 : JS_NULL_CLASS_SPEC,
4154 : &sClassExtension,
4155 : JS_NULL_OBJECT_OPS
4156 : },
4157 : { prototypes::id::MOZ_debug, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
4158 : IsBaseOf<nsISupports, mozilla::WebGLExtensionMOZDebug >::value,
4159 : sNativePropertyHooks,
4160 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionMOZDebug>::Get,
4161 : GetProtoObjectHandle,
4162 : GetCCParticipant<mozilla::WebGLExtensionMOZDebug>::Get()
4163 : };
4164 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
4165 : "Must have the right minimal number of reserved slots.");
4166 : static_assert(1 >= 1,
4167 : "Must have enough reserved slots.");
4168 :
4169 : const JSClass*
4170 0 : GetJSClass()
4171 : {
4172 0 : return sClass.ToJSClass();
4173 : }
4174 :
4175 : bool
4176 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionMOZDebug* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
4177 : {
4178 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionMOZDebug*>(aObject) ==
4179 : reinterpret_cast<mozilla::WebGLExtensionMOZDebug*>(aObject),
4180 : "Multiple inheritance for mozilla::WebGLExtensionMOZDebug is broken.");
4181 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
4182 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
4183 0 : MOZ_ASSERT(!aCache->GetWrapper(),
4184 : "You should probably not be using Wrap() directly; use "
4185 : "GetOrCreateDOMReflector instead");
4186 :
4187 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
4188 : "nsISupports must be on our primary inheritance chain");
4189 :
4190 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
4191 0 : if (!global) {
4192 0 : return false;
4193 : }
4194 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
4195 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
4196 :
4197 : // That might have ended up wrapping us already, due to the wonders
4198 : // of XBL. Check for that, and bail out as needed.
4199 0 : aReflector.set(aCache->GetWrapper());
4200 0 : if (aReflector) {
4201 : #ifdef DEBUG
4202 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
4203 : #endif // DEBUG
4204 0 : return true;
4205 : }
4206 :
4207 0 : JSAutoCompartment ac(aCx, global);
4208 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
4209 0 : if (!canonicalProto) {
4210 0 : return false;
4211 : }
4212 0 : JS::Rooted<JSObject*> proto(aCx);
4213 0 : if (aGivenProto) {
4214 0 : proto = aGivenProto;
4215 : // Unfortunately, while aGivenProto was in the compartment of aCx
4216 : // coming in, we changed compartments to that of "parent" so may need
4217 : // to wrap the proto here.
4218 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
4219 0 : if (!JS_WrapObject(aCx, &proto)) {
4220 0 : return false;
4221 : }
4222 : }
4223 : } else {
4224 0 : proto = canonicalProto;
4225 : }
4226 :
4227 0 : BindingJSObjectCreator<mozilla::WebGLExtensionMOZDebug> creator(aCx);
4228 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
4229 0 : if (!aReflector) {
4230 0 : return false;
4231 : }
4232 :
4233 0 : aCache->SetWrapper(aReflector);
4234 0 : creator.InitializationSucceeded();
4235 :
4236 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
4237 : aCache->GetWrapperPreserveColor() == aReflector);
4238 : // If proto != canonicalProto, we have to preserve our wrapper;
4239 : // otherwise we won't be able to properly recreate it later, since
4240 : // we won't know what proto to use. Note that we don't check
4241 : // aGivenProto here, since it's entirely possible (and even
4242 : // somewhat common) to have a non-null aGivenProto which is the
4243 : // same as canonicalProto.
4244 0 : if (proto != canonicalProto) {
4245 0 : PreserveWrapper(aObject);
4246 : }
4247 :
4248 0 : return true;
4249 : }
4250 :
4251 : const NativePropertyHooks sNativePropertyHooks[] = { {
4252 : nullptr,
4253 : nullptr,
4254 : nullptr,
4255 : { sNativeProperties.Upcast(), nullptr },
4256 : prototypes::id::MOZ_debug,
4257 : constructors::id::_ID_Count,
4258 : nullptr,
4259 : &DefaultXrayExpandoObjectClass
4260 : } };
4261 :
4262 : void
4263 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
4264 : {
4265 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
4266 0 : if (!parentProto) {
4267 0 : return;
4268 : }
4269 :
4270 : static bool sIdsInited = false;
4271 0 : if (!sIdsInited && NS_IsMainThread()) {
4272 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
4273 0 : return;
4274 : }
4275 0 : sIdsInited = true;
4276 : }
4277 :
4278 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::MOZ_debug);
4279 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
4280 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
4281 : &sPrototypeClass.mBase, protoCache,
4282 : nullptr, nullptr, 0, nullptr,
4283 : interfaceCache,
4284 : sNativeProperties.Upcast(),
4285 : nullptr,
4286 : nullptr, aDefineOnGlobal,
4287 : nullptr,
4288 0 : false);
4289 : }
4290 :
4291 : JS::Handle<JSObject*>
4292 0 : GetProtoObjectHandle(JSContext* aCx)
4293 : {
4294 : /* Get the interface prototype object for this class. This will create the
4295 : object as needed. */
4296 0 : bool aDefineOnGlobal = true;
4297 :
4298 : /* Make sure our global is sane. Hopefully we can remove this sometime */
4299 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
4300 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
4301 0 : return nullptr;
4302 : }
4303 :
4304 : /* Check to see whether the interface objects are already installed */
4305 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
4306 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::MOZ_debug)) {
4307 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
4308 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
4309 : }
4310 :
4311 : /*
4312 : * The object might _still_ be null, but that's OK.
4313 : *
4314 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
4315 : * traced by TraceProtoAndIfaceCache() and its contents are never
4316 : * changed after they have been set.
4317 : *
4318 : * Calling address() avoids the read read barrier that does gray
4319 : * unmarking, but it's not possible for the object to be gray here.
4320 : */
4321 :
4322 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::MOZ_debug);
4323 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
4324 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
4325 : }
4326 :
4327 : } // namespace MOZ_debugBinding
4328 :
4329 :
4330 :
4331 : namespace OES_element_index_uintBinding {
4332 :
4333 : static bool
4334 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
4335 : {
4336 0 : mozilla::WebGLExtensionElementIndexUint* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionElementIndexUint>(obj);
4337 : // We don't want to preserve if we don't have a wrapper, and we
4338 : // obviously can't preserve if we're not initialized.
4339 0 : if (self && self->GetWrapperPreserveColor()) {
4340 0 : PreserveWrapper(self);
4341 : }
4342 0 : return true;
4343 : }
4344 :
4345 : static void
4346 0 : _finalize(js::FreeOp* fop, JSObject* obj)
4347 : {
4348 0 : mozilla::WebGLExtensionElementIndexUint* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionElementIndexUint>(obj);
4349 0 : if (self) {
4350 0 : ClearWrapper(self, self, obj);
4351 0 : AddForDeferredFinalization<mozilla::WebGLExtensionElementIndexUint>(self);
4352 : }
4353 0 : }
4354 :
4355 : static void
4356 0 : _objectMoved(JSObject* obj, const JSObject* old)
4357 : {
4358 0 : mozilla::WebGLExtensionElementIndexUint* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionElementIndexUint>(obj);
4359 0 : if (self) {
4360 0 : UpdateWrapper(self, self, obj, old);
4361 : }
4362 0 : }
4363 :
4364 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
4365 : {
4366 : "OES_element_index_uintPrototype",
4367 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
4368 : JS_NULL_CLASS_OPS,
4369 : JS_NULL_CLASS_SPEC,
4370 : JS_NULL_CLASS_EXT,
4371 : JS_NULL_OBJECT_OPS
4372 : },
4373 : eInterfacePrototype,
4374 : false,
4375 : prototypes::id::OES_element_index_uint,
4376 : PrototypeTraits<prototypes::id::OES_element_index_uint>::Depth,
4377 : sNativePropertyHooks,
4378 : "[object OES_element_index_uintPrototype]",
4379 : JS::GetRealmObjectPrototype
4380 : };
4381 :
4382 : static const js::ClassOps sClassOps = {
4383 : _addProperty, /* addProperty */
4384 : nullptr, /* delProperty */
4385 : nullptr, /* getProperty */
4386 : nullptr, /* setProperty */
4387 : nullptr, /* enumerate */
4388 : nullptr, /* newEnumerate */
4389 : nullptr, /* resolve */
4390 : nullptr, /* mayResolve */
4391 : _finalize, /* finalize */
4392 : nullptr, /* call */
4393 : nullptr, /* hasInstance */
4394 : nullptr, /* construct */
4395 : nullptr, /* trace */
4396 : };
4397 :
4398 : static const js::ClassExtension sClassExtension = {
4399 : nullptr, /* weakmapKeyDelegateOp */
4400 : _objectMoved /* objectMovedOp */
4401 : };
4402 :
4403 : static const DOMJSClass sClass = {
4404 : { "OES_element_index_uint",
4405 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
4406 : &sClassOps,
4407 : JS_NULL_CLASS_SPEC,
4408 : &sClassExtension,
4409 : JS_NULL_OBJECT_OPS
4410 : },
4411 : { prototypes::id::OES_element_index_uint, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
4412 : IsBaseOf<nsISupports, mozilla::WebGLExtensionElementIndexUint >::value,
4413 : sNativePropertyHooks,
4414 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionElementIndexUint>::Get,
4415 : GetProtoObjectHandle,
4416 : GetCCParticipant<mozilla::WebGLExtensionElementIndexUint>::Get()
4417 : };
4418 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
4419 : "Must have the right minimal number of reserved slots.");
4420 : static_assert(1 >= 1,
4421 : "Must have enough reserved slots.");
4422 :
4423 : const JSClass*
4424 0 : GetJSClass()
4425 : {
4426 0 : return sClass.ToJSClass();
4427 : }
4428 :
4429 : bool
4430 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionElementIndexUint* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
4431 : {
4432 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionElementIndexUint*>(aObject) ==
4433 : reinterpret_cast<mozilla::WebGLExtensionElementIndexUint*>(aObject),
4434 : "Multiple inheritance for mozilla::WebGLExtensionElementIndexUint is broken.");
4435 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
4436 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
4437 0 : MOZ_ASSERT(!aCache->GetWrapper(),
4438 : "You should probably not be using Wrap() directly; use "
4439 : "GetOrCreateDOMReflector instead");
4440 :
4441 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
4442 : "nsISupports must be on our primary inheritance chain");
4443 :
4444 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
4445 0 : if (!global) {
4446 0 : return false;
4447 : }
4448 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
4449 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
4450 :
4451 : // That might have ended up wrapping us already, due to the wonders
4452 : // of XBL. Check for that, and bail out as needed.
4453 0 : aReflector.set(aCache->GetWrapper());
4454 0 : if (aReflector) {
4455 : #ifdef DEBUG
4456 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
4457 : #endif // DEBUG
4458 0 : return true;
4459 : }
4460 :
4461 0 : JSAutoCompartment ac(aCx, global);
4462 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
4463 0 : if (!canonicalProto) {
4464 0 : return false;
4465 : }
4466 0 : JS::Rooted<JSObject*> proto(aCx);
4467 0 : if (aGivenProto) {
4468 0 : proto = aGivenProto;
4469 : // Unfortunately, while aGivenProto was in the compartment of aCx
4470 : // coming in, we changed compartments to that of "parent" so may need
4471 : // to wrap the proto here.
4472 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
4473 0 : if (!JS_WrapObject(aCx, &proto)) {
4474 0 : return false;
4475 : }
4476 : }
4477 : } else {
4478 0 : proto = canonicalProto;
4479 : }
4480 :
4481 0 : BindingJSObjectCreator<mozilla::WebGLExtensionElementIndexUint> creator(aCx);
4482 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
4483 0 : if (!aReflector) {
4484 0 : return false;
4485 : }
4486 :
4487 0 : aCache->SetWrapper(aReflector);
4488 0 : creator.InitializationSucceeded();
4489 :
4490 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
4491 : aCache->GetWrapperPreserveColor() == aReflector);
4492 : // If proto != canonicalProto, we have to preserve our wrapper;
4493 : // otherwise we won't be able to properly recreate it later, since
4494 : // we won't know what proto to use. Note that we don't check
4495 : // aGivenProto here, since it's entirely possible (and even
4496 : // somewhat common) to have a non-null aGivenProto which is the
4497 : // same as canonicalProto.
4498 0 : if (proto != canonicalProto) {
4499 0 : PreserveWrapper(aObject);
4500 : }
4501 :
4502 0 : return true;
4503 : }
4504 :
4505 : const NativePropertyHooks sNativePropertyHooks[] = { {
4506 : nullptr,
4507 : nullptr,
4508 : nullptr,
4509 : { nullptr, nullptr },
4510 : prototypes::id::OES_element_index_uint,
4511 : constructors::id::_ID_Count,
4512 : nullptr,
4513 : &DefaultXrayExpandoObjectClass
4514 : } };
4515 :
4516 : void
4517 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
4518 : {
4519 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
4520 0 : if (!parentProto) {
4521 0 : return;
4522 : }
4523 :
4524 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::OES_element_index_uint);
4525 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
4526 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
4527 : &sPrototypeClass.mBase, protoCache,
4528 : nullptr, nullptr, 0, nullptr,
4529 : interfaceCache,
4530 : nullptr,
4531 : nullptr,
4532 : nullptr, aDefineOnGlobal,
4533 : nullptr,
4534 0 : false);
4535 : }
4536 :
4537 : JS::Handle<JSObject*>
4538 0 : GetProtoObjectHandle(JSContext* aCx)
4539 : {
4540 : /* Get the interface prototype object for this class. This will create the
4541 : object as needed. */
4542 0 : bool aDefineOnGlobal = true;
4543 :
4544 : /* Make sure our global is sane. Hopefully we can remove this sometime */
4545 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
4546 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
4547 0 : return nullptr;
4548 : }
4549 :
4550 : /* Check to see whether the interface objects are already installed */
4551 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
4552 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::OES_element_index_uint)) {
4553 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
4554 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
4555 : }
4556 :
4557 : /*
4558 : * The object might _still_ be null, but that's OK.
4559 : *
4560 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
4561 : * traced by TraceProtoAndIfaceCache() and its contents are never
4562 : * changed after they have been set.
4563 : *
4564 : * Calling address() avoids the read read barrier that does gray
4565 : * unmarking, but it's not possible for the object to be gray here.
4566 : */
4567 :
4568 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::OES_element_index_uint);
4569 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
4570 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
4571 : }
4572 :
4573 : } // namespace OES_element_index_uintBinding
4574 :
4575 :
4576 :
4577 : namespace OES_standard_derivativesBinding {
4578 :
4579 : static bool
4580 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
4581 : {
4582 0 : mozilla::WebGLExtensionStandardDerivatives* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionStandardDerivatives>(obj);
4583 : // We don't want to preserve if we don't have a wrapper, and we
4584 : // obviously can't preserve if we're not initialized.
4585 0 : if (self && self->GetWrapperPreserveColor()) {
4586 0 : PreserveWrapper(self);
4587 : }
4588 0 : return true;
4589 : }
4590 :
4591 : static void
4592 0 : _finalize(js::FreeOp* fop, JSObject* obj)
4593 : {
4594 0 : mozilla::WebGLExtensionStandardDerivatives* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionStandardDerivatives>(obj);
4595 0 : if (self) {
4596 0 : ClearWrapper(self, self, obj);
4597 0 : AddForDeferredFinalization<mozilla::WebGLExtensionStandardDerivatives>(self);
4598 : }
4599 0 : }
4600 :
4601 : static void
4602 0 : _objectMoved(JSObject* obj, const JSObject* old)
4603 : {
4604 0 : mozilla::WebGLExtensionStandardDerivatives* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionStandardDerivatives>(obj);
4605 0 : if (self) {
4606 0 : UpdateWrapper(self, self, obj, old);
4607 : }
4608 0 : }
4609 :
4610 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
4611 : #if defined(__clang__)
4612 : #pragma clang diagnostic push
4613 : #pragma clang diagnostic ignored "-Wmissing-braces"
4614 : #endif
4615 : static const ConstantSpec sConstants_specs[] = {
4616 : { "FRAGMENT_SHADER_DERIVATIVE_HINT_OES", JS::NumberValue(35723U) },
4617 : { 0, JS::UndefinedValue() }
4618 : };
4619 : #if defined(__clang__)
4620 : #pragma clang diagnostic pop
4621 : #endif
4622 :
4623 :
4624 : // Can't be const because the pref-enabled boolean needs to be writable
4625 : static Prefable<const ConstantSpec> sConstants[] = {
4626 : { nullptr, &sConstants_specs[0] },
4627 : { nullptr, nullptr }
4628 : };
4629 :
4630 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
4631 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
4632 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
4633 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
4634 :
4635 :
4636 : static uint16_t sNativeProperties_sortedPropertyIndices[1];
4637 : static PropertyInfo sNativeProperties_propertyInfos[1];
4638 :
4639 : static const NativePropertiesN<1> sNativeProperties = {
4640 : false, 0,
4641 : false, 0,
4642 : false, 0,
4643 : false, 0,
4644 : false, 0,
4645 : false, 0,
4646 : true, 0 /* sConstants */,
4647 : -1,
4648 : 1,
4649 : sNativeProperties_sortedPropertyIndices,
4650 : {
4651 : { sConstants, &sNativeProperties_propertyInfos[0] }
4652 : }
4653 : };
4654 : static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
4655 : "We have a property info count that is oversized");
4656 :
4657 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
4658 : {
4659 : "OES_standard_derivativesPrototype",
4660 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
4661 : JS_NULL_CLASS_OPS,
4662 : JS_NULL_CLASS_SPEC,
4663 : JS_NULL_CLASS_EXT,
4664 : JS_NULL_OBJECT_OPS
4665 : },
4666 : eInterfacePrototype,
4667 : false,
4668 : prototypes::id::OES_standard_derivatives,
4669 : PrototypeTraits<prototypes::id::OES_standard_derivatives>::Depth,
4670 : sNativePropertyHooks,
4671 : "[object OES_standard_derivativesPrototype]",
4672 : JS::GetRealmObjectPrototype
4673 : };
4674 :
4675 : static const js::ClassOps sClassOps = {
4676 : _addProperty, /* addProperty */
4677 : nullptr, /* delProperty */
4678 : nullptr, /* getProperty */
4679 : nullptr, /* setProperty */
4680 : nullptr, /* enumerate */
4681 : nullptr, /* newEnumerate */
4682 : nullptr, /* resolve */
4683 : nullptr, /* mayResolve */
4684 : _finalize, /* finalize */
4685 : nullptr, /* call */
4686 : nullptr, /* hasInstance */
4687 : nullptr, /* construct */
4688 : nullptr, /* trace */
4689 : };
4690 :
4691 : static const js::ClassExtension sClassExtension = {
4692 : nullptr, /* weakmapKeyDelegateOp */
4693 : _objectMoved /* objectMovedOp */
4694 : };
4695 :
4696 : static const DOMJSClass sClass = {
4697 : { "OES_standard_derivatives",
4698 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
4699 : &sClassOps,
4700 : JS_NULL_CLASS_SPEC,
4701 : &sClassExtension,
4702 : JS_NULL_OBJECT_OPS
4703 : },
4704 : { prototypes::id::OES_standard_derivatives, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
4705 : IsBaseOf<nsISupports, mozilla::WebGLExtensionStandardDerivatives >::value,
4706 : sNativePropertyHooks,
4707 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionStandardDerivatives>::Get,
4708 : GetProtoObjectHandle,
4709 : GetCCParticipant<mozilla::WebGLExtensionStandardDerivatives>::Get()
4710 : };
4711 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
4712 : "Must have the right minimal number of reserved slots.");
4713 : static_assert(1 >= 1,
4714 : "Must have enough reserved slots.");
4715 :
4716 : const JSClass*
4717 0 : GetJSClass()
4718 : {
4719 0 : return sClass.ToJSClass();
4720 : }
4721 :
4722 : bool
4723 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionStandardDerivatives* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
4724 : {
4725 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionStandardDerivatives*>(aObject) ==
4726 : reinterpret_cast<mozilla::WebGLExtensionStandardDerivatives*>(aObject),
4727 : "Multiple inheritance for mozilla::WebGLExtensionStandardDerivatives is broken.");
4728 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
4729 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
4730 0 : MOZ_ASSERT(!aCache->GetWrapper(),
4731 : "You should probably not be using Wrap() directly; use "
4732 : "GetOrCreateDOMReflector instead");
4733 :
4734 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
4735 : "nsISupports must be on our primary inheritance chain");
4736 :
4737 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
4738 0 : if (!global) {
4739 0 : return false;
4740 : }
4741 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
4742 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
4743 :
4744 : // That might have ended up wrapping us already, due to the wonders
4745 : // of XBL. Check for that, and bail out as needed.
4746 0 : aReflector.set(aCache->GetWrapper());
4747 0 : if (aReflector) {
4748 : #ifdef DEBUG
4749 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
4750 : #endif // DEBUG
4751 0 : return true;
4752 : }
4753 :
4754 0 : JSAutoCompartment ac(aCx, global);
4755 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
4756 0 : if (!canonicalProto) {
4757 0 : return false;
4758 : }
4759 0 : JS::Rooted<JSObject*> proto(aCx);
4760 0 : if (aGivenProto) {
4761 0 : proto = aGivenProto;
4762 : // Unfortunately, while aGivenProto was in the compartment of aCx
4763 : // coming in, we changed compartments to that of "parent" so may need
4764 : // to wrap the proto here.
4765 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
4766 0 : if (!JS_WrapObject(aCx, &proto)) {
4767 0 : return false;
4768 : }
4769 : }
4770 : } else {
4771 0 : proto = canonicalProto;
4772 : }
4773 :
4774 0 : BindingJSObjectCreator<mozilla::WebGLExtensionStandardDerivatives> creator(aCx);
4775 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
4776 0 : if (!aReflector) {
4777 0 : return false;
4778 : }
4779 :
4780 0 : aCache->SetWrapper(aReflector);
4781 0 : creator.InitializationSucceeded();
4782 :
4783 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
4784 : aCache->GetWrapperPreserveColor() == aReflector);
4785 : // If proto != canonicalProto, we have to preserve our wrapper;
4786 : // otherwise we won't be able to properly recreate it later, since
4787 : // we won't know what proto to use. Note that we don't check
4788 : // aGivenProto here, since it's entirely possible (and even
4789 : // somewhat common) to have a non-null aGivenProto which is the
4790 : // same as canonicalProto.
4791 0 : if (proto != canonicalProto) {
4792 0 : PreserveWrapper(aObject);
4793 : }
4794 :
4795 0 : return true;
4796 : }
4797 :
4798 : const NativePropertyHooks sNativePropertyHooks[] = { {
4799 : nullptr,
4800 : nullptr,
4801 : nullptr,
4802 : { sNativeProperties.Upcast(), nullptr },
4803 : prototypes::id::OES_standard_derivatives,
4804 : constructors::id::_ID_Count,
4805 : nullptr,
4806 : &DefaultXrayExpandoObjectClass
4807 : } };
4808 :
4809 : void
4810 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
4811 : {
4812 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
4813 0 : if (!parentProto) {
4814 0 : return;
4815 : }
4816 :
4817 : static bool sIdsInited = false;
4818 0 : if (!sIdsInited && NS_IsMainThread()) {
4819 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
4820 0 : return;
4821 : }
4822 0 : sIdsInited = true;
4823 : }
4824 :
4825 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::OES_standard_derivatives);
4826 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
4827 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
4828 : &sPrototypeClass.mBase, protoCache,
4829 : nullptr, nullptr, 0, nullptr,
4830 : interfaceCache,
4831 : sNativeProperties.Upcast(),
4832 : nullptr,
4833 : nullptr, aDefineOnGlobal,
4834 : nullptr,
4835 0 : false);
4836 : }
4837 :
4838 : JS::Handle<JSObject*>
4839 0 : GetProtoObjectHandle(JSContext* aCx)
4840 : {
4841 : /* Get the interface prototype object for this class. This will create the
4842 : object as needed. */
4843 0 : bool aDefineOnGlobal = true;
4844 :
4845 : /* Make sure our global is sane. Hopefully we can remove this sometime */
4846 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
4847 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
4848 0 : return nullptr;
4849 : }
4850 :
4851 : /* Check to see whether the interface objects are already installed */
4852 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
4853 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::OES_standard_derivatives)) {
4854 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
4855 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
4856 : }
4857 :
4858 : /*
4859 : * The object might _still_ be null, but that's OK.
4860 : *
4861 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
4862 : * traced by TraceProtoAndIfaceCache() and its contents are never
4863 : * changed after they have been set.
4864 : *
4865 : * Calling address() avoids the read read barrier that does gray
4866 : * unmarking, but it's not possible for the object to be gray here.
4867 : */
4868 :
4869 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::OES_standard_derivatives);
4870 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
4871 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
4872 : }
4873 :
4874 : } // namespace OES_standard_derivativesBinding
4875 :
4876 :
4877 :
4878 : namespace OES_texture_floatBinding {
4879 :
4880 : static bool
4881 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
4882 : {
4883 0 : mozilla::WebGLExtensionTextureFloat* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionTextureFloat>(obj);
4884 : // We don't want to preserve if we don't have a wrapper, and we
4885 : // obviously can't preserve if we're not initialized.
4886 0 : if (self && self->GetWrapperPreserveColor()) {
4887 0 : PreserveWrapper(self);
4888 : }
4889 0 : return true;
4890 : }
4891 :
4892 : static void
4893 0 : _finalize(js::FreeOp* fop, JSObject* obj)
4894 : {
4895 0 : mozilla::WebGLExtensionTextureFloat* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionTextureFloat>(obj);
4896 0 : if (self) {
4897 0 : ClearWrapper(self, self, obj);
4898 0 : AddForDeferredFinalization<mozilla::WebGLExtensionTextureFloat>(self);
4899 : }
4900 0 : }
4901 :
4902 : static void
4903 0 : _objectMoved(JSObject* obj, const JSObject* old)
4904 : {
4905 0 : mozilla::WebGLExtensionTextureFloat* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionTextureFloat>(obj);
4906 0 : if (self) {
4907 0 : UpdateWrapper(self, self, obj, old);
4908 : }
4909 0 : }
4910 :
4911 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
4912 : {
4913 : "OES_texture_floatPrototype",
4914 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
4915 : JS_NULL_CLASS_OPS,
4916 : JS_NULL_CLASS_SPEC,
4917 : JS_NULL_CLASS_EXT,
4918 : JS_NULL_OBJECT_OPS
4919 : },
4920 : eInterfacePrototype,
4921 : false,
4922 : prototypes::id::OES_texture_float,
4923 : PrototypeTraits<prototypes::id::OES_texture_float>::Depth,
4924 : sNativePropertyHooks,
4925 : "[object OES_texture_floatPrototype]",
4926 : JS::GetRealmObjectPrototype
4927 : };
4928 :
4929 : static const js::ClassOps sClassOps = {
4930 : _addProperty, /* addProperty */
4931 : nullptr, /* delProperty */
4932 : nullptr, /* getProperty */
4933 : nullptr, /* setProperty */
4934 : nullptr, /* enumerate */
4935 : nullptr, /* newEnumerate */
4936 : nullptr, /* resolve */
4937 : nullptr, /* mayResolve */
4938 : _finalize, /* finalize */
4939 : nullptr, /* call */
4940 : nullptr, /* hasInstance */
4941 : nullptr, /* construct */
4942 : nullptr, /* trace */
4943 : };
4944 :
4945 : static const js::ClassExtension sClassExtension = {
4946 : nullptr, /* weakmapKeyDelegateOp */
4947 : _objectMoved /* objectMovedOp */
4948 : };
4949 :
4950 : static const DOMJSClass sClass = {
4951 : { "OES_texture_float",
4952 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
4953 : &sClassOps,
4954 : JS_NULL_CLASS_SPEC,
4955 : &sClassExtension,
4956 : JS_NULL_OBJECT_OPS
4957 : },
4958 : { prototypes::id::OES_texture_float, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
4959 : IsBaseOf<nsISupports, mozilla::WebGLExtensionTextureFloat >::value,
4960 : sNativePropertyHooks,
4961 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionTextureFloat>::Get,
4962 : GetProtoObjectHandle,
4963 : GetCCParticipant<mozilla::WebGLExtensionTextureFloat>::Get()
4964 : };
4965 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
4966 : "Must have the right minimal number of reserved slots.");
4967 : static_assert(1 >= 1,
4968 : "Must have enough reserved slots.");
4969 :
4970 : const JSClass*
4971 0 : GetJSClass()
4972 : {
4973 0 : return sClass.ToJSClass();
4974 : }
4975 :
4976 : bool
4977 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionTextureFloat* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
4978 : {
4979 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionTextureFloat*>(aObject) ==
4980 : reinterpret_cast<mozilla::WebGLExtensionTextureFloat*>(aObject),
4981 : "Multiple inheritance for mozilla::WebGLExtensionTextureFloat is broken.");
4982 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
4983 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
4984 0 : MOZ_ASSERT(!aCache->GetWrapper(),
4985 : "You should probably not be using Wrap() directly; use "
4986 : "GetOrCreateDOMReflector instead");
4987 :
4988 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
4989 : "nsISupports must be on our primary inheritance chain");
4990 :
4991 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
4992 0 : if (!global) {
4993 0 : return false;
4994 : }
4995 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
4996 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
4997 :
4998 : // That might have ended up wrapping us already, due to the wonders
4999 : // of XBL. Check for that, and bail out as needed.
5000 0 : aReflector.set(aCache->GetWrapper());
5001 0 : if (aReflector) {
5002 : #ifdef DEBUG
5003 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
5004 : #endif // DEBUG
5005 0 : return true;
5006 : }
5007 :
5008 0 : JSAutoCompartment ac(aCx, global);
5009 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
5010 0 : if (!canonicalProto) {
5011 0 : return false;
5012 : }
5013 0 : JS::Rooted<JSObject*> proto(aCx);
5014 0 : if (aGivenProto) {
5015 0 : proto = aGivenProto;
5016 : // Unfortunately, while aGivenProto was in the compartment of aCx
5017 : // coming in, we changed compartments to that of "parent" so may need
5018 : // to wrap the proto here.
5019 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
5020 0 : if (!JS_WrapObject(aCx, &proto)) {
5021 0 : return false;
5022 : }
5023 : }
5024 : } else {
5025 0 : proto = canonicalProto;
5026 : }
5027 :
5028 0 : BindingJSObjectCreator<mozilla::WebGLExtensionTextureFloat> creator(aCx);
5029 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
5030 0 : if (!aReflector) {
5031 0 : return false;
5032 : }
5033 :
5034 0 : aCache->SetWrapper(aReflector);
5035 0 : creator.InitializationSucceeded();
5036 :
5037 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
5038 : aCache->GetWrapperPreserveColor() == aReflector);
5039 : // If proto != canonicalProto, we have to preserve our wrapper;
5040 : // otherwise we won't be able to properly recreate it later, since
5041 : // we won't know what proto to use. Note that we don't check
5042 : // aGivenProto here, since it's entirely possible (and even
5043 : // somewhat common) to have a non-null aGivenProto which is the
5044 : // same as canonicalProto.
5045 0 : if (proto != canonicalProto) {
5046 0 : PreserveWrapper(aObject);
5047 : }
5048 :
5049 0 : return true;
5050 : }
5051 :
5052 : const NativePropertyHooks sNativePropertyHooks[] = { {
5053 : nullptr,
5054 : nullptr,
5055 : nullptr,
5056 : { nullptr, nullptr },
5057 : prototypes::id::OES_texture_float,
5058 : constructors::id::_ID_Count,
5059 : nullptr,
5060 : &DefaultXrayExpandoObjectClass
5061 : } };
5062 :
5063 : void
5064 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
5065 : {
5066 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
5067 0 : if (!parentProto) {
5068 0 : return;
5069 : }
5070 :
5071 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::OES_texture_float);
5072 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
5073 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
5074 : &sPrototypeClass.mBase, protoCache,
5075 : nullptr, nullptr, 0, nullptr,
5076 : interfaceCache,
5077 : nullptr,
5078 : nullptr,
5079 : nullptr, aDefineOnGlobal,
5080 : nullptr,
5081 0 : false);
5082 : }
5083 :
5084 : JS::Handle<JSObject*>
5085 0 : GetProtoObjectHandle(JSContext* aCx)
5086 : {
5087 : /* Get the interface prototype object for this class. This will create the
5088 : object as needed. */
5089 0 : bool aDefineOnGlobal = true;
5090 :
5091 : /* Make sure our global is sane. Hopefully we can remove this sometime */
5092 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
5093 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
5094 0 : return nullptr;
5095 : }
5096 :
5097 : /* Check to see whether the interface objects are already installed */
5098 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
5099 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::OES_texture_float)) {
5100 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
5101 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
5102 : }
5103 :
5104 : /*
5105 : * The object might _still_ be null, but that's OK.
5106 : *
5107 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
5108 : * traced by TraceProtoAndIfaceCache() and its contents are never
5109 : * changed after they have been set.
5110 : *
5111 : * Calling address() avoids the read read barrier that does gray
5112 : * unmarking, but it's not possible for the object to be gray here.
5113 : */
5114 :
5115 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::OES_texture_float);
5116 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
5117 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
5118 : }
5119 :
5120 : } // namespace OES_texture_floatBinding
5121 :
5122 :
5123 :
5124 : namespace OES_texture_float_linearBinding {
5125 :
5126 : static bool
5127 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
5128 : {
5129 0 : mozilla::WebGLExtensionTextureFloatLinear* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionTextureFloatLinear>(obj);
5130 : // We don't want to preserve if we don't have a wrapper, and we
5131 : // obviously can't preserve if we're not initialized.
5132 0 : if (self && self->GetWrapperPreserveColor()) {
5133 0 : PreserveWrapper(self);
5134 : }
5135 0 : return true;
5136 : }
5137 :
5138 : static void
5139 0 : _finalize(js::FreeOp* fop, JSObject* obj)
5140 : {
5141 0 : mozilla::WebGLExtensionTextureFloatLinear* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionTextureFloatLinear>(obj);
5142 0 : if (self) {
5143 0 : ClearWrapper(self, self, obj);
5144 0 : AddForDeferredFinalization<mozilla::WebGLExtensionTextureFloatLinear>(self);
5145 : }
5146 0 : }
5147 :
5148 : static void
5149 0 : _objectMoved(JSObject* obj, const JSObject* old)
5150 : {
5151 0 : mozilla::WebGLExtensionTextureFloatLinear* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionTextureFloatLinear>(obj);
5152 0 : if (self) {
5153 0 : UpdateWrapper(self, self, obj, old);
5154 : }
5155 0 : }
5156 :
5157 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
5158 : {
5159 : "OES_texture_float_linearPrototype",
5160 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
5161 : JS_NULL_CLASS_OPS,
5162 : JS_NULL_CLASS_SPEC,
5163 : JS_NULL_CLASS_EXT,
5164 : JS_NULL_OBJECT_OPS
5165 : },
5166 : eInterfacePrototype,
5167 : false,
5168 : prototypes::id::OES_texture_float_linear,
5169 : PrototypeTraits<prototypes::id::OES_texture_float_linear>::Depth,
5170 : sNativePropertyHooks,
5171 : "[object OES_texture_float_linearPrototype]",
5172 : JS::GetRealmObjectPrototype
5173 : };
5174 :
5175 : static const js::ClassOps sClassOps = {
5176 : _addProperty, /* addProperty */
5177 : nullptr, /* delProperty */
5178 : nullptr, /* getProperty */
5179 : nullptr, /* setProperty */
5180 : nullptr, /* enumerate */
5181 : nullptr, /* newEnumerate */
5182 : nullptr, /* resolve */
5183 : nullptr, /* mayResolve */
5184 : _finalize, /* finalize */
5185 : nullptr, /* call */
5186 : nullptr, /* hasInstance */
5187 : nullptr, /* construct */
5188 : nullptr, /* trace */
5189 : };
5190 :
5191 : static const js::ClassExtension sClassExtension = {
5192 : nullptr, /* weakmapKeyDelegateOp */
5193 : _objectMoved /* objectMovedOp */
5194 : };
5195 :
5196 : static const DOMJSClass sClass = {
5197 : { "OES_texture_float_linear",
5198 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
5199 : &sClassOps,
5200 : JS_NULL_CLASS_SPEC,
5201 : &sClassExtension,
5202 : JS_NULL_OBJECT_OPS
5203 : },
5204 : { prototypes::id::OES_texture_float_linear, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
5205 : IsBaseOf<nsISupports, mozilla::WebGLExtensionTextureFloatLinear >::value,
5206 : sNativePropertyHooks,
5207 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionTextureFloatLinear>::Get,
5208 : GetProtoObjectHandle,
5209 : GetCCParticipant<mozilla::WebGLExtensionTextureFloatLinear>::Get()
5210 : };
5211 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
5212 : "Must have the right minimal number of reserved slots.");
5213 : static_assert(1 >= 1,
5214 : "Must have enough reserved slots.");
5215 :
5216 : const JSClass*
5217 0 : GetJSClass()
5218 : {
5219 0 : return sClass.ToJSClass();
5220 : }
5221 :
5222 : bool
5223 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionTextureFloatLinear* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
5224 : {
5225 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionTextureFloatLinear*>(aObject) ==
5226 : reinterpret_cast<mozilla::WebGLExtensionTextureFloatLinear*>(aObject),
5227 : "Multiple inheritance for mozilla::WebGLExtensionTextureFloatLinear is broken.");
5228 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
5229 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
5230 0 : MOZ_ASSERT(!aCache->GetWrapper(),
5231 : "You should probably not be using Wrap() directly; use "
5232 : "GetOrCreateDOMReflector instead");
5233 :
5234 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
5235 : "nsISupports must be on our primary inheritance chain");
5236 :
5237 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
5238 0 : if (!global) {
5239 0 : return false;
5240 : }
5241 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
5242 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
5243 :
5244 : // That might have ended up wrapping us already, due to the wonders
5245 : // of XBL. Check for that, and bail out as needed.
5246 0 : aReflector.set(aCache->GetWrapper());
5247 0 : if (aReflector) {
5248 : #ifdef DEBUG
5249 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
5250 : #endif // DEBUG
5251 0 : return true;
5252 : }
5253 :
5254 0 : JSAutoCompartment ac(aCx, global);
5255 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
5256 0 : if (!canonicalProto) {
5257 0 : return false;
5258 : }
5259 0 : JS::Rooted<JSObject*> proto(aCx);
5260 0 : if (aGivenProto) {
5261 0 : proto = aGivenProto;
5262 : // Unfortunately, while aGivenProto was in the compartment of aCx
5263 : // coming in, we changed compartments to that of "parent" so may need
5264 : // to wrap the proto here.
5265 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
5266 0 : if (!JS_WrapObject(aCx, &proto)) {
5267 0 : return false;
5268 : }
5269 : }
5270 : } else {
5271 0 : proto = canonicalProto;
5272 : }
5273 :
5274 0 : BindingJSObjectCreator<mozilla::WebGLExtensionTextureFloatLinear> creator(aCx);
5275 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
5276 0 : if (!aReflector) {
5277 0 : return false;
5278 : }
5279 :
5280 0 : aCache->SetWrapper(aReflector);
5281 0 : creator.InitializationSucceeded();
5282 :
5283 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
5284 : aCache->GetWrapperPreserveColor() == aReflector);
5285 : // If proto != canonicalProto, we have to preserve our wrapper;
5286 : // otherwise we won't be able to properly recreate it later, since
5287 : // we won't know what proto to use. Note that we don't check
5288 : // aGivenProto here, since it's entirely possible (and even
5289 : // somewhat common) to have a non-null aGivenProto which is the
5290 : // same as canonicalProto.
5291 0 : if (proto != canonicalProto) {
5292 0 : PreserveWrapper(aObject);
5293 : }
5294 :
5295 0 : return true;
5296 : }
5297 :
5298 : const NativePropertyHooks sNativePropertyHooks[] = { {
5299 : nullptr,
5300 : nullptr,
5301 : nullptr,
5302 : { nullptr, nullptr },
5303 : prototypes::id::OES_texture_float_linear,
5304 : constructors::id::_ID_Count,
5305 : nullptr,
5306 : &DefaultXrayExpandoObjectClass
5307 : } };
5308 :
5309 : void
5310 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
5311 : {
5312 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
5313 0 : if (!parentProto) {
5314 0 : return;
5315 : }
5316 :
5317 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::OES_texture_float_linear);
5318 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
5319 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
5320 : &sPrototypeClass.mBase, protoCache,
5321 : nullptr, nullptr, 0, nullptr,
5322 : interfaceCache,
5323 : nullptr,
5324 : nullptr,
5325 : nullptr, aDefineOnGlobal,
5326 : nullptr,
5327 0 : false);
5328 : }
5329 :
5330 : JS::Handle<JSObject*>
5331 0 : GetProtoObjectHandle(JSContext* aCx)
5332 : {
5333 : /* Get the interface prototype object for this class. This will create the
5334 : object as needed. */
5335 0 : bool aDefineOnGlobal = true;
5336 :
5337 : /* Make sure our global is sane. Hopefully we can remove this sometime */
5338 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
5339 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
5340 0 : return nullptr;
5341 : }
5342 :
5343 : /* Check to see whether the interface objects are already installed */
5344 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
5345 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::OES_texture_float_linear)) {
5346 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
5347 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
5348 : }
5349 :
5350 : /*
5351 : * The object might _still_ be null, but that's OK.
5352 : *
5353 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
5354 : * traced by TraceProtoAndIfaceCache() and its contents are never
5355 : * changed after they have been set.
5356 : *
5357 : * Calling address() avoids the read read barrier that does gray
5358 : * unmarking, but it's not possible for the object to be gray here.
5359 : */
5360 :
5361 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::OES_texture_float_linear);
5362 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
5363 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
5364 : }
5365 :
5366 : } // namespace OES_texture_float_linearBinding
5367 :
5368 :
5369 :
5370 : namespace OES_texture_half_floatBinding {
5371 :
5372 : static bool
5373 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
5374 : {
5375 0 : mozilla::WebGLExtensionTextureHalfFloat* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionTextureHalfFloat>(obj);
5376 : // We don't want to preserve if we don't have a wrapper, and we
5377 : // obviously can't preserve if we're not initialized.
5378 0 : if (self && self->GetWrapperPreserveColor()) {
5379 0 : PreserveWrapper(self);
5380 : }
5381 0 : return true;
5382 : }
5383 :
5384 : static void
5385 0 : _finalize(js::FreeOp* fop, JSObject* obj)
5386 : {
5387 0 : mozilla::WebGLExtensionTextureHalfFloat* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionTextureHalfFloat>(obj);
5388 0 : if (self) {
5389 0 : ClearWrapper(self, self, obj);
5390 0 : AddForDeferredFinalization<mozilla::WebGLExtensionTextureHalfFloat>(self);
5391 : }
5392 0 : }
5393 :
5394 : static void
5395 0 : _objectMoved(JSObject* obj, const JSObject* old)
5396 : {
5397 0 : mozilla::WebGLExtensionTextureHalfFloat* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionTextureHalfFloat>(obj);
5398 0 : if (self) {
5399 0 : UpdateWrapper(self, self, obj, old);
5400 : }
5401 0 : }
5402 :
5403 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
5404 : #if defined(__clang__)
5405 : #pragma clang diagnostic push
5406 : #pragma clang diagnostic ignored "-Wmissing-braces"
5407 : #endif
5408 : static const ConstantSpec sConstants_specs[] = {
5409 : { "HALF_FLOAT_OES", JS::NumberValue(36193U) },
5410 : { 0, JS::UndefinedValue() }
5411 : };
5412 : #if defined(__clang__)
5413 : #pragma clang diagnostic pop
5414 : #endif
5415 :
5416 :
5417 : // Can't be const because the pref-enabled boolean needs to be writable
5418 : static Prefable<const ConstantSpec> sConstants[] = {
5419 : { nullptr, &sConstants_specs[0] },
5420 : { nullptr, nullptr }
5421 : };
5422 :
5423 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
5424 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
5425 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
5426 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
5427 :
5428 :
5429 : static uint16_t sNativeProperties_sortedPropertyIndices[1];
5430 : static PropertyInfo sNativeProperties_propertyInfos[1];
5431 :
5432 : static const NativePropertiesN<1> sNativeProperties = {
5433 : false, 0,
5434 : false, 0,
5435 : false, 0,
5436 : false, 0,
5437 : false, 0,
5438 : false, 0,
5439 : true, 0 /* sConstants */,
5440 : -1,
5441 : 1,
5442 : sNativeProperties_sortedPropertyIndices,
5443 : {
5444 : { sConstants, &sNativeProperties_propertyInfos[0] }
5445 : }
5446 : };
5447 : static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
5448 : "We have a property info count that is oversized");
5449 :
5450 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
5451 : {
5452 : "OES_texture_half_floatPrototype",
5453 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
5454 : JS_NULL_CLASS_OPS,
5455 : JS_NULL_CLASS_SPEC,
5456 : JS_NULL_CLASS_EXT,
5457 : JS_NULL_OBJECT_OPS
5458 : },
5459 : eInterfacePrototype,
5460 : false,
5461 : prototypes::id::OES_texture_half_float,
5462 : PrototypeTraits<prototypes::id::OES_texture_half_float>::Depth,
5463 : sNativePropertyHooks,
5464 : "[object OES_texture_half_floatPrototype]",
5465 : JS::GetRealmObjectPrototype
5466 : };
5467 :
5468 : static const js::ClassOps sClassOps = {
5469 : _addProperty, /* addProperty */
5470 : nullptr, /* delProperty */
5471 : nullptr, /* getProperty */
5472 : nullptr, /* setProperty */
5473 : nullptr, /* enumerate */
5474 : nullptr, /* newEnumerate */
5475 : nullptr, /* resolve */
5476 : nullptr, /* mayResolve */
5477 : _finalize, /* finalize */
5478 : nullptr, /* call */
5479 : nullptr, /* hasInstance */
5480 : nullptr, /* construct */
5481 : nullptr, /* trace */
5482 : };
5483 :
5484 : static const js::ClassExtension sClassExtension = {
5485 : nullptr, /* weakmapKeyDelegateOp */
5486 : _objectMoved /* objectMovedOp */
5487 : };
5488 :
5489 : static const DOMJSClass sClass = {
5490 : { "OES_texture_half_float",
5491 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
5492 : &sClassOps,
5493 : JS_NULL_CLASS_SPEC,
5494 : &sClassExtension,
5495 : JS_NULL_OBJECT_OPS
5496 : },
5497 : { prototypes::id::OES_texture_half_float, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
5498 : IsBaseOf<nsISupports, mozilla::WebGLExtensionTextureHalfFloat >::value,
5499 : sNativePropertyHooks,
5500 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionTextureHalfFloat>::Get,
5501 : GetProtoObjectHandle,
5502 : GetCCParticipant<mozilla::WebGLExtensionTextureHalfFloat>::Get()
5503 : };
5504 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
5505 : "Must have the right minimal number of reserved slots.");
5506 : static_assert(1 >= 1,
5507 : "Must have enough reserved slots.");
5508 :
5509 : const JSClass*
5510 0 : GetJSClass()
5511 : {
5512 0 : return sClass.ToJSClass();
5513 : }
5514 :
5515 : bool
5516 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionTextureHalfFloat* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
5517 : {
5518 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionTextureHalfFloat*>(aObject) ==
5519 : reinterpret_cast<mozilla::WebGLExtensionTextureHalfFloat*>(aObject),
5520 : "Multiple inheritance for mozilla::WebGLExtensionTextureHalfFloat is broken.");
5521 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
5522 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
5523 0 : MOZ_ASSERT(!aCache->GetWrapper(),
5524 : "You should probably not be using Wrap() directly; use "
5525 : "GetOrCreateDOMReflector instead");
5526 :
5527 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
5528 : "nsISupports must be on our primary inheritance chain");
5529 :
5530 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
5531 0 : if (!global) {
5532 0 : return false;
5533 : }
5534 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
5535 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
5536 :
5537 : // That might have ended up wrapping us already, due to the wonders
5538 : // of XBL. Check for that, and bail out as needed.
5539 0 : aReflector.set(aCache->GetWrapper());
5540 0 : if (aReflector) {
5541 : #ifdef DEBUG
5542 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
5543 : #endif // DEBUG
5544 0 : return true;
5545 : }
5546 :
5547 0 : JSAutoCompartment ac(aCx, global);
5548 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
5549 0 : if (!canonicalProto) {
5550 0 : return false;
5551 : }
5552 0 : JS::Rooted<JSObject*> proto(aCx);
5553 0 : if (aGivenProto) {
5554 0 : proto = aGivenProto;
5555 : // Unfortunately, while aGivenProto was in the compartment of aCx
5556 : // coming in, we changed compartments to that of "parent" so may need
5557 : // to wrap the proto here.
5558 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
5559 0 : if (!JS_WrapObject(aCx, &proto)) {
5560 0 : return false;
5561 : }
5562 : }
5563 : } else {
5564 0 : proto = canonicalProto;
5565 : }
5566 :
5567 0 : BindingJSObjectCreator<mozilla::WebGLExtensionTextureHalfFloat> creator(aCx);
5568 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
5569 0 : if (!aReflector) {
5570 0 : return false;
5571 : }
5572 :
5573 0 : aCache->SetWrapper(aReflector);
5574 0 : creator.InitializationSucceeded();
5575 :
5576 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
5577 : aCache->GetWrapperPreserveColor() == aReflector);
5578 : // If proto != canonicalProto, we have to preserve our wrapper;
5579 : // otherwise we won't be able to properly recreate it later, since
5580 : // we won't know what proto to use. Note that we don't check
5581 : // aGivenProto here, since it's entirely possible (and even
5582 : // somewhat common) to have a non-null aGivenProto which is the
5583 : // same as canonicalProto.
5584 0 : if (proto != canonicalProto) {
5585 0 : PreserveWrapper(aObject);
5586 : }
5587 :
5588 0 : return true;
5589 : }
5590 :
5591 : const NativePropertyHooks sNativePropertyHooks[] = { {
5592 : nullptr,
5593 : nullptr,
5594 : nullptr,
5595 : { sNativeProperties.Upcast(), nullptr },
5596 : prototypes::id::OES_texture_half_float,
5597 : constructors::id::_ID_Count,
5598 : nullptr,
5599 : &DefaultXrayExpandoObjectClass
5600 : } };
5601 :
5602 : void
5603 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
5604 : {
5605 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
5606 0 : if (!parentProto) {
5607 0 : return;
5608 : }
5609 :
5610 : static bool sIdsInited = false;
5611 0 : if (!sIdsInited && NS_IsMainThread()) {
5612 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
5613 0 : return;
5614 : }
5615 0 : sIdsInited = true;
5616 : }
5617 :
5618 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::OES_texture_half_float);
5619 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
5620 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
5621 : &sPrototypeClass.mBase, protoCache,
5622 : nullptr, nullptr, 0, nullptr,
5623 : interfaceCache,
5624 : sNativeProperties.Upcast(),
5625 : nullptr,
5626 : nullptr, aDefineOnGlobal,
5627 : nullptr,
5628 0 : false);
5629 : }
5630 :
5631 : JS::Handle<JSObject*>
5632 0 : GetProtoObjectHandle(JSContext* aCx)
5633 : {
5634 : /* Get the interface prototype object for this class. This will create the
5635 : object as needed. */
5636 0 : bool aDefineOnGlobal = true;
5637 :
5638 : /* Make sure our global is sane. Hopefully we can remove this sometime */
5639 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
5640 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
5641 0 : return nullptr;
5642 : }
5643 :
5644 : /* Check to see whether the interface objects are already installed */
5645 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
5646 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::OES_texture_half_float)) {
5647 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
5648 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
5649 : }
5650 :
5651 : /*
5652 : * The object might _still_ be null, but that's OK.
5653 : *
5654 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
5655 : * traced by TraceProtoAndIfaceCache() and its contents are never
5656 : * changed after they have been set.
5657 : *
5658 : * Calling address() avoids the read read barrier that does gray
5659 : * unmarking, but it's not possible for the object to be gray here.
5660 : */
5661 :
5662 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::OES_texture_half_float);
5663 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
5664 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
5665 : }
5666 :
5667 : } // namespace OES_texture_half_floatBinding
5668 :
5669 :
5670 :
5671 : namespace OES_texture_half_float_linearBinding {
5672 :
5673 : static bool
5674 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
5675 : {
5676 0 : mozilla::WebGLExtensionTextureHalfFloatLinear* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionTextureHalfFloatLinear>(obj);
5677 : // We don't want to preserve if we don't have a wrapper, and we
5678 : // obviously can't preserve if we're not initialized.
5679 0 : if (self && self->GetWrapperPreserveColor()) {
5680 0 : PreserveWrapper(self);
5681 : }
5682 0 : return true;
5683 : }
5684 :
5685 : static void
5686 0 : _finalize(js::FreeOp* fop, JSObject* obj)
5687 : {
5688 0 : mozilla::WebGLExtensionTextureHalfFloatLinear* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionTextureHalfFloatLinear>(obj);
5689 0 : if (self) {
5690 0 : ClearWrapper(self, self, obj);
5691 0 : AddForDeferredFinalization<mozilla::WebGLExtensionTextureHalfFloatLinear>(self);
5692 : }
5693 0 : }
5694 :
5695 : static void
5696 0 : _objectMoved(JSObject* obj, const JSObject* old)
5697 : {
5698 0 : mozilla::WebGLExtensionTextureHalfFloatLinear* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionTextureHalfFloatLinear>(obj);
5699 0 : if (self) {
5700 0 : UpdateWrapper(self, self, obj, old);
5701 : }
5702 0 : }
5703 :
5704 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
5705 : {
5706 : "OES_texture_half_float_linearPrototype",
5707 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
5708 : JS_NULL_CLASS_OPS,
5709 : JS_NULL_CLASS_SPEC,
5710 : JS_NULL_CLASS_EXT,
5711 : JS_NULL_OBJECT_OPS
5712 : },
5713 : eInterfacePrototype,
5714 : false,
5715 : prototypes::id::OES_texture_half_float_linear,
5716 : PrototypeTraits<prototypes::id::OES_texture_half_float_linear>::Depth,
5717 : sNativePropertyHooks,
5718 : "[object OES_texture_half_float_linearPrototype]",
5719 : JS::GetRealmObjectPrototype
5720 : };
5721 :
5722 : static const js::ClassOps sClassOps = {
5723 : _addProperty, /* addProperty */
5724 : nullptr, /* delProperty */
5725 : nullptr, /* getProperty */
5726 : nullptr, /* setProperty */
5727 : nullptr, /* enumerate */
5728 : nullptr, /* newEnumerate */
5729 : nullptr, /* resolve */
5730 : nullptr, /* mayResolve */
5731 : _finalize, /* finalize */
5732 : nullptr, /* call */
5733 : nullptr, /* hasInstance */
5734 : nullptr, /* construct */
5735 : nullptr, /* trace */
5736 : };
5737 :
5738 : static const js::ClassExtension sClassExtension = {
5739 : nullptr, /* weakmapKeyDelegateOp */
5740 : _objectMoved /* objectMovedOp */
5741 : };
5742 :
5743 : static const DOMJSClass sClass = {
5744 : { "OES_texture_half_float_linear",
5745 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
5746 : &sClassOps,
5747 : JS_NULL_CLASS_SPEC,
5748 : &sClassExtension,
5749 : JS_NULL_OBJECT_OPS
5750 : },
5751 : { prototypes::id::OES_texture_half_float_linear, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
5752 : IsBaseOf<nsISupports, mozilla::WebGLExtensionTextureHalfFloatLinear >::value,
5753 : sNativePropertyHooks,
5754 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionTextureHalfFloatLinear>::Get,
5755 : GetProtoObjectHandle,
5756 : GetCCParticipant<mozilla::WebGLExtensionTextureHalfFloatLinear>::Get()
5757 : };
5758 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
5759 : "Must have the right minimal number of reserved slots.");
5760 : static_assert(1 >= 1,
5761 : "Must have enough reserved slots.");
5762 :
5763 : const JSClass*
5764 0 : GetJSClass()
5765 : {
5766 0 : return sClass.ToJSClass();
5767 : }
5768 :
5769 : bool
5770 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionTextureHalfFloatLinear* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
5771 : {
5772 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionTextureHalfFloatLinear*>(aObject) ==
5773 : reinterpret_cast<mozilla::WebGLExtensionTextureHalfFloatLinear*>(aObject),
5774 : "Multiple inheritance for mozilla::WebGLExtensionTextureHalfFloatLinear is broken.");
5775 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
5776 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
5777 0 : MOZ_ASSERT(!aCache->GetWrapper(),
5778 : "You should probably not be using Wrap() directly; use "
5779 : "GetOrCreateDOMReflector instead");
5780 :
5781 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
5782 : "nsISupports must be on our primary inheritance chain");
5783 :
5784 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
5785 0 : if (!global) {
5786 0 : return false;
5787 : }
5788 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
5789 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
5790 :
5791 : // That might have ended up wrapping us already, due to the wonders
5792 : // of XBL. Check for that, and bail out as needed.
5793 0 : aReflector.set(aCache->GetWrapper());
5794 0 : if (aReflector) {
5795 : #ifdef DEBUG
5796 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
5797 : #endif // DEBUG
5798 0 : return true;
5799 : }
5800 :
5801 0 : JSAutoCompartment ac(aCx, global);
5802 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
5803 0 : if (!canonicalProto) {
5804 0 : return false;
5805 : }
5806 0 : JS::Rooted<JSObject*> proto(aCx);
5807 0 : if (aGivenProto) {
5808 0 : proto = aGivenProto;
5809 : // Unfortunately, while aGivenProto was in the compartment of aCx
5810 : // coming in, we changed compartments to that of "parent" so may need
5811 : // to wrap the proto here.
5812 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
5813 0 : if (!JS_WrapObject(aCx, &proto)) {
5814 0 : return false;
5815 : }
5816 : }
5817 : } else {
5818 0 : proto = canonicalProto;
5819 : }
5820 :
5821 0 : BindingJSObjectCreator<mozilla::WebGLExtensionTextureHalfFloatLinear> creator(aCx);
5822 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
5823 0 : if (!aReflector) {
5824 0 : return false;
5825 : }
5826 :
5827 0 : aCache->SetWrapper(aReflector);
5828 0 : creator.InitializationSucceeded();
5829 :
5830 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
5831 : aCache->GetWrapperPreserveColor() == aReflector);
5832 : // If proto != canonicalProto, we have to preserve our wrapper;
5833 : // otherwise we won't be able to properly recreate it later, since
5834 : // we won't know what proto to use. Note that we don't check
5835 : // aGivenProto here, since it's entirely possible (and even
5836 : // somewhat common) to have a non-null aGivenProto which is the
5837 : // same as canonicalProto.
5838 0 : if (proto != canonicalProto) {
5839 0 : PreserveWrapper(aObject);
5840 : }
5841 :
5842 0 : return true;
5843 : }
5844 :
5845 : const NativePropertyHooks sNativePropertyHooks[] = { {
5846 : nullptr,
5847 : nullptr,
5848 : nullptr,
5849 : { nullptr, nullptr },
5850 : prototypes::id::OES_texture_half_float_linear,
5851 : constructors::id::_ID_Count,
5852 : nullptr,
5853 : &DefaultXrayExpandoObjectClass
5854 : } };
5855 :
5856 : void
5857 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
5858 : {
5859 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
5860 0 : if (!parentProto) {
5861 0 : return;
5862 : }
5863 :
5864 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::OES_texture_half_float_linear);
5865 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
5866 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
5867 : &sPrototypeClass.mBase, protoCache,
5868 : nullptr, nullptr, 0, nullptr,
5869 : interfaceCache,
5870 : nullptr,
5871 : nullptr,
5872 : nullptr, aDefineOnGlobal,
5873 : nullptr,
5874 0 : false);
5875 : }
5876 :
5877 : JS::Handle<JSObject*>
5878 0 : GetProtoObjectHandle(JSContext* aCx)
5879 : {
5880 : /* Get the interface prototype object for this class. This will create the
5881 : object as needed. */
5882 0 : bool aDefineOnGlobal = true;
5883 :
5884 : /* Make sure our global is sane. Hopefully we can remove this sometime */
5885 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
5886 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
5887 0 : return nullptr;
5888 : }
5889 :
5890 : /* Check to see whether the interface objects are already installed */
5891 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
5892 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::OES_texture_half_float_linear)) {
5893 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
5894 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
5895 : }
5896 :
5897 : /*
5898 : * The object might _still_ be null, but that's OK.
5899 : *
5900 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
5901 : * traced by TraceProtoAndIfaceCache() and its contents are never
5902 : * changed after they have been set.
5903 : *
5904 : * Calling address() avoids the read read barrier that does gray
5905 : * unmarking, but it's not possible for the object to be gray here.
5906 : */
5907 :
5908 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::OES_texture_half_float_linear);
5909 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
5910 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
5911 : }
5912 :
5913 : } // namespace OES_texture_half_float_linearBinding
5914 :
5915 :
5916 :
5917 : namespace OES_vertex_array_objectBinding {
5918 :
5919 : static bool
5920 0 : createVertexArrayOES(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionVertexArray* self, const JSJitMethodCallArgs& args)
5921 : {
5922 0 : auto result(StrongOrRawPtr<mozilla::WebGLVertexArray>(self->CreateVertexArrayOES()));
5923 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
5924 0 : if (!result) {
5925 0 : args.rval().setNull();
5926 0 : return true;
5927 : }
5928 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
5929 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
5930 0 : return false;
5931 : }
5932 0 : return true;
5933 : }
5934 :
5935 : static const JSJitInfo createVertexArrayOES_methodinfo = {
5936 : { (JSJitGetterOp)createVertexArrayOES },
5937 : { prototypes::id::OES_vertex_array_object },
5938 : { PrototypeTraits<prototypes::id::OES_vertex_array_object>::Depth },
5939 : JSJitInfo::Method,
5940 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
5941 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
5942 : false, /* isInfallible. False in setters. */
5943 : false, /* isMovable. Not relevant for setters. */
5944 : false, /* isEliminatable. Not relevant for setters. */
5945 : false, /* isAlwaysInSlot. Only relevant for getters. */
5946 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
5947 : false, /* isTypedMethod. Only relevant for methods. */
5948 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
5949 : };
5950 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
5951 : static_assert(0 < 1, "There is no slot for us");
5952 :
5953 : static bool
5954 0 : deleteVertexArrayOES(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionVertexArray* self, const JSJitMethodCallArgs& args)
5955 : {
5956 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
5957 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "OES_vertex_array_object.deleteVertexArrayOES");
5958 : }
5959 : mozilla::WebGLVertexArray* arg0;
5960 0 : if (args[0].isObject()) {
5961 : {
5962 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLVertexArrayObject, mozilla::WebGLVertexArray>(args[0], arg0);
5963 0 : if (NS_FAILED(rv)) {
5964 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of OES_vertex_array_object.deleteVertexArrayOES", "WebGLVertexArrayObject");
5965 0 : return false;
5966 : }
5967 : }
5968 0 : } else if (args[0].isNullOrUndefined()) {
5969 0 : arg0 = nullptr;
5970 : } else {
5971 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of OES_vertex_array_object.deleteVertexArrayOES");
5972 0 : return false;
5973 : }
5974 0 : self->DeleteVertexArrayOES(Constify(arg0));
5975 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
5976 0 : args.rval().setUndefined();
5977 0 : return true;
5978 : }
5979 :
5980 : static const JSJitInfo deleteVertexArrayOES_methodinfo = {
5981 : { (JSJitGetterOp)deleteVertexArrayOES },
5982 : { prototypes::id::OES_vertex_array_object },
5983 : { PrototypeTraits<prototypes::id::OES_vertex_array_object>::Depth },
5984 : JSJitInfo::Method,
5985 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
5986 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
5987 : false, /* isInfallible. False in setters. */
5988 : false, /* isMovable. Not relevant for setters. */
5989 : false, /* isEliminatable. Not relevant for setters. */
5990 : false, /* isAlwaysInSlot. Only relevant for getters. */
5991 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
5992 : false, /* isTypedMethod. Only relevant for methods. */
5993 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
5994 : };
5995 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
5996 : static_assert(0 < 1, "There is no slot for us");
5997 :
5998 : static bool
5999 0 : isVertexArrayOES(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionVertexArray* self, const JSJitMethodCallArgs& args)
6000 : {
6001 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
6002 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "OES_vertex_array_object.isVertexArrayOES");
6003 : }
6004 : mozilla::WebGLVertexArray* arg0;
6005 0 : if (args[0].isObject()) {
6006 : {
6007 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLVertexArrayObject, mozilla::WebGLVertexArray>(args[0], arg0);
6008 0 : if (NS_FAILED(rv)) {
6009 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of OES_vertex_array_object.isVertexArrayOES", "WebGLVertexArrayObject");
6010 0 : return false;
6011 : }
6012 : }
6013 0 : } else if (args[0].isNullOrUndefined()) {
6014 0 : arg0 = nullptr;
6015 : } else {
6016 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of OES_vertex_array_object.isVertexArrayOES");
6017 0 : return false;
6018 : }
6019 0 : bool result(self->IsVertexArrayOES(Constify(arg0)));
6020 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
6021 0 : args.rval().setBoolean(result);
6022 0 : return true;
6023 : }
6024 :
6025 : static const JSJitInfo isVertexArrayOES_methodinfo = {
6026 : { (JSJitGetterOp)isVertexArrayOES },
6027 : { prototypes::id::OES_vertex_array_object },
6028 : { PrototypeTraits<prototypes::id::OES_vertex_array_object>::Depth },
6029 : JSJitInfo::Method,
6030 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
6031 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
6032 : false, /* isInfallible. False in setters. */
6033 : false, /* isMovable. Not relevant for setters. */
6034 : false, /* isEliminatable. Not relevant for setters. */
6035 : false, /* isAlwaysInSlot. Only relevant for getters. */
6036 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
6037 : false, /* isTypedMethod. Only relevant for methods. */
6038 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
6039 : };
6040 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
6041 : static_assert(0 < 1, "There is no slot for us");
6042 :
6043 : static bool
6044 0 : bindVertexArrayOES(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionVertexArray* self, const JSJitMethodCallArgs& args)
6045 : {
6046 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
6047 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "OES_vertex_array_object.bindVertexArrayOES");
6048 : }
6049 : mozilla::WebGLVertexArray* arg0;
6050 0 : if (args[0].isObject()) {
6051 : {
6052 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLVertexArrayObject, mozilla::WebGLVertexArray>(args[0], arg0);
6053 0 : if (NS_FAILED(rv)) {
6054 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of OES_vertex_array_object.bindVertexArrayOES", "WebGLVertexArrayObject");
6055 0 : return false;
6056 : }
6057 : }
6058 0 : } else if (args[0].isNullOrUndefined()) {
6059 0 : arg0 = nullptr;
6060 : } else {
6061 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of OES_vertex_array_object.bindVertexArrayOES");
6062 0 : return false;
6063 : }
6064 0 : self->BindVertexArrayOES(Constify(arg0));
6065 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
6066 0 : args.rval().setUndefined();
6067 0 : return true;
6068 : }
6069 :
6070 : static const JSJitInfo bindVertexArrayOES_methodinfo = {
6071 : { (JSJitGetterOp)bindVertexArrayOES },
6072 : { prototypes::id::OES_vertex_array_object },
6073 : { PrototypeTraits<prototypes::id::OES_vertex_array_object>::Depth },
6074 : JSJitInfo::Method,
6075 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
6076 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
6077 : false, /* isInfallible. False in setters. */
6078 : false, /* isMovable. Not relevant for setters. */
6079 : false, /* isEliminatable. Not relevant for setters. */
6080 : false, /* isAlwaysInSlot. Only relevant for getters. */
6081 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
6082 : false, /* isTypedMethod. Only relevant for methods. */
6083 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
6084 : };
6085 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
6086 : static_assert(0 < 1, "There is no slot for us");
6087 :
6088 : static bool
6089 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
6090 : {
6091 0 : mozilla::WebGLExtensionVertexArray* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionVertexArray>(obj);
6092 : // We don't want to preserve if we don't have a wrapper, and we
6093 : // obviously can't preserve if we're not initialized.
6094 0 : if (self && self->GetWrapperPreserveColor()) {
6095 0 : PreserveWrapper(self);
6096 : }
6097 0 : return true;
6098 : }
6099 :
6100 : static void
6101 0 : _finalize(js::FreeOp* fop, JSObject* obj)
6102 : {
6103 0 : mozilla::WebGLExtensionVertexArray* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionVertexArray>(obj);
6104 0 : if (self) {
6105 0 : ClearWrapper(self, self, obj);
6106 0 : AddForDeferredFinalization<mozilla::WebGLExtensionVertexArray>(self);
6107 : }
6108 0 : }
6109 :
6110 : static void
6111 0 : _objectMoved(JSObject* obj, const JSObject* old)
6112 : {
6113 0 : mozilla::WebGLExtensionVertexArray* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionVertexArray>(obj);
6114 0 : if (self) {
6115 0 : UpdateWrapper(self, self, obj, old);
6116 : }
6117 0 : }
6118 :
6119 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
6120 : #if defined(__clang__)
6121 : #pragma clang diagnostic push
6122 : #pragma clang diagnostic ignored "-Wmissing-braces"
6123 : #endif
6124 : static const JSFunctionSpec sMethods_specs[] = {
6125 : JS_FNSPEC("createVertexArrayOES", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createVertexArrayOES_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
6126 : JS_FNSPEC("deleteVertexArrayOES", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&deleteVertexArrayOES_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
6127 : JS_FNSPEC("isVertexArrayOES", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&isVertexArrayOES_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
6128 : JS_FNSPEC("bindVertexArrayOES", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&bindVertexArrayOES_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
6129 : JS_FS_END
6130 : };
6131 : #if defined(__clang__)
6132 : #pragma clang diagnostic pop
6133 : #endif
6134 :
6135 :
6136 : // Can't be const because the pref-enabled boolean needs to be writable
6137 : static Prefable<const JSFunctionSpec> sMethods[] = {
6138 : { nullptr, &sMethods_specs[0] },
6139 : { nullptr, nullptr }
6140 : };
6141 :
6142 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
6143 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
6144 : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
6145 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
6146 :
6147 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
6148 : #if defined(__clang__)
6149 : #pragma clang diagnostic push
6150 : #pragma clang diagnostic ignored "-Wmissing-braces"
6151 : #endif
6152 : static const ConstantSpec sConstants_specs[] = {
6153 : { "VERTEX_ARRAY_BINDING_OES", JS::NumberValue(34229U) },
6154 : { 0, JS::UndefinedValue() }
6155 : };
6156 : #if defined(__clang__)
6157 : #pragma clang diagnostic pop
6158 : #endif
6159 :
6160 :
6161 : // Can't be const because the pref-enabled boolean needs to be writable
6162 : static Prefable<const ConstantSpec> sConstants[] = {
6163 : { nullptr, &sConstants_specs[0] },
6164 : { nullptr, nullptr }
6165 : };
6166 :
6167 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
6168 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
6169 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
6170 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
6171 :
6172 :
6173 : static uint16_t sNativeProperties_sortedPropertyIndices[5];
6174 : static PropertyInfo sNativeProperties_propertyInfos[5];
6175 :
6176 : static const NativePropertiesN<2> sNativeProperties = {
6177 : false, 0,
6178 : false, 0,
6179 : true, 0 /* sMethods */,
6180 : false, 0,
6181 : false, 0,
6182 : false, 0,
6183 : true, 1 /* sConstants */,
6184 : -1,
6185 : 5,
6186 : sNativeProperties_sortedPropertyIndices,
6187 : {
6188 : { sMethods, &sNativeProperties_propertyInfos[0] },
6189 : { sConstants, &sNativeProperties_propertyInfos[4] }
6190 : }
6191 : };
6192 : static_assert(5 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
6193 : "We have a property info count that is oversized");
6194 :
6195 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
6196 : {
6197 : "OES_vertex_array_objectPrototype",
6198 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
6199 : JS_NULL_CLASS_OPS,
6200 : JS_NULL_CLASS_SPEC,
6201 : JS_NULL_CLASS_EXT,
6202 : JS_NULL_OBJECT_OPS
6203 : },
6204 : eInterfacePrototype,
6205 : false,
6206 : prototypes::id::OES_vertex_array_object,
6207 : PrototypeTraits<prototypes::id::OES_vertex_array_object>::Depth,
6208 : sNativePropertyHooks,
6209 : "[object OES_vertex_array_objectPrototype]",
6210 : JS::GetRealmObjectPrototype
6211 : };
6212 :
6213 : static const js::ClassOps sClassOps = {
6214 : _addProperty, /* addProperty */
6215 : nullptr, /* delProperty */
6216 : nullptr, /* getProperty */
6217 : nullptr, /* setProperty */
6218 : nullptr, /* enumerate */
6219 : nullptr, /* newEnumerate */
6220 : nullptr, /* resolve */
6221 : nullptr, /* mayResolve */
6222 : _finalize, /* finalize */
6223 : nullptr, /* call */
6224 : nullptr, /* hasInstance */
6225 : nullptr, /* construct */
6226 : nullptr, /* trace */
6227 : };
6228 :
6229 : static const js::ClassExtension sClassExtension = {
6230 : nullptr, /* weakmapKeyDelegateOp */
6231 : _objectMoved /* objectMovedOp */
6232 : };
6233 :
6234 : static const DOMJSClass sClass = {
6235 : { "OES_vertex_array_object",
6236 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
6237 : &sClassOps,
6238 : JS_NULL_CLASS_SPEC,
6239 : &sClassExtension,
6240 : JS_NULL_OBJECT_OPS
6241 : },
6242 : { prototypes::id::OES_vertex_array_object, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
6243 : IsBaseOf<nsISupports, mozilla::WebGLExtensionVertexArray >::value,
6244 : sNativePropertyHooks,
6245 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionVertexArray>::Get,
6246 : GetProtoObjectHandle,
6247 : GetCCParticipant<mozilla::WebGLExtensionVertexArray>::Get()
6248 : };
6249 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
6250 : "Must have the right minimal number of reserved slots.");
6251 : static_assert(1 >= 1,
6252 : "Must have enough reserved slots.");
6253 :
6254 : const JSClass*
6255 0 : GetJSClass()
6256 : {
6257 0 : return sClass.ToJSClass();
6258 : }
6259 :
6260 : bool
6261 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionVertexArray* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
6262 : {
6263 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionVertexArray*>(aObject) ==
6264 : reinterpret_cast<mozilla::WebGLExtensionVertexArray*>(aObject),
6265 : "Multiple inheritance for mozilla::WebGLExtensionVertexArray is broken.");
6266 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
6267 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
6268 0 : MOZ_ASSERT(!aCache->GetWrapper(),
6269 : "You should probably not be using Wrap() directly; use "
6270 : "GetOrCreateDOMReflector instead");
6271 :
6272 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
6273 : "nsISupports must be on our primary inheritance chain");
6274 :
6275 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
6276 0 : if (!global) {
6277 0 : return false;
6278 : }
6279 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
6280 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
6281 :
6282 : // That might have ended up wrapping us already, due to the wonders
6283 : // of XBL. Check for that, and bail out as needed.
6284 0 : aReflector.set(aCache->GetWrapper());
6285 0 : if (aReflector) {
6286 : #ifdef DEBUG
6287 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
6288 : #endif // DEBUG
6289 0 : return true;
6290 : }
6291 :
6292 0 : JSAutoCompartment ac(aCx, global);
6293 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
6294 0 : if (!canonicalProto) {
6295 0 : return false;
6296 : }
6297 0 : JS::Rooted<JSObject*> proto(aCx);
6298 0 : if (aGivenProto) {
6299 0 : proto = aGivenProto;
6300 : // Unfortunately, while aGivenProto was in the compartment of aCx
6301 : // coming in, we changed compartments to that of "parent" so may need
6302 : // to wrap the proto here.
6303 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
6304 0 : if (!JS_WrapObject(aCx, &proto)) {
6305 0 : return false;
6306 : }
6307 : }
6308 : } else {
6309 0 : proto = canonicalProto;
6310 : }
6311 :
6312 0 : BindingJSObjectCreator<mozilla::WebGLExtensionVertexArray> creator(aCx);
6313 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
6314 0 : if (!aReflector) {
6315 0 : return false;
6316 : }
6317 :
6318 0 : aCache->SetWrapper(aReflector);
6319 0 : creator.InitializationSucceeded();
6320 :
6321 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
6322 : aCache->GetWrapperPreserveColor() == aReflector);
6323 : // If proto != canonicalProto, we have to preserve our wrapper;
6324 : // otherwise we won't be able to properly recreate it later, since
6325 : // we won't know what proto to use. Note that we don't check
6326 : // aGivenProto here, since it's entirely possible (and even
6327 : // somewhat common) to have a non-null aGivenProto which is the
6328 : // same as canonicalProto.
6329 0 : if (proto != canonicalProto) {
6330 0 : PreserveWrapper(aObject);
6331 : }
6332 :
6333 0 : return true;
6334 : }
6335 :
6336 : const NativePropertyHooks sNativePropertyHooks[] = { {
6337 : nullptr,
6338 : nullptr,
6339 : nullptr,
6340 : { sNativeProperties.Upcast(), nullptr },
6341 : prototypes::id::OES_vertex_array_object,
6342 : constructors::id::_ID_Count,
6343 : nullptr,
6344 : &DefaultXrayExpandoObjectClass
6345 : } };
6346 :
6347 : void
6348 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
6349 : {
6350 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
6351 0 : if (!parentProto) {
6352 0 : return;
6353 : }
6354 :
6355 : static bool sIdsInited = false;
6356 0 : if (!sIdsInited && NS_IsMainThread()) {
6357 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
6358 0 : return;
6359 : }
6360 0 : sIdsInited = true;
6361 : }
6362 :
6363 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::OES_vertex_array_object);
6364 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
6365 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
6366 : &sPrototypeClass.mBase, protoCache,
6367 : nullptr, nullptr, 0, nullptr,
6368 : interfaceCache,
6369 : sNativeProperties.Upcast(),
6370 : nullptr,
6371 : nullptr, aDefineOnGlobal,
6372 : nullptr,
6373 0 : false);
6374 : }
6375 :
6376 : JS::Handle<JSObject*>
6377 0 : GetProtoObjectHandle(JSContext* aCx)
6378 : {
6379 : /* Get the interface prototype object for this class. This will create the
6380 : object as needed. */
6381 0 : bool aDefineOnGlobal = true;
6382 :
6383 : /* Make sure our global is sane. Hopefully we can remove this sometime */
6384 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
6385 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
6386 0 : return nullptr;
6387 : }
6388 :
6389 : /* Check to see whether the interface objects are already installed */
6390 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
6391 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::OES_vertex_array_object)) {
6392 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
6393 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
6394 : }
6395 :
6396 : /*
6397 : * The object might _still_ be null, but that's OK.
6398 : *
6399 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
6400 : * traced by TraceProtoAndIfaceCache() and its contents are never
6401 : * changed after they have been set.
6402 : *
6403 : * Calling address() avoids the read read barrier that does gray
6404 : * unmarking, but it's not possible for the object to be gray here.
6405 : */
6406 :
6407 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::OES_vertex_array_object);
6408 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
6409 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
6410 : }
6411 :
6412 : } // namespace OES_vertex_array_objectBinding
6413 :
6414 :
6415 :
6416 : namespace WEBGL_color_buffer_floatBinding {
6417 :
6418 : static bool
6419 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
6420 : {
6421 0 : mozilla::WebGLExtensionColorBufferFloat* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionColorBufferFloat>(obj);
6422 : // We don't want to preserve if we don't have a wrapper, and we
6423 : // obviously can't preserve if we're not initialized.
6424 0 : if (self && self->GetWrapperPreserveColor()) {
6425 0 : PreserveWrapper(self);
6426 : }
6427 0 : return true;
6428 : }
6429 :
6430 : static void
6431 0 : _finalize(js::FreeOp* fop, JSObject* obj)
6432 : {
6433 0 : mozilla::WebGLExtensionColorBufferFloat* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionColorBufferFloat>(obj);
6434 0 : if (self) {
6435 0 : ClearWrapper(self, self, obj);
6436 0 : AddForDeferredFinalization<mozilla::WebGLExtensionColorBufferFloat>(self);
6437 : }
6438 0 : }
6439 :
6440 : static void
6441 0 : _objectMoved(JSObject* obj, const JSObject* old)
6442 : {
6443 0 : mozilla::WebGLExtensionColorBufferFloat* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionColorBufferFloat>(obj);
6444 0 : if (self) {
6445 0 : UpdateWrapper(self, self, obj, old);
6446 : }
6447 0 : }
6448 :
6449 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
6450 : #if defined(__clang__)
6451 : #pragma clang diagnostic push
6452 : #pragma clang diagnostic ignored "-Wmissing-braces"
6453 : #endif
6454 : static const ConstantSpec sConstants_specs[] = {
6455 : { "RGBA32F_EXT", JS::NumberValue(34836U) },
6456 : { "RGB32F_EXT", JS::NumberValue(34837U) },
6457 : { "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT", JS::NumberValue(33297U) },
6458 : { "UNSIGNED_NORMALIZED_EXT", JS::NumberValue(35863U) },
6459 : { 0, JS::UndefinedValue() }
6460 : };
6461 : #if defined(__clang__)
6462 : #pragma clang diagnostic pop
6463 : #endif
6464 :
6465 :
6466 : // Can't be const because the pref-enabled boolean needs to be writable
6467 : static Prefable<const ConstantSpec> sConstants[] = {
6468 : { nullptr, &sConstants_specs[0] },
6469 : { nullptr, nullptr }
6470 : };
6471 :
6472 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
6473 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
6474 : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
6475 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
6476 :
6477 :
6478 : static uint16_t sNativeProperties_sortedPropertyIndices[4];
6479 : static PropertyInfo sNativeProperties_propertyInfos[4];
6480 :
6481 : static const NativePropertiesN<1> sNativeProperties = {
6482 : false, 0,
6483 : false, 0,
6484 : false, 0,
6485 : false, 0,
6486 : false, 0,
6487 : false, 0,
6488 : true, 0 /* sConstants */,
6489 : -1,
6490 : 4,
6491 : sNativeProperties_sortedPropertyIndices,
6492 : {
6493 : { sConstants, &sNativeProperties_propertyInfos[0] }
6494 : }
6495 : };
6496 : static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
6497 : "We have a property info count that is oversized");
6498 :
6499 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
6500 : {
6501 : "WEBGL_color_buffer_floatPrototype",
6502 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
6503 : JS_NULL_CLASS_OPS,
6504 : JS_NULL_CLASS_SPEC,
6505 : JS_NULL_CLASS_EXT,
6506 : JS_NULL_OBJECT_OPS
6507 : },
6508 : eInterfacePrototype,
6509 : false,
6510 : prototypes::id::WEBGL_color_buffer_float,
6511 : PrototypeTraits<prototypes::id::WEBGL_color_buffer_float>::Depth,
6512 : sNativePropertyHooks,
6513 : "[object WEBGL_color_buffer_floatPrototype]",
6514 : JS::GetRealmObjectPrototype
6515 : };
6516 :
6517 : static const js::ClassOps sClassOps = {
6518 : _addProperty, /* addProperty */
6519 : nullptr, /* delProperty */
6520 : nullptr, /* getProperty */
6521 : nullptr, /* setProperty */
6522 : nullptr, /* enumerate */
6523 : nullptr, /* newEnumerate */
6524 : nullptr, /* resolve */
6525 : nullptr, /* mayResolve */
6526 : _finalize, /* finalize */
6527 : nullptr, /* call */
6528 : nullptr, /* hasInstance */
6529 : nullptr, /* construct */
6530 : nullptr, /* trace */
6531 : };
6532 :
6533 : static const js::ClassExtension sClassExtension = {
6534 : nullptr, /* weakmapKeyDelegateOp */
6535 : _objectMoved /* objectMovedOp */
6536 : };
6537 :
6538 : static const DOMJSClass sClass = {
6539 : { "WEBGL_color_buffer_float",
6540 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
6541 : &sClassOps,
6542 : JS_NULL_CLASS_SPEC,
6543 : &sClassExtension,
6544 : JS_NULL_OBJECT_OPS
6545 : },
6546 : { prototypes::id::WEBGL_color_buffer_float, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
6547 : IsBaseOf<nsISupports, mozilla::WebGLExtensionColorBufferFloat >::value,
6548 : sNativePropertyHooks,
6549 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionColorBufferFloat>::Get,
6550 : GetProtoObjectHandle,
6551 : GetCCParticipant<mozilla::WebGLExtensionColorBufferFloat>::Get()
6552 : };
6553 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
6554 : "Must have the right minimal number of reserved slots.");
6555 : static_assert(1 >= 1,
6556 : "Must have enough reserved slots.");
6557 :
6558 : const JSClass*
6559 0 : GetJSClass()
6560 : {
6561 0 : return sClass.ToJSClass();
6562 : }
6563 :
6564 : bool
6565 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionColorBufferFloat* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
6566 : {
6567 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionColorBufferFloat*>(aObject) ==
6568 : reinterpret_cast<mozilla::WebGLExtensionColorBufferFloat*>(aObject),
6569 : "Multiple inheritance for mozilla::WebGLExtensionColorBufferFloat is broken.");
6570 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
6571 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
6572 0 : MOZ_ASSERT(!aCache->GetWrapper(),
6573 : "You should probably not be using Wrap() directly; use "
6574 : "GetOrCreateDOMReflector instead");
6575 :
6576 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
6577 : "nsISupports must be on our primary inheritance chain");
6578 :
6579 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
6580 0 : if (!global) {
6581 0 : return false;
6582 : }
6583 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
6584 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
6585 :
6586 : // That might have ended up wrapping us already, due to the wonders
6587 : // of XBL. Check for that, and bail out as needed.
6588 0 : aReflector.set(aCache->GetWrapper());
6589 0 : if (aReflector) {
6590 : #ifdef DEBUG
6591 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
6592 : #endif // DEBUG
6593 0 : return true;
6594 : }
6595 :
6596 0 : JSAutoCompartment ac(aCx, global);
6597 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
6598 0 : if (!canonicalProto) {
6599 0 : return false;
6600 : }
6601 0 : JS::Rooted<JSObject*> proto(aCx);
6602 0 : if (aGivenProto) {
6603 0 : proto = aGivenProto;
6604 : // Unfortunately, while aGivenProto was in the compartment of aCx
6605 : // coming in, we changed compartments to that of "parent" so may need
6606 : // to wrap the proto here.
6607 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
6608 0 : if (!JS_WrapObject(aCx, &proto)) {
6609 0 : return false;
6610 : }
6611 : }
6612 : } else {
6613 0 : proto = canonicalProto;
6614 : }
6615 :
6616 0 : BindingJSObjectCreator<mozilla::WebGLExtensionColorBufferFloat> creator(aCx);
6617 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
6618 0 : if (!aReflector) {
6619 0 : return false;
6620 : }
6621 :
6622 0 : aCache->SetWrapper(aReflector);
6623 0 : creator.InitializationSucceeded();
6624 :
6625 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
6626 : aCache->GetWrapperPreserveColor() == aReflector);
6627 : // If proto != canonicalProto, we have to preserve our wrapper;
6628 : // otherwise we won't be able to properly recreate it later, since
6629 : // we won't know what proto to use. Note that we don't check
6630 : // aGivenProto here, since it's entirely possible (and even
6631 : // somewhat common) to have a non-null aGivenProto which is the
6632 : // same as canonicalProto.
6633 0 : if (proto != canonicalProto) {
6634 0 : PreserveWrapper(aObject);
6635 : }
6636 :
6637 0 : return true;
6638 : }
6639 :
6640 : const NativePropertyHooks sNativePropertyHooks[] = { {
6641 : nullptr,
6642 : nullptr,
6643 : nullptr,
6644 : { sNativeProperties.Upcast(), nullptr },
6645 : prototypes::id::WEBGL_color_buffer_float,
6646 : constructors::id::_ID_Count,
6647 : nullptr,
6648 : &DefaultXrayExpandoObjectClass
6649 : } };
6650 :
6651 : void
6652 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
6653 : {
6654 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
6655 0 : if (!parentProto) {
6656 0 : return;
6657 : }
6658 :
6659 : static bool sIdsInited = false;
6660 0 : if (!sIdsInited && NS_IsMainThread()) {
6661 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
6662 0 : return;
6663 : }
6664 0 : sIdsInited = true;
6665 : }
6666 :
6667 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WEBGL_color_buffer_float);
6668 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
6669 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
6670 : &sPrototypeClass.mBase, protoCache,
6671 : nullptr, nullptr, 0, nullptr,
6672 : interfaceCache,
6673 : sNativeProperties.Upcast(),
6674 : nullptr,
6675 : nullptr, aDefineOnGlobal,
6676 : nullptr,
6677 0 : false);
6678 : }
6679 :
6680 : JS::Handle<JSObject*>
6681 0 : GetProtoObjectHandle(JSContext* aCx)
6682 : {
6683 : /* Get the interface prototype object for this class. This will create the
6684 : object as needed. */
6685 0 : bool aDefineOnGlobal = true;
6686 :
6687 : /* Make sure our global is sane. Hopefully we can remove this sometime */
6688 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
6689 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
6690 0 : return nullptr;
6691 : }
6692 :
6693 : /* Check to see whether the interface objects are already installed */
6694 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
6695 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WEBGL_color_buffer_float)) {
6696 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
6697 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
6698 : }
6699 :
6700 : /*
6701 : * The object might _still_ be null, but that's OK.
6702 : *
6703 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
6704 : * traced by TraceProtoAndIfaceCache() and its contents are never
6705 : * changed after they have been set.
6706 : *
6707 : * Calling address() avoids the read read barrier that does gray
6708 : * unmarking, but it's not possible for the object to be gray here.
6709 : */
6710 :
6711 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WEBGL_color_buffer_float);
6712 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
6713 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
6714 : }
6715 :
6716 : } // namespace WEBGL_color_buffer_floatBinding
6717 :
6718 :
6719 :
6720 : namespace WEBGL_compressed_texture_astcBinding {
6721 :
6722 : static bool
6723 0 : getSupportedProfiles(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionCompressedTextureASTC* self, const JSJitMethodCallArgs& args)
6724 : {
6725 0 : Nullable<nsTArray<nsString>> result;
6726 0 : self->GetSupportedProfiles(result);
6727 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
6728 :
6729 0 : if (result.IsNull()) {
6730 0 : args.rval().setNull();
6731 0 : return true;
6732 : }
6733 :
6734 0 : uint32_t length = result.Value().Length();
6735 0 : JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
6736 0 : if (!returnArray) {
6737 0 : return false;
6738 : }
6739 : // Scope for 'tmp'
6740 : {
6741 0 : JS::Rooted<JS::Value> tmp(cx);
6742 0 : for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
6743 : // Control block to let us common up the JS_DefineElement calls when there
6744 : // are different ways to succeed at wrapping the object.
6745 : do {
6746 0 : if (!xpc::NonVoidStringToJsval(cx, result.Value()[sequenceIdx0], &tmp)) {
6747 0 : return false;
6748 : }
6749 0 : break;
6750 : } while (0);
6751 0 : if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
6752 : JSPROP_ENUMERATE)) {
6753 0 : return false;
6754 : }
6755 : }
6756 : }
6757 0 : args.rval().setObject(*returnArray);
6758 0 : return true;
6759 : }
6760 :
6761 : static const JSJitInfo getSupportedProfiles_methodinfo = {
6762 : { (JSJitGetterOp)getSupportedProfiles },
6763 : { prototypes::id::WEBGL_compressed_texture_astc },
6764 : { PrototypeTraits<prototypes::id::WEBGL_compressed_texture_astc>::Depth },
6765 : JSJitInfo::Method,
6766 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
6767 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
6768 : false, /* isInfallible. False in setters. */
6769 : false, /* isMovable. Not relevant for setters. */
6770 : false, /* isEliminatable. Not relevant for setters. */
6771 : false, /* isAlwaysInSlot. Only relevant for getters. */
6772 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
6773 : false, /* isTypedMethod. Only relevant for methods. */
6774 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
6775 : };
6776 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
6777 : static_assert(0 < 1, "There is no slot for us");
6778 :
6779 : static bool
6780 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
6781 : {
6782 0 : mozilla::WebGLExtensionCompressedTextureASTC* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureASTC>(obj);
6783 : // We don't want to preserve if we don't have a wrapper, and we
6784 : // obviously can't preserve if we're not initialized.
6785 0 : if (self && self->GetWrapperPreserveColor()) {
6786 0 : PreserveWrapper(self);
6787 : }
6788 0 : return true;
6789 : }
6790 :
6791 : static void
6792 0 : _finalize(js::FreeOp* fop, JSObject* obj)
6793 : {
6794 0 : mozilla::WebGLExtensionCompressedTextureASTC* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureASTC>(obj);
6795 0 : if (self) {
6796 0 : ClearWrapper(self, self, obj);
6797 0 : AddForDeferredFinalization<mozilla::WebGLExtensionCompressedTextureASTC>(self);
6798 : }
6799 0 : }
6800 :
6801 : static void
6802 0 : _objectMoved(JSObject* obj, const JSObject* old)
6803 : {
6804 0 : mozilla::WebGLExtensionCompressedTextureASTC* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureASTC>(obj);
6805 0 : if (self) {
6806 0 : UpdateWrapper(self, self, obj, old);
6807 : }
6808 0 : }
6809 :
6810 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
6811 : #if defined(__clang__)
6812 : #pragma clang diagnostic push
6813 : #pragma clang diagnostic ignored "-Wmissing-braces"
6814 : #endif
6815 : static const JSFunctionSpec sMethods_specs[] = {
6816 : JS_FNSPEC("getSupportedProfiles", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getSupportedProfiles_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
6817 : JS_FS_END
6818 : };
6819 : #if defined(__clang__)
6820 : #pragma clang diagnostic pop
6821 : #endif
6822 :
6823 :
6824 : // Can't be const because the pref-enabled boolean needs to be writable
6825 : static Prefable<const JSFunctionSpec> sMethods[] = {
6826 : { nullptr, &sMethods_specs[0] },
6827 : { nullptr, nullptr }
6828 : };
6829 :
6830 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
6831 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
6832 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
6833 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
6834 :
6835 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
6836 : #if defined(__clang__)
6837 : #pragma clang diagnostic push
6838 : #pragma clang diagnostic ignored "-Wmissing-braces"
6839 : #endif
6840 : static const ConstantSpec sConstants_specs[] = {
6841 : { "COMPRESSED_RGBA_ASTC_4x4_KHR", JS::NumberValue(37808U) },
6842 : { "COMPRESSED_RGBA_ASTC_5x4_KHR", JS::NumberValue(37809U) },
6843 : { "COMPRESSED_RGBA_ASTC_5x5_KHR", JS::NumberValue(37810U) },
6844 : { "COMPRESSED_RGBA_ASTC_6x5_KHR", JS::NumberValue(37811U) },
6845 : { "COMPRESSED_RGBA_ASTC_6x6_KHR", JS::NumberValue(37812U) },
6846 : { "COMPRESSED_RGBA_ASTC_8x5_KHR", JS::NumberValue(37813U) },
6847 : { "COMPRESSED_RGBA_ASTC_8x6_KHR", JS::NumberValue(37814U) },
6848 : { "COMPRESSED_RGBA_ASTC_8x8_KHR", JS::NumberValue(37815U) },
6849 : { "COMPRESSED_RGBA_ASTC_10x5_KHR", JS::NumberValue(37816U) },
6850 : { "COMPRESSED_RGBA_ASTC_10x6_KHR", JS::NumberValue(37817U) },
6851 : { "COMPRESSED_RGBA_ASTC_10x8_KHR", JS::NumberValue(37818U) },
6852 : { "COMPRESSED_RGBA_ASTC_10x10_KHR", JS::NumberValue(37819U) },
6853 : { "COMPRESSED_RGBA_ASTC_12x10_KHR", JS::NumberValue(37820U) },
6854 : { "COMPRESSED_RGBA_ASTC_12x12_KHR", JS::NumberValue(37821U) },
6855 : { "COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR", JS::NumberValue(37840U) },
6856 : { "COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR", JS::NumberValue(37841U) },
6857 : { "COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR", JS::NumberValue(37842U) },
6858 : { "COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR", JS::NumberValue(37843U) },
6859 : { "COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR", JS::NumberValue(37844U) },
6860 : { "COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR", JS::NumberValue(37845U) },
6861 : { "COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR", JS::NumberValue(37846U) },
6862 : { "COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR", JS::NumberValue(37847U) },
6863 : { "COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR", JS::NumberValue(37848U) },
6864 : { "COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR", JS::NumberValue(37849U) },
6865 : { "COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR", JS::NumberValue(37850U) },
6866 : { "COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR", JS::NumberValue(37851U) },
6867 : { "COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR", JS::NumberValue(37852U) },
6868 : { "COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR", JS::NumberValue(37853U) },
6869 : { 0, JS::UndefinedValue() }
6870 : };
6871 : #if defined(__clang__)
6872 : #pragma clang diagnostic pop
6873 : #endif
6874 :
6875 :
6876 : // Can't be const because the pref-enabled boolean needs to be writable
6877 : static Prefable<const ConstantSpec> sConstants[] = {
6878 : { nullptr, &sConstants_specs[0] },
6879 : { nullptr, nullptr }
6880 : };
6881 :
6882 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
6883 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
6884 : static_assert(28 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
6885 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
6886 :
6887 :
6888 : static uint16_t sNativeProperties_sortedPropertyIndices[29];
6889 : static PropertyInfo sNativeProperties_propertyInfos[29];
6890 :
6891 : static const NativePropertiesN<2> sNativeProperties = {
6892 : false, 0,
6893 : false, 0,
6894 : true, 0 /* sMethods */,
6895 : false, 0,
6896 : false, 0,
6897 : false, 0,
6898 : true, 1 /* sConstants */,
6899 : -1,
6900 : 29,
6901 : sNativeProperties_sortedPropertyIndices,
6902 : {
6903 : { sMethods, &sNativeProperties_propertyInfos[0] },
6904 : { sConstants, &sNativeProperties_propertyInfos[1] }
6905 : }
6906 : };
6907 : static_assert(29 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
6908 : "We have a property info count that is oversized");
6909 :
6910 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
6911 : {
6912 : "WEBGL_compressed_texture_astcPrototype",
6913 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
6914 : JS_NULL_CLASS_OPS,
6915 : JS_NULL_CLASS_SPEC,
6916 : JS_NULL_CLASS_EXT,
6917 : JS_NULL_OBJECT_OPS
6918 : },
6919 : eInterfacePrototype,
6920 : false,
6921 : prototypes::id::WEBGL_compressed_texture_astc,
6922 : PrototypeTraits<prototypes::id::WEBGL_compressed_texture_astc>::Depth,
6923 : sNativePropertyHooks,
6924 : "[object WEBGL_compressed_texture_astcPrototype]",
6925 : JS::GetRealmObjectPrototype
6926 : };
6927 :
6928 : static const js::ClassOps sClassOps = {
6929 : _addProperty, /* addProperty */
6930 : nullptr, /* delProperty */
6931 : nullptr, /* getProperty */
6932 : nullptr, /* setProperty */
6933 : nullptr, /* enumerate */
6934 : nullptr, /* newEnumerate */
6935 : nullptr, /* resolve */
6936 : nullptr, /* mayResolve */
6937 : _finalize, /* finalize */
6938 : nullptr, /* call */
6939 : nullptr, /* hasInstance */
6940 : nullptr, /* construct */
6941 : nullptr, /* trace */
6942 : };
6943 :
6944 : static const js::ClassExtension sClassExtension = {
6945 : nullptr, /* weakmapKeyDelegateOp */
6946 : _objectMoved /* objectMovedOp */
6947 : };
6948 :
6949 : static const DOMJSClass sClass = {
6950 : { "WEBGL_compressed_texture_astc",
6951 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
6952 : &sClassOps,
6953 : JS_NULL_CLASS_SPEC,
6954 : &sClassExtension,
6955 : JS_NULL_OBJECT_OPS
6956 : },
6957 : { prototypes::id::WEBGL_compressed_texture_astc, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
6958 : IsBaseOf<nsISupports, mozilla::WebGLExtensionCompressedTextureASTC >::value,
6959 : sNativePropertyHooks,
6960 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionCompressedTextureASTC>::Get,
6961 : GetProtoObjectHandle,
6962 : GetCCParticipant<mozilla::WebGLExtensionCompressedTextureASTC>::Get()
6963 : };
6964 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
6965 : "Must have the right minimal number of reserved slots.");
6966 : static_assert(1 >= 1,
6967 : "Must have enough reserved slots.");
6968 :
6969 : const JSClass*
6970 0 : GetJSClass()
6971 : {
6972 0 : return sClass.ToJSClass();
6973 : }
6974 :
6975 : bool
6976 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionCompressedTextureASTC* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
6977 : {
6978 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionCompressedTextureASTC*>(aObject) ==
6979 : reinterpret_cast<mozilla::WebGLExtensionCompressedTextureASTC*>(aObject),
6980 : "Multiple inheritance for mozilla::WebGLExtensionCompressedTextureASTC is broken.");
6981 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
6982 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
6983 0 : MOZ_ASSERT(!aCache->GetWrapper(),
6984 : "You should probably not be using Wrap() directly; use "
6985 : "GetOrCreateDOMReflector instead");
6986 :
6987 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
6988 : "nsISupports must be on our primary inheritance chain");
6989 :
6990 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
6991 0 : if (!global) {
6992 0 : return false;
6993 : }
6994 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
6995 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
6996 :
6997 : // That might have ended up wrapping us already, due to the wonders
6998 : // of XBL. Check for that, and bail out as needed.
6999 0 : aReflector.set(aCache->GetWrapper());
7000 0 : if (aReflector) {
7001 : #ifdef DEBUG
7002 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
7003 : #endif // DEBUG
7004 0 : return true;
7005 : }
7006 :
7007 0 : JSAutoCompartment ac(aCx, global);
7008 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
7009 0 : if (!canonicalProto) {
7010 0 : return false;
7011 : }
7012 0 : JS::Rooted<JSObject*> proto(aCx);
7013 0 : if (aGivenProto) {
7014 0 : proto = aGivenProto;
7015 : // Unfortunately, while aGivenProto was in the compartment of aCx
7016 : // coming in, we changed compartments to that of "parent" so may need
7017 : // to wrap the proto here.
7018 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
7019 0 : if (!JS_WrapObject(aCx, &proto)) {
7020 0 : return false;
7021 : }
7022 : }
7023 : } else {
7024 0 : proto = canonicalProto;
7025 : }
7026 :
7027 0 : BindingJSObjectCreator<mozilla::WebGLExtensionCompressedTextureASTC> creator(aCx);
7028 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
7029 0 : if (!aReflector) {
7030 0 : return false;
7031 : }
7032 :
7033 0 : aCache->SetWrapper(aReflector);
7034 0 : creator.InitializationSucceeded();
7035 :
7036 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
7037 : aCache->GetWrapperPreserveColor() == aReflector);
7038 : // If proto != canonicalProto, we have to preserve our wrapper;
7039 : // otherwise we won't be able to properly recreate it later, since
7040 : // we won't know what proto to use. Note that we don't check
7041 : // aGivenProto here, since it's entirely possible (and even
7042 : // somewhat common) to have a non-null aGivenProto which is the
7043 : // same as canonicalProto.
7044 0 : if (proto != canonicalProto) {
7045 0 : PreserveWrapper(aObject);
7046 : }
7047 :
7048 0 : return true;
7049 : }
7050 :
7051 : const NativePropertyHooks sNativePropertyHooks[] = { {
7052 : nullptr,
7053 : nullptr,
7054 : nullptr,
7055 : { sNativeProperties.Upcast(), nullptr },
7056 : prototypes::id::WEBGL_compressed_texture_astc,
7057 : constructors::id::_ID_Count,
7058 : nullptr,
7059 : &DefaultXrayExpandoObjectClass
7060 : } };
7061 :
7062 : void
7063 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
7064 : {
7065 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
7066 0 : if (!parentProto) {
7067 0 : return;
7068 : }
7069 :
7070 : static bool sIdsInited = false;
7071 0 : if (!sIdsInited && NS_IsMainThread()) {
7072 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
7073 0 : return;
7074 : }
7075 0 : sIdsInited = true;
7076 : }
7077 :
7078 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WEBGL_compressed_texture_astc);
7079 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
7080 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
7081 : &sPrototypeClass.mBase, protoCache,
7082 : nullptr, nullptr, 0, nullptr,
7083 : interfaceCache,
7084 : sNativeProperties.Upcast(),
7085 : nullptr,
7086 : nullptr, aDefineOnGlobal,
7087 : nullptr,
7088 0 : false);
7089 : }
7090 :
7091 : JS::Handle<JSObject*>
7092 0 : GetProtoObjectHandle(JSContext* aCx)
7093 : {
7094 : /* Get the interface prototype object for this class. This will create the
7095 : object as needed. */
7096 0 : bool aDefineOnGlobal = true;
7097 :
7098 : /* Make sure our global is sane. Hopefully we can remove this sometime */
7099 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
7100 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
7101 0 : return nullptr;
7102 : }
7103 :
7104 : /* Check to see whether the interface objects are already installed */
7105 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
7106 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WEBGL_compressed_texture_astc)) {
7107 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
7108 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
7109 : }
7110 :
7111 : /*
7112 : * The object might _still_ be null, but that's OK.
7113 : *
7114 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
7115 : * traced by TraceProtoAndIfaceCache() and its contents are never
7116 : * changed after they have been set.
7117 : *
7118 : * Calling address() avoids the read read barrier that does gray
7119 : * unmarking, but it's not possible for the object to be gray here.
7120 : */
7121 :
7122 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WEBGL_compressed_texture_astc);
7123 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
7124 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
7125 : }
7126 :
7127 : } // namespace WEBGL_compressed_texture_astcBinding
7128 :
7129 :
7130 :
7131 : namespace WEBGL_compressed_texture_atcBinding {
7132 :
7133 : static bool
7134 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
7135 : {
7136 0 : mozilla::WebGLExtensionCompressedTextureATC* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureATC>(obj);
7137 : // We don't want to preserve if we don't have a wrapper, and we
7138 : // obviously can't preserve if we're not initialized.
7139 0 : if (self && self->GetWrapperPreserveColor()) {
7140 0 : PreserveWrapper(self);
7141 : }
7142 0 : return true;
7143 : }
7144 :
7145 : static void
7146 0 : _finalize(js::FreeOp* fop, JSObject* obj)
7147 : {
7148 0 : mozilla::WebGLExtensionCompressedTextureATC* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureATC>(obj);
7149 0 : if (self) {
7150 0 : ClearWrapper(self, self, obj);
7151 0 : AddForDeferredFinalization<mozilla::WebGLExtensionCompressedTextureATC>(self);
7152 : }
7153 0 : }
7154 :
7155 : static void
7156 0 : _objectMoved(JSObject* obj, const JSObject* old)
7157 : {
7158 0 : mozilla::WebGLExtensionCompressedTextureATC* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureATC>(obj);
7159 0 : if (self) {
7160 0 : UpdateWrapper(self, self, obj, old);
7161 : }
7162 0 : }
7163 :
7164 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
7165 : #if defined(__clang__)
7166 : #pragma clang diagnostic push
7167 : #pragma clang diagnostic ignored "-Wmissing-braces"
7168 : #endif
7169 : static const ConstantSpec sConstants_specs[] = {
7170 : { "COMPRESSED_RGB_ATC_WEBGL", JS::NumberValue(35986U) },
7171 : { "COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL", JS::NumberValue(35987U) },
7172 : { "COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL", JS::NumberValue(34798U) },
7173 : { 0, JS::UndefinedValue() }
7174 : };
7175 : #if defined(__clang__)
7176 : #pragma clang diagnostic pop
7177 : #endif
7178 :
7179 :
7180 : // Can't be const because the pref-enabled boolean needs to be writable
7181 : static Prefable<const ConstantSpec> sConstants[] = {
7182 : { nullptr, &sConstants_specs[0] },
7183 : { nullptr, nullptr }
7184 : };
7185 :
7186 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
7187 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
7188 : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
7189 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
7190 :
7191 :
7192 : static uint16_t sNativeProperties_sortedPropertyIndices[3];
7193 : static PropertyInfo sNativeProperties_propertyInfos[3];
7194 :
7195 : static const NativePropertiesN<1> sNativeProperties = {
7196 : false, 0,
7197 : false, 0,
7198 : false, 0,
7199 : false, 0,
7200 : false, 0,
7201 : false, 0,
7202 : true, 0 /* sConstants */,
7203 : -1,
7204 : 3,
7205 : sNativeProperties_sortedPropertyIndices,
7206 : {
7207 : { sConstants, &sNativeProperties_propertyInfos[0] }
7208 : }
7209 : };
7210 : static_assert(3 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
7211 : "We have a property info count that is oversized");
7212 :
7213 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
7214 : {
7215 : "WEBGL_compressed_texture_atcPrototype",
7216 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
7217 : JS_NULL_CLASS_OPS,
7218 : JS_NULL_CLASS_SPEC,
7219 : JS_NULL_CLASS_EXT,
7220 : JS_NULL_OBJECT_OPS
7221 : },
7222 : eInterfacePrototype,
7223 : false,
7224 : prototypes::id::WEBGL_compressed_texture_atc,
7225 : PrototypeTraits<prototypes::id::WEBGL_compressed_texture_atc>::Depth,
7226 : sNativePropertyHooks,
7227 : "[object WEBGL_compressed_texture_atcPrototype]",
7228 : JS::GetRealmObjectPrototype
7229 : };
7230 :
7231 : static const js::ClassOps sClassOps = {
7232 : _addProperty, /* addProperty */
7233 : nullptr, /* delProperty */
7234 : nullptr, /* getProperty */
7235 : nullptr, /* setProperty */
7236 : nullptr, /* enumerate */
7237 : nullptr, /* newEnumerate */
7238 : nullptr, /* resolve */
7239 : nullptr, /* mayResolve */
7240 : _finalize, /* finalize */
7241 : nullptr, /* call */
7242 : nullptr, /* hasInstance */
7243 : nullptr, /* construct */
7244 : nullptr, /* trace */
7245 : };
7246 :
7247 : static const js::ClassExtension sClassExtension = {
7248 : nullptr, /* weakmapKeyDelegateOp */
7249 : _objectMoved /* objectMovedOp */
7250 : };
7251 :
7252 : static const DOMJSClass sClass = {
7253 : { "WEBGL_compressed_texture_atc",
7254 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
7255 : &sClassOps,
7256 : JS_NULL_CLASS_SPEC,
7257 : &sClassExtension,
7258 : JS_NULL_OBJECT_OPS
7259 : },
7260 : { prototypes::id::WEBGL_compressed_texture_atc, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
7261 : IsBaseOf<nsISupports, mozilla::WebGLExtensionCompressedTextureATC >::value,
7262 : sNativePropertyHooks,
7263 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionCompressedTextureATC>::Get,
7264 : GetProtoObjectHandle,
7265 : GetCCParticipant<mozilla::WebGLExtensionCompressedTextureATC>::Get()
7266 : };
7267 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
7268 : "Must have the right minimal number of reserved slots.");
7269 : static_assert(1 >= 1,
7270 : "Must have enough reserved slots.");
7271 :
7272 : const JSClass*
7273 0 : GetJSClass()
7274 : {
7275 0 : return sClass.ToJSClass();
7276 : }
7277 :
7278 : bool
7279 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionCompressedTextureATC* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
7280 : {
7281 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionCompressedTextureATC*>(aObject) ==
7282 : reinterpret_cast<mozilla::WebGLExtensionCompressedTextureATC*>(aObject),
7283 : "Multiple inheritance for mozilla::WebGLExtensionCompressedTextureATC is broken.");
7284 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
7285 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
7286 0 : MOZ_ASSERT(!aCache->GetWrapper(),
7287 : "You should probably not be using Wrap() directly; use "
7288 : "GetOrCreateDOMReflector instead");
7289 :
7290 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
7291 : "nsISupports must be on our primary inheritance chain");
7292 :
7293 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
7294 0 : if (!global) {
7295 0 : return false;
7296 : }
7297 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
7298 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
7299 :
7300 : // That might have ended up wrapping us already, due to the wonders
7301 : // of XBL. Check for that, and bail out as needed.
7302 0 : aReflector.set(aCache->GetWrapper());
7303 0 : if (aReflector) {
7304 : #ifdef DEBUG
7305 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
7306 : #endif // DEBUG
7307 0 : return true;
7308 : }
7309 :
7310 0 : JSAutoCompartment ac(aCx, global);
7311 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
7312 0 : if (!canonicalProto) {
7313 0 : return false;
7314 : }
7315 0 : JS::Rooted<JSObject*> proto(aCx);
7316 0 : if (aGivenProto) {
7317 0 : proto = aGivenProto;
7318 : // Unfortunately, while aGivenProto was in the compartment of aCx
7319 : // coming in, we changed compartments to that of "parent" so may need
7320 : // to wrap the proto here.
7321 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
7322 0 : if (!JS_WrapObject(aCx, &proto)) {
7323 0 : return false;
7324 : }
7325 : }
7326 : } else {
7327 0 : proto = canonicalProto;
7328 : }
7329 :
7330 0 : BindingJSObjectCreator<mozilla::WebGLExtensionCompressedTextureATC> creator(aCx);
7331 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
7332 0 : if (!aReflector) {
7333 0 : return false;
7334 : }
7335 :
7336 0 : aCache->SetWrapper(aReflector);
7337 0 : creator.InitializationSucceeded();
7338 :
7339 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
7340 : aCache->GetWrapperPreserveColor() == aReflector);
7341 : // If proto != canonicalProto, we have to preserve our wrapper;
7342 : // otherwise we won't be able to properly recreate it later, since
7343 : // we won't know what proto to use. Note that we don't check
7344 : // aGivenProto here, since it's entirely possible (and even
7345 : // somewhat common) to have a non-null aGivenProto which is the
7346 : // same as canonicalProto.
7347 0 : if (proto != canonicalProto) {
7348 0 : PreserveWrapper(aObject);
7349 : }
7350 :
7351 0 : return true;
7352 : }
7353 :
7354 : const NativePropertyHooks sNativePropertyHooks[] = { {
7355 : nullptr,
7356 : nullptr,
7357 : nullptr,
7358 : { sNativeProperties.Upcast(), nullptr },
7359 : prototypes::id::WEBGL_compressed_texture_atc,
7360 : constructors::id::_ID_Count,
7361 : nullptr,
7362 : &DefaultXrayExpandoObjectClass
7363 : } };
7364 :
7365 : void
7366 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
7367 : {
7368 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
7369 0 : if (!parentProto) {
7370 0 : return;
7371 : }
7372 :
7373 : static bool sIdsInited = false;
7374 0 : if (!sIdsInited && NS_IsMainThread()) {
7375 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
7376 0 : return;
7377 : }
7378 0 : sIdsInited = true;
7379 : }
7380 :
7381 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WEBGL_compressed_texture_atc);
7382 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
7383 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
7384 : &sPrototypeClass.mBase, protoCache,
7385 : nullptr, nullptr, 0, nullptr,
7386 : interfaceCache,
7387 : sNativeProperties.Upcast(),
7388 : nullptr,
7389 : nullptr, aDefineOnGlobal,
7390 : nullptr,
7391 0 : false);
7392 : }
7393 :
7394 : JS::Handle<JSObject*>
7395 0 : GetProtoObjectHandle(JSContext* aCx)
7396 : {
7397 : /* Get the interface prototype object for this class. This will create the
7398 : object as needed. */
7399 0 : bool aDefineOnGlobal = true;
7400 :
7401 : /* Make sure our global is sane. Hopefully we can remove this sometime */
7402 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
7403 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
7404 0 : return nullptr;
7405 : }
7406 :
7407 : /* Check to see whether the interface objects are already installed */
7408 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
7409 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WEBGL_compressed_texture_atc)) {
7410 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
7411 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
7412 : }
7413 :
7414 : /*
7415 : * The object might _still_ be null, but that's OK.
7416 : *
7417 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
7418 : * traced by TraceProtoAndIfaceCache() and its contents are never
7419 : * changed after they have been set.
7420 : *
7421 : * Calling address() avoids the read read barrier that does gray
7422 : * unmarking, but it's not possible for the object to be gray here.
7423 : */
7424 :
7425 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WEBGL_compressed_texture_atc);
7426 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
7427 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
7428 : }
7429 :
7430 : } // namespace WEBGL_compressed_texture_atcBinding
7431 :
7432 :
7433 :
7434 : namespace WEBGL_compressed_texture_etcBinding {
7435 :
7436 : static bool
7437 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
7438 : {
7439 0 : mozilla::WebGLExtensionCompressedTextureES3* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureES3>(obj);
7440 : // We don't want to preserve if we don't have a wrapper, and we
7441 : // obviously can't preserve if we're not initialized.
7442 0 : if (self && self->GetWrapperPreserveColor()) {
7443 0 : PreserveWrapper(self);
7444 : }
7445 0 : return true;
7446 : }
7447 :
7448 : static void
7449 0 : _finalize(js::FreeOp* fop, JSObject* obj)
7450 : {
7451 0 : mozilla::WebGLExtensionCompressedTextureES3* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureES3>(obj);
7452 0 : if (self) {
7453 0 : ClearWrapper(self, self, obj);
7454 0 : AddForDeferredFinalization<mozilla::WebGLExtensionCompressedTextureES3>(self);
7455 : }
7456 0 : }
7457 :
7458 : static void
7459 0 : _objectMoved(JSObject* obj, const JSObject* old)
7460 : {
7461 0 : mozilla::WebGLExtensionCompressedTextureES3* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureES3>(obj);
7462 0 : if (self) {
7463 0 : UpdateWrapper(self, self, obj, old);
7464 : }
7465 0 : }
7466 :
7467 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
7468 : #if defined(__clang__)
7469 : #pragma clang diagnostic push
7470 : #pragma clang diagnostic ignored "-Wmissing-braces"
7471 : #endif
7472 : static const ConstantSpec sConstants_specs[] = {
7473 : { "COMPRESSED_R11_EAC", JS::NumberValue(37488U) },
7474 : { "COMPRESSED_SIGNED_R11_EAC", JS::NumberValue(37489U) },
7475 : { "COMPRESSED_RG11_EAC", JS::NumberValue(37490U) },
7476 : { "COMPRESSED_SIGNED_RG11_EAC", JS::NumberValue(37491U) },
7477 : { "COMPRESSED_RGB8_ETC2", JS::NumberValue(37492U) },
7478 : { "COMPRESSED_SRGB8_ETC2", JS::NumberValue(37493U) },
7479 : { "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", JS::NumberValue(37494U) },
7480 : { "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", JS::NumberValue(37495U) },
7481 : { "COMPRESSED_RGBA8_ETC2_EAC", JS::NumberValue(37496U) },
7482 : { "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", JS::NumberValue(37497U) },
7483 : { 0, JS::UndefinedValue() }
7484 : };
7485 : #if defined(__clang__)
7486 : #pragma clang diagnostic pop
7487 : #endif
7488 :
7489 :
7490 : // Can't be const because the pref-enabled boolean needs to be writable
7491 : static Prefable<const ConstantSpec> sConstants[] = {
7492 : { nullptr, &sConstants_specs[0] },
7493 : { nullptr, nullptr }
7494 : };
7495 :
7496 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
7497 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
7498 : static_assert(10 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
7499 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
7500 :
7501 :
7502 : static uint16_t sNativeProperties_sortedPropertyIndices[10];
7503 : static PropertyInfo sNativeProperties_propertyInfos[10];
7504 :
7505 : static const NativePropertiesN<1> sNativeProperties = {
7506 : false, 0,
7507 : false, 0,
7508 : false, 0,
7509 : false, 0,
7510 : false, 0,
7511 : false, 0,
7512 : true, 0 /* sConstants */,
7513 : -1,
7514 : 10,
7515 : sNativeProperties_sortedPropertyIndices,
7516 : {
7517 : { sConstants, &sNativeProperties_propertyInfos[0] }
7518 : }
7519 : };
7520 : static_assert(10 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
7521 : "We have a property info count that is oversized");
7522 :
7523 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
7524 : {
7525 : "WEBGL_compressed_texture_etcPrototype",
7526 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
7527 : JS_NULL_CLASS_OPS,
7528 : JS_NULL_CLASS_SPEC,
7529 : JS_NULL_CLASS_EXT,
7530 : JS_NULL_OBJECT_OPS
7531 : },
7532 : eInterfacePrototype,
7533 : false,
7534 : prototypes::id::WEBGL_compressed_texture_etc,
7535 : PrototypeTraits<prototypes::id::WEBGL_compressed_texture_etc>::Depth,
7536 : sNativePropertyHooks,
7537 : "[object WEBGL_compressed_texture_etcPrototype]",
7538 : JS::GetRealmObjectPrototype
7539 : };
7540 :
7541 : static const js::ClassOps sClassOps = {
7542 : _addProperty, /* addProperty */
7543 : nullptr, /* delProperty */
7544 : nullptr, /* getProperty */
7545 : nullptr, /* setProperty */
7546 : nullptr, /* enumerate */
7547 : nullptr, /* newEnumerate */
7548 : nullptr, /* resolve */
7549 : nullptr, /* mayResolve */
7550 : _finalize, /* finalize */
7551 : nullptr, /* call */
7552 : nullptr, /* hasInstance */
7553 : nullptr, /* construct */
7554 : nullptr, /* trace */
7555 : };
7556 :
7557 : static const js::ClassExtension sClassExtension = {
7558 : nullptr, /* weakmapKeyDelegateOp */
7559 : _objectMoved /* objectMovedOp */
7560 : };
7561 :
7562 : static const DOMJSClass sClass = {
7563 : { "WEBGL_compressed_texture_etc",
7564 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
7565 : &sClassOps,
7566 : JS_NULL_CLASS_SPEC,
7567 : &sClassExtension,
7568 : JS_NULL_OBJECT_OPS
7569 : },
7570 : { prototypes::id::WEBGL_compressed_texture_etc, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
7571 : IsBaseOf<nsISupports, mozilla::WebGLExtensionCompressedTextureES3 >::value,
7572 : sNativePropertyHooks,
7573 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionCompressedTextureES3>::Get,
7574 : GetProtoObjectHandle,
7575 : GetCCParticipant<mozilla::WebGLExtensionCompressedTextureES3>::Get()
7576 : };
7577 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
7578 : "Must have the right minimal number of reserved slots.");
7579 : static_assert(1 >= 1,
7580 : "Must have enough reserved slots.");
7581 :
7582 : const JSClass*
7583 0 : GetJSClass()
7584 : {
7585 0 : return sClass.ToJSClass();
7586 : }
7587 :
7588 : bool
7589 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionCompressedTextureES3* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
7590 : {
7591 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionCompressedTextureES3*>(aObject) ==
7592 : reinterpret_cast<mozilla::WebGLExtensionCompressedTextureES3*>(aObject),
7593 : "Multiple inheritance for mozilla::WebGLExtensionCompressedTextureES3 is broken.");
7594 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
7595 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
7596 0 : MOZ_ASSERT(!aCache->GetWrapper(),
7597 : "You should probably not be using Wrap() directly; use "
7598 : "GetOrCreateDOMReflector instead");
7599 :
7600 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
7601 : "nsISupports must be on our primary inheritance chain");
7602 :
7603 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
7604 0 : if (!global) {
7605 0 : return false;
7606 : }
7607 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
7608 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
7609 :
7610 : // That might have ended up wrapping us already, due to the wonders
7611 : // of XBL. Check for that, and bail out as needed.
7612 0 : aReflector.set(aCache->GetWrapper());
7613 0 : if (aReflector) {
7614 : #ifdef DEBUG
7615 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
7616 : #endif // DEBUG
7617 0 : return true;
7618 : }
7619 :
7620 0 : JSAutoCompartment ac(aCx, global);
7621 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
7622 0 : if (!canonicalProto) {
7623 0 : return false;
7624 : }
7625 0 : JS::Rooted<JSObject*> proto(aCx);
7626 0 : if (aGivenProto) {
7627 0 : proto = aGivenProto;
7628 : // Unfortunately, while aGivenProto was in the compartment of aCx
7629 : // coming in, we changed compartments to that of "parent" so may need
7630 : // to wrap the proto here.
7631 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
7632 0 : if (!JS_WrapObject(aCx, &proto)) {
7633 0 : return false;
7634 : }
7635 : }
7636 : } else {
7637 0 : proto = canonicalProto;
7638 : }
7639 :
7640 0 : BindingJSObjectCreator<mozilla::WebGLExtensionCompressedTextureES3> creator(aCx);
7641 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
7642 0 : if (!aReflector) {
7643 0 : return false;
7644 : }
7645 :
7646 0 : aCache->SetWrapper(aReflector);
7647 0 : creator.InitializationSucceeded();
7648 :
7649 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
7650 : aCache->GetWrapperPreserveColor() == aReflector);
7651 : // If proto != canonicalProto, we have to preserve our wrapper;
7652 : // otherwise we won't be able to properly recreate it later, since
7653 : // we won't know what proto to use. Note that we don't check
7654 : // aGivenProto here, since it's entirely possible (and even
7655 : // somewhat common) to have a non-null aGivenProto which is the
7656 : // same as canonicalProto.
7657 0 : if (proto != canonicalProto) {
7658 0 : PreserveWrapper(aObject);
7659 : }
7660 :
7661 0 : return true;
7662 : }
7663 :
7664 : const NativePropertyHooks sNativePropertyHooks[] = { {
7665 : nullptr,
7666 : nullptr,
7667 : nullptr,
7668 : { sNativeProperties.Upcast(), nullptr },
7669 : prototypes::id::WEBGL_compressed_texture_etc,
7670 : constructors::id::_ID_Count,
7671 : nullptr,
7672 : &DefaultXrayExpandoObjectClass
7673 : } };
7674 :
7675 : void
7676 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
7677 : {
7678 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
7679 0 : if (!parentProto) {
7680 0 : return;
7681 : }
7682 :
7683 : static bool sIdsInited = false;
7684 0 : if (!sIdsInited && NS_IsMainThread()) {
7685 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
7686 0 : return;
7687 : }
7688 0 : sIdsInited = true;
7689 : }
7690 :
7691 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WEBGL_compressed_texture_etc);
7692 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
7693 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
7694 : &sPrototypeClass.mBase, protoCache,
7695 : nullptr, nullptr, 0, nullptr,
7696 : interfaceCache,
7697 : sNativeProperties.Upcast(),
7698 : nullptr,
7699 : nullptr, aDefineOnGlobal,
7700 : nullptr,
7701 0 : false);
7702 : }
7703 :
7704 : JS::Handle<JSObject*>
7705 0 : GetProtoObjectHandle(JSContext* aCx)
7706 : {
7707 : /* Get the interface prototype object for this class. This will create the
7708 : object as needed. */
7709 0 : bool aDefineOnGlobal = true;
7710 :
7711 : /* Make sure our global is sane. Hopefully we can remove this sometime */
7712 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
7713 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
7714 0 : return nullptr;
7715 : }
7716 :
7717 : /* Check to see whether the interface objects are already installed */
7718 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
7719 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WEBGL_compressed_texture_etc)) {
7720 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
7721 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
7722 : }
7723 :
7724 : /*
7725 : * The object might _still_ be null, but that's OK.
7726 : *
7727 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
7728 : * traced by TraceProtoAndIfaceCache() and its contents are never
7729 : * changed after they have been set.
7730 : *
7731 : * Calling address() avoids the read read barrier that does gray
7732 : * unmarking, but it's not possible for the object to be gray here.
7733 : */
7734 :
7735 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WEBGL_compressed_texture_etc);
7736 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
7737 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
7738 : }
7739 :
7740 : } // namespace WEBGL_compressed_texture_etcBinding
7741 :
7742 :
7743 :
7744 : namespace WEBGL_compressed_texture_etc1Binding {
7745 :
7746 : static bool
7747 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
7748 : {
7749 0 : mozilla::WebGLExtensionCompressedTextureETC1* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureETC1>(obj);
7750 : // We don't want to preserve if we don't have a wrapper, and we
7751 : // obviously can't preserve if we're not initialized.
7752 0 : if (self && self->GetWrapperPreserveColor()) {
7753 0 : PreserveWrapper(self);
7754 : }
7755 0 : return true;
7756 : }
7757 :
7758 : static void
7759 0 : _finalize(js::FreeOp* fop, JSObject* obj)
7760 : {
7761 0 : mozilla::WebGLExtensionCompressedTextureETC1* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureETC1>(obj);
7762 0 : if (self) {
7763 0 : ClearWrapper(self, self, obj);
7764 0 : AddForDeferredFinalization<mozilla::WebGLExtensionCompressedTextureETC1>(self);
7765 : }
7766 0 : }
7767 :
7768 : static void
7769 0 : _objectMoved(JSObject* obj, const JSObject* old)
7770 : {
7771 0 : mozilla::WebGLExtensionCompressedTextureETC1* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureETC1>(obj);
7772 0 : if (self) {
7773 0 : UpdateWrapper(self, self, obj, old);
7774 : }
7775 0 : }
7776 :
7777 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
7778 : #if defined(__clang__)
7779 : #pragma clang diagnostic push
7780 : #pragma clang diagnostic ignored "-Wmissing-braces"
7781 : #endif
7782 : static const ConstantSpec sConstants_specs[] = {
7783 : { "COMPRESSED_RGB_ETC1_WEBGL", JS::NumberValue(36196U) },
7784 : { 0, JS::UndefinedValue() }
7785 : };
7786 : #if defined(__clang__)
7787 : #pragma clang diagnostic pop
7788 : #endif
7789 :
7790 :
7791 : // Can't be const because the pref-enabled boolean needs to be writable
7792 : static Prefable<const ConstantSpec> sConstants[] = {
7793 : { nullptr, &sConstants_specs[0] },
7794 : { nullptr, nullptr }
7795 : };
7796 :
7797 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
7798 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
7799 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
7800 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
7801 :
7802 :
7803 : static uint16_t sNativeProperties_sortedPropertyIndices[1];
7804 : static PropertyInfo sNativeProperties_propertyInfos[1];
7805 :
7806 : static const NativePropertiesN<1> sNativeProperties = {
7807 : false, 0,
7808 : false, 0,
7809 : false, 0,
7810 : false, 0,
7811 : false, 0,
7812 : false, 0,
7813 : true, 0 /* sConstants */,
7814 : -1,
7815 : 1,
7816 : sNativeProperties_sortedPropertyIndices,
7817 : {
7818 : { sConstants, &sNativeProperties_propertyInfos[0] }
7819 : }
7820 : };
7821 : static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
7822 : "We have a property info count that is oversized");
7823 :
7824 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
7825 : {
7826 : "WEBGL_compressed_texture_etc1Prototype",
7827 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
7828 : JS_NULL_CLASS_OPS,
7829 : JS_NULL_CLASS_SPEC,
7830 : JS_NULL_CLASS_EXT,
7831 : JS_NULL_OBJECT_OPS
7832 : },
7833 : eInterfacePrototype,
7834 : false,
7835 : prototypes::id::WEBGL_compressed_texture_etc1,
7836 : PrototypeTraits<prototypes::id::WEBGL_compressed_texture_etc1>::Depth,
7837 : sNativePropertyHooks,
7838 : "[object WEBGL_compressed_texture_etc1Prototype]",
7839 : JS::GetRealmObjectPrototype
7840 : };
7841 :
7842 : static const js::ClassOps sClassOps = {
7843 : _addProperty, /* addProperty */
7844 : nullptr, /* delProperty */
7845 : nullptr, /* getProperty */
7846 : nullptr, /* setProperty */
7847 : nullptr, /* enumerate */
7848 : nullptr, /* newEnumerate */
7849 : nullptr, /* resolve */
7850 : nullptr, /* mayResolve */
7851 : _finalize, /* finalize */
7852 : nullptr, /* call */
7853 : nullptr, /* hasInstance */
7854 : nullptr, /* construct */
7855 : nullptr, /* trace */
7856 : };
7857 :
7858 : static const js::ClassExtension sClassExtension = {
7859 : nullptr, /* weakmapKeyDelegateOp */
7860 : _objectMoved /* objectMovedOp */
7861 : };
7862 :
7863 : static const DOMJSClass sClass = {
7864 : { "WEBGL_compressed_texture_etc1",
7865 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
7866 : &sClassOps,
7867 : JS_NULL_CLASS_SPEC,
7868 : &sClassExtension,
7869 : JS_NULL_OBJECT_OPS
7870 : },
7871 : { prototypes::id::WEBGL_compressed_texture_etc1, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
7872 : IsBaseOf<nsISupports, mozilla::WebGLExtensionCompressedTextureETC1 >::value,
7873 : sNativePropertyHooks,
7874 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionCompressedTextureETC1>::Get,
7875 : GetProtoObjectHandle,
7876 : GetCCParticipant<mozilla::WebGLExtensionCompressedTextureETC1>::Get()
7877 : };
7878 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
7879 : "Must have the right minimal number of reserved slots.");
7880 : static_assert(1 >= 1,
7881 : "Must have enough reserved slots.");
7882 :
7883 : const JSClass*
7884 0 : GetJSClass()
7885 : {
7886 0 : return sClass.ToJSClass();
7887 : }
7888 :
7889 : bool
7890 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionCompressedTextureETC1* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
7891 : {
7892 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionCompressedTextureETC1*>(aObject) ==
7893 : reinterpret_cast<mozilla::WebGLExtensionCompressedTextureETC1*>(aObject),
7894 : "Multiple inheritance for mozilla::WebGLExtensionCompressedTextureETC1 is broken.");
7895 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
7896 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
7897 0 : MOZ_ASSERT(!aCache->GetWrapper(),
7898 : "You should probably not be using Wrap() directly; use "
7899 : "GetOrCreateDOMReflector instead");
7900 :
7901 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
7902 : "nsISupports must be on our primary inheritance chain");
7903 :
7904 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
7905 0 : if (!global) {
7906 0 : return false;
7907 : }
7908 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
7909 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
7910 :
7911 : // That might have ended up wrapping us already, due to the wonders
7912 : // of XBL. Check for that, and bail out as needed.
7913 0 : aReflector.set(aCache->GetWrapper());
7914 0 : if (aReflector) {
7915 : #ifdef DEBUG
7916 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
7917 : #endif // DEBUG
7918 0 : return true;
7919 : }
7920 :
7921 0 : JSAutoCompartment ac(aCx, global);
7922 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
7923 0 : if (!canonicalProto) {
7924 0 : return false;
7925 : }
7926 0 : JS::Rooted<JSObject*> proto(aCx);
7927 0 : if (aGivenProto) {
7928 0 : proto = aGivenProto;
7929 : // Unfortunately, while aGivenProto was in the compartment of aCx
7930 : // coming in, we changed compartments to that of "parent" so may need
7931 : // to wrap the proto here.
7932 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
7933 0 : if (!JS_WrapObject(aCx, &proto)) {
7934 0 : return false;
7935 : }
7936 : }
7937 : } else {
7938 0 : proto = canonicalProto;
7939 : }
7940 :
7941 0 : BindingJSObjectCreator<mozilla::WebGLExtensionCompressedTextureETC1> creator(aCx);
7942 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
7943 0 : if (!aReflector) {
7944 0 : return false;
7945 : }
7946 :
7947 0 : aCache->SetWrapper(aReflector);
7948 0 : creator.InitializationSucceeded();
7949 :
7950 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
7951 : aCache->GetWrapperPreserveColor() == aReflector);
7952 : // If proto != canonicalProto, we have to preserve our wrapper;
7953 : // otherwise we won't be able to properly recreate it later, since
7954 : // we won't know what proto to use. Note that we don't check
7955 : // aGivenProto here, since it's entirely possible (and even
7956 : // somewhat common) to have a non-null aGivenProto which is the
7957 : // same as canonicalProto.
7958 0 : if (proto != canonicalProto) {
7959 0 : PreserveWrapper(aObject);
7960 : }
7961 :
7962 0 : return true;
7963 : }
7964 :
7965 : const NativePropertyHooks sNativePropertyHooks[] = { {
7966 : nullptr,
7967 : nullptr,
7968 : nullptr,
7969 : { sNativeProperties.Upcast(), nullptr },
7970 : prototypes::id::WEBGL_compressed_texture_etc1,
7971 : constructors::id::_ID_Count,
7972 : nullptr,
7973 : &DefaultXrayExpandoObjectClass
7974 : } };
7975 :
7976 : void
7977 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
7978 : {
7979 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
7980 0 : if (!parentProto) {
7981 0 : return;
7982 : }
7983 :
7984 : static bool sIdsInited = false;
7985 0 : if (!sIdsInited && NS_IsMainThread()) {
7986 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
7987 0 : return;
7988 : }
7989 0 : sIdsInited = true;
7990 : }
7991 :
7992 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WEBGL_compressed_texture_etc1);
7993 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
7994 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
7995 : &sPrototypeClass.mBase, protoCache,
7996 : nullptr, nullptr, 0, nullptr,
7997 : interfaceCache,
7998 : sNativeProperties.Upcast(),
7999 : nullptr,
8000 : nullptr, aDefineOnGlobal,
8001 : nullptr,
8002 0 : false);
8003 : }
8004 :
8005 : JS::Handle<JSObject*>
8006 0 : GetProtoObjectHandle(JSContext* aCx)
8007 : {
8008 : /* Get the interface prototype object for this class. This will create the
8009 : object as needed. */
8010 0 : bool aDefineOnGlobal = true;
8011 :
8012 : /* Make sure our global is sane. Hopefully we can remove this sometime */
8013 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
8014 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
8015 0 : return nullptr;
8016 : }
8017 :
8018 : /* Check to see whether the interface objects are already installed */
8019 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
8020 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WEBGL_compressed_texture_etc1)) {
8021 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
8022 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
8023 : }
8024 :
8025 : /*
8026 : * The object might _still_ be null, but that's OK.
8027 : *
8028 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
8029 : * traced by TraceProtoAndIfaceCache() and its contents are never
8030 : * changed after they have been set.
8031 : *
8032 : * Calling address() avoids the read read barrier that does gray
8033 : * unmarking, but it's not possible for the object to be gray here.
8034 : */
8035 :
8036 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WEBGL_compressed_texture_etc1);
8037 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
8038 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
8039 : }
8040 :
8041 : } // namespace WEBGL_compressed_texture_etc1Binding
8042 :
8043 :
8044 :
8045 : namespace WEBGL_compressed_texture_pvrtcBinding {
8046 :
8047 : static bool
8048 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
8049 : {
8050 0 : mozilla::WebGLExtensionCompressedTexturePVRTC* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTexturePVRTC>(obj);
8051 : // We don't want to preserve if we don't have a wrapper, and we
8052 : // obviously can't preserve if we're not initialized.
8053 0 : if (self && self->GetWrapperPreserveColor()) {
8054 0 : PreserveWrapper(self);
8055 : }
8056 0 : return true;
8057 : }
8058 :
8059 : static void
8060 0 : _finalize(js::FreeOp* fop, JSObject* obj)
8061 : {
8062 0 : mozilla::WebGLExtensionCompressedTexturePVRTC* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTexturePVRTC>(obj);
8063 0 : if (self) {
8064 0 : ClearWrapper(self, self, obj);
8065 0 : AddForDeferredFinalization<mozilla::WebGLExtensionCompressedTexturePVRTC>(self);
8066 : }
8067 0 : }
8068 :
8069 : static void
8070 0 : _objectMoved(JSObject* obj, const JSObject* old)
8071 : {
8072 0 : mozilla::WebGLExtensionCompressedTexturePVRTC* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTexturePVRTC>(obj);
8073 0 : if (self) {
8074 0 : UpdateWrapper(self, self, obj, old);
8075 : }
8076 0 : }
8077 :
8078 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
8079 : #if defined(__clang__)
8080 : #pragma clang diagnostic push
8081 : #pragma clang diagnostic ignored "-Wmissing-braces"
8082 : #endif
8083 : static const ConstantSpec sConstants_specs[] = {
8084 : { "COMPRESSED_RGB_PVRTC_4BPPV1_IMG", JS::NumberValue(35840U) },
8085 : { "COMPRESSED_RGB_PVRTC_2BPPV1_IMG", JS::NumberValue(35841U) },
8086 : { "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG", JS::NumberValue(35842U) },
8087 : { "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG", JS::NumberValue(35843U) },
8088 : { 0, JS::UndefinedValue() }
8089 : };
8090 : #if defined(__clang__)
8091 : #pragma clang diagnostic pop
8092 : #endif
8093 :
8094 :
8095 : // Can't be const because the pref-enabled boolean needs to be writable
8096 : static Prefable<const ConstantSpec> sConstants[] = {
8097 : { nullptr, &sConstants_specs[0] },
8098 : { nullptr, nullptr }
8099 : };
8100 :
8101 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
8102 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
8103 : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
8104 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
8105 :
8106 :
8107 : static uint16_t sNativeProperties_sortedPropertyIndices[4];
8108 : static PropertyInfo sNativeProperties_propertyInfos[4];
8109 :
8110 : static const NativePropertiesN<1> sNativeProperties = {
8111 : false, 0,
8112 : false, 0,
8113 : false, 0,
8114 : false, 0,
8115 : false, 0,
8116 : false, 0,
8117 : true, 0 /* sConstants */,
8118 : -1,
8119 : 4,
8120 : sNativeProperties_sortedPropertyIndices,
8121 : {
8122 : { sConstants, &sNativeProperties_propertyInfos[0] }
8123 : }
8124 : };
8125 : static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
8126 : "We have a property info count that is oversized");
8127 :
8128 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
8129 : {
8130 : "WEBGL_compressed_texture_pvrtcPrototype",
8131 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
8132 : JS_NULL_CLASS_OPS,
8133 : JS_NULL_CLASS_SPEC,
8134 : JS_NULL_CLASS_EXT,
8135 : JS_NULL_OBJECT_OPS
8136 : },
8137 : eInterfacePrototype,
8138 : false,
8139 : prototypes::id::WEBGL_compressed_texture_pvrtc,
8140 : PrototypeTraits<prototypes::id::WEBGL_compressed_texture_pvrtc>::Depth,
8141 : sNativePropertyHooks,
8142 : "[object WEBGL_compressed_texture_pvrtcPrototype]",
8143 : JS::GetRealmObjectPrototype
8144 : };
8145 :
8146 : static const js::ClassOps sClassOps = {
8147 : _addProperty, /* addProperty */
8148 : nullptr, /* delProperty */
8149 : nullptr, /* getProperty */
8150 : nullptr, /* setProperty */
8151 : nullptr, /* enumerate */
8152 : nullptr, /* newEnumerate */
8153 : nullptr, /* resolve */
8154 : nullptr, /* mayResolve */
8155 : _finalize, /* finalize */
8156 : nullptr, /* call */
8157 : nullptr, /* hasInstance */
8158 : nullptr, /* construct */
8159 : nullptr, /* trace */
8160 : };
8161 :
8162 : static const js::ClassExtension sClassExtension = {
8163 : nullptr, /* weakmapKeyDelegateOp */
8164 : _objectMoved /* objectMovedOp */
8165 : };
8166 :
8167 : static const DOMJSClass sClass = {
8168 : { "WEBGL_compressed_texture_pvrtc",
8169 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
8170 : &sClassOps,
8171 : JS_NULL_CLASS_SPEC,
8172 : &sClassExtension,
8173 : JS_NULL_OBJECT_OPS
8174 : },
8175 : { prototypes::id::WEBGL_compressed_texture_pvrtc, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
8176 : IsBaseOf<nsISupports, mozilla::WebGLExtensionCompressedTexturePVRTC >::value,
8177 : sNativePropertyHooks,
8178 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionCompressedTexturePVRTC>::Get,
8179 : GetProtoObjectHandle,
8180 : GetCCParticipant<mozilla::WebGLExtensionCompressedTexturePVRTC>::Get()
8181 : };
8182 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
8183 : "Must have the right minimal number of reserved slots.");
8184 : static_assert(1 >= 1,
8185 : "Must have enough reserved slots.");
8186 :
8187 : const JSClass*
8188 0 : GetJSClass()
8189 : {
8190 0 : return sClass.ToJSClass();
8191 : }
8192 :
8193 : bool
8194 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionCompressedTexturePVRTC* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
8195 : {
8196 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionCompressedTexturePVRTC*>(aObject) ==
8197 : reinterpret_cast<mozilla::WebGLExtensionCompressedTexturePVRTC*>(aObject),
8198 : "Multiple inheritance for mozilla::WebGLExtensionCompressedTexturePVRTC is broken.");
8199 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
8200 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
8201 0 : MOZ_ASSERT(!aCache->GetWrapper(),
8202 : "You should probably not be using Wrap() directly; use "
8203 : "GetOrCreateDOMReflector instead");
8204 :
8205 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
8206 : "nsISupports must be on our primary inheritance chain");
8207 :
8208 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
8209 0 : if (!global) {
8210 0 : return false;
8211 : }
8212 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
8213 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
8214 :
8215 : // That might have ended up wrapping us already, due to the wonders
8216 : // of XBL. Check for that, and bail out as needed.
8217 0 : aReflector.set(aCache->GetWrapper());
8218 0 : if (aReflector) {
8219 : #ifdef DEBUG
8220 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
8221 : #endif // DEBUG
8222 0 : return true;
8223 : }
8224 :
8225 0 : JSAutoCompartment ac(aCx, global);
8226 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
8227 0 : if (!canonicalProto) {
8228 0 : return false;
8229 : }
8230 0 : JS::Rooted<JSObject*> proto(aCx);
8231 0 : if (aGivenProto) {
8232 0 : proto = aGivenProto;
8233 : // Unfortunately, while aGivenProto was in the compartment of aCx
8234 : // coming in, we changed compartments to that of "parent" so may need
8235 : // to wrap the proto here.
8236 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
8237 0 : if (!JS_WrapObject(aCx, &proto)) {
8238 0 : return false;
8239 : }
8240 : }
8241 : } else {
8242 0 : proto = canonicalProto;
8243 : }
8244 :
8245 0 : BindingJSObjectCreator<mozilla::WebGLExtensionCompressedTexturePVRTC> creator(aCx);
8246 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
8247 0 : if (!aReflector) {
8248 0 : return false;
8249 : }
8250 :
8251 0 : aCache->SetWrapper(aReflector);
8252 0 : creator.InitializationSucceeded();
8253 :
8254 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
8255 : aCache->GetWrapperPreserveColor() == aReflector);
8256 : // If proto != canonicalProto, we have to preserve our wrapper;
8257 : // otherwise we won't be able to properly recreate it later, since
8258 : // we won't know what proto to use. Note that we don't check
8259 : // aGivenProto here, since it's entirely possible (and even
8260 : // somewhat common) to have a non-null aGivenProto which is the
8261 : // same as canonicalProto.
8262 0 : if (proto != canonicalProto) {
8263 0 : PreserveWrapper(aObject);
8264 : }
8265 :
8266 0 : return true;
8267 : }
8268 :
8269 : const NativePropertyHooks sNativePropertyHooks[] = { {
8270 : nullptr,
8271 : nullptr,
8272 : nullptr,
8273 : { sNativeProperties.Upcast(), nullptr },
8274 : prototypes::id::WEBGL_compressed_texture_pvrtc,
8275 : constructors::id::_ID_Count,
8276 : nullptr,
8277 : &DefaultXrayExpandoObjectClass
8278 : } };
8279 :
8280 : void
8281 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
8282 : {
8283 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
8284 0 : if (!parentProto) {
8285 0 : return;
8286 : }
8287 :
8288 : static bool sIdsInited = false;
8289 0 : if (!sIdsInited && NS_IsMainThread()) {
8290 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
8291 0 : return;
8292 : }
8293 0 : sIdsInited = true;
8294 : }
8295 :
8296 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WEBGL_compressed_texture_pvrtc);
8297 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
8298 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
8299 : &sPrototypeClass.mBase, protoCache,
8300 : nullptr, nullptr, 0, nullptr,
8301 : interfaceCache,
8302 : sNativeProperties.Upcast(),
8303 : nullptr,
8304 : nullptr, aDefineOnGlobal,
8305 : nullptr,
8306 0 : false);
8307 : }
8308 :
8309 : JS::Handle<JSObject*>
8310 0 : GetProtoObjectHandle(JSContext* aCx)
8311 : {
8312 : /* Get the interface prototype object for this class. This will create the
8313 : object as needed. */
8314 0 : bool aDefineOnGlobal = true;
8315 :
8316 : /* Make sure our global is sane. Hopefully we can remove this sometime */
8317 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
8318 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
8319 0 : return nullptr;
8320 : }
8321 :
8322 : /* Check to see whether the interface objects are already installed */
8323 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
8324 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WEBGL_compressed_texture_pvrtc)) {
8325 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
8326 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
8327 : }
8328 :
8329 : /*
8330 : * The object might _still_ be null, but that's OK.
8331 : *
8332 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
8333 : * traced by TraceProtoAndIfaceCache() and its contents are never
8334 : * changed after they have been set.
8335 : *
8336 : * Calling address() avoids the read read barrier that does gray
8337 : * unmarking, but it's not possible for the object to be gray here.
8338 : */
8339 :
8340 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WEBGL_compressed_texture_pvrtc);
8341 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
8342 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
8343 : }
8344 :
8345 : } // namespace WEBGL_compressed_texture_pvrtcBinding
8346 :
8347 :
8348 :
8349 : namespace WEBGL_compressed_texture_s3tcBinding {
8350 :
8351 : static bool
8352 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
8353 : {
8354 0 : mozilla::WebGLExtensionCompressedTextureS3TC* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureS3TC>(obj);
8355 : // We don't want to preserve if we don't have a wrapper, and we
8356 : // obviously can't preserve if we're not initialized.
8357 0 : if (self && self->GetWrapperPreserveColor()) {
8358 0 : PreserveWrapper(self);
8359 : }
8360 0 : return true;
8361 : }
8362 :
8363 : static void
8364 0 : _finalize(js::FreeOp* fop, JSObject* obj)
8365 : {
8366 0 : mozilla::WebGLExtensionCompressedTextureS3TC* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureS3TC>(obj);
8367 0 : if (self) {
8368 0 : ClearWrapper(self, self, obj);
8369 0 : AddForDeferredFinalization<mozilla::WebGLExtensionCompressedTextureS3TC>(self);
8370 : }
8371 0 : }
8372 :
8373 : static void
8374 0 : _objectMoved(JSObject* obj, const JSObject* old)
8375 : {
8376 0 : mozilla::WebGLExtensionCompressedTextureS3TC* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureS3TC>(obj);
8377 0 : if (self) {
8378 0 : UpdateWrapper(self, self, obj, old);
8379 : }
8380 0 : }
8381 :
8382 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
8383 : #if defined(__clang__)
8384 : #pragma clang diagnostic push
8385 : #pragma clang diagnostic ignored "-Wmissing-braces"
8386 : #endif
8387 : static const ConstantSpec sConstants_specs[] = {
8388 : { "COMPRESSED_RGB_S3TC_DXT1_EXT", JS::NumberValue(33776U) },
8389 : { "COMPRESSED_RGBA_S3TC_DXT1_EXT", JS::NumberValue(33777U) },
8390 : { "COMPRESSED_RGBA_S3TC_DXT3_EXT", JS::NumberValue(33778U) },
8391 : { "COMPRESSED_RGBA_S3TC_DXT5_EXT", JS::NumberValue(33779U) },
8392 : { 0, JS::UndefinedValue() }
8393 : };
8394 : #if defined(__clang__)
8395 : #pragma clang diagnostic pop
8396 : #endif
8397 :
8398 :
8399 : // Can't be const because the pref-enabled boolean needs to be writable
8400 : static Prefable<const ConstantSpec> sConstants[] = {
8401 : { nullptr, &sConstants_specs[0] },
8402 : { nullptr, nullptr }
8403 : };
8404 :
8405 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
8406 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
8407 : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
8408 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
8409 :
8410 :
8411 : static uint16_t sNativeProperties_sortedPropertyIndices[4];
8412 : static PropertyInfo sNativeProperties_propertyInfos[4];
8413 :
8414 : static const NativePropertiesN<1> sNativeProperties = {
8415 : false, 0,
8416 : false, 0,
8417 : false, 0,
8418 : false, 0,
8419 : false, 0,
8420 : false, 0,
8421 : true, 0 /* sConstants */,
8422 : -1,
8423 : 4,
8424 : sNativeProperties_sortedPropertyIndices,
8425 : {
8426 : { sConstants, &sNativeProperties_propertyInfos[0] }
8427 : }
8428 : };
8429 : static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
8430 : "We have a property info count that is oversized");
8431 :
8432 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
8433 : {
8434 : "WEBGL_compressed_texture_s3tcPrototype",
8435 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
8436 : JS_NULL_CLASS_OPS,
8437 : JS_NULL_CLASS_SPEC,
8438 : JS_NULL_CLASS_EXT,
8439 : JS_NULL_OBJECT_OPS
8440 : },
8441 : eInterfacePrototype,
8442 : false,
8443 : prototypes::id::WEBGL_compressed_texture_s3tc,
8444 : PrototypeTraits<prototypes::id::WEBGL_compressed_texture_s3tc>::Depth,
8445 : sNativePropertyHooks,
8446 : "[object WEBGL_compressed_texture_s3tcPrototype]",
8447 : JS::GetRealmObjectPrototype
8448 : };
8449 :
8450 : static const js::ClassOps sClassOps = {
8451 : _addProperty, /* addProperty */
8452 : nullptr, /* delProperty */
8453 : nullptr, /* getProperty */
8454 : nullptr, /* setProperty */
8455 : nullptr, /* enumerate */
8456 : nullptr, /* newEnumerate */
8457 : nullptr, /* resolve */
8458 : nullptr, /* mayResolve */
8459 : _finalize, /* finalize */
8460 : nullptr, /* call */
8461 : nullptr, /* hasInstance */
8462 : nullptr, /* construct */
8463 : nullptr, /* trace */
8464 : };
8465 :
8466 : static const js::ClassExtension sClassExtension = {
8467 : nullptr, /* weakmapKeyDelegateOp */
8468 : _objectMoved /* objectMovedOp */
8469 : };
8470 :
8471 : static const DOMJSClass sClass = {
8472 : { "WEBGL_compressed_texture_s3tc",
8473 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
8474 : &sClassOps,
8475 : JS_NULL_CLASS_SPEC,
8476 : &sClassExtension,
8477 : JS_NULL_OBJECT_OPS
8478 : },
8479 : { prototypes::id::WEBGL_compressed_texture_s3tc, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
8480 : IsBaseOf<nsISupports, mozilla::WebGLExtensionCompressedTextureS3TC >::value,
8481 : sNativePropertyHooks,
8482 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionCompressedTextureS3TC>::Get,
8483 : GetProtoObjectHandle,
8484 : GetCCParticipant<mozilla::WebGLExtensionCompressedTextureS3TC>::Get()
8485 : };
8486 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
8487 : "Must have the right minimal number of reserved slots.");
8488 : static_assert(1 >= 1,
8489 : "Must have enough reserved slots.");
8490 :
8491 : const JSClass*
8492 0 : GetJSClass()
8493 : {
8494 0 : return sClass.ToJSClass();
8495 : }
8496 :
8497 : bool
8498 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionCompressedTextureS3TC* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
8499 : {
8500 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionCompressedTextureS3TC*>(aObject) ==
8501 : reinterpret_cast<mozilla::WebGLExtensionCompressedTextureS3TC*>(aObject),
8502 : "Multiple inheritance for mozilla::WebGLExtensionCompressedTextureS3TC is broken.");
8503 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
8504 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
8505 0 : MOZ_ASSERT(!aCache->GetWrapper(),
8506 : "You should probably not be using Wrap() directly; use "
8507 : "GetOrCreateDOMReflector instead");
8508 :
8509 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
8510 : "nsISupports must be on our primary inheritance chain");
8511 :
8512 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
8513 0 : if (!global) {
8514 0 : return false;
8515 : }
8516 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
8517 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
8518 :
8519 : // That might have ended up wrapping us already, due to the wonders
8520 : // of XBL. Check for that, and bail out as needed.
8521 0 : aReflector.set(aCache->GetWrapper());
8522 0 : if (aReflector) {
8523 : #ifdef DEBUG
8524 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
8525 : #endif // DEBUG
8526 0 : return true;
8527 : }
8528 :
8529 0 : JSAutoCompartment ac(aCx, global);
8530 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
8531 0 : if (!canonicalProto) {
8532 0 : return false;
8533 : }
8534 0 : JS::Rooted<JSObject*> proto(aCx);
8535 0 : if (aGivenProto) {
8536 0 : proto = aGivenProto;
8537 : // Unfortunately, while aGivenProto was in the compartment of aCx
8538 : // coming in, we changed compartments to that of "parent" so may need
8539 : // to wrap the proto here.
8540 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
8541 0 : if (!JS_WrapObject(aCx, &proto)) {
8542 0 : return false;
8543 : }
8544 : }
8545 : } else {
8546 0 : proto = canonicalProto;
8547 : }
8548 :
8549 0 : BindingJSObjectCreator<mozilla::WebGLExtensionCompressedTextureS3TC> creator(aCx);
8550 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
8551 0 : if (!aReflector) {
8552 0 : return false;
8553 : }
8554 :
8555 0 : aCache->SetWrapper(aReflector);
8556 0 : creator.InitializationSucceeded();
8557 :
8558 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
8559 : aCache->GetWrapperPreserveColor() == aReflector);
8560 : // If proto != canonicalProto, we have to preserve our wrapper;
8561 : // otherwise we won't be able to properly recreate it later, since
8562 : // we won't know what proto to use. Note that we don't check
8563 : // aGivenProto here, since it's entirely possible (and even
8564 : // somewhat common) to have a non-null aGivenProto which is the
8565 : // same as canonicalProto.
8566 0 : if (proto != canonicalProto) {
8567 0 : PreserveWrapper(aObject);
8568 : }
8569 :
8570 0 : return true;
8571 : }
8572 :
8573 : const NativePropertyHooks sNativePropertyHooks[] = { {
8574 : nullptr,
8575 : nullptr,
8576 : nullptr,
8577 : { sNativeProperties.Upcast(), nullptr },
8578 : prototypes::id::WEBGL_compressed_texture_s3tc,
8579 : constructors::id::_ID_Count,
8580 : nullptr,
8581 : &DefaultXrayExpandoObjectClass
8582 : } };
8583 :
8584 : void
8585 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
8586 : {
8587 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
8588 0 : if (!parentProto) {
8589 0 : return;
8590 : }
8591 :
8592 : static bool sIdsInited = false;
8593 0 : if (!sIdsInited && NS_IsMainThread()) {
8594 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
8595 0 : return;
8596 : }
8597 0 : sIdsInited = true;
8598 : }
8599 :
8600 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WEBGL_compressed_texture_s3tc);
8601 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
8602 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
8603 : &sPrototypeClass.mBase, protoCache,
8604 : nullptr, nullptr, 0, nullptr,
8605 : interfaceCache,
8606 : sNativeProperties.Upcast(),
8607 : nullptr,
8608 : nullptr, aDefineOnGlobal,
8609 : nullptr,
8610 0 : false);
8611 : }
8612 :
8613 : JS::Handle<JSObject*>
8614 0 : GetProtoObjectHandle(JSContext* aCx)
8615 : {
8616 : /* Get the interface prototype object for this class. This will create the
8617 : object as needed. */
8618 0 : bool aDefineOnGlobal = true;
8619 :
8620 : /* Make sure our global is sane. Hopefully we can remove this sometime */
8621 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
8622 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
8623 0 : return nullptr;
8624 : }
8625 :
8626 : /* Check to see whether the interface objects are already installed */
8627 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
8628 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WEBGL_compressed_texture_s3tc)) {
8629 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
8630 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
8631 : }
8632 :
8633 : /*
8634 : * The object might _still_ be null, but that's OK.
8635 : *
8636 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
8637 : * traced by TraceProtoAndIfaceCache() and its contents are never
8638 : * changed after they have been set.
8639 : *
8640 : * Calling address() avoids the read read barrier that does gray
8641 : * unmarking, but it's not possible for the object to be gray here.
8642 : */
8643 :
8644 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WEBGL_compressed_texture_s3tc);
8645 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
8646 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
8647 : }
8648 :
8649 : } // namespace WEBGL_compressed_texture_s3tcBinding
8650 :
8651 :
8652 :
8653 : namespace WEBGL_compressed_texture_s3tc_srgbBinding {
8654 :
8655 : static bool
8656 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
8657 : {
8658 0 : mozilla::WebGLExtensionCompressedTextureS3TC_SRGB* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureS3TC_SRGB>(obj);
8659 : // We don't want to preserve if we don't have a wrapper, and we
8660 : // obviously can't preserve if we're not initialized.
8661 0 : if (self && self->GetWrapperPreserveColor()) {
8662 0 : PreserveWrapper(self);
8663 : }
8664 0 : return true;
8665 : }
8666 :
8667 : static void
8668 0 : _finalize(js::FreeOp* fop, JSObject* obj)
8669 : {
8670 0 : mozilla::WebGLExtensionCompressedTextureS3TC_SRGB* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureS3TC_SRGB>(obj);
8671 0 : if (self) {
8672 0 : ClearWrapper(self, self, obj);
8673 0 : AddForDeferredFinalization<mozilla::WebGLExtensionCompressedTextureS3TC_SRGB>(self);
8674 : }
8675 0 : }
8676 :
8677 : static void
8678 0 : _objectMoved(JSObject* obj, const JSObject* old)
8679 : {
8680 0 : mozilla::WebGLExtensionCompressedTextureS3TC_SRGB* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionCompressedTextureS3TC_SRGB>(obj);
8681 0 : if (self) {
8682 0 : UpdateWrapper(self, self, obj, old);
8683 : }
8684 0 : }
8685 :
8686 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
8687 : #if defined(__clang__)
8688 : #pragma clang diagnostic push
8689 : #pragma clang diagnostic ignored "-Wmissing-braces"
8690 : #endif
8691 : static const ConstantSpec sConstants_specs[] = {
8692 : { "COMPRESSED_SRGB_S3TC_DXT1_EXT", JS::NumberValue(35916U) },
8693 : { "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT", JS::NumberValue(35917U) },
8694 : { "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT", JS::NumberValue(35918U) },
8695 : { "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT", JS::NumberValue(35919U) },
8696 : { 0, JS::UndefinedValue() }
8697 : };
8698 : #if defined(__clang__)
8699 : #pragma clang diagnostic pop
8700 : #endif
8701 :
8702 :
8703 : // Can't be const because the pref-enabled boolean needs to be writable
8704 : static Prefable<const ConstantSpec> sConstants[] = {
8705 : { nullptr, &sConstants_specs[0] },
8706 : { nullptr, nullptr }
8707 : };
8708 :
8709 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
8710 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
8711 : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
8712 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
8713 :
8714 :
8715 : static uint16_t sNativeProperties_sortedPropertyIndices[4];
8716 : static PropertyInfo sNativeProperties_propertyInfos[4];
8717 :
8718 : static const NativePropertiesN<1> sNativeProperties = {
8719 : false, 0,
8720 : false, 0,
8721 : false, 0,
8722 : false, 0,
8723 : false, 0,
8724 : false, 0,
8725 : true, 0 /* sConstants */,
8726 : -1,
8727 : 4,
8728 : sNativeProperties_sortedPropertyIndices,
8729 : {
8730 : { sConstants, &sNativeProperties_propertyInfos[0] }
8731 : }
8732 : };
8733 : static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
8734 : "We have a property info count that is oversized");
8735 :
8736 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
8737 : {
8738 : "WEBGL_compressed_texture_s3tc_srgbPrototype",
8739 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
8740 : JS_NULL_CLASS_OPS,
8741 : JS_NULL_CLASS_SPEC,
8742 : JS_NULL_CLASS_EXT,
8743 : JS_NULL_OBJECT_OPS
8744 : },
8745 : eInterfacePrototype,
8746 : false,
8747 : prototypes::id::WEBGL_compressed_texture_s3tc_srgb,
8748 : PrototypeTraits<prototypes::id::WEBGL_compressed_texture_s3tc_srgb>::Depth,
8749 : sNativePropertyHooks,
8750 : "[object WEBGL_compressed_texture_s3tc_srgbPrototype]",
8751 : JS::GetRealmObjectPrototype
8752 : };
8753 :
8754 : static const js::ClassOps sClassOps = {
8755 : _addProperty, /* addProperty */
8756 : nullptr, /* delProperty */
8757 : nullptr, /* getProperty */
8758 : nullptr, /* setProperty */
8759 : nullptr, /* enumerate */
8760 : nullptr, /* newEnumerate */
8761 : nullptr, /* resolve */
8762 : nullptr, /* mayResolve */
8763 : _finalize, /* finalize */
8764 : nullptr, /* call */
8765 : nullptr, /* hasInstance */
8766 : nullptr, /* construct */
8767 : nullptr, /* trace */
8768 : };
8769 :
8770 : static const js::ClassExtension sClassExtension = {
8771 : nullptr, /* weakmapKeyDelegateOp */
8772 : _objectMoved /* objectMovedOp */
8773 : };
8774 :
8775 : static const DOMJSClass sClass = {
8776 : { "WEBGL_compressed_texture_s3tc_srgb",
8777 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
8778 : &sClassOps,
8779 : JS_NULL_CLASS_SPEC,
8780 : &sClassExtension,
8781 : JS_NULL_OBJECT_OPS
8782 : },
8783 : { prototypes::id::WEBGL_compressed_texture_s3tc_srgb, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
8784 : IsBaseOf<nsISupports, mozilla::WebGLExtensionCompressedTextureS3TC_SRGB >::value,
8785 : sNativePropertyHooks,
8786 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionCompressedTextureS3TC_SRGB>::Get,
8787 : GetProtoObjectHandle,
8788 : GetCCParticipant<mozilla::WebGLExtensionCompressedTextureS3TC_SRGB>::Get()
8789 : };
8790 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
8791 : "Must have the right minimal number of reserved slots.");
8792 : static_assert(1 >= 1,
8793 : "Must have enough reserved slots.");
8794 :
8795 : const JSClass*
8796 0 : GetJSClass()
8797 : {
8798 0 : return sClass.ToJSClass();
8799 : }
8800 :
8801 : bool
8802 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionCompressedTextureS3TC_SRGB* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
8803 : {
8804 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionCompressedTextureS3TC_SRGB*>(aObject) ==
8805 : reinterpret_cast<mozilla::WebGLExtensionCompressedTextureS3TC_SRGB*>(aObject),
8806 : "Multiple inheritance for mozilla::WebGLExtensionCompressedTextureS3TC_SRGB is broken.");
8807 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
8808 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
8809 0 : MOZ_ASSERT(!aCache->GetWrapper(),
8810 : "You should probably not be using Wrap() directly; use "
8811 : "GetOrCreateDOMReflector instead");
8812 :
8813 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
8814 : "nsISupports must be on our primary inheritance chain");
8815 :
8816 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
8817 0 : if (!global) {
8818 0 : return false;
8819 : }
8820 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
8821 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
8822 :
8823 : // That might have ended up wrapping us already, due to the wonders
8824 : // of XBL. Check for that, and bail out as needed.
8825 0 : aReflector.set(aCache->GetWrapper());
8826 0 : if (aReflector) {
8827 : #ifdef DEBUG
8828 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
8829 : #endif // DEBUG
8830 0 : return true;
8831 : }
8832 :
8833 0 : JSAutoCompartment ac(aCx, global);
8834 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
8835 0 : if (!canonicalProto) {
8836 0 : return false;
8837 : }
8838 0 : JS::Rooted<JSObject*> proto(aCx);
8839 0 : if (aGivenProto) {
8840 0 : proto = aGivenProto;
8841 : // Unfortunately, while aGivenProto was in the compartment of aCx
8842 : // coming in, we changed compartments to that of "parent" so may need
8843 : // to wrap the proto here.
8844 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
8845 0 : if (!JS_WrapObject(aCx, &proto)) {
8846 0 : return false;
8847 : }
8848 : }
8849 : } else {
8850 0 : proto = canonicalProto;
8851 : }
8852 :
8853 0 : BindingJSObjectCreator<mozilla::WebGLExtensionCompressedTextureS3TC_SRGB> creator(aCx);
8854 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
8855 0 : if (!aReflector) {
8856 0 : return false;
8857 : }
8858 :
8859 0 : aCache->SetWrapper(aReflector);
8860 0 : creator.InitializationSucceeded();
8861 :
8862 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
8863 : aCache->GetWrapperPreserveColor() == aReflector);
8864 : // If proto != canonicalProto, we have to preserve our wrapper;
8865 : // otherwise we won't be able to properly recreate it later, since
8866 : // we won't know what proto to use. Note that we don't check
8867 : // aGivenProto here, since it's entirely possible (and even
8868 : // somewhat common) to have a non-null aGivenProto which is the
8869 : // same as canonicalProto.
8870 0 : if (proto != canonicalProto) {
8871 0 : PreserveWrapper(aObject);
8872 : }
8873 :
8874 0 : return true;
8875 : }
8876 :
8877 : const NativePropertyHooks sNativePropertyHooks[] = { {
8878 : nullptr,
8879 : nullptr,
8880 : nullptr,
8881 : { sNativeProperties.Upcast(), nullptr },
8882 : prototypes::id::WEBGL_compressed_texture_s3tc_srgb,
8883 : constructors::id::_ID_Count,
8884 : nullptr,
8885 : &DefaultXrayExpandoObjectClass
8886 : } };
8887 :
8888 : void
8889 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
8890 : {
8891 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
8892 0 : if (!parentProto) {
8893 0 : return;
8894 : }
8895 :
8896 : static bool sIdsInited = false;
8897 0 : if (!sIdsInited && NS_IsMainThread()) {
8898 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
8899 0 : return;
8900 : }
8901 0 : sIdsInited = true;
8902 : }
8903 :
8904 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WEBGL_compressed_texture_s3tc_srgb);
8905 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
8906 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
8907 : &sPrototypeClass.mBase, protoCache,
8908 : nullptr, nullptr, 0, nullptr,
8909 : interfaceCache,
8910 : sNativeProperties.Upcast(),
8911 : nullptr,
8912 : nullptr, aDefineOnGlobal,
8913 : nullptr,
8914 0 : false);
8915 : }
8916 :
8917 : JS::Handle<JSObject*>
8918 0 : GetProtoObjectHandle(JSContext* aCx)
8919 : {
8920 : /* Get the interface prototype object for this class. This will create the
8921 : object as needed. */
8922 0 : bool aDefineOnGlobal = true;
8923 :
8924 : /* Make sure our global is sane. Hopefully we can remove this sometime */
8925 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
8926 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
8927 0 : return nullptr;
8928 : }
8929 :
8930 : /* Check to see whether the interface objects are already installed */
8931 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
8932 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WEBGL_compressed_texture_s3tc_srgb)) {
8933 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
8934 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
8935 : }
8936 :
8937 : /*
8938 : * The object might _still_ be null, but that's OK.
8939 : *
8940 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
8941 : * traced by TraceProtoAndIfaceCache() and its contents are never
8942 : * changed after they have been set.
8943 : *
8944 : * Calling address() avoids the read read barrier that does gray
8945 : * unmarking, but it's not possible for the object to be gray here.
8946 : */
8947 :
8948 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WEBGL_compressed_texture_s3tc_srgb);
8949 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
8950 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
8951 : }
8952 :
8953 : } // namespace WEBGL_compressed_texture_s3tc_srgbBinding
8954 :
8955 :
8956 :
8957 : namespace WEBGL_debug_renderer_infoBinding {
8958 :
8959 : static bool
8960 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
8961 : {
8962 0 : mozilla::WebGLExtensionDebugRendererInfo* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionDebugRendererInfo>(obj);
8963 : // We don't want to preserve if we don't have a wrapper, and we
8964 : // obviously can't preserve if we're not initialized.
8965 0 : if (self && self->GetWrapperPreserveColor()) {
8966 0 : PreserveWrapper(self);
8967 : }
8968 0 : return true;
8969 : }
8970 :
8971 : static void
8972 0 : _finalize(js::FreeOp* fop, JSObject* obj)
8973 : {
8974 0 : mozilla::WebGLExtensionDebugRendererInfo* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionDebugRendererInfo>(obj);
8975 0 : if (self) {
8976 0 : ClearWrapper(self, self, obj);
8977 0 : AddForDeferredFinalization<mozilla::WebGLExtensionDebugRendererInfo>(self);
8978 : }
8979 0 : }
8980 :
8981 : static void
8982 0 : _objectMoved(JSObject* obj, const JSObject* old)
8983 : {
8984 0 : mozilla::WebGLExtensionDebugRendererInfo* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionDebugRendererInfo>(obj);
8985 0 : if (self) {
8986 0 : UpdateWrapper(self, self, obj, old);
8987 : }
8988 0 : }
8989 :
8990 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
8991 : #if defined(__clang__)
8992 : #pragma clang diagnostic push
8993 : #pragma clang diagnostic ignored "-Wmissing-braces"
8994 : #endif
8995 : static const ConstantSpec sConstants_specs[] = {
8996 : { "UNMASKED_VENDOR_WEBGL", JS::NumberValue(37445U) },
8997 : { "UNMASKED_RENDERER_WEBGL", JS::NumberValue(37446U) },
8998 : { 0, JS::UndefinedValue() }
8999 : };
9000 : #if defined(__clang__)
9001 : #pragma clang diagnostic pop
9002 : #endif
9003 :
9004 :
9005 : // Can't be const because the pref-enabled boolean needs to be writable
9006 : static Prefable<const ConstantSpec> sConstants[] = {
9007 : { nullptr, &sConstants_specs[0] },
9008 : { nullptr, nullptr }
9009 : };
9010 :
9011 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
9012 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
9013 : static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
9014 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
9015 :
9016 :
9017 : static uint16_t sNativeProperties_sortedPropertyIndices[2];
9018 : static PropertyInfo sNativeProperties_propertyInfos[2];
9019 :
9020 : static const NativePropertiesN<1> sNativeProperties = {
9021 : false, 0,
9022 : false, 0,
9023 : false, 0,
9024 : false, 0,
9025 : false, 0,
9026 : false, 0,
9027 : true, 0 /* sConstants */,
9028 : -1,
9029 : 2,
9030 : sNativeProperties_sortedPropertyIndices,
9031 : {
9032 : { sConstants, &sNativeProperties_propertyInfos[0] }
9033 : }
9034 : };
9035 : static_assert(2 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
9036 : "We have a property info count that is oversized");
9037 :
9038 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
9039 : {
9040 : "WEBGL_debug_renderer_infoPrototype",
9041 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
9042 : JS_NULL_CLASS_OPS,
9043 : JS_NULL_CLASS_SPEC,
9044 : JS_NULL_CLASS_EXT,
9045 : JS_NULL_OBJECT_OPS
9046 : },
9047 : eInterfacePrototype,
9048 : false,
9049 : prototypes::id::WEBGL_debug_renderer_info,
9050 : PrototypeTraits<prototypes::id::WEBGL_debug_renderer_info>::Depth,
9051 : sNativePropertyHooks,
9052 : "[object WEBGL_debug_renderer_infoPrototype]",
9053 : JS::GetRealmObjectPrototype
9054 : };
9055 :
9056 : static const js::ClassOps sClassOps = {
9057 : _addProperty, /* addProperty */
9058 : nullptr, /* delProperty */
9059 : nullptr, /* getProperty */
9060 : nullptr, /* setProperty */
9061 : nullptr, /* enumerate */
9062 : nullptr, /* newEnumerate */
9063 : nullptr, /* resolve */
9064 : nullptr, /* mayResolve */
9065 : _finalize, /* finalize */
9066 : nullptr, /* call */
9067 : nullptr, /* hasInstance */
9068 : nullptr, /* construct */
9069 : nullptr, /* trace */
9070 : };
9071 :
9072 : static const js::ClassExtension sClassExtension = {
9073 : nullptr, /* weakmapKeyDelegateOp */
9074 : _objectMoved /* objectMovedOp */
9075 : };
9076 :
9077 : static const DOMJSClass sClass = {
9078 : { "WEBGL_debug_renderer_info",
9079 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
9080 : &sClassOps,
9081 : JS_NULL_CLASS_SPEC,
9082 : &sClassExtension,
9083 : JS_NULL_OBJECT_OPS
9084 : },
9085 : { prototypes::id::WEBGL_debug_renderer_info, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
9086 : IsBaseOf<nsISupports, mozilla::WebGLExtensionDebugRendererInfo >::value,
9087 : sNativePropertyHooks,
9088 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionDebugRendererInfo>::Get,
9089 : GetProtoObjectHandle,
9090 : GetCCParticipant<mozilla::WebGLExtensionDebugRendererInfo>::Get()
9091 : };
9092 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
9093 : "Must have the right minimal number of reserved slots.");
9094 : static_assert(1 >= 1,
9095 : "Must have enough reserved slots.");
9096 :
9097 : const JSClass*
9098 0 : GetJSClass()
9099 : {
9100 0 : return sClass.ToJSClass();
9101 : }
9102 :
9103 : bool
9104 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionDebugRendererInfo* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
9105 : {
9106 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionDebugRendererInfo*>(aObject) ==
9107 : reinterpret_cast<mozilla::WebGLExtensionDebugRendererInfo*>(aObject),
9108 : "Multiple inheritance for mozilla::WebGLExtensionDebugRendererInfo is broken.");
9109 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
9110 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
9111 0 : MOZ_ASSERT(!aCache->GetWrapper(),
9112 : "You should probably not be using Wrap() directly; use "
9113 : "GetOrCreateDOMReflector instead");
9114 :
9115 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
9116 : "nsISupports must be on our primary inheritance chain");
9117 :
9118 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
9119 0 : if (!global) {
9120 0 : return false;
9121 : }
9122 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
9123 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
9124 :
9125 : // That might have ended up wrapping us already, due to the wonders
9126 : // of XBL. Check for that, and bail out as needed.
9127 0 : aReflector.set(aCache->GetWrapper());
9128 0 : if (aReflector) {
9129 : #ifdef DEBUG
9130 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
9131 : #endif // DEBUG
9132 0 : return true;
9133 : }
9134 :
9135 0 : JSAutoCompartment ac(aCx, global);
9136 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
9137 0 : if (!canonicalProto) {
9138 0 : return false;
9139 : }
9140 0 : JS::Rooted<JSObject*> proto(aCx);
9141 0 : if (aGivenProto) {
9142 0 : proto = aGivenProto;
9143 : // Unfortunately, while aGivenProto was in the compartment of aCx
9144 : // coming in, we changed compartments to that of "parent" so may need
9145 : // to wrap the proto here.
9146 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
9147 0 : if (!JS_WrapObject(aCx, &proto)) {
9148 0 : return false;
9149 : }
9150 : }
9151 : } else {
9152 0 : proto = canonicalProto;
9153 : }
9154 :
9155 0 : BindingJSObjectCreator<mozilla::WebGLExtensionDebugRendererInfo> creator(aCx);
9156 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
9157 0 : if (!aReflector) {
9158 0 : return false;
9159 : }
9160 :
9161 0 : aCache->SetWrapper(aReflector);
9162 0 : creator.InitializationSucceeded();
9163 :
9164 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
9165 : aCache->GetWrapperPreserveColor() == aReflector);
9166 : // If proto != canonicalProto, we have to preserve our wrapper;
9167 : // otherwise we won't be able to properly recreate it later, since
9168 : // we won't know what proto to use. Note that we don't check
9169 : // aGivenProto here, since it's entirely possible (and even
9170 : // somewhat common) to have a non-null aGivenProto which is the
9171 : // same as canonicalProto.
9172 0 : if (proto != canonicalProto) {
9173 0 : PreserveWrapper(aObject);
9174 : }
9175 :
9176 0 : return true;
9177 : }
9178 :
9179 : const NativePropertyHooks sNativePropertyHooks[] = { {
9180 : nullptr,
9181 : nullptr,
9182 : nullptr,
9183 : { sNativeProperties.Upcast(), nullptr },
9184 : prototypes::id::WEBGL_debug_renderer_info,
9185 : constructors::id::_ID_Count,
9186 : nullptr,
9187 : &DefaultXrayExpandoObjectClass
9188 : } };
9189 :
9190 : void
9191 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
9192 : {
9193 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
9194 0 : if (!parentProto) {
9195 0 : return;
9196 : }
9197 :
9198 : static bool sIdsInited = false;
9199 0 : if (!sIdsInited && NS_IsMainThread()) {
9200 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
9201 0 : return;
9202 : }
9203 0 : sIdsInited = true;
9204 : }
9205 :
9206 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WEBGL_debug_renderer_info);
9207 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
9208 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
9209 : &sPrototypeClass.mBase, protoCache,
9210 : nullptr, nullptr, 0, nullptr,
9211 : interfaceCache,
9212 : sNativeProperties.Upcast(),
9213 : nullptr,
9214 : nullptr, aDefineOnGlobal,
9215 : nullptr,
9216 0 : false);
9217 : }
9218 :
9219 : JS::Handle<JSObject*>
9220 0 : GetProtoObjectHandle(JSContext* aCx)
9221 : {
9222 : /* Get the interface prototype object for this class. This will create the
9223 : object as needed. */
9224 0 : bool aDefineOnGlobal = true;
9225 :
9226 : /* Make sure our global is sane. Hopefully we can remove this sometime */
9227 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
9228 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
9229 0 : return nullptr;
9230 : }
9231 :
9232 : /* Check to see whether the interface objects are already installed */
9233 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
9234 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WEBGL_debug_renderer_info)) {
9235 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
9236 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
9237 : }
9238 :
9239 : /*
9240 : * The object might _still_ be null, but that's OK.
9241 : *
9242 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
9243 : * traced by TraceProtoAndIfaceCache() and its contents are never
9244 : * changed after they have been set.
9245 : *
9246 : * Calling address() avoids the read read barrier that does gray
9247 : * unmarking, but it's not possible for the object to be gray here.
9248 : */
9249 :
9250 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WEBGL_debug_renderer_info);
9251 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
9252 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
9253 : }
9254 :
9255 : } // namespace WEBGL_debug_renderer_infoBinding
9256 :
9257 :
9258 :
9259 : namespace WEBGL_debug_shadersBinding {
9260 :
9261 : static bool
9262 0 : getTranslatedShaderSource(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionDebugShaders* self, const JSJitMethodCallArgs& args)
9263 : {
9264 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
9265 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WEBGL_debug_shaders.getTranslatedShaderSource");
9266 : }
9267 0 : NonNull<mozilla::WebGLShader> arg0;
9268 0 : if (args[0].isObject()) {
9269 : {
9270 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLShader, mozilla::WebGLShader>(args[0], arg0);
9271 0 : if (NS_FAILED(rv)) {
9272 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WEBGL_debug_shaders.getTranslatedShaderSource", "WebGLShader");
9273 0 : return false;
9274 : }
9275 : }
9276 : } else {
9277 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WEBGL_debug_shaders.getTranslatedShaderSource");
9278 0 : return false;
9279 : }
9280 0 : DOMString result;
9281 0 : self->GetTranslatedShaderSource(NonNullHelper(arg0), result);
9282 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
9283 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
9284 0 : return false;
9285 : }
9286 0 : return true;
9287 : }
9288 :
9289 : static const JSJitInfo getTranslatedShaderSource_methodinfo = {
9290 : { (JSJitGetterOp)getTranslatedShaderSource },
9291 : { prototypes::id::WEBGL_debug_shaders },
9292 : { PrototypeTraits<prototypes::id::WEBGL_debug_shaders>::Depth },
9293 : JSJitInfo::Method,
9294 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
9295 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
9296 : false, /* isInfallible. False in setters. */
9297 : false, /* isMovable. Not relevant for setters. */
9298 : false, /* isEliminatable. Not relevant for setters. */
9299 : false, /* isAlwaysInSlot. Only relevant for getters. */
9300 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
9301 : false, /* isTypedMethod. Only relevant for methods. */
9302 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
9303 : };
9304 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
9305 : static_assert(0 < 1, "There is no slot for us");
9306 :
9307 : static bool
9308 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
9309 : {
9310 0 : mozilla::WebGLExtensionDebugShaders* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionDebugShaders>(obj);
9311 : // We don't want to preserve if we don't have a wrapper, and we
9312 : // obviously can't preserve if we're not initialized.
9313 0 : if (self && self->GetWrapperPreserveColor()) {
9314 0 : PreserveWrapper(self);
9315 : }
9316 0 : return true;
9317 : }
9318 :
9319 : static void
9320 0 : _finalize(js::FreeOp* fop, JSObject* obj)
9321 : {
9322 0 : mozilla::WebGLExtensionDebugShaders* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionDebugShaders>(obj);
9323 0 : if (self) {
9324 0 : ClearWrapper(self, self, obj);
9325 0 : AddForDeferredFinalization<mozilla::WebGLExtensionDebugShaders>(self);
9326 : }
9327 0 : }
9328 :
9329 : static void
9330 0 : _objectMoved(JSObject* obj, const JSObject* old)
9331 : {
9332 0 : mozilla::WebGLExtensionDebugShaders* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionDebugShaders>(obj);
9333 0 : if (self) {
9334 0 : UpdateWrapper(self, self, obj, old);
9335 : }
9336 0 : }
9337 :
9338 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
9339 : #if defined(__clang__)
9340 : #pragma clang diagnostic push
9341 : #pragma clang diagnostic ignored "-Wmissing-braces"
9342 : #endif
9343 : static const JSFunctionSpec sMethods_specs[] = {
9344 : JS_FNSPEC("getTranslatedShaderSource", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getTranslatedShaderSource_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
9345 : JS_FS_END
9346 : };
9347 : #if defined(__clang__)
9348 : #pragma clang diagnostic pop
9349 : #endif
9350 :
9351 :
9352 : // Can't be const because the pref-enabled boolean needs to be writable
9353 : static Prefable<const JSFunctionSpec> sMethods[] = {
9354 : { nullptr, &sMethods_specs[0] },
9355 : { nullptr, nullptr }
9356 : };
9357 :
9358 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
9359 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
9360 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
9361 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
9362 :
9363 :
9364 : static uint16_t sNativeProperties_sortedPropertyIndices[1];
9365 : static PropertyInfo sNativeProperties_propertyInfos[1];
9366 :
9367 : static const NativePropertiesN<1> sNativeProperties = {
9368 : false, 0,
9369 : false, 0,
9370 : true, 0 /* sMethods */,
9371 : false, 0,
9372 : false, 0,
9373 : false, 0,
9374 : false, 0,
9375 : -1,
9376 : 1,
9377 : sNativeProperties_sortedPropertyIndices,
9378 : {
9379 : { sMethods, &sNativeProperties_propertyInfos[0] }
9380 : }
9381 : };
9382 : static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
9383 : "We have a property info count that is oversized");
9384 :
9385 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
9386 : {
9387 : "WEBGL_debug_shadersPrototype",
9388 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
9389 : JS_NULL_CLASS_OPS,
9390 : JS_NULL_CLASS_SPEC,
9391 : JS_NULL_CLASS_EXT,
9392 : JS_NULL_OBJECT_OPS
9393 : },
9394 : eInterfacePrototype,
9395 : false,
9396 : prototypes::id::WEBGL_debug_shaders,
9397 : PrototypeTraits<prototypes::id::WEBGL_debug_shaders>::Depth,
9398 : sNativePropertyHooks,
9399 : "[object WEBGL_debug_shadersPrototype]",
9400 : JS::GetRealmObjectPrototype
9401 : };
9402 :
9403 : static const js::ClassOps sClassOps = {
9404 : _addProperty, /* addProperty */
9405 : nullptr, /* delProperty */
9406 : nullptr, /* getProperty */
9407 : nullptr, /* setProperty */
9408 : nullptr, /* enumerate */
9409 : nullptr, /* newEnumerate */
9410 : nullptr, /* resolve */
9411 : nullptr, /* mayResolve */
9412 : _finalize, /* finalize */
9413 : nullptr, /* call */
9414 : nullptr, /* hasInstance */
9415 : nullptr, /* construct */
9416 : nullptr, /* trace */
9417 : };
9418 :
9419 : static const js::ClassExtension sClassExtension = {
9420 : nullptr, /* weakmapKeyDelegateOp */
9421 : _objectMoved /* objectMovedOp */
9422 : };
9423 :
9424 : static const DOMJSClass sClass = {
9425 : { "WEBGL_debug_shaders",
9426 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
9427 : &sClassOps,
9428 : JS_NULL_CLASS_SPEC,
9429 : &sClassExtension,
9430 : JS_NULL_OBJECT_OPS
9431 : },
9432 : { prototypes::id::WEBGL_debug_shaders, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
9433 : IsBaseOf<nsISupports, mozilla::WebGLExtensionDebugShaders >::value,
9434 : sNativePropertyHooks,
9435 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionDebugShaders>::Get,
9436 : GetProtoObjectHandle,
9437 : GetCCParticipant<mozilla::WebGLExtensionDebugShaders>::Get()
9438 : };
9439 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
9440 : "Must have the right minimal number of reserved slots.");
9441 : static_assert(1 >= 1,
9442 : "Must have enough reserved slots.");
9443 :
9444 : const JSClass*
9445 0 : GetJSClass()
9446 : {
9447 0 : return sClass.ToJSClass();
9448 : }
9449 :
9450 : bool
9451 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionDebugShaders* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
9452 : {
9453 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionDebugShaders*>(aObject) ==
9454 : reinterpret_cast<mozilla::WebGLExtensionDebugShaders*>(aObject),
9455 : "Multiple inheritance for mozilla::WebGLExtensionDebugShaders is broken.");
9456 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
9457 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
9458 0 : MOZ_ASSERT(!aCache->GetWrapper(),
9459 : "You should probably not be using Wrap() directly; use "
9460 : "GetOrCreateDOMReflector instead");
9461 :
9462 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
9463 : "nsISupports must be on our primary inheritance chain");
9464 :
9465 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
9466 0 : if (!global) {
9467 0 : return false;
9468 : }
9469 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
9470 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
9471 :
9472 : // That might have ended up wrapping us already, due to the wonders
9473 : // of XBL. Check for that, and bail out as needed.
9474 0 : aReflector.set(aCache->GetWrapper());
9475 0 : if (aReflector) {
9476 : #ifdef DEBUG
9477 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
9478 : #endif // DEBUG
9479 0 : return true;
9480 : }
9481 :
9482 0 : JSAutoCompartment ac(aCx, global);
9483 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
9484 0 : if (!canonicalProto) {
9485 0 : return false;
9486 : }
9487 0 : JS::Rooted<JSObject*> proto(aCx);
9488 0 : if (aGivenProto) {
9489 0 : proto = aGivenProto;
9490 : // Unfortunately, while aGivenProto was in the compartment of aCx
9491 : // coming in, we changed compartments to that of "parent" so may need
9492 : // to wrap the proto here.
9493 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
9494 0 : if (!JS_WrapObject(aCx, &proto)) {
9495 0 : return false;
9496 : }
9497 : }
9498 : } else {
9499 0 : proto = canonicalProto;
9500 : }
9501 :
9502 0 : BindingJSObjectCreator<mozilla::WebGLExtensionDebugShaders> creator(aCx);
9503 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
9504 0 : if (!aReflector) {
9505 0 : return false;
9506 : }
9507 :
9508 0 : aCache->SetWrapper(aReflector);
9509 0 : creator.InitializationSucceeded();
9510 :
9511 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
9512 : aCache->GetWrapperPreserveColor() == aReflector);
9513 : // If proto != canonicalProto, we have to preserve our wrapper;
9514 : // otherwise we won't be able to properly recreate it later, since
9515 : // we won't know what proto to use. Note that we don't check
9516 : // aGivenProto here, since it's entirely possible (and even
9517 : // somewhat common) to have a non-null aGivenProto which is the
9518 : // same as canonicalProto.
9519 0 : if (proto != canonicalProto) {
9520 0 : PreserveWrapper(aObject);
9521 : }
9522 :
9523 0 : return true;
9524 : }
9525 :
9526 : const NativePropertyHooks sNativePropertyHooks[] = { {
9527 : nullptr,
9528 : nullptr,
9529 : nullptr,
9530 : { sNativeProperties.Upcast(), nullptr },
9531 : prototypes::id::WEBGL_debug_shaders,
9532 : constructors::id::_ID_Count,
9533 : nullptr,
9534 : &DefaultXrayExpandoObjectClass
9535 : } };
9536 :
9537 : void
9538 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
9539 : {
9540 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
9541 0 : if (!parentProto) {
9542 0 : return;
9543 : }
9544 :
9545 : static bool sIdsInited = false;
9546 0 : if (!sIdsInited && NS_IsMainThread()) {
9547 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
9548 0 : return;
9549 : }
9550 0 : sIdsInited = true;
9551 : }
9552 :
9553 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WEBGL_debug_shaders);
9554 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
9555 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
9556 : &sPrototypeClass.mBase, protoCache,
9557 : nullptr, nullptr, 0, nullptr,
9558 : interfaceCache,
9559 : sNativeProperties.Upcast(),
9560 : nullptr,
9561 : nullptr, aDefineOnGlobal,
9562 : nullptr,
9563 0 : false);
9564 : }
9565 :
9566 : JS::Handle<JSObject*>
9567 0 : GetProtoObjectHandle(JSContext* aCx)
9568 : {
9569 : /* Get the interface prototype object for this class. This will create the
9570 : object as needed. */
9571 0 : bool aDefineOnGlobal = true;
9572 :
9573 : /* Make sure our global is sane. Hopefully we can remove this sometime */
9574 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
9575 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
9576 0 : return nullptr;
9577 : }
9578 :
9579 : /* Check to see whether the interface objects are already installed */
9580 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
9581 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WEBGL_debug_shaders)) {
9582 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
9583 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
9584 : }
9585 :
9586 : /*
9587 : * The object might _still_ be null, but that's OK.
9588 : *
9589 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
9590 : * traced by TraceProtoAndIfaceCache() and its contents are never
9591 : * changed after they have been set.
9592 : *
9593 : * Calling address() avoids the read read barrier that does gray
9594 : * unmarking, but it's not possible for the object to be gray here.
9595 : */
9596 :
9597 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WEBGL_debug_shaders);
9598 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
9599 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
9600 : }
9601 :
9602 : } // namespace WEBGL_debug_shadersBinding
9603 :
9604 :
9605 :
9606 : namespace WEBGL_depth_textureBinding {
9607 :
9608 : static bool
9609 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
9610 : {
9611 0 : mozilla::WebGLExtensionDepthTexture* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionDepthTexture>(obj);
9612 : // We don't want to preserve if we don't have a wrapper, and we
9613 : // obviously can't preserve if we're not initialized.
9614 0 : if (self && self->GetWrapperPreserveColor()) {
9615 0 : PreserveWrapper(self);
9616 : }
9617 0 : return true;
9618 : }
9619 :
9620 : static void
9621 0 : _finalize(js::FreeOp* fop, JSObject* obj)
9622 : {
9623 0 : mozilla::WebGLExtensionDepthTexture* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionDepthTexture>(obj);
9624 0 : if (self) {
9625 0 : ClearWrapper(self, self, obj);
9626 0 : AddForDeferredFinalization<mozilla::WebGLExtensionDepthTexture>(self);
9627 : }
9628 0 : }
9629 :
9630 : static void
9631 0 : _objectMoved(JSObject* obj, const JSObject* old)
9632 : {
9633 0 : mozilla::WebGLExtensionDepthTexture* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionDepthTexture>(obj);
9634 0 : if (self) {
9635 0 : UpdateWrapper(self, self, obj, old);
9636 : }
9637 0 : }
9638 :
9639 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
9640 : #if defined(__clang__)
9641 : #pragma clang diagnostic push
9642 : #pragma clang diagnostic ignored "-Wmissing-braces"
9643 : #endif
9644 : static const ConstantSpec sConstants_specs[] = {
9645 : { "UNSIGNED_INT_24_8_WEBGL", JS::NumberValue(34042U) },
9646 : { 0, JS::UndefinedValue() }
9647 : };
9648 : #if defined(__clang__)
9649 : #pragma clang diagnostic pop
9650 : #endif
9651 :
9652 :
9653 : // Can't be const because the pref-enabled boolean needs to be writable
9654 : static Prefable<const ConstantSpec> sConstants[] = {
9655 : { nullptr, &sConstants_specs[0] },
9656 : { nullptr, nullptr }
9657 : };
9658 :
9659 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
9660 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
9661 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
9662 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
9663 :
9664 :
9665 : static uint16_t sNativeProperties_sortedPropertyIndices[1];
9666 : static PropertyInfo sNativeProperties_propertyInfos[1];
9667 :
9668 : static const NativePropertiesN<1> sNativeProperties = {
9669 : false, 0,
9670 : false, 0,
9671 : false, 0,
9672 : false, 0,
9673 : false, 0,
9674 : false, 0,
9675 : true, 0 /* sConstants */,
9676 : -1,
9677 : 1,
9678 : sNativeProperties_sortedPropertyIndices,
9679 : {
9680 : { sConstants, &sNativeProperties_propertyInfos[0] }
9681 : }
9682 : };
9683 : static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
9684 : "We have a property info count that is oversized");
9685 :
9686 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
9687 : {
9688 : "WEBGL_depth_texturePrototype",
9689 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
9690 : JS_NULL_CLASS_OPS,
9691 : JS_NULL_CLASS_SPEC,
9692 : JS_NULL_CLASS_EXT,
9693 : JS_NULL_OBJECT_OPS
9694 : },
9695 : eInterfacePrototype,
9696 : false,
9697 : prototypes::id::WEBGL_depth_texture,
9698 : PrototypeTraits<prototypes::id::WEBGL_depth_texture>::Depth,
9699 : sNativePropertyHooks,
9700 : "[object WEBGL_depth_texturePrototype]",
9701 : JS::GetRealmObjectPrototype
9702 : };
9703 :
9704 : static const js::ClassOps sClassOps = {
9705 : _addProperty, /* addProperty */
9706 : nullptr, /* delProperty */
9707 : nullptr, /* getProperty */
9708 : nullptr, /* setProperty */
9709 : nullptr, /* enumerate */
9710 : nullptr, /* newEnumerate */
9711 : nullptr, /* resolve */
9712 : nullptr, /* mayResolve */
9713 : _finalize, /* finalize */
9714 : nullptr, /* call */
9715 : nullptr, /* hasInstance */
9716 : nullptr, /* construct */
9717 : nullptr, /* trace */
9718 : };
9719 :
9720 : static const js::ClassExtension sClassExtension = {
9721 : nullptr, /* weakmapKeyDelegateOp */
9722 : _objectMoved /* objectMovedOp */
9723 : };
9724 :
9725 : static const DOMJSClass sClass = {
9726 : { "WEBGL_depth_texture",
9727 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
9728 : &sClassOps,
9729 : JS_NULL_CLASS_SPEC,
9730 : &sClassExtension,
9731 : JS_NULL_OBJECT_OPS
9732 : },
9733 : { prototypes::id::WEBGL_depth_texture, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
9734 : IsBaseOf<nsISupports, mozilla::WebGLExtensionDepthTexture >::value,
9735 : sNativePropertyHooks,
9736 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionDepthTexture>::Get,
9737 : GetProtoObjectHandle,
9738 : GetCCParticipant<mozilla::WebGLExtensionDepthTexture>::Get()
9739 : };
9740 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
9741 : "Must have the right minimal number of reserved slots.");
9742 : static_assert(1 >= 1,
9743 : "Must have enough reserved slots.");
9744 :
9745 : const JSClass*
9746 0 : GetJSClass()
9747 : {
9748 0 : return sClass.ToJSClass();
9749 : }
9750 :
9751 : bool
9752 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionDepthTexture* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
9753 : {
9754 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionDepthTexture*>(aObject) ==
9755 : reinterpret_cast<mozilla::WebGLExtensionDepthTexture*>(aObject),
9756 : "Multiple inheritance for mozilla::WebGLExtensionDepthTexture is broken.");
9757 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
9758 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
9759 0 : MOZ_ASSERT(!aCache->GetWrapper(),
9760 : "You should probably not be using Wrap() directly; use "
9761 : "GetOrCreateDOMReflector instead");
9762 :
9763 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
9764 : "nsISupports must be on our primary inheritance chain");
9765 :
9766 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
9767 0 : if (!global) {
9768 0 : return false;
9769 : }
9770 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
9771 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
9772 :
9773 : // That might have ended up wrapping us already, due to the wonders
9774 : // of XBL. Check for that, and bail out as needed.
9775 0 : aReflector.set(aCache->GetWrapper());
9776 0 : if (aReflector) {
9777 : #ifdef DEBUG
9778 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
9779 : #endif // DEBUG
9780 0 : return true;
9781 : }
9782 :
9783 0 : JSAutoCompartment ac(aCx, global);
9784 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
9785 0 : if (!canonicalProto) {
9786 0 : return false;
9787 : }
9788 0 : JS::Rooted<JSObject*> proto(aCx);
9789 0 : if (aGivenProto) {
9790 0 : proto = aGivenProto;
9791 : // Unfortunately, while aGivenProto was in the compartment of aCx
9792 : // coming in, we changed compartments to that of "parent" so may need
9793 : // to wrap the proto here.
9794 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
9795 0 : if (!JS_WrapObject(aCx, &proto)) {
9796 0 : return false;
9797 : }
9798 : }
9799 : } else {
9800 0 : proto = canonicalProto;
9801 : }
9802 :
9803 0 : BindingJSObjectCreator<mozilla::WebGLExtensionDepthTexture> creator(aCx);
9804 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
9805 0 : if (!aReflector) {
9806 0 : return false;
9807 : }
9808 :
9809 0 : aCache->SetWrapper(aReflector);
9810 0 : creator.InitializationSucceeded();
9811 :
9812 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
9813 : aCache->GetWrapperPreserveColor() == aReflector);
9814 : // If proto != canonicalProto, we have to preserve our wrapper;
9815 : // otherwise we won't be able to properly recreate it later, since
9816 : // we won't know what proto to use. Note that we don't check
9817 : // aGivenProto here, since it's entirely possible (and even
9818 : // somewhat common) to have a non-null aGivenProto which is the
9819 : // same as canonicalProto.
9820 0 : if (proto != canonicalProto) {
9821 0 : PreserveWrapper(aObject);
9822 : }
9823 :
9824 0 : return true;
9825 : }
9826 :
9827 : const NativePropertyHooks sNativePropertyHooks[] = { {
9828 : nullptr,
9829 : nullptr,
9830 : nullptr,
9831 : { sNativeProperties.Upcast(), nullptr },
9832 : prototypes::id::WEBGL_depth_texture,
9833 : constructors::id::_ID_Count,
9834 : nullptr,
9835 : &DefaultXrayExpandoObjectClass
9836 : } };
9837 :
9838 : void
9839 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
9840 : {
9841 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
9842 0 : if (!parentProto) {
9843 0 : return;
9844 : }
9845 :
9846 : static bool sIdsInited = false;
9847 0 : if (!sIdsInited && NS_IsMainThread()) {
9848 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
9849 0 : return;
9850 : }
9851 0 : sIdsInited = true;
9852 : }
9853 :
9854 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WEBGL_depth_texture);
9855 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
9856 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
9857 : &sPrototypeClass.mBase, protoCache,
9858 : nullptr, nullptr, 0, nullptr,
9859 : interfaceCache,
9860 : sNativeProperties.Upcast(),
9861 : nullptr,
9862 : nullptr, aDefineOnGlobal,
9863 : nullptr,
9864 0 : false);
9865 : }
9866 :
9867 : JS::Handle<JSObject*>
9868 0 : GetProtoObjectHandle(JSContext* aCx)
9869 : {
9870 : /* Get the interface prototype object for this class. This will create the
9871 : object as needed. */
9872 0 : bool aDefineOnGlobal = true;
9873 :
9874 : /* Make sure our global is sane. Hopefully we can remove this sometime */
9875 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
9876 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
9877 0 : return nullptr;
9878 : }
9879 :
9880 : /* Check to see whether the interface objects are already installed */
9881 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
9882 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WEBGL_depth_texture)) {
9883 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
9884 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
9885 : }
9886 :
9887 : /*
9888 : * The object might _still_ be null, but that's OK.
9889 : *
9890 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
9891 : * traced by TraceProtoAndIfaceCache() and its contents are never
9892 : * changed after they have been set.
9893 : *
9894 : * Calling address() avoids the read read barrier that does gray
9895 : * unmarking, but it's not possible for the object to be gray here.
9896 : */
9897 :
9898 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WEBGL_depth_texture);
9899 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
9900 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
9901 : }
9902 :
9903 : } // namespace WEBGL_depth_textureBinding
9904 :
9905 :
9906 :
9907 : namespace WEBGL_draw_buffersBinding {
9908 :
9909 : static bool
9910 0 : drawBuffersWEBGL(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionDrawBuffers* self, const JSJitMethodCallArgs& args)
9911 : {
9912 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
9913 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WEBGL_draw_buffers.drawBuffersWEBGL");
9914 : }
9915 0 : binding_detail::AutoSequence<uint32_t> arg0;
9916 0 : if (args[0].isObject()) {
9917 0 : JS::ForOfIterator iter(cx);
9918 0 : if (!iter.init(args[0], JS::ForOfIterator::AllowNonIterable)) {
9919 0 : return false;
9920 : }
9921 0 : if (!iter.valueIsIterable()) {
9922 0 : ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "Argument 1 of WEBGL_draw_buffers.drawBuffersWEBGL");
9923 0 : return false;
9924 : }
9925 0 : binding_detail::AutoSequence<uint32_t> &arr = arg0;
9926 0 : JS::Rooted<JS::Value> temp(cx);
9927 : while (true) {
9928 : bool done;
9929 0 : if (!iter.next(&temp, &done)) {
9930 0 : return false;
9931 : }
9932 0 : if (done) {
9933 0 : break;
9934 : }
9935 0 : uint32_t* slotPtr = arr.AppendElement(mozilla::fallible);
9936 0 : if (!slotPtr) {
9937 0 : JS_ReportOutOfMemory(cx);
9938 0 : return false;
9939 : }
9940 0 : uint32_t& slot = *slotPtr;
9941 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, temp, &slot)) {
9942 0 : return false;
9943 : }
9944 0 : }
9945 : } else {
9946 0 : ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "Argument 1 of WEBGL_draw_buffers.drawBuffersWEBGL");
9947 0 : return false;
9948 : }
9949 0 : self->DrawBuffersWEBGL(Constify(arg0));
9950 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
9951 0 : args.rval().setUndefined();
9952 0 : return true;
9953 : }
9954 :
9955 : static const JSJitInfo drawBuffersWEBGL_methodinfo = {
9956 : { (JSJitGetterOp)drawBuffersWEBGL },
9957 : { prototypes::id::WEBGL_draw_buffers },
9958 : { PrototypeTraits<prototypes::id::WEBGL_draw_buffers>::Depth },
9959 : JSJitInfo::Method,
9960 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
9961 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
9962 : false, /* isInfallible. False in setters. */
9963 : false, /* isMovable. Not relevant for setters. */
9964 : false, /* isEliminatable. Not relevant for setters. */
9965 : false, /* isAlwaysInSlot. Only relevant for getters. */
9966 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
9967 : false, /* isTypedMethod. Only relevant for methods. */
9968 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
9969 : };
9970 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
9971 : static_assert(0 < 1, "There is no slot for us");
9972 :
9973 : static bool
9974 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
9975 : {
9976 0 : mozilla::WebGLExtensionDrawBuffers* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionDrawBuffers>(obj);
9977 : // We don't want to preserve if we don't have a wrapper, and we
9978 : // obviously can't preserve if we're not initialized.
9979 0 : if (self && self->GetWrapperPreserveColor()) {
9980 0 : PreserveWrapper(self);
9981 : }
9982 0 : return true;
9983 : }
9984 :
9985 : static void
9986 0 : _finalize(js::FreeOp* fop, JSObject* obj)
9987 : {
9988 0 : mozilla::WebGLExtensionDrawBuffers* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionDrawBuffers>(obj);
9989 0 : if (self) {
9990 0 : ClearWrapper(self, self, obj);
9991 0 : AddForDeferredFinalization<mozilla::WebGLExtensionDrawBuffers>(self);
9992 : }
9993 0 : }
9994 :
9995 : static void
9996 0 : _objectMoved(JSObject* obj, const JSObject* old)
9997 : {
9998 0 : mozilla::WebGLExtensionDrawBuffers* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionDrawBuffers>(obj);
9999 0 : if (self) {
10000 0 : UpdateWrapper(self, self, obj, old);
10001 : }
10002 0 : }
10003 :
10004 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
10005 : #if defined(__clang__)
10006 : #pragma clang diagnostic push
10007 : #pragma clang diagnostic ignored "-Wmissing-braces"
10008 : #endif
10009 : static const JSFunctionSpec sMethods_specs[] = {
10010 : JS_FNSPEC("drawBuffersWEBGL", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&drawBuffersWEBGL_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
10011 : JS_FS_END
10012 : };
10013 : #if defined(__clang__)
10014 : #pragma clang diagnostic pop
10015 : #endif
10016 :
10017 :
10018 : // Can't be const because the pref-enabled boolean needs to be writable
10019 : static Prefable<const JSFunctionSpec> sMethods[] = {
10020 : { nullptr, &sMethods_specs[0] },
10021 : { nullptr, nullptr }
10022 : };
10023 :
10024 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
10025 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
10026 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
10027 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
10028 :
10029 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
10030 : #if defined(__clang__)
10031 : #pragma clang diagnostic push
10032 : #pragma clang diagnostic ignored "-Wmissing-braces"
10033 : #endif
10034 : static const ConstantSpec sConstants_specs[] = {
10035 : { "COLOR_ATTACHMENT0_WEBGL", JS::NumberValue(36064U) },
10036 : { "COLOR_ATTACHMENT1_WEBGL", JS::NumberValue(36065U) },
10037 : { "COLOR_ATTACHMENT2_WEBGL", JS::NumberValue(36066U) },
10038 : { "COLOR_ATTACHMENT3_WEBGL", JS::NumberValue(36067U) },
10039 : { "COLOR_ATTACHMENT4_WEBGL", JS::NumberValue(36068U) },
10040 : { "COLOR_ATTACHMENT5_WEBGL", JS::NumberValue(36069U) },
10041 : { "COLOR_ATTACHMENT6_WEBGL", JS::NumberValue(36070U) },
10042 : { "COLOR_ATTACHMENT7_WEBGL", JS::NumberValue(36071U) },
10043 : { "COLOR_ATTACHMENT8_WEBGL", JS::NumberValue(36072U) },
10044 : { "COLOR_ATTACHMENT9_WEBGL", JS::NumberValue(36073U) },
10045 : { "COLOR_ATTACHMENT10_WEBGL", JS::NumberValue(36074U) },
10046 : { "COLOR_ATTACHMENT11_WEBGL", JS::NumberValue(36075U) },
10047 : { "COLOR_ATTACHMENT12_WEBGL", JS::NumberValue(36076U) },
10048 : { "COLOR_ATTACHMENT13_WEBGL", JS::NumberValue(36077U) },
10049 : { "COLOR_ATTACHMENT14_WEBGL", JS::NumberValue(36078U) },
10050 : { "COLOR_ATTACHMENT15_WEBGL", JS::NumberValue(36079U) },
10051 : { "DRAW_BUFFER0_WEBGL", JS::NumberValue(34853U) },
10052 : { "DRAW_BUFFER1_WEBGL", JS::NumberValue(34854U) },
10053 : { "DRAW_BUFFER2_WEBGL", JS::NumberValue(34855U) },
10054 : { "DRAW_BUFFER3_WEBGL", JS::NumberValue(34856U) },
10055 : { "DRAW_BUFFER4_WEBGL", JS::NumberValue(34857U) },
10056 : { "DRAW_BUFFER5_WEBGL", JS::NumberValue(34858U) },
10057 : { "DRAW_BUFFER6_WEBGL", JS::NumberValue(34859U) },
10058 : { "DRAW_BUFFER7_WEBGL", JS::NumberValue(34860U) },
10059 : { "DRAW_BUFFER8_WEBGL", JS::NumberValue(34861U) },
10060 : { "DRAW_BUFFER9_WEBGL", JS::NumberValue(34862U) },
10061 : { "DRAW_BUFFER10_WEBGL", JS::NumberValue(34863U) },
10062 : { "DRAW_BUFFER11_WEBGL", JS::NumberValue(34864U) },
10063 : { "DRAW_BUFFER12_WEBGL", JS::NumberValue(34865U) },
10064 : { "DRAW_BUFFER13_WEBGL", JS::NumberValue(34866U) },
10065 : { "DRAW_BUFFER14_WEBGL", JS::NumberValue(34867U) },
10066 : { "DRAW_BUFFER15_WEBGL", JS::NumberValue(34868U) },
10067 : { "MAX_COLOR_ATTACHMENTS_WEBGL", JS::NumberValue(36063U) },
10068 : { "MAX_DRAW_BUFFERS_WEBGL", JS::NumberValue(34852U) },
10069 : { 0, JS::UndefinedValue() }
10070 : };
10071 : #if defined(__clang__)
10072 : #pragma clang diagnostic pop
10073 : #endif
10074 :
10075 :
10076 : // Can't be const because the pref-enabled boolean needs to be writable
10077 : static Prefable<const ConstantSpec> sConstants[] = {
10078 : { nullptr, &sConstants_specs[0] },
10079 : { nullptr, nullptr }
10080 : };
10081 :
10082 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
10083 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
10084 : static_assert(34 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
10085 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
10086 :
10087 :
10088 : static uint16_t sNativeProperties_sortedPropertyIndices[35];
10089 : static PropertyInfo sNativeProperties_propertyInfos[35];
10090 :
10091 : static const NativePropertiesN<2> sNativeProperties = {
10092 : false, 0,
10093 : false, 0,
10094 : true, 0 /* sMethods */,
10095 : false, 0,
10096 : false, 0,
10097 : false, 0,
10098 : true, 1 /* sConstants */,
10099 : -1,
10100 : 35,
10101 : sNativeProperties_sortedPropertyIndices,
10102 : {
10103 : { sMethods, &sNativeProperties_propertyInfos[0] },
10104 : { sConstants, &sNativeProperties_propertyInfos[1] }
10105 : }
10106 : };
10107 : static_assert(35 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
10108 : "We have a property info count that is oversized");
10109 :
10110 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
10111 : {
10112 : "WEBGL_draw_buffersPrototype",
10113 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
10114 : JS_NULL_CLASS_OPS,
10115 : JS_NULL_CLASS_SPEC,
10116 : JS_NULL_CLASS_EXT,
10117 : JS_NULL_OBJECT_OPS
10118 : },
10119 : eInterfacePrototype,
10120 : false,
10121 : prototypes::id::WEBGL_draw_buffers,
10122 : PrototypeTraits<prototypes::id::WEBGL_draw_buffers>::Depth,
10123 : sNativePropertyHooks,
10124 : "[object WEBGL_draw_buffersPrototype]",
10125 : JS::GetRealmObjectPrototype
10126 : };
10127 :
10128 : static const js::ClassOps sClassOps = {
10129 : _addProperty, /* addProperty */
10130 : nullptr, /* delProperty */
10131 : nullptr, /* getProperty */
10132 : nullptr, /* setProperty */
10133 : nullptr, /* enumerate */
10134 : nullptr, /* newEnumerate */
10135 : nullptr, /* resolve */
10136 : nullptr, /* mayResolve */
10137 : _finalize, /* finalize */
10138 : nullptr, /* call */
10139 : nullptr, /* hasInstance */
10140 : nullptr, /* construct */
10141 : nullptr, /* trace */
10142 : };
10143 :
10144 : static const js::ClassExtension sClassExtension = {
10145 : nullptr, /* weakmapKeyDelegateOp */
10146 : _objectMoved /* objectMovedOp */
10147 : };
10148 :
10149 : static const DOMJSClass sClass = {
10150 : { "WEBGL_draw_buffers",
10151 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
10152 : &sClassOps,
10153 : JS_NULL_CLASS_SPEC,
10154 : &sClassExtension,
10155 : JS_NULL_OBJECT_OPS
10156 : },
10157 : { prototypes::id::WEBGL_draw_buffers, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
10158 : IsBaseOf<nsISupports, mozilla::WebGLExtensionDrawBuffers >::value,
10159 : sNativePropertyHooks,
10160 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionDrawBuffers>::Get,
10161 : GetProtoObjectHandle,
10162 : GetCCParticipant<mozilla::WebGLExtensionDrawBuffers>::Get()
10163 : };
10164 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
10165 : "Must have the right minimal number of reserved slots.");
10166 : static_assert(1 >= 1,
10167 : "Must have enough reserved slots.");
10168 :
10169 : const JSClass*
10170 0 : GetJSClass()
10171 : {
10172 0 : return sClass.ToJSClass();
10173 : }
10174 :
10175 : bool
10176 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionDrawBuffers* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
10177 : {
10178 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionDrawBuffers*>(aObject) ==
10179 : reinterpret_cast<mozilla::WebGLExtensionDrawBuffers*>(aObject),
10180 : "Multiple inheritance for mozilla::WebGLExtensionDrawBuffers is broken.");
10181 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
10182 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
10183 0 : MOZ_ASSERT(!aCache->GetWrapper(),
10184 : "You should probably not be using Wrap() directly; use "
10185 : "GetOrCreateDOMReflector instead");
10186 :
10187 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
10188 : "nsISupports must be on our primary inheritance chain");
10189 :
10190 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
10191 0 : if (!global) {
10192 0 : return false;
10193 : }
10194 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
10195 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
10196 :
10197 : // That might have ended up wrapping us already, due to the wonders
10198 : // of XBL. Check for that, and bail out as needed.
10199 0 : aReflector.set(aCache->GetWrapper());
10200 0 : if (aReflector) {
10201 : #ifdef DEBUG
10202 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
10203 : #endif // DEBUG
10204 0 : return true;
10205 : }
10206 :
10207 0 : JSAutoCompartment ac(aCx, global);
10208 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
10209 0 : if (!canonicalProto) {
10210 0 : return false;
10211 : }
10212 0 : JS::Rooted<JSObject*> proto(aCx);
10213 0 : if (aGivenProto) {
10214 0 : proto = aGivenProto;
10215 : // Unfortunately, while aGivenProto was in the compartment of aCx
10216 : // coming in, we changed compartments to that of "parent" so may need
10217 : // to wrap the proto here.
10218 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
10219 0 : if (!JS_WrapObject(aCx, &proto)) {
10220 0 : return false;
10221 : }
10222 : }
10223 : } else {
10224 0 : proto = canonicalProto;
10225 : }
10226 :
10227 0 : BindingJSObjectCreator<mozilla::WebGLExtensionDrawBuffers> creator(aCx);
10228 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
10229 0 : if (!aReflector) {
10230 0 : return false;
10231 : }
10232 :
10233 0 : aCache->SetWrapper(aReflector);
10234 0 : creator.InitializationSucceeded();
10235 :
10236 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
10237 : aCache->GetWrapperPreserveColor() == aReflector);
10238 : // If proto != canonicalProto, we have to preserve our wrapper;
10239 : // otherwise we won't be able to properly recreate it later, since
10240 : // we won't know what proto to use. Note that we don't check
10241 : // aGivenProto here, since it's entirely possible (and even
10242 : // somewhat common) to have a non-null aGivenProto which is the
10243 : // same as canonicalProto.
10244 0 : if (proto != canonicalProto) {
10245 0 : PreserveWrapper(aObject);
10246 : }
10247 :
10248 0 : return true;
10249 : }
10250 :
10251 : const NativePropertyHooks sNativePropertyHooks[] = { {
10252 : nullptr,
10253 : nullptr,
10254 : nullptr,
10255 : { sNativeProperties.Upcast(), nullptr },
10256 : prototypes::id::WEBGL_draw_buffers,
10257 : constructors::id::_ID_Count,
10258 : nullptr,
10259 : &DefaultXrayExpandoObjectClass
10260 : } };
10261 :
10262 : void
10263 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
10264 : {
10265 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
10266 0 : if (!parentProto) {
10267 0 : return;
10268 : }
10269 :
10270 : static bool sIdsInited = false;
10271 0 : if (!sIdsInited && NS_IsMainThread()) {
10272 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
10273 0 : return;
10274 : }
10275 0 : sIdsInited = true;
10276 : }
10277 :
10278 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WEBGL_draw_buffers);
10279 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
10280 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
10281 : &sPrototypeClass.mBase, protoCache,
10282 : nullptr, nullptr, 0, nullptr,
10283 : interfaceCache,
10284 : sNativeProperties.Upcast(),
10285 : nullptr,
10286 : nullptr, aDefineOnGlobal,
10287 : nullptr,
10288 0 : false);
10289 : }
10290 :
10291 : JS::Handle<JSObject*>
10292 0 : GetProtoObjectHandle(JSContext* aCx)
10293 : {
10294 : /* Get the interface prototype object for this class. This will create the
10295 : object as needed. */
10296 0 : bool aDefineOnGlobal = true;
10297 :
10298 : /* Make sure our global is sane. Hopefully we can remove this sometime */
10299 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
10300 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
10301 0 : return nullptr;
10302 : }
10303 :
10304 : /* Check to see whether the interface objects are already installed */
10305 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
10306 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WEBGL_draw_buffers)) {
10307 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
10308 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
10309 : }
10310 :
10311 : /*
10312 : * The object might _still_ be null, but that's OK.
10313 : *
10314 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
10315 : * traced by TraceProtoAndIfaceCache() and its contents are never
10316 : * changed after they have been set.
10317 : *
10318 : * Calling address() avoids the read read barrier that does gray
10319 : * unmarking, but it's not possible for the object to be gray here.
10320 : */
10321 :
10322 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WEBGL_draw_buffers);
10323 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
10324 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
10325 : }
10326 :
10327 : } // namespace WEBGL_draw_buffersBinding
10328 :
10329 :
10330 :
10331 : namespace WEBGL_lose_contextBinding {
10332 :
10333 : static bool
10334 0 : loseContext(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionLoseContext* self, const JSJitMethodCallArgs& args)
10335 : {
10336 0 : self->LoseContext();
10337 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
10338 0 : args.rval().setUndefined();
10339 0 : return true;
10340 : }
10341 :
10342 : static const JSJitInfo loseContext_methodinfo = {
10343 : { (JSJitGetterOp)loseContext },
10344 : { prototypes::id::WEBGL_lose_context },
10345 : { PrototypeTraits<prototypes::id::WEBGL_lose_context>::Depth },
10346 : JSJitInfo::Method,
10347 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
10348 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
10349 : true, /* isInfallible. False in setters. */
10350 : false, /* isMovable. Not relevant for setters. */
10351 : false, /* isEliminatable. Not relevant for setters. */
10352 : false, /* isAlwaysInSlot. Only relevant for getters. */
10353 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
10354 : false, /* isTypedMethod. Only relevant for methods. */
10355 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
10356 : };
10357 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
10358 : static_assert(0 < 1, "There is no slot for us");
10359 :
10360 : static bool
10361 0 : restoreContext(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLExtensionLoseContext* self, const JSJitMethodCallArgs& args)
10362 : {
10363 0 : self->RestoreContext();
10364 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
10365 0 : args.rval().setUndefined();
10366 0 : return true;
10367 : }
10368 :
10369 : static const JSJitInfo restoreContext_methodinfo = {
10370 : { (JSJitGetterOp)restoreContext },
10371 : { prototypes::id::WEBGL_lose_context },
10372 : { PrototypeTraits<prototypes::id::WEBGL_lose_context>::Depth },
10373 : JSJitInfo::Method,
10374 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
10375 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
10376 : true, /* isInfallible. False in setters. */
10377 : false, /* isMovable. Not relevant for setters. */
10378 : false, /* isEliminatable. Not relevant for setters. */
10379 : false, /* isAlwaysInSlot. Only relevant for getters. */
10380 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
10381 : false, /* isTypedMethod. Only relevant for methods. */
10382 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
10383 : };
10384 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
10385 : static_assert(0 < 1, "There is no slot for us");
10386 :
10387 : static bool
10388 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
10389 : {
10390 0 : mozilla::WebGLExtensionLoseContext* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionLoseContext>(obj);
10391 : // We don't want to preserve if we don't have a wrapper, and we
10392 : // obviously can't preserve if we're not initialized.
10393 0 : if (self && self->GetWrapperPreserveColor()) {
10394 0 : PreserveWrapper(self);
10395 : }
10396 0 : return true;
10397 : }
10398 :
10399 : static void
10400 0 : _finalize(js::FreeOp* fop, JSObject* obj)
10401 : {
10402 0 : mozilla::WebGLExtensionLoseContext* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionLoseContext>(obj);
10403 0 : if (self) {
10404 0 : ClearWrapper(self, self, obj);
10405 0 : AddForDeferredFinalization<mozilla::WebGLExtensionLoseContext>(self);
10406 : }
10407 0 : }
10408 :
10409 : static void
10410 0 : _objectMoved(JSObject* obj, const JSObject* old)
10411 : {
10412 0 : mozilla::WebGLExtensionLoseContext* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLExtensionLoseContext>(obj);
10413 0 : if (self) {
10414 0 : UpdateWrapper(self, self, obj, old);
10415 : }
10416 0 : }
10417 :
10418 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
10419 : #if defined(__clang__)
10420 : #pragma clang diagnostic push
10421 : #pragma clang diagnostic ignored "-Wmissing-braces"
10422 : #endif
10423 : static const JSFunctionSpec sMethods_specs[] = {
10424 : JS_FNSPEC("loseContext", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&loseContext_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
10425 : JS_FNSPEC("restoreContext", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&restoreContext_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
10426 : JS_FS_END
10427 : };
10428 : #if defined(__clang__)
10429 : #pragma clang diagnostic pop
10430 : #endif
10431 :
10432 :
10433 : // Can't be const because the pref-enabled boolean needs to be writable
10434 : static Prefable<const JSFunctionSpec> sMethods[] = {
10435 : { nullptr, &sMethods_specs[0] },
10436 : { nullptr, nullptr }
10437 : };
10438 :
10439 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
10440 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
10441 : static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
10442 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
10443 :
10444 :
10445 : static uint16_t sNativeProperties_sortedPropertyIndices[2];
10446 : static PropertyInfo sNativeProperties_propertyInfos[2];
10447 :
10448 : static const NativePropertiesN<1> sNativeProperties = {
10449 : false, 0,
10450 : false, 0,
10451 : true, 0 /* sMethods */,
10452 : false, 0,
10453 : false, 0,
10454 : false, 0,
10455 : false, 0,
10456 : -1,
10457 : 2,
10458 : sNativeProperties_sortedPropertyIndices,
10459 : {
10460 : { sMethods, &sNativeProperties_propertyInfos[0] }
10461 : }
10462 : };
10463 : static_assert(2 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
10464 : "We have a property info count that is oversized");
10465 :
10466 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
10467 : {
10468 : "WEBGL_lose_contextPrototype",
10469 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
10470 : JS_NULL_CLASS_OPS,
10471 : JS_NULL_CLASS_SPEC,
10472 : JS_NULL_CLASS_EXT,
10473 : JS_NULL_OBJECT_OPS
10474 : },
10475 : eInterfacePrototype,
10476 : false,
10477 : prototypes::id::WEBGL_lose_context,
10478 : PrototypeTraits<prototypes::id::WEBGL_lose_context>::Depth,
10479 : sNativePropertyHooks,
10480 : "[object WEBGL_lose_contextPrototype]",
10481 : JS::GetRealmObjectPrototype
10482 : };
10483 :
10484 : static const js::ClassOps sClassOps = {
10485 : _addProperty, /* addProperty */
10486 : nullptr, /* delProperty */
10487 : nullptr, /* getProperty */
10488 : nullptr, /* setProperty */
10489 : nullptr, /* enumerate */
10490 : nullptr, /* newEnumerate */
10491 : nullptr, /* resolve */
10492 : nullptr, /* mayResolve */
10493 : _finalize, /* finalize */
10494 : nullptr, /* call */
10495 : nullptr, /* hasInstance */
10496 : nullptr, /* construct */
10497 : nullptr, /* trace */
10498 : };
10499 :
10500 : static const js::ClassExtension sClassExtension = {
10501 : nullptr, /* weakmapKeyDelegateOp */
10502 : _objectMoved /* objectMovedOp */
10503 : };
10504 :
10505 : static const DOMJSClass sClass = {
10506 : { "WEBGL_lose_context",
10507 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
10508 : &sClassOps,
10509 : JS_NULL_CLASS_SPEC,
10510 : &sClassExtension,
10511 : JS_NULL_OBJECT_OPS
10512 : },
10513 : { prototypes::id::WEBGL_lose_context, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
10514 : IsBaseOf<nsISupports, mozilla::WebGLExtensionLoseContext >::value,
10515 : sNativePropertyHooks,
10516 : FindAssociatedGlobalForNative<mozilla::WebGLExtensionLoseContext>::Get,
10517 : GetProtoObjectHandle,
10518 : GetCCParticipant<mozilla::WebGLExtensionLoseContext>::Get()
10519 : };
10520 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
10521 : "Must have the right minimal number of reserved slots.");
10522 : static_assert(1 >= 1,
10523 : "Must have enough reserved slots.");
10524 :
10525 : const JSClass*
10526 0 : GetJSClass()
10527 : {
10528 0 : return sClass.ToJSClass();
10529 : }
10530 :
10531 : bool
10532 0 : Wrap(JSContext* aCx, mozilla::WebGLExtensionLoseContext* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
10533 : {
10534 : MOZ_ASSERT(static_cast<mozilla::WebGLExtensionLoseContext*>(aObject) ==
10535 : reinterpret_cast<mozilla::WebGLExtensionLoseContext*>(aObject),
10536 : "Multiple inheritance for mozilla::WebGLExtensionLoseContext is broken.");
10537 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
10538 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
10539 0 : MOZ_ASSERT(!aCache->GetWrapper(),
10540 : "You should probably not be using Wrap() directly; use "
10541 : "GetOrCreateDOMReflector instead");
10542 :
10543 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
10544 : "nsISupports must be on our primary inheritance chain");
10545 :
10546 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
10547 0 : if (!global) {
10548 0 : return false;
10549 : }
10550 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
10551 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
10552 :
10553 : // That might have ended up wrapping us already, due to the wonders
10554 : // of XBL. Check for that, and bail out as needed.
10555 0 : aReflector.set(aCache->GetWrapper());
10556 0 : if (aReflector) {
10557 : #ifdef DEBUG
10558 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
10559 : #endif // DEBUG
10560 0 : return true;
10561 : }
10562 :
10563 0 : JSAutoCompartment ac(aCx, global);
10564 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
10565 0 : if (!canonicalProto) {
10566 0 : return false;
10567 : }
10568 0 : JS::Rooted<JSObject*> proto(aCx);
10569 0 : if (aGivenProto) {
10570 0 : proto = aGivenProto;
10571 : // Unfortunately, while aGivenProto was in the compartment of aCx
10572 : // coming in, we changed compartments to that of "parent" so may need
10573 : // to wrap the proto here.
10574 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
10575 0 : if (!JS_WrapObject(aCx, &proto)) {
10576 0 : return false;
10577 : }
10578 : }
10579 : } else {
10580 0 : proto = canonicalProto;
10581 : }
10582 :
10583 0 : BindingJSObjectCreator<mozilla::WebGLExtensionLoseContext> creator(aCx);
10584 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
10585 0 : if (!aReflector) {
10586 0 : return false;
10587 : }
10588 :
10589 0 : aCache->SetWrapper(aReflector);
10590 0 : creator.InitializationSucceeded();
10591 :
10592 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
10593 : aCache->GetWrapperPreserveColor() == aReflector);
10594 : // If proto != canonicalProto, we have to preserve our wrapper;
10595 : // otherwise we won't be able to properly recreate it later, since
10596 : // we won't know what proto to use. Note that we don't check
10597 : // aGivenProto here, since it's entirely possible (and even
10598 : // somewhat common) to have a non-null aGivenProto which is the
10599 : // same as canonicalProto.
10600 0 : if (proto != canonicalProto) {
10601 0 : PreserveWrapper(aObject);
10602 : }
10603 :
10604 0 : return true;
10605 : }
10606 :
10607 : const NativePropertyHooks sNativePropertyHooks[] = { {
10608 : nullptr,
10609 : nullptr,
10610 : nullptr,
10611 : { sNativeProperties.Upcast(), nullptr },
10612 : prototypes::id::WEBGL_lose_context,
10613 : constructors::id::_ID_Count,
10614 : nullptr,
10615 : &DefaultXrayExpandoObjectClass
10616 : } };
10617 :
10618 : void
10619 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
10620 : {
10621 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
10622 0 : if (!parentProto) {
10623 0 : return;
10624 : }
10625 :
10626 : static bool sIdsInited = false;
10627 0 : if (!sIdsInited && NS_IsMainThread()) {
10628 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
10629 0 : return;
10630 : }
10631 0 : sIdsInited = true;
10632 : }
10633 :
10634 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WEBGL_lose_context);
10635 0 : JS::Heap<JSObject*>* interfaceCache = nullptr;
10636 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
10637 : &sPrototypeClass.mBase, protoCache,
10638 : nullptr, nullptr, 0, nullptr,
10639 : interfaceCache,
10640 : sNativeProperties.Upcast(),
10641 : nullptr,
10642 : nullptr, aDefineOnGlobal,
10643 : nullptr,
10644 0 : false);
10645 : }
10646 :
10647 : JS::Handle<JSObject*>
10648 0 : GetProtoObjectHandle(JSContext* aCx)
10649 : {
10650 : /* Get the interface prototype object for this class. This will create the
10651 : object as needed. */
10652 0 : bool aDefineOnGlobal = true;
10653 :
10654 : /* Make sure our global is sane. Hopefully we can remove this sometime */
10655 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
10656 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
10657 0 : return nullptr;
10658 : }
10659 :
10660 : /* Check to see whether the interface objects are already installed */
10661 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
10662 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WEBGL_lose_context)) {
10663 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
10664 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
10665 : }
10666 :
10667 : /*
10668 : * The object might _still_ be null, but that's OK.
10669 : *
10670 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
10671 : * traced by TraceProtoAndIfaceCache() and its contents are never
10672 : * changed after they have been set.
10673 : *
10674 : * Calling address() avoids the read read barrier that does gray
10675 : * unmarking, but it's not possible for the object to be gray here.
10676 : */
10677 :
10678 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WEBGL_lose_context);
10679 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
10680 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
10681 : }
10682 :
10683 : } // namespace WEBGL_lose_contextBinding
10684 :
10685 :
10686 :
10687 : namespace WebGLActiveInfoBinding {
10688 :
10689 : static bool
10690 0 : get_size(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLActiveInfo* self, JSJitGetterCallArgs args)
10691 : {
10692 0 : int32_t result(self->Size());
10693 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
10694 0 : args.rval().setInt32(int32_t(result));
10695 0 : return true;
10696 : }
10697 :
10698 : static const JSJitInfo size_getterinfo = {
10699 : { (JSJitGetterOp)get_size },
10700 : { prototypes::id::WebGLActiveInfo },
10701 : { PrototypeTraits<prototypes::id::WebGLActiveInfo>::Depth },
10702 : JSJitInfo::Getter,
10703 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
10704 : JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */
10705 : true, /* isInfallible. False in setters. */
10706 : false, /* isMovable. Not relevant for setters. */
10707 : false, /* isEliminatable. Not relevant for setters. */
10708 : false, /* isAlwaysInSlot. Only relevant for getters. */
10709 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
10710 : false, /* isTypedMethod. Only relevant for methods. */
10711 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
10712 : };
10713 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
10714 : static_assert(0 < 1, "There is no slot for us");
10715 :
10716 : static bool
10717 0 : get_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLActiveInfo* self, JSJitGetterCallArgs args)
10718 : {
10719 0 : uint32_t result(self->Type());
10720 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
10721 0 : args.rval().setNumber(result);
10722 0 : return true;
10723 : }
10724 :
10725 : static const JSJitInfo type_getterinfo = {
10726 : { (JSJitGetterOp)get_type },
10727 : { prototypes::id::WebGLActiveInfo },
10728 : { PrototypeTraits<prototypes::id::WebGLActiveInfo>::Depth },
10729 : JSJitInfo::Getter,
10730 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
10731 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
10732 : true, /* isInfallible. False in setters. */
10733 : false, /* isMovable. Not relevant for setters. */
10734 : false, /* isEliminatable. Not relevant for setters. */
10735 : false, /* isAlwaysInSlot. Only relevant for getters. */
10736 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
10737 : false, /* isTypedMethod. Only relevant for methods. */
10738 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
10739 : };
10740 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
10741 : static_assert(0 < 1, "There is no slot for us");
10742 :
10743 : static bool
10744 0 : get_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLActiveInfo* self, JSJitGetterCallArgs args)
10745 : {
10746 0 : DOMString result;
10747 0 : self->GetName(result);
10748 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
10749 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
10750 0 : return false;
10751 : }
10752 0 : return true;
10753 : }
10754 :
10755 : static const JSJitInfo name_getterinfo = {
10756 : { (JSJitGetterOp)get_name },
10757 : { prototypes::id::WebGLActiveInfo },
10758 : { PrototypeTraits<prototypes::id::WebGLActiveInfo>::Depth },
10759 : JSJitInfo::Getter,
10760 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
10761 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
10762 : false, /* isInfallible. False in setters. */
10763 : false, /* isMovable. Not relevant for setters. */
10764 : false, /* isEliminatable. Not relevant for setters. */
10765 : false, /* isAlwaysInSlot. Only relevant for getters. */
10766 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
10767 : false, /* isTypedMethod. Only relevant for methods. */
10768 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
10769 : };
10770 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
10771 : static_assert(0 < 1, "There is no slot for us");
10772 :
10773 : static bool
10774 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
10775 : {
10776 0 : mozilla::WebGLActiveInfo* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLActiveInfo>(obj);
10777 : // We don't want to preserve if we don't have a wrapper, and we
10778 : // obviously can't preserve if we're not initialized.
10779 0 : if (self && self->GetWrapperPreserveColor()) {
10780 0 : PreserveWrapper(self);
10781 : }
10782 0 : return true;
10783 : }
10784 :
10785 : static void
10786 0 : _finalize(js::FreeOp* fop, JSObject* obj)
10787 : {
10788 0 : mozilla::WebGLActiveInfo* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLActiveInfo>(obj);
10789 0 : if (self) {
10790 0 : ClearWrapper(self, self, obj);
10791 0 : AddForDeferredFinalization<mozilla::WebGLActiveInfo>(self);
10792 : }
10793 0 : }
10794 :
10795 : static void
10796 0 : _objectMoved(JSObject* obj, const JSObject* old)
10797 : {
10798 0 : mozilla::WebGLActiveInfo* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLActiveInfo>(obj);
10799 0 : if (self) {
10800 0 : UpdateWrapper(self, self, obj, old);
10801 : }
10802 0 : }
10803 :
10804 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
10805 : #if defined(__clang__)
10806 : #pragma clang diagnostic push
10807 : #pragma clang diagnostic ignored "-Wmissing-braces"
10808 : #endif
10809 : static const JSPropertySpec sAttributes_specs[] = {
10810 : { "size", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &size_getterinfo, nullptr, nullptr },
10811 : { "type", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &type_getterinfo, nullptr, nullptr },
10812 : { "name", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &name_getterinfo, nullptr, nullptr },
10813 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
10814 : };
10815 : #if defined(__clang__)
10816 : #pragma clang diagnostic pop
10817 : #endif
10818 :
10819 :
10820 : // Can't be const because the pref-enabled boolean needs to be writable
10821 : static Prefable<const JSPropertySpec> sAttributes[] = {
10822 : { nullptr, &sAttributes_specs[0] },
10823 : { nullptr, nullptr }
10824 : };
10825 :
10826 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
10827 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
10828 : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
10829 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
10830 :
10831 :
10832 : static uint16_t sNativeProperties_sortedPropertyIndices[3];
10833 : static PropertyInfo sNativeProperties_propertyInfos[3];
10834 :
10835 : static const NativePropertiesN<1> sNativeProperties = {
10836 : false, 0,
10837 : false, 0,
10838 : false, 0,
10839 : true, 0 /* sAttributes */,
10840 : false, 0,
10841 : false, 0,
10842 : false, 0,
10843 : -1,
10844 : 3,
10845 : sNativeProperties_sortedPropertyIndices,
10846 : {
10847 : { sAttributes, &sNativeProperties_propertyInfos[0] }
10848 : }
10849 : };
10850 : static_assert(3 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
10851 : "We have a property info count that is oversized");
10852 :
10853 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
10854 : {
10855 : "Function",
10856 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
10857 : &sBoringInterfaceObjectClassClassOps,
10858 : JS_NULL_CLASS_SPEC,
10859 : JS_NULL_CLASS_EXT,
10860 : &sInterfaceObjectClassObjectOps
10861 : },
10862 : eInterface,
10863 : true,
10864 : prototypes::id::WebGLActiveInfo,
10865 : PrototypeTraits<prototypes::id::WebGLActiveInfo>::Depth,
10866 : sNativePropertyHooks,
10867 : "function WebGLActiveInfo() {\n [native code]\n}",
10868 : JS::GetRealmFunctionPrototype
10869 : };
10870 :
10871 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
10872 : {
10873 : "WebGLActiveInfoPrototype",
10874 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
10875 : JS_NULL_CLASS_OPS,
10876 : JS_NULL_CLASS_SPEC,
10877 : JS_NULL_CLASS_EXT,
10878 : JS_NULL_OBJECT_OPS
10879 : },
10880 : eInterfacePrototype,
10881 : false,
10882 : prototypes::id::WebGLActiveInfo,
10883 : PrototypeTraits<prototypes::id::WebGLActiveInfo>::Depth,
10884 : sNativePropertyHooks,
10885 : "[object WebGLActiveInfoPrototype]",
10886 : JS::GetRealmObjectPrototype
10887 : };
10888 :
10889 : bool
10890 1 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
10891 : {
10892 1 : return mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread(aCx, aObj);
10893 : }
10894 :
10895 : JSObject*
10896 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
10897 : {
10898 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
10899 : }
10900 :
10901 : static const js::ClassOps sClassOps = {
10902 : _addProperty, /* addProperty */
10903 : nullptr, /* delProperty */
10904 : nullptr, /* getProperty */
10905 : nullptr, /* setProperty */
10906 : nullptr, /* enumerate */
10907 : nullptr, /* newEnumerate */
10908 : nullptr, /* resolve */
10909 : nullptr, /* mayResolve */
10910 : _finalize, /* finalize */
10911 : nullptr, /* call */
10912 : nullptr, /* hasInstance */
10913 : nullptr, /* construct */
10914 : nullptr, /* trace */
10915 : };
10916 :
10917 : static const js::ClassExtension sClassExtension = {
10918 : nullptr, /* weakmapKeyDelegateOp */
10919 : _objectMoved /* objectMovedOp */
10920 : };
10921 :
10922 : static const DOMJSClass sClass = {
10923 : { "WebGLActiveInfo",
10924 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
10925 : &sClassOps,
10926 : JS_NULL_CLASS_SPEC,
10927 : &sClassExtension,
10928 : JS_NULL_OBJECT_OPS
10929 : },
10930 : { prototypes::id::WebGLActiveInfo, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
10931 : IsBaseOf<nsISupports, mozilla::WebGLActiveInfo >::value,
10932 : sNativePropertyHooks,
10933 : FindAssociatedGlobalForNative<mozilla::WebGLActiveInfo>::Get,
10934 : GetProtoObjectHandle,
10935 : GetCCParticipant<mozilla::WebGLActiveInfo>::Get()
10936 : };
10937 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
10938 : "Must have the right minimal number of reserved slots.");
10939 : static_assert(1 >= 1,
10940 : "Must have enough reserved slots.");
10941 :
10942 : const JSClass*
10943 0 : GetJSClass()
10944 : {
10945 0 : return sClass.ToJSClass();
10946 : }
10947 :
10948 : bool
10949 0 : Wrap(JSContext* aCx, mozilla::WebGLActiveInfo* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
10950 : {
10951 : MOZ_ASSERT(static_cast<mozilla::WebGLActiveInfo*>(aObject) ==
10952 : reinterpret_cast<mozilla::WebGLActiveInfo*>(aObject),
10953 : "Multiple inheritance for mozilla::WebGLActiveInfo is broken.");
10954 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
10955 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
10956 0 : MOZ_ASSERT(!aCache->GetWrapper(),
10957 : "You should probably not be using Wrap() directly; use "
10958 : "GetOrCreateDOMReflector instead");
10959 :
10960 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
10961 : "nsISupports must be on our primary inheritance chain");
10962 :
10963 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
10964 0 : if (!global) {
10965 0 : return false;
10966 : }
10967 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
10968 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
10969 :
10970 : // That might have ended up wrapping us already, due to the wonders
10971 : // of XBL. Check for that, and bail out as needed.
10972 0 : aReflector.set(aCache->GetWrapper());
10973 0 : if (aReflector) {
10974 : #ifdef DEBUG
10975 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
10976 : #endif // DEBUG
10977 0 : return true;
10978 : }
10979 :
10980 0 : JSAutoCompartment ac(aCx, global);
10981 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
10982 0 : if (!canonicalProto) {
10983 0 : return false;
10984 : }
10985 0 : JS::Rooted<JSObject*> proto(aCx);
10986 0 : if (aGivenProto) {
10987 0 : proto = aGivenProto;
10988 : // Unfortunately, while aGivenProto was in the compartment of aCx
10989 : // coming in, we changed compartments to that of "parent" so may need
10990 : // to wrap the proto here.
10991 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
10992 0 : if (!JS_WrapObject(aCx, &proto)) {
10993 0 : return false;
10994 : }
10995 : }
10996 : } else {
10997 0 : proto = canonicalProto;
10998 : }
10999 :
11000 0 : BindingJSObjectCreator<mozilla::WebGLActiveInfo> creator(aCx);
11001 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
11002 0 : if (!aReflector) {
11003 0 : return false;
11004 : }
11005 :
11006 0 : aCache->SetWrapper(aReflector);
11007 0 : creator.InitializationSucceeded();
11008 :
11009 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
11010 : aCache->GetWrapperPreserveColor() == aReflector);
11011 : // If proto != canonicalProto, we have to preserve our wrapper;
11012 : // otherwise we won't be able to properly recreate it later, since
11013 : // we won't know what proto to use. Note that we don't check
11014 : // aGivenProto here, since it's entirely possible (and even
11015 : // somewhat common) to have a non-null aGivenProto which is the
11016 : // same as canonicalProto.
11017 0 : if (proto != canonicalProto) {
11018 0 : PreserveWrapper(aObject);
11019 : }
11020 :
11021 0 : return true;
11022 : }
11023 :
11024 : const NativePropertyHooks sNativePropertyHooks[] = { {
11025 : nullptr,
11026 : nullptr,
11027 : nullptr,
11028 : { sNativeProperties.Upcast(), nullptr },
11029 : prototypes::id::WebGLActiveInfo,
11030 : constructors::id::WebGLActiveInfo,
11031 : nullptr,
11032 : &DefaultXrayExpandoObjectClass
11033 : } };
11034 :
11035 : void
11036 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
11037 : {
11038 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
11039 0 : if (!parentProto) {
11040 0 : return;
11041 : }
11042 :
11043 0 : JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
11044 0 : if (!constructorProto) {
11045 0 : return;
11046 : }
11047 :
11048 : static bool sIdsInited = false;
11049 0 : if (!sIdsInited && NS_IsMainThread()) {
11050 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
11051 0 : return;
11052 : }
11053 0 : sIdsInited = true;
11054 : }
11055 :
11056 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WebGLActiveInfo);
11057 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::WebGLActiveInfo);
11058 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
11059 : &sPrototypeClass.mBase, protoCache,
11060 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
11061 : interfaceCache,
11062 : sNativeProperties.Upcast(),
11063 : nullptr,
11064 : "WebGLActiveInfo", aDefineOnGlobal,
11065 : nullptr,
11066 0 : false);
11067 : }
11068 :
11069 : JS::Handle<JSObject*>
11070 0 : GetProtoObjectHandle(JSContext* aCx)
11071 : {
11072 : /* Get the interface prototype object for this class. This will create the
11073 : object as needed. */
11074 0 : bool aDefineOnGlobal = true;
11075 :
11076 : /* Make sure our global is sane. Hopefully we can remove this sometime */
11077 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
11078 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
11079 0 : return nullptr;
11080 : }
11081 :
11082 : /* Check to see whether the interface objects are already installed */
11083 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
11084 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WebGLActiveInfo)) {
11085 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
11086 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
11087 : }
11088 :
11089 : /*
11090 : * The object might _still_ be null, but that's OK.
11091 : *
11092 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
11093 : * traced by TraceProtoAndIfaceCache() and its contents are never
11094 : * changed after they have been set.
11095 : *
11096 : * Calling address() avoids the read read barrier that does gray
11097 : * unmarking, but it's not possible for the object to be gray here.
11098 : */
11099 :
11100 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WebGLActiveInfo);
11101 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
11102 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
11103 : }
11104 :
11105 : JS::Handle<JSObject*>
11106 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
11107 : {
11108 : /* Get the interface object for this class. This will create the object as
11109 : needed. */
11110 :
11111 : /* Make sure our global is sane. Hopefully we can remove this sometime */
11112 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
11113 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
11114 0 : return nullptr;
11115 : }
11116 :
11117 : /* Check to see whether the interface objects are already installed */
11118 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
11119 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::WebGLActiveInfo)) {
11120 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
11121 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
11122 : }
11123 :
11124 : /*
11125 : * The object might _still_ be null, but that's OK.
11126 : *
11127 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
11128 : * traced by TraceProtoAndIfaceCache() and its contents are never
11129 : * changed after they have been set.
11130 : *
11131 : * Calling address() avoids the read read barrier that does gray
11132 : * unmarking, but it's not possible for the object to be gray here.
11133 : */
11134 :
11135 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::WebGLActiveInfo);
11136 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
11137 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
11138 : }
11139 :
11140 : JSObject*
11141 0 : GetConstructorObject(JSContext* aCx)
11142 : {
11143 0 : return GetConstructorObjectHandle(aCx);
11144 : }
11145 :
11146 : } // namespace WebGLActiveInfoBinding
11147 :
11148 :
11149 :
11150 : namespace WebGLBufferBinding {
11151 :
11152 : static bool
11153 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
11154 : {
11155 0 : mozilla::WebGLBuffer* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLBuffer>(obj);
11156 : // We don't want to preserve if we don't have a wrapper, and we
11157 : // obviously can't preserve if we're not initialized.
11158 0 : if (self && self->GetWrapperPreserveColor()) {
11159 0 : PreserveWrapper(self);
11160 : }
11161 0 : return true;
11162 : }
11163 :
11164 : static void
11165 0 : _finalize(js::FreeOp* fop, JSObject* obj)
11166 : {
11167 0 : mozilla::WebGLBuffer* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLBuffer>(obj);
11168 0 : if (self) {
11169 0 : ClearWrapper(self, self, obj);
11170 0 : AddForDeferredFinalization<mozilla::WebGLBuffer>(self);
11171 : }
11172 0 : }
11173 :
11174 : static void
11175 0 : _objectMoved(JSObject* obj, const JSObject* old)
11176 : {
11177 0 : mozilla::WebGLBuffer* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLBuffer>(obj);
11178 0 : if (self) {
11179 0 : UpdateWrapper(self, self, obj, old);
11180 : }
11181 0 : }
11182 :
11183 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
11184 : {
11185 : "Function",
11186 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
11187 : &sBoringInterfaceObjectClassClassOps,
11188 : JS_NULL_CLASS_SPEC,
11189 : JS_NULL_CLASS_EXT,
11190 : &sInterfaceObjectClassObjectOps
11191 : },
11192 : eInterface,
11193 : true,
11194 : prototypes::id::WebGLBuffer,
11195 : PrototypeTraits<prototypes::id::WebGLBuffer>::Depth,
11196 : sNativePropertyHooks,
11197 : "function WebGLBuffer() {\n [native code]\n}",
11198 : JS::GetRealmFunctionPrototype
11199 : };
11200 :
11201 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
11202 : {
11203 : "WebGLBufferPrototype",
11204 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
11205 : JS_NULL_CLASS_OPS,
11206 : JS_NULL_CLASS_SPEC,
11207 : JS_NULL_CLASS_EXT,
11208 : JS_NULL_OBJECT_OPS
11209 : },
11210 : eInterfacePrototype,
11211 : false,
11212 : prototypes::id::WebGLBuffer,
11213 : PrototypeTraits<prototypes::id::WebGLBuffer>::Depth,
11214 : sNativePropertyHooks,
11215 : "[object WebGLBufferPrototype]",
11216 : JS::GetRealmObjectPrototype
11217 : };
11218 :
11219 : bool
11220 1 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
11221 : {
11222 1 : return mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread(aCx, aObj);
11223 : }
11224 :
11225 : JSObject*
11226 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
11227 : {
11228 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
11229 : }
11230 :
11231 : static const js::ClassOps sClassOps = {
11232 : _addProperty, /* addProperty */
11233 : nullptr, /* delProperty */
11234 : nullptr, /* getProperty */
11235 : nullptr, /* setProperty */
11236 : nullptr, /* enumerate */
11237 : nullptr, /* newEnumerate */
11238 : nullptr, /* resolve */
11239 : nullptr, /* mayResolve */
11240 : _finalize, /* finalize */
11241 : nullptr, /* call */
11242 : nullptr, /* hasInstance */
11243 : nullptr, /* construct */
11244 : nullptr, /* trace */
11245 : };
11246 :
11247 : static const js::ClassExtension sClassExtension = {
11248 : nullptr, /* weakmapKeyDelegateOp */
11249 : _objectMoved /* objectMovedOp */
11250 : };
11251 :
11252 : static const DOMJSClass sClass = {
11253 : { "WebGLBuffer",
11254 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
11255 : &sClassOps,
11256 : JS_NULL_CLASS_SPEC,
11257 : &sClassExtension,
11258 : JS_NULL_OBJECT_OPS
11259 : },
11260 : { prototypes::id::WebGLBuffer, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
11261 : IsBaseOf<nsISupports, mozilla::WebGLBuffer >::value,
11262 : sNativePropertyHooks,
11263 : FindAssociatedGlobalForNative<mozilla::WebGLBuffer>::Get,
11264 : GetProtoObjectHandle,
11265 : GetCCParticipant<mozilla::WebGLBuffer>::Get()
11266 : };
11267 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
11268 : "Must have the right minimal number of reserved slots.");
11269 : static_assert(1 >= 1,
11270 : "Must have enough reserved slots.");
11271 :
11272 : const JSClass*
11273 0 : GetJSClass()
11274 : {
11275 0 : return sClass.ToJSClass();
11276 : }
11277 :
11278 : bool
11279 0 : Wrap(JSContext* aCx, mozilla::WebGLBuffer* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
11280 : {
11281 : MOZ_ASSERT(static_cast<mozilla::WebGLBuffer*>(aObject) ==
11282 : reinterpret_cast<mozilla::WebGLBuffer*>(aObject),
11283 : "Multiple inheritance for mozilla::WebGLBuffer is broken.");
11284 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
11285 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
11286 0 : MOZ_ASSERT(!aCache->GetWrapper(),
11287 : "You should probably not be using Wrap() directly; use "
11288 : "GetOrCreateDOMReflector instead");
11289 :
11290 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
11291 : "nsISupports must be on our primary inheritance chain");
11292 :
11293 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
11294 0 : if (!global) {
11295 0 : return false;
11296 : }
11297 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
11298 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
11299 :
11300 : // That might have ended up wrapping us already, due to the wonders
11301 : // of XBL. Check for that, and bail out as needed.
11302 0 : aReflector.set(aCache->GetWrapper());
11303 0 : if (aReflector) {
11304 : #ifdef DEBUG
11305 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
11306 : #endif // DEBUG
11307 0 : return true;
11308 : }
11309 :
11310 0 : JSAutoCompartment ac(aCx, global);
11311 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
11312 0 : if (!canonicalProto) {
11313 0 : return false;
11314 : }
11315 0 : JS::Rooted<JSObject*> proto(aCx);
11316 0 : if (aGivenProto) {
11317 0 : proto = aGivenProto;
11318 : // Unfortunately, while aGivenProto was in the compartment of aCx
11319 : // coming in, we changed compartments to that of "parent" so may need
11320 : // to wrap the proto here.
11321 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
11322 0 : if (!JS_WrapObject(aCx, &proto)) {
11323 0 : return false;
11324 : }
11325 : }
11326 : } else {
11327 0 : proto = canonicalProto;
11328 : }
11329 :
11330 0 : BindingJSObjectCreator<mozilla::WebGLBuffer> creator(aCx);
11331 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
11332 0 : if (!aReflector) {
11333 0 : return false;
11334 : }
11335 :
11336 0 : aCache->SetWrapper(aReflector);
11337 0 : creator.InitializationSucceeded();
11338 :
11339 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
11340 : aCache->GetWrapperPreserveColor() == aReflector);
11341 : // If proto != canonicalProto, we have to preserve our wrapper;
11342 : // otherwise we won't be able to properly recreate it later, since
11343 : // we won't know what proto to use. Note that we don't check
11344 : // aGivenProto here, since it's entirely possible (and even
11345 : // somewhat common) to have a non-null aGivenProto which is the
11346 : // same as canonicalProto.
11347 0 : if (proto != canonicalProto) {
11348 0 : PreserveWrapper(aObject);
11349 : }
11350 :
11351 0 : return true;
11352 : }
11353 :
11354 : const NativePropertyHooks sNativePropertyHooks[] = { {
11355 : nullptr,
11356 : nullptr,
11357 : nullptr,
11358 : { nullptr, nullptr },
11359 : prototypes::id::WebGLBuffer,
11360 : constructors::id::WebGLBuffer,
11361 : nullptr,
11362 : &DefaultXrayExpandoObjectClass
11363 : } };
11364 :
11365 : void
11366 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
11367 : {
11368 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
11369 0 : if (!parentProto) {
11370 0 : return;
11371 : }
11372 :
11373 0 : JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
11374 0 : if (!constructorProto) {
11375 0 : return;
11376 : }
11377 :
11378 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WebGLBuffer);
11379 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::WebGLBuffer);
11380 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
11381 : &sPrototypeClass.mBase, protoCache,
11382 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
11383 : interfaceCache,
11384 : nullptr,
11385 : nullptr,
11386 : "WebGLBuffer", aDefineOnGlobal,
11387 : nullptr,
11388 0 : false);
11389 : }
11390 :
11391 : JS::Handle<JSObject*>
11392 0 : GetProtoObjectHandle(JSContext* aCx)
11393 : {
11394 : /* Get the interface prototype object for this class. This will create the
11395 : object as needed. */
11396 0 : bool aDefineOnGlobal = true;
11397 :
11398 : /* Make sure our global is sane. Hopefully we can remove this sometime */
11399 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
11400 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
11401 0 : return nullptr;
11402 : }
11403 :
11404 : /* Check to see whether the interface objects are already installed */
11405 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
11406 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WebGLBuffer)) {
11407 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
11408 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
11409 : }
11410 :
11411 : /*
11412 : * The object might _still_ be null, but that's OK.
11413 : *
11414 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
11415 : * traced by TraceProtoAndIfaceCache() and its contents are never
11416 : * changed after they have been set.
11417 : *
11418 : * Calling address() avoids the read read barrier that does gray
11419 : * unmarking, but it's not possible for the object to be gray here.
11420 : */
11421 :
11422 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WebGLBuffer);
11423 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
11424 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
11425 : }
11426 :
11427 : JS::Handle<JSObject*>
11428 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
11429 : {
11430 : /* Get the interface object for this class. This will create the object as
11431 : needed. */
11432 :
11433 : /* Make sure our global is sane. Hopefully we can remove this sometime */
11434 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
11435 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
11436 0 : return nullptr;
11437 : }
11438 :
11439 : /* Check to see whether the interface objects are already installed */
11440 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
11441 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::WebGLBuffer)) {
11442 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
11443 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
11444 : }
11445 :
11446 : /*
11447 : * The object might _still_ be null, but that's OK.
11448 : *
11449 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
11450 : * traced by TraceProtoAndIfaceCache() and its contents are never
11451 : * changed after they have been set.
11452 : *
11453 : * Calling address() avoids the read read barrier that does gray
11454 : * unmarking, but it's not possible for the object to be gray here.
11455 : */
11456 :
11457 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::WebGLBuffer);
11458 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
11459 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
11460 : }
11461 :
11462 : JSObject*
11463 0 : GetConstructorObject(JSContext* aCx)
11464 : {
11465 0 : return GetConstructorObjectHandle(aCx);
11466 : }
11467 :
11468 : } // namespace WebGLBufferBinding
11469 :
11470 :
11471 :
11472 : namespace WebGLFramebufferBinding {
11473 :
11474 : static bool
11475 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
11476 : {
11477 0 : mozilla::WebGLFramebuffer* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLFramebuffer>(obj);
11478 : // We don't want to preserve if we don't have a wrapper, and we
11479 : // obviously can't preserve if we're not initialized.
11480 0 : if (self && self->GetWrapperPreserveColor()) {
11481 0 : PreserveWrapper(self);
11482 : }
11483 0 : return true;
11484 : }
11485 :
11486 : static void
11487 0 : _finalize(js::FreeOp* fop, JSObject* obj)
11488 : {
11489 0 : mozilla::WebGLFramebuffer* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLFramebuffer>(obj);
11490 0 : if (self) {
11491 0 : ClearWrapper(self, self, obj);
11492 0 : AddForDeferredFinalization<mozilla::WebGLFramebuffer>(self);
11493 : }
11494 0 : }
11495 :
11496 : static void
11497 0 : _objectMoved(JSObject* obj, const JSObject* old)
11498 : {
11499 0 : mozilla::WebGLFramebuffer* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLFramebuffer>(obj);
11500 0 : if (self) {
11501 0 : UpdateWrapper(self, self, obj, old);
11502 : }
11503 0 : }
11504 :
11505 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
11506 : {
11507 : "Function",
11508 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
11509 : &sBoringInterfaceObjectClassClassOps,
11510 : JS_NULL_CLASS_SPEC,
11511 : JS_NULL_CLASS_EXT,
11512 : &sInterfaceObjectClassObjectOps
11513 : },
11514 : eInterface,
11515 : true,
11516 : prototypes::id::WebGLFramebuffer,
11517 : PrototypeTraits<prototypes::id::WebGLFramebuffer>::Depth,
11518 : sNativePropertyHooks,
11519 : "function WebGLFramebuffer() {\n [native code]\n}",
11520 : JS::GetRealmFunctionPrototype
11521 : };
11522 :
11523 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
11524 : {
11525 : "WebGLFramebufferPrototype",
11526 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
11527 : JS_NULL_CLASS_OPS,
11528 : JS_NULL_CLASS_SPEC,
11529 : JS_NULL_CLASS_EXT,
11530 : JS_NULL_OBJECT_OPS
11531 : },
11532 : eInterfacePrototype,
11533 : false,
11534 : prototypes::id::WebGLFramebuffer,
11535 : PrototypeTraits<prototypes::id::WebGLFramebuffer>::Depth,
11536 : sNativePropertyHooks,
11537 : "[object WebGLFramebufferPrototype]",
11538 : JS::GetRealmObjectPrototype
11539 : };
11540 :
11541 : bool
11542 1 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
11543 : {
11544 1 : return mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread(aCx, aObj);
11545 : }
11546 :
11547 : JSObject*
11548 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
11549 : {
11550 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
11551 : }
11552 :
11553 : static const js::ClassOps sClassOps = {
11554 : _addProperty, /* addProperty */
11555 : nullptr, /* delProperty */
11556 : nullptr, /* getProperty */
11557 : nullptr, /* setProperty */
11558 : nullptr, /* enumerate */
11559 : nullptr, /* newEnumerate */
11560 : nullptr, /* resolve */
11561 : nullptr, /* mayResolve */
11562 : _finalize, /* finalize */
11563 : nullptr, /* call */
11564 : nullptr, /* hasInstance */
11565 : nullptr, /* construct */
11566 : nullptr, /* trace */
11567 : };
11568 :
11569 : static const js::ClassExtension sClassExtension = {
11570 : nullptr, /* weakmapKeyDelegateOp */
11571 : _objectMoved /* objectMovedOp */
11572 : };
11573 :
11574 : static const DOMJSClass sClass = {
11575 : { "WebGLFramebuffer",
11576 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
11577 : &sClassOps,
11578 : JS_NULL_CLASS_SPEC,
11579 : &sClassExtension,
11580 : JS_NULL_OBJECT_OPS
11581 : },
11582 : { prototypes::id::WebGLFramebuffer, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
11583 : IsBaseOf<nsISupports, mozilla::WebGLFramebuffer >::value,
11584 : sNativePropertyHooks,
11585 : FindAssociatedGlobalForNative<mozilla::WebGLFramebuffer>::Get,
11586 : GetProtoObjectHandle,
11587 : GetCCParticipant<mozilla::WebGLFramebuffer>::Get()
11588 : };
11589 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
11590 : "Must have the right minimal number of reserved slots.");
11591 : static_assert(1 >= 1,
11592 : "Must have enough reserved slots.");
11593 :
11594 : const JSClass*
11595 0 : GetJSClass()
11596 : {
11597 0 : return sClass.ToJSClass();
11598 : }
11599 :
11600 : bool
11601 0 : Wrap(JSContext* aCx, mozilla::WebGLFramebuffer* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
11602 : {
11603 : MOZ_ASSERT(static_cast<mozilla::WebGLFramebuffer*>(aObject) ==
11604 : reinterpret_cast<mozilla::WebGLFramebuffer*>(aObject),
11605 : "Multiple inheritance for mozilla::WebGLFramebuffer is broken.");
11606 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
11607 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
11608 0 : MOZ_ASSERT(!aCache->GetWrapper(),
11609 : "You should probably not be using Wrap() directly; use "
11610 : "GetOrCreateDOMReflector instead");
11611 :
11612 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
11613 : "nsISupports must be on our primary inheritance chain");
11614 :
11615 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
11616 0 : if (!global) {
11617 0 : return false;
11618 : }
11619 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
11620 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
11621 :
11622 : // That might have ended up wrapping us already, due to the wonders
11623 : // of XBL. Check for that, and bail out as needed.
11624 0 : aReflector.set(aCache->GetWrapper());
11625 0 : if (aReflector) {
11626 : #ifdef DEBUG
11627 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
11628 : #endif // DEBUG
11629 0 : return true;
11630 : }
11631 :
11632 0 : JSAutoCompartment ac(aCx, global);
11633 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
11634 0 : if (!canonicalProto) {
11635 0 : return false;
11636 : }
11637 0 : JS::Rooted<JSObject*> proto(aCx);
11638 0 : if (aGivenProto) {
11639 0 : proto = aGivenProto;
11640 : // Unfortunately, while aGivenProto was in the compartment of aCx
11641 : // coming in, we changed compartments to that of "parent" so may need
11642 : // to wrap the proto here.
11643 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
11644 0 : if (!JS_WrapObject(aCx, &proto)) {
11645 0 : return false;
11646 : }
11647 : }
11648 : } else {
11649 0 : proto = canonicalProto;
11650 : }
11651 :
11652 0 : BindingJSObjectCreator<mozilla::WebGLFramebuffer> creator(aCx);
11653 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
11654 0 : if (!aReflector) {
11655 0 : return false;
11656 : }
11657 :
11658 0 : aCache->SetWrapper(aReflector);
11659 0 : creator.InitializationSucceeded();
11660 :
11661 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
11662 : aCache->GetWrapperPreserveColor() == aReflector);
11663 : // If proto != canonicalProto, we have to preserve our wrapper;
11664 : // otherwise we won't be able to properly recreate it later, since
11665 : // we won't know what proto to use. Note that we don't check
11666 : // aGivenProto here, since it's entirely possible (and even
11667 : // somewhat common) to have a non-null aGivenProto which is the
11668 : // same as canonicalProto.
11669 0 : if (proto != canonicalProto) {
11670 0 : PreserveWrapper(aObject);
11671 : }
11672 :
11673 0 : return true;
11674 : }
11675 :
11676 : const NativePropertyHooks sNativePropertyHooks[] = { {
11677 : nullptr,
11678 : nullptr,
11679 : nullptr,
11680 : { nullptr, nullptr },
11681 : prototypes::id::WebGLFramebuffer,
11682 : constructors::id::WebGLFramebuffer,
11683 : nullptr,
11684 : &DefaultXrayExpandoObjectClass
11685 : } };
11686 :
11687 : void
11688 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
11689 : {
11690 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
11691 0 : if (!parentProto) {
11692 0 : return;
11693 : }
11694 :
11695 0 : JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
11696 0 : if (!constructorProto) {
11697 0 : return;
11698 : }
11699 :
11700 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WebGLFramebuffer);
11701 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::WebGLFramebuffer);
11702 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
11703 : &sPrototypeClass.mBase, protoCache,
11704 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
11705 : interfaceCache,
11706 : nullptr,
11707 : nullptr,
11708 : "WebGLFramebuffer", aDefineOnGlobal,
11709 : nullptr,
11710 0 : false);
11711 : }
11712 :
11713 : JS::Handle<JSObject*>
11714 0 : GetProtoObjectHandle(JSContext* aCx)
11715 : {
11716 : /* Get the interface prototype object for this class. This will create the
11717 : object as needed. */
11718 0 : bool aDefineOnGlobal = true;
11719 :
11720 : /* Make sure our global is sane. Hopefully we can remove this sometime */
11721 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
11722 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
11723 0 : return nullptr;
11724 : }
11725 :
11726 : /* Check to see whether the interface objects are already installed */
11727 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
11728 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WebGLFramebuffer)) {
11729 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
11730 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
11731 : }
11732 :
11733 : /*
11734 : * The object might _still_ be null, but that's OK.
11735 : *
11736 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
11737 : * traced by TraceProtoAndIfaceCache() and its contents are never
11738 : * changed after they have been set.
11739 : *
11740 : * Calling address() avoids the read read barrier that does gray
11741 : * unmarking, but it's not possible for the object to be gray here.
11742 : */
11743 :
11744 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WebGLFramebuffer);
11745 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
11746 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
11747 : }
11748 :
11749 : JS::Handle<JSObject*>
11750 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
11751 : {
11752 : /* Get the interface object for this class. This will create the object as
11753 : needed. */
11754 :
11755 : /* Make sure our global is sane. Hopefully we can remove this sometime */
11756 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
11757 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
11758 0 : return nullptr;
11759 : }
11760 :
11761 : /* Check to see whether the interface objects are already installed */
11762 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
11763 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::WebGLFramebuffer)) {
11764 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
11765 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
11766 : }
11767 :
11768 : /*
11769 : * The object might _still_ be null, but that's OK.
11770 : *
11771 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
11772 : * traced by TraceProtoAndIfaceCache() and its contents are never
11773 : * changed after they have been set.
11774 : *
11775 : * Calling address() avoids the read read barrier that does gray
11776 : * unmarking, but it's not possible for the object to be gray here.
11777 : */
11778 :
11779 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::WebGLFramebuffer);
11780 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
11781 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
11782 : }
11783 :
11784 : JSObject*
11785 0 : GetConstructorObject(JSContext* aCx)
11786 : {
11787 0 : return GetConstructorObjectHandle(aCx);
11788 : }
11789 :
11790 : } // namespace WebGLFramebufferBinding
11791 :
11792 :
11793 :
11794 : namespace WebGLProgramBinding {
11795 :
11796 : static bool
11797 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
11798 : {
11799 0 : mozilla::WebGLProgram* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLProgram>(obj);
11800 : // We don't want to preserve if we don't have a wrapper, and we
11801 : // obviously can't preserve if we're not initialized.
11802 0 : if (self && self->GetWrapperPreserveColor()) {
11803 0 : PreserveWrapper(self);
11804 : }
11805 0 : return true;
11806 : }
11807 :
11808 : static void
11809 0 : _finalize(js::FreeOp* fop, JSObject* obj)
11810 : {
11811 0 : mozilla::WebGLProgram* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLProgram>(obj);
11812 0 : if (self) {
11813 0 : ClearWrapper(self, self, obj);
11814 0 : AddForDeferredFinalization<mozilla::WebGLProgram>(self);
11815 : }
11816 0 : }
11817 :
11818 : static void
11819 0 : _objectMoved(JSObject* obj, const JSObject* old)
11820 : {
11821 0 : mozilla::WebGLProgram* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLProgram>(obj);
11822 0 : if (self) {
11823 0 : UpdateWrapper(self, self, obj, old);
11824 : }
11825 0 : }
11826 :
11827 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
11828 : {
11829 : "Function",
11830 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
11831 : &sBoringInterfaceObjectClassClassOps,
11832 : JS_NULL_CLASS_SPEC,
11833 : JS_NULL_CLASS_EXT,
11834 : &sInterfaceObjectClassObjectOps
11835 : },
11836 : eInterface,
11837 : true,
11838 : prototypes::id::WebGLProgram,
11839 : PrototypeTraits<prototypes::id::WebGLProgram>::Depth,
11840 : sNativePropertyHooks,
11841 : "function WebGLProgram() {\n [native code]\n}",
11842 : JS::GetRealmFunctionPrototype
11843 : };
11844 :
11845 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
11846 : {
11847 : "WebGLProgramPrototype",
11848 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
11849 : JS_NULL_CLASS_OPS,
11850 : JS_NULL_CLASS_SPEC,
11851 : JS_NULL_CLASS_EXT,
11852 : JS_NULL_OBJECT_OPS
11853 : },
11854 : eInterfacePrototype,
11855 : false,
11856 : prototypes::id::WebGLProgram,
11857 : PrototypeTraits<prototypes::id::WebGLProgram>::Depth,
11858 : sNativePropertyHooks,
11859 : "[object WebGLProgramPrototype]",
11860 : JS::GetRealmObjectPrototype
11861 : };
11862 :
11863 : bool
11864 1 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
11865 : {
11866 1 : return mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread(aCx, aObj);
11867 : }
11868 :
11869 : JSObject*
11870 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
11871 : {
11872 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
11873 : }
11874 :
11875 : static const js::ClassOps sClassOps = {
11876 : _addProperty, /* addProperty */
11877 : nullptr, /* delProperty */
11878 : nullptr, /* getProperty */
11879 : nullptr, /* setProperty */
11880 : nullptr, /* enumerate */
11881 : nullptr, /* newEnumerate */
11882 : nullptr, /* resolve */
11883 : nullptr, /* mayResolve */
11884 : _finalize, /* finalize */
11885 : nullptr, /* call */
11886 : nullptr, /* hasInstance */
11887 : nullptr, /* construct */
11888 : nullptr, /* trace */
11889 : };
11890 :
11891 : static const js::ClassExtension sClassExtension = {
11892 : nullptr, /* weakmapKeyDelegateOp */
11893 : _objectMoved /* objectMovedOp */
11894 : };
11895 :
11896 : static const DOMJSClass sClass = {
11897 : { "WebGLProgram",
11898 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
11899 : &sClassOps,
11900 : JS_NULL_CLASS_SPEC,
11901 : &sClassExtension,
11902 : JS_NULL_OBJECT_OPS
11903 : },
11904 : { prototypes::id::WebGLProgram, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
11905 : IsBaseOf<nsISupports, mozilla::WebGLProgram >::value,
11906 : sNativePropertyHooks,
11907 : FindAssociatedGlobalForNative<mozilla::WebGLProgram>::Get,
11908 : GetProtoObjectHandle,
11909 : GetCCParticipant<mozilla::WebGLProgram>::Get()
11910 : };
11911 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
11912 : "Must have the right minimal number of reserved slots.");
11913 : static_assert(1 >= 1,
11914 : "Must have enough reserved slots.");
11915 :
11916 : const JSClass*
11917 0 : GetJSClass()
11918 : {
11919 0 : return sClass.ToJSClass();
11920 : }
11921 :
11922 : bool
11923 0 : Wrap(JSContext* aCx, mozilla::WebGLProgram* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
11924 : {
11925 : MOZ_ASSERT(static_cast<mozilla::WebGLProgram*>(aObject) ==
11926 : reinterpret_cast<mozilla::WebGLProgram*>(aObject),
11927 : "Multiple inheritance for mozilla::WebGLProgram is broken.");
11928 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
11929 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
11930 0 : MOZ_ASSERT(!aCache->GetWrapper(),
11931 : "You should probably not be using Wrap() directly; use "
11932 : "GetOrCreateDOMReflector instead");
11933 :
11934 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
11935 : "nsISupports must be on our primary inheritance chain");
11936 :
11937 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
11938 0 : if (!global) {
11939 0 : return false;
11940 : }
11941 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
11942 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
11943 :
11944 : // That might have ended up wrapping us already, due to the wonders
11945 : // of XBL. Check for that, and bail out as needed.
11946 0 : aReflector.set(aCache->GetWrapper());
11947 0 : if (aReflector) {
11948 : #ifdef DEBUG
11949 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
11950 : #endif // DEBUG
11951 0 : return true;
11952 : }
11953 :
11954 0 : JSAutoCompartment ac(aCx, global);
11955 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
11956 0 : if (!canonicalProto) {
11957 0 : return false;
11958 : }
11959 0 : JS::Rooted<JSObject*> proto(aCx);
11960 0 : if (aGivenProto) {
11961 0 : proto = aGivenProto;
11962 : // Unfortunately, while aGivenProto was in the compartment of aCx
11963 : // coming in, we changed compartments to that of "parent" so may need
11964 : // to wrap the proto here.
11965 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
11966 0 : if (!JS_WrapObject(aCx, &proto)) {
11967 0 : return false;
11968 : }
11969 : }
11970 : } else {
11971 0 : proto = canonicalProto;
11972 : }
11973 :
11974 0 : BindingJSObjectCreator<mozilla::WebGLProgram> creator(aCx);
11975 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
11976 0 : if (!aReflector) {
11977 0 : return false;
11978 : }
11979 :
11980 0 : aCache->SetWrapper(aReflector);
11981 0 : creator.InitializationSucceeded();
11982 :
11983 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
11984 : aCache->GetWrapperPreserveColor() == aReflector);
11985 : // If proto != canonicalProto, we have to preserve our wrapper;
11986 : // otherwise we won't be able to properly recreate it later, since
11987 : // we won't know what proto to use. Note that we don't check
11988 : // aGivenProto here, since it's entirely possible (and even
11989 : // somewhat common) to have a non-null aGivenProto which is the
11990 : // same as canonicalProto.
11991 0 : if (proto != canonicalProto) {
11992 0 : PreserveWrapper(aObject);
11993 : }
11994 :
11995 0 : return true;
11996 : }
11997 :
11998 : const NativePropertyHooks sNativePropertyHooks[] = { {
11999 : nullptr,
12000 : nullptr,
12001 : nullptr,
12002 : { nullptr, nullptr },
12003 : prototypes::id::WebGLProgram,
12004 : constructors::id::WebGLProgram,
12005 : nullptr,
12006 : &DefaultXrayExpandoObjectClass
12007 : } };
12008 :
12009 : void
12010 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
12011 : {
12012 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
12013 0 : if (!parentProto) {
12014 0 : return;
12015 : }
12016 :
12017 0 : JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
12018 0 : if (!constructorProto) {
12019 0 : return;
12020 : }
12021 :
12022 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WebGLProgram);
12023 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::WebGLProgram);
12024 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
12025 : &sPrototypeClass.mBase, protoCache,
12026 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
12027 : interfaceCache,
12028 : nullptr,
12029 : nullptr,
12030 : "WebGLProgram", aDefineOnGlobal,
12031 : nullptr,
12032 0 : false);
12033 : }
12034 :
12035 : JS::Handle<JSObject*>
12036 0 : GetProtoObjectHandle(JSContext* aCx)
12037 : {
12038 : /* Get the interface prototype object for this class. This will create the
12039 : object as needed. */
12040 0 : bool aDefineOnGlobal = true;
12041 :
12042 : /* Make sure our global is sane. Hopefully we can remove this sometime */
12043 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
12044 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
12045 0 : return nullptr;
12046 : }
12047 :
12048 : /* Check to see whether the interface objects are already installed */
12049 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
12050 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WebGLProgram)) {
12051 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
12052 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
12053 : }
12054 :
12055 : /*
12056 : * The object might _still_ be null, but that's OK.
12057 : *
12058 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
12059 : * traced by TraceProtoAndIfaceCache() and its contents are never
12060 : * changed after they have been set.
12061 : *
12062 : * Calling address() avoids the read read barrier that does gray
12063 : * unmarking, but it's not possible for the object to be gray here.
12064 : */
12065 :
12066 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WebGLProgram);
12067 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
12068 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
12069 : }
12070 :
12071 : JS::Handle<JSObject*>
12072 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
12073 : {
12074 : /* Get the interface object for this class. This will create the object as
12075 : needed. */
12076 :
12077 : /* Make sure our global is sane. Hopefully we can remove this sometime */
12078 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
12079 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
12080 0 : return nullptr;
12081 : }
12082 :
12083 : /* Check to see whether the interface objects are already installed */
12084 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
12085 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::WebGLProgram)) {
12086 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
12087 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
12088 : }
12089 :
12090 : /*
12091 : * The object might _still_ be null, but that's OK.
12092 : *
12093 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
12094 : * traced by TraceProtoAndIfaceCache() and its contents are never
12095 : * changed after they have been set.
12096 : *
12097 : * Calling address() avoids the read read barrier that does gray
12098 : * unmarking, but it's not possible for the object to be gray here.
12099 : */
12100 :
12101 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::WebGLProgram);
12102 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
12103 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
12104 : }
12105 :
12106 : JSObject*
12107 0 : GetConstructorObject(JSContext* aCx)
12108 : {
12109 0 : return GetConstructorObjectHandle(aCx);
12110 : }
12111 :
12112 : } // namespace WebGLProgramBinding
12113 :
12114 :
12115 :
12116 : namespace WebGLQueryBinding {
12117 :
12118 : static bool
12119 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
12120 : {
12121 0 : mozilla::WebGLQuery* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLQuery>(obj);
12122 : // We don't want to preserve if we don't have a wrapper, and we
12123 : // obviously can't preserve if we're not initialized.
12124 0 : if (self && self->GetWrapperPreserveColor()) {
12125 0 : PreserveWrapper(self);
12126 : }
12127 0 : return true;
12128 : }
12129 :
12130 : static void
12131 0 : _finalize(js::FreeOp* fop, JSObject* obj)
12132 : {
12133 0 : mozilla::WebGLQuery* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLQuery>(obj);
12134 0 : if (self) {
12135 0 : ClearWrapper(self, self, obj);
12136 0 : AddForDeferredFinalization<mozilla::WebGLQuery>(self);
12137 : }
12138 0 : }
12139 :
12140 : static void
12141 0 : _objectMoved(JSObject* obj, const JSObject* old)
12142 : {
12143 0 : mozilla::WebGLQuery* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLQuery>(obj);
12144 0 : if (self) {
12145 0 : UpdateWrapper(self, self, obj, old);
12146 : }
12147 0 : }
12148 :
12149 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
12150 : {
12151 : "Function",
12152 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
12153 : &sBoringInterfaceObjectClassClassOps,
12154 : JS_NULL_CLASS_SPEC,
12155 : JS_NULL_CLASS_EXT,
12156 : &sInterfaceObjectClassObjectOps
12157 : },
12158 : eInterface,
12159 : true,
12160 : prototypes::id::WebGLQuery,
12161 : PrototypeTraits<prototypes::id::WebGLQuery>::Depth,
12162 : sNativePropertyHooks,
12163 : "function WebGLQuery() {\n [native code]\n}",
12164 : JS::GetRealmFunctionPrototype
12165 : };
12166 :
12167 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
12168 : {
12169 : "WebGLQueryPrototype",
12170 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
12171 : JS_NULL_CLASS_OPS,
12172 : JS_NULL_CLASS_SPEC,
12173 : JS_NULL_CLASS_EXT,
12174 : JS_NULL_OBJECT_OPS
12175 : },
12176 : eInterfacePrototype,
12177 : false,
12178 : prototypes::id::WebGLQuery,
12179 : PrototypeTraits<prototypes::id::WebGLQuery>::Depth,
12180 : sNativePropertyHooks,
12181 : "[object WebGLQueryPrototype]",
12182 : JS::GetRealmObjectPrototype
12183 : };
12184 :
12185 : JSObject*
12186 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
12187 : {
12188 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
12189 : }
12190 :
12191 : static const js::ClassOps sClassOps = {
12192 : _addProperty, /* addProperty */
12193 : nullptr, /* delProperty */
12194 : nullptr, /* getProperty */
12195 : nullptr, /* setProperty */
12196 : nullptr, /* enumerate */
12197 : nullptr, /* newEnumerate */
12198 : nullptr, /* resolve */
12199 : nullptr, /* mayResolve */
12200 : _finalize, /* finalize */
12201 : nullptr, /* call */
12202 : nullptr, /* hasInstance */
12203 : nullptr, /* construct */
12204 : nullptr, /* trace */
12205 : };
12206 :
12207 : static const js::ClassExtension sClassExtension = {
12208 : nullptr, /* weakmapKeyDelegateOp */
12209 : _objectMoved /* objectMovedOp */
12210 : };
12211 :
12212 : static const DOMJSClass sClass = {
12213 : { "WebGLQuery",
12214 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
12215 : &sClassOps,
12216 : JS_NULL_CLASS_SPEC,
12217 : &sClassExtension,
12218 : JS_NULL_OBJECT_OPS
12219 : },
12220 : { prototypes::id::WebGLQuery, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
12221 : IsBaseOf<nsISupports, mozilla::WebGLQuery >::value,
12222 : sNativePropertyHooks,
12223 : FindAssociatedGlobalForNative<mozilla::WebGLQuery>::Get,
12224 : GetProtoObjectHandle,
12225 : GetCCParticipant<mozilla::WebGLQuery>::Get()
12226 : };
12227 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
12228 : "Must have the right minimal number of reserved slots.");
12229 : static_assert(1 >= 1,
12230 : "Must have enough reserved slots.");
12231 :
12232 : const JSClass*
12233 0 : GetJSClass()
12234 : {
12235 0 : return sClass.ToJSClass();
12236 : }
12237 :
12238 : bool
12239 0 : Wrap(JSContext* aCx, mozilla::WebGLQuery* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
12240 : {
12241 : MOZ_ASSERT(static_cast<mozilla::WebGLQuery*>(aObject) ==
12242 : reinterpret_cast<mozilla::WebGLQuery*>(aObject),
12243 : "Multiple inheritance for mozilla::WebGLQuery is broken.");
12244 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
12245 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
12246 0 : MOZ_ASSERT(!aCache->GetWrapper(),
12247 : "You should probably not be using Wrap() directly; use "
12248 : "GetOrCreateDOMReflector instead");
12249 :
12250 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
12251 : "nsISupports must be on our primary inheritance chain");
12252 :
12253 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
12254 0 : if (!global) {
12255 0 : return false;
12256 : }
12257 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
12258 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
12259 :
12260 : // That might have ended up wrapping us already, due to the wonders
12261 : // of XBL. Check for that, and bail out as needed.
12262 0 : aReflector.set(aCache->GetWrapper());
12263 0 : if (aReflector) {
12264 : #ifdef DEBUG
12265 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
12266 : #endif // DEBUG
12267 0 : return true;
12268 : }
12269 :
12270 0 : JSAutoCompartment ac(aCx, global);
12271 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
12272 0 : if (!canonicalProto) {
12273 0 : return false;
12274 : }
12275 0 : JS::Rooted<JSObject*> proto(aCx);
12276 0 : if (aGivenProto) {
12277 0 : proto = aGivenProto;
12278 : // Unfortunately, while aGivenProto was in the compartment of aCx
12279 : // coming in, we changed compartments to that of "parent" so may need
12280 : // to wrap the proto here.
12281 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
12282 0 : if (!JS_WrapObject(aCx, &proto)) {
12283 0 : return false;
12284 : }
12285 : }
12286 : } else {
12287 0 : proto = canonicalProto;
12288 : }
12289 :
12290 0 : BindingJSObjectCreator<mozilla::WebGLQuery> creator(aCx);
12291 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
12292 0 : if (!aReflector) {
12293 0 : return false;
12294 : }
12295 :
12296 0 : aCache->SetWrapper(aReflector);
12297 0 : creator.InitializationSucceeded();
12298 :
12299 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
12300 : aCache->GetWrapperPreserveColor() == aReflector);
12301 : // If proto != canonicalProto, we have to preserve our wrapper;
12302 : // otherwise we won't be able to properly recreate it later, since
12303 : // we won't know what proto to use. Note that we don't check
12304 : // aGivenProto here, since it's entirely possible (and even
12305 : // somewhat common) to have a non-null aGivenProto which is the
12306 : // same as canonicalProto.
12307 0 : if (proto != canonicalProto) {
12308 0 : PreserveWrapper(aObject);
12309 : }
12310 :
12311 0 : return true;
12312 : }
12313 :
12314 : const NativePropertyHooks sNativePropertyHooks[] = { {
12315 : nullptr,
12316 : nullptr,
12317 : nullptr,
12318 : { nullptr, nullptr },
12319 : prototypes::id::WebGLQuery,
12320 : constructors::id::WebGLQuery,
12321 : nullptr,
12322 : &DefaultXrayExpandoObjectClass
12323 : } };
12324 :
12325 : void
12326 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
12327 : {
12328 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
12329 0 : if (!parentProto) {
12330 0 : return;
12331 : }
12332 :
12333 0 : JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
12334 0 : if (!constructorProto) {
12335 0 : return;
12336 : }
12337 :
12338 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WebGLQuery);
12339 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::WebGLQuery);
12340 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
12341 : &sPrototypeClass.mBase, protoCache,
12342 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
12343 : interfaceCache,
12344 : nullptr,
12345 : nullptr,
12346 : "WebGLQuery", aDefineOnGlobal,
12347 : nullptr,
12348 0 : false);
12349 : }
12350 :
12351 : JS::Handle<JSObject*>
12352 0 : GetProtoObjectHandle(JSContext* aCx)
12353 : {
12354 : /* Get the interface prototype object for this class. This will create the
12355 : object as needed. */
12356 0 : bool aDefineOnGlobal = true;
12357 :
12358 : /* Make sure our global is sane. Hopefully we can remove this sometime */
12359 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
12360 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
12361 0 : return nullptr;
12362 : }
12363 :
12364 : /* Check to see whether the interface objects are already installed */
12365 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
12366 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WebGLQuery)) {
12367 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
12368 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
12369 : }
12370 :
12371 : /*
12372 : * The object might _still_ be null, but that's OK.
12373 : *
12374 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
12375 : * traced by TraceProtoAndIfaceCache() and its contents are never
12376 : * changed after they have been set.
12377 : *
12378 : * Calling address() avoids the read read barrier that does gray
12379 : * unmarking, but it's not possible for the object to be gray here.
12380 : */
12381 :
12382 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WebGLQuery);
12383 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
12384 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
12385 : }
12386 :
12387 : JS::Handle<JSObject*>
12388 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
12389 : {
12390 : /* Get the interface object for this class. This will create the object as
12391 : needed. */
12392 :
12393 : /* Make sure our global is sane. Hopefully we can remove this sometime */
12394 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
12395 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
12396 0 : return nullptr;
12397 : }
12398 :
12399 : /* Check to see whether the interface objects are already installed */
12400 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
12401 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::WebGLQuery)) {
12402 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
12403 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
12404 : }
12405 :
12406 : /*
12407 : * The object might _still_ be null, but that's OK.
12408 : *
12409 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
12410 : * traced by TraceProtoAndIfaceCache() and its contents are never
12411 : * changed after they have been set.
12412 : *
12413 : * Calling address() avoids the read read barrier that does gray
12414 : * unmarking, but it's not possible for the object to be gray here.
12415 : */
12416 :
12417 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::WebGLQuery);
12418 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
12419 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
12420 : }
12421 :
12422 : JSObject*
12423 0 : GetConstructorObject(JSContext* aCx)
12424 : {
12425 0 : return GetConstructorObjectHandle(aCx);
12426 : }
12427 :
12428 : } // namespace WebGLQueryBinding
12429 :
12430 :
12431 :
12432 : namespace WebGLRenderbufferBinding {
12433 :
12434 : static bool
12435 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
12436 : {
12437 0 : mozilla::WebGLRenderbuffer* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLRenderbuffer>(obj);
12438 : // We don't want to preserve if we don't have a wrapper, and we
12439 : // obviously can't preserve if we're not initialized.
12440 0 : if (self && self->GetWrapperPreserveColor()) {
12441 0 : PreserveWrapper(self);
12442 : }
12443 0 : return true;
12444 : }
12445 :
12446 : static void
12447 0 : _finalize(js::FreeOp* fop, JSObject* obj)
12448 : {
12449 0 : mozilla::WebGLRenderbuffer* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLRenderbuffer>(obj);
12450 0 : if (self) {
12451 0 : ClearWrapper(self, self, obj);
12452 0 : AddForDeferredFinalization<mozilla::WebGLRenderbuffer>(self);
12453 : }
12454 0 : }
12455 :
12456 : static void
12457 0 : _objectMoved(JSObject* obj, const JSObject* old)
12458 : {
12459 0 : mozilla::WebGLRenderbuffer* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLRenderbuffer>(obj);
12460 0 : if (self) {
12461 0 : UpdateWrapper(self, self, obj, old);
12462 : }
12463 0 : }
12464 :
12465 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
12466 : {
12467 : "Function",
12468 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
12469 : &sBoringInterfaceObjectClassClassOps,
12470 : JS_NULL_CLASS_SPEC,
12471 : JS_NULL_CLASS_EXT,
12472 : &sInterfaceObjectClassObjectOps
12473 : },
12474 : eInterface,
12475 : true,
12476 : prototypes::id::WebGLRenderbuffer,
12477 : PrototypeTraits<prototypes::id::WebGLRenderbuffer>::Depth,
12478 : sNativePropertyHooks,
12479 : "function WebGLRenderbuffer() {\n [native code]\n}",
12480 : JS::GetRealmFunctionPrototype
12481 : };
12482 :
12483 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
12484 : {
12485 : "WebGLRenderbufferPrototype",
12486 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
12487 : JS_NULL_CLASS_OPS,
12488 : JS_NULL_CLASS_SPEC,
12489 : JS_NULL_CLASS_EXT,
12490 : JS_NULL_OBJECT_OPS
12491 : },
12492 : eInterfacePrototype,
12493 : false,
12494 : prototypes::id::WebGLRenderbuffer,
12495 : PrototypeTraits<prototypes::id::WebGLRenderbuffer>::Depth,
12496 : sNativePropertyHooks,
12497 : "[object WebGLRenderbufferPrototype]",
12498 : JS::GetRealmObjectPrototype
12499 : };
12500 :
12501 : bool
12502 1 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
12503 : {
12504 1 : return mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread(aCx, aObj);
12505 : }
12506 :
12507 : JSObject*
12508 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
12509 : {
12510 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
12511 : }
12512 :
12513 : static const js::ClassOps sClassOps = {
12514 : _addProperty, /* addProperty */
12515 : nullptr, /* delProperty */
12516 : nullptr, /* getProperty */
12517 : nullptr, /* setProperty */
12518 : nullptr, /* enumerate */
12519 : nullptr, /* newEnumerate */
12520 : nullptr, /* resolve */
12521 : nullptr, /* mayResolve */
12522 : _finalize, /* finalize */
12523 : nullptr, /* call */
12524 : nullptr, /* hasInstance */
12525 : nullptr, /* construct */
12526 : nullptr, /* trace */
12527 : };
12528 :
12529 : static const js::ClassExtension sClassExtension = {
12530 : nullptr, /* weakmapKeyDelegateOp */
12531 : _objectMoved /* objectMovedOp */
12532 : };
12533 :
12534 : static const DOMJSClass sClass = {
12535 : { "WebGLRenderbuffer",
12536 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
12537 : &sClassOps,
12538 : JS_NULL_CLASS_SPEC,
12539 : &sClassExtension,
12540 : JS_NULL_OBJECT_OPS
12541 : },
12542 : { prototypes::id::WebGLRenderbuffer, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
12543 : IsBaseOf<nsISupports, mozilla::WebGLRenderbuffer >::value,
12544 : sNativePropertyHooks,
12545 : FindAssociatedGlobalForNative<mozilla::WebGLRenderbuffer>::Get,
12546 : GetProtoObjectHandle,
12547 : GetCCParticipant<mozilla::WebGLRenderbuffer>::Get()
12548 : };
12549 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
12550 : "Must have the right minimal number of reserved slots.");
12551 : static_assert(1 >= 1,
12552 : "Must have enough reserved slots.");
12553 :
12554 : const JSClass*
12555 0 : GetJSClass()
12556 : {
12557 0 : return sClass.ToJSClass();
12558 : }
12559 :
12560 : bool
12561 0 : Wrap(JSContext* aCx, mozilla::WebGLRenderbuffer* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
12562 : {
12563 : MOZ_ASSERT(static_cast<mozilla::WebGLRenderbuffer*>(aObject) ==
12564 : reinterpret_cast<mozilla::WebGLRenderbuffer*>(aObject),
12565 : "Multiple inheritance for mozilla::WebGLRenderbuffer is broken.");
12566 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
12567 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
12568 0 : MOZ_ASSERT(!aCache->GetWrapper(),
12569 : "You should probably not be using Wrap() directly; use "
12570 : "GetOrCreateDOMReflector instead");
12571 :
12572 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
12573 : "nsISupports must be on our primary inheritance chain");
12574 :
12575 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
12576 0 : if (!global) {
12577 0 : return false;
12578 : }
12579 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
12580 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
12581 :
12582 : // That might have ended up wrapping us already, due to the wonders
12583 : // of XBL. Check for that, and bail out as needed.
12584 0 : aReflector.set(aCache->GetWrapper());
12585 0 : if (aReflector) {
12586 : #ifdef DEBUG
12587 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
12588 : #endif // DEBUG
12589 0 : return true;
12590 : }
12591 :
12592 0 : JSAutoCompartment ac(aCx, global);
12593 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
12594 0 : if (!canonicalProto) {
12595 0 : return false;
12596 : }
12597 0 : JS::Rooted<JSObject*> proto(aCx);
12598 0 : if (aGivenProto) {
12599 0 : proto = aGivenProto;
12600 : // Unfortunately, while aGivenProto was in the compartment of aCx
12601 : // coming in, we changed compartments to that of "parent" so may need
12602 : // to wrap the proto here.
12603 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
12604 0 : if (!JS_WrapObject(aCx, &proto)) {
12605 0 : return false;
12606 : }
12607 : }
12608 : } else {
12609 0 : proto = canonicalProto;
12610 : }
12611 :
12612 0 : BindingJSObjectCreator<mozilla::WebGLRenderbuffer> creator(aCx);
12613 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
12614 0 : if (!aReflector) {
12615 0 : return false;
12616 : }
12617 :
12618 0 : aCache->SetWrapper(aReflector);
12619 0 : creator.InitializationSucceeded();
12620 :
12621 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
12622 : aCache->GetWrapperPreserveColor() == aReflector);
12623 : // If proto != canonicalProto, we have to preserve our wrapper;
12624 : // otherwise we won't be able to properly recreate it later, since
12625 : // we won't know what proto to use. Note that we don't check
12626 : // aGivenProto here, since it's entirely possible (and even
12627 : // somewhat common) to have a non-null aGivenProto which is the
12628 : // same as canonicalProto.
12629 0 : if (proto != canonicalProto) {
12630 0 : PreserveWrapper(aObject);
12631 : }
12632 :
12633 0 : return true;
12634 : }
12635 :
12636 : const NativePropertyHooks sNativePropertyHooks[] = { {
12637 : nullptr,
12638 : nullptr,
12639 : nullptr,
12640 : { nullptr, nullptr },
12641 : prototypes::id::WebGLRenderbuffer,
12642 : constructors::id::WebGLRenderbuffer,
12643 : nullptr,
12644 : &DefaultXrayExpandoObjectClass
12645 : } };
12646 :
12647 : void
12648 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
12649 : {
12650 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
12651 0 : if (!parentProto) {
12652 0 : return;
12653 : }
12654 :
12655 0 : JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
12656 0 : if (!constructorProto) {
12657 0 : return;
12658 : }
12659 :
12660 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WebGLRenderbuffer);
12661 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::WebGLRenderbuffer);
12662 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
12663 : &sPrototypeClass.mBase, protoCache,
12664 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
12665 : interfaceCache,
12666 : nullptr,
12667 : nullptr,
12668 : "WebGLRenderbuffer", aDefineOnGlobal,
12669 : nullptr,
12670 0 : false);
12671 : }
12672 :
12673 : JS::Handle<JSObject*>
12674 0 : GetProtoObjectHandle(JSContext* aCx)
12675 : {
12676 : /* Get the interface prototype object for this class. This will create the
12677 : object as needed. */
12678 0 : bool aDefineOnGlobal = true;
12679 :
12680 : /* Make sure our global is sane. Hopefully we can remove this sometime */
12681 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
12682 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
12683 0 : return nullptr;
12684 : }
12685 :
12686 : /* Check to see whether the interface objects are already installed */
12687 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
12688 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WebGLRenderbuffer)) {
12689 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
12690 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
12691 : }
12692 :
12693 : /*
12694 : * The object might _still_ be null, but that's OK.
12695 : *
12696 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
12697 : * traced by TraceProtoAndIfaceCache() and its contents are never
12698 : * changed after they have been set.
12699 : *
12700 : * Calling address() avoids the read read barrier that does gray
12701 : * unmarking, but it's not possible for the object to be gray here.
12702 : */
12703 :
12704 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WebGLRenderbuffer);
12705 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
12706 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
12707 : }
12708 :
12709 : JS::Handle<JSObject*>
12710 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
12711 : {
12712 : /* Get the interface object for this class. This will create the object as
12713 : needed. */
12714 :
12715 : /* Make sure our global is sane. Hopefully we can remove this sometime */
12716 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
12717 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
12718 0 : return nullptr;
12719 : }
12720 :
12721 : /* Check to see whether the interface objects are already installed */
12722 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
12723 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::WebGLRenderbuffer)) {
12724 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
12725 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
12726 : }
12727 :
12728 : /*
12729 : * The object might _still_ be null, but that's OK.
12730 : *
12731 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
12732 : * traced by TraceProtoAndIfaceCache() and its contents are never
12733 : * changed after they have been set.
12734 : *
12735 : * Calling address() avoids the read read barrier that does gray
12736 : * unmarking, but it's not possible for the object to be gray here.
12737 : */
12738 :
12739 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::WebGLRenderbuffer);
12740 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
12741 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
12742 : }
12743 :
12744 : JSObject*
12745 0 : GetConstructorObject(JSContext* aCx)
12746 : {
12747 0 : return GetConstructorObjectHandle(aCx);
12748 : }
12749 :
12750 : } // namespace WebGLRenderbufferBinding
12751 :
12752 :
12753 :
12754 : namespace WebGLRenderingContextBinding {
12755 :
12756 : static bool
12757 0 : bufferData(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
12758 : {
12759 0 : unsigned argcount = std::min(args.length(), 3u);
12760 0 : switch (argcount) {
12761 : case 3: {
12762 : uint32_t arg0;
12763 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
12764 0 : return false;
12765 : }
12766 0 : if (args[1].isNullOrUndefined()) {
12767 0 : RootedTypedArray<Nullable<ArrayBuffer>> arg1(cx);
12768 0 : arg1.SetNull();
12769 : uint32_t arg2;
12770 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
12771 0 : return false;
12772 : }
12773 0 : self->BufferData(arg0, Constify(arg1), arg2);
12774 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
12775 0 : args.rval().setUndefined();
12776 0 : return true;
12777 : }
12778 0 : if (args[1].isObject()) {
12779 : do {
12780 0 : RootedTypedArray<Nullable<ArrayBuffer>> arg1(cx);
12781 0 : if (!arg1.SetValue().Init(&args[1].toObject())) {
12782 0 : break;
12783 : }
12784 : uint32_t arg2;
12785 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
12786 0 : return false;
12787 : }
12788 0 : self->BufferData(arg0, Constify(arg1), arg2);
12789 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
12790 0 : args.rval().setUndefined();
12791 0 : return true;
12792 : } while (0);
12793 : do {
12794 0 : RootedTypedArray<ArrayBufferView> arg1(cx);
12795 0 : if (!arg1.Init(&args[1].toObject())) {
12796 0 : break;
12797 : }
12798 : uint32_t arg2;
12799 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
12800 0 : return false;
12801 : }
12802 0 : self->BufferData(arg0, Constify(arg1), arg2);
12803 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
12804 0 : args.rval().setUndefined();
12805 0 : return true;
12806 : } while (0);
12807 : }
12808 : int64_t arg1;
12809 0 : if (!ValueToPrimitive<int64_t, eDefault>(cx, args[1], &arg1)) {
12810 0 : return false;
12811 : }
12812 : uint32_t arg2;
12813 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
12814 0 : return false;
12815 : }
12816 0 : self->BufferData(arg0, arg1, arg2);
12817 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
12818 0 : args.rval().setUndefined();
12819 0 : return true;
12820 : break;
12821 : }
12822 : default: {
12823 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.bufferData");
12824 : break;
12825 : }
12826 : }
12827 : MOZ_CRASH("We have an always-returning default case");
12828 : return false;
12829 : }
12830 :
12831 : static const JSJitInfo bufferData_methodinfo = {
12832 : { (JSJitGetterOp)bufferData },
12833 : { prototypes::id::WebGLRenderingContext },
12834 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
12835 : JSJitInfo::Method,
12836 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
12837 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
12838 : false, /* isInfallible. False in setters. */
12839 : false, /* isMovable. Not relevant for setters. */
12840 : false, /* isEliminatable. Not relevant for setters. */
12841 : false, /* isAlwaysInSlot. Only relevant for getters. */
12842 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
12843 : false, /* isTypedMethod. Only relevant for methods. */
12844 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
12845 : };
12846 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
12847 : static_assert(0 < 1, "There is no slot for us");
12848 :
12849 : static bool
12850 0 : bufferSubData(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
12851 : {
12852 0 : unsigned argcount = std::min(args.length(), 3u);
12853 0 : switch (argcount) {
12854 : case 3: {
12855 : uint32_t arg0;
12856 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
12857 0 : return false;
12858 : }
12859 : int64_t arg1;
12860 0 : if (!ValueToPrimitive<int64_t, eDefault>(cx, args[1], &arg1)) {
12861 0 : return false;
12862 : }
12863 0 : if (args[2].isObject()) {
12864 : do {
12865 0 : RootedTypedArray<ArrayBuffer> arg2(cx);
12866 0 : if (!arg2.Init(&args[2].toObject())) {
12867 0 : break;
12868 : }
12869 0 : self->BufferSubData(arg0, arg1, Constify(arg2));
12870 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
12871 0 : args.rval().setUndefined();
12872 0 : return true;
12873 : } while (0);
12874 : do {
12875 0 : RootedTypedArray<ArrayBufferView> arg2(cx);
12876 0 : if (!arg2.Init(&args[2].toObject())) {
12877 0 : break;
12878 : }
12879 0 : self->BufferSubData(arg0, arg1, Constify(arg2));
12880 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
12881 0 : args.rval().setUndefined();
12882 0 : return true;
12883 : } while (0);
12884 : }
12885 0 : return ThrowErrorMessage(cx, MSG_OVERLOAD_RESOLUTION_FAILED, "3", "3", "WebGLRenderingContext.bufferSubData");
12886 : break;
12887 : }
12888 : default: {
12889 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.bufferSubData");
12890 : break;
12891 : }
12892 : }
12893 : MOZ_CRASH("We have an always-returning default case");
12894 : return false;
12895 : }
12896 :
12897 : static const JSJitInfo bufferSubData_methodinfo = {
12898 : { (JSJitGetterOp)bufferSubData },
12899 : { prototypes::id::WebGLRenderingContext },
12900 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
12901 : JSJitInfo::Method,
12902 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
12903 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
12904 : false, /* isInfallible. False in setters. */
12905 : false, /* isMovable. Not relevant for setters. */
12906 : false, /* isEliminatable. Not relevant for setters. */
12907 : false, /* isAlwaysInSlot. Only relevant for getters. */
12908 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
12909 : false, /* isTypedMethod. Only relevant for methods. */
12910 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
12911 : };
12912 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
12913 : static_assert(0 < 1, "There is no slot for us");
12914 :
12915 : static bool
12916 0 : compressedTexImage2D(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
12917 : {
12918 0 : if (MOZ_UNLIKELY(args.length() < 7)) {
12919 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.compressedTexImage2D");
12920 : }
12921 : uint32_t arg0;
12922 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
12923 0 : return false;
12924 : }
12925 : int32_t arg1;
12926 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
12927 0 : return false;
12928 : }
12929 : uint32_t arg2;
12930 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
12931 0 : return false;
12932 : }
12933 : int32_t arg3;
12934 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
12935 0 : return false;
12936 : }
12937 : int32_t arg4;
12938 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[4], &arg4)) {
12939 0 : return false;
12940 : }
12941 : int32_t arg5;
12942 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[5], &arg5)) {
12943 0 : return false;
12944 : }
12945 0 : RootedTypedArray<ArrayBufferView> arg6(cx);
12946 0 : if (args[6].isObject()) {
12947 0 : if (!arg6.Init(&args[6].toObject())) {
12948 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 7 of WebGLRenderingContext.compressedTexImage2D", "ArrayBufferView");
12949 0 : return false;
12950 : }
12951 : } else {
12952 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 7 of WebGLRenderingContext.compressedTexImage2D");
12953 0 : return false;
12954 : }
12955 0 : self->CompressedTexImage2D(arg0, arg1, arg2, arg3, arg4, arg5, Constify(arg6));
12956 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
12957 0 : args.rval().setUndefined();
12958 0 : return true;
12959 : }
12960 :
12961 : static const JSJitInfo compressedTexImage2D_methodinfo = {
12962 : { (JSJitGetterOp)compressedTexImage2D },
12963 : { prototypes::id::WebGLRenderingContext },
12964 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
12965 : JSJitInfo::Method,
12966 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
12967 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
12968 : false, /* isInfallible. False in setters. */
12969 : false, /* isMovable. Not relevant for setters. */
12970 : false, /* isEliminatable. Not relevant for setters. */
12971 : false, /* isAlwaysInSlot. Only relevant for getters. */
12972 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
12973 : false, /* isTypedMethod. Only relevant for methods. */
12974 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
12975 : };
12976 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
12977 : static_assert(0 < 1, "There is no slot for us");
12978 :
12979 : static bool
12980 0 : compressedTexSubImage2D(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
12981 : {
12982 0 : if (MOZ_UNLIKELY(args.length() < 8)) {
12983 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.compressedTexSubImage2D");
12984 : }
12985 : uint32_t arg0;
12986 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
12987 0 : return false;
12988 : }
12989 : int32_t arg1;
12990 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
12991 0 : return false;
12992 : }
12993 : int32_t arg2;
12994 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
12995 0 : return false;
12996 : }
12997 : int32_t arg3;
12998 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
12999 0 : return false;
13000 : }
13001 : int32_t arg4;
13002 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[4], &arg4)) {
13003 0 : return false;
13004 : }
13005 : int32_t arg5;
13006 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[5], &arg5)) {
13007 0 : return false;
13008 : }
13009 : uint32_t arg6;
13010 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[6], &arg6)) {
13011 0 : return false;
13012 : }
13013 0 : RootedTypedArray<ArrayBufferView> arg7(cx);
13014 0 : if (args[7].isObject()) {
13015 0 : if (!arg7.Init(&args[7].toObject())) {
13016 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 8 of WebGLRenderingContext.compressedTexSubImage2D", "ArrayBufferView");
13017 0 : return false;
13018 : }
13019 : } else {
13020 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 8 of WebGLRenderingContext.compressedTexSubImage2D");
13021 0 : return false;
13022 : }
13023 0 : self->CompressedTexSubImage2D(arg0, arg1, arg2, arg3, arg4, arg5, arg6, Constify(arg7));
13024 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13025 0 : args.rval().setUndefined();
13026 0 : return true;
13027 : }
13028 :
13029 : static const JSJitInfo compressedTexSubImage2D_methodinfo = {
13030 : { (JSJitGetterOp)compressedTexSubImage2D },
13031 : { prototypes::id::WebGLRenderingContext },
13032 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
13033 : JSJitInfo::Method,
13034 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
13035 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
13036 : false, /* isInfallible. False in setters. */
13037 : false, /* isMovable. Not relevant for setters. */
13038 : false, /* isEliminatable. Not relevant for setters. */
13039 : false, /* isAlwaysInSlot. Only relevant for getters. */
13040 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
13041 : false, /* isTypedMethod. Only relevant for methods. */
13042 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
13043 : };
13044 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
13045 : static_assert(0 < 1, "There is no slot for us");
13046 :
13047 : static bool
13048 0 : readPixels(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
13049 : {
13050 0 : if (MOZ_UNLIKELY(args.length() < 7)) {
13051 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.readPixels");
13052 : }
13053 : int32_t arg0;
13054 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
13055 0 : return false;
13056 : }
13057 : int32_t arg1;
13058 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
13059 0 : return false;
13060 : }
13061 : int32_t arg2;
13062 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
13063 0 : return false;
13064 : }
13065 : int32_t arg3;
13066 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
13067 0 : return false;
13068 : }
13069 : uint32_t arg4;
13070 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[4], &arg4)) {
13071 0 : return false;
13072 : }
13073 : uint32_t arg5;
13074 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[5], &arg5)) {
13075 0 : return false;
13076 : }
13077 0 : RootedTypedArray<Nullable<ArrayBufferView>> arg6(cx);
13078 0 : if (args[6].isObject()) {
13079 0 : if (!arg6.SetValue().Init(&args[6].toObject())) {
13080 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 7 of WebGLRenderingContext.readPixels", "ArrayBufferViewOrNull");
13081 0 : return false;
13082 : }
13083 0 : } else if (args[6].isNullOrUndefined()) {
13084 0 : arg6.SetNull();
13085 : } else {
13086 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 7 of WebGLRenderingContext.readPixels");
13087 0 : return false;
13088 : }
13089 0 : binding_detail::FastErrorResult rv;
13090 0 : self->ReadPixels(arg0, arg1, arg2, arg3, arg4, arg5, Constify(arg6), nsContentUtils::ThreadsafeIsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv);
13091 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
13092 0 : return false;
13093 : }
13094 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13095 0 : args.rval().setUndefined();
13096 0 : return true;
13097 : }
13098 :
13099 : static const JSJitInfo readPixels_methodinfo = {
13100 : { (JSJitGetterOp)readPixels },
13101 : { prototypes::id::WebGLRenderingContext },
13102 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
13103 : JSJitInfo::Method,
13104 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
13105 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
13106 : false, /* isInfallible. False in setters. */
13107 : false, /* isMovable. Not relevant for setters. */
13108 : false, /* isEliminatable. Not relevant for setters. */
13109 : false, /* isAlwaysInSlot. Only relevant for getters. */
13110 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
13111 : false, /* isTypedMethod. Only relevant for methods. */
13112 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
13113 : };
13114 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
13115 : static_assert(0 < 1, "There is no slot for us");
13116 :
13117 : static bool
13118 0 : texImage2D(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
13119 : {
13120 0 : unsigned argcount = std::min(args.length(), 9u);
13121 0 : switch (argcount) {
13122 : case 6: {
13123 : uint32_t arg0;
13124 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
13125 0 : return false;
13126 : }
13127 : int32_t arg1;
13128 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
13129 0 : return false;
13130 : }
13131 : int32_t arg2;
13132 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
13133 0 : return false;
13134 : }
13135 : uint32_t arg3;
13136 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[3], &arg3)) {
13137 0 : return false;
13138 : }
13139 : uint32_t arg4;
13140 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[4], &arg4)) {
13141 0 : return false;
13142 : }
13143 0 : if (args[5].isObject()) {
13144 : do {
13145 0 : NonNull<mozilla::dom::ImageBitmap> arg5;
13146 : {
13147 0 : nsresult rv = UnwrapObject<prototypes::id::ImageBitmap, mozilla::dom::ImageBitmap>(args[5], arg5);
13148 0 : if (NS_FAILED(rv)) {
13149 0 : break;
13150 : }
13151 : }
13152 0 : binding_detail::FastErrorResult rv;
13153 0 : self->TexImage2D(arg0, arg1, arg2, arg3, arg4, NonNullHelper(arg5), rv);
13154 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
13155 0 : return false;
13156 : }
13157 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13158 0 : args.rval().setUndefined();
13159 0 : return true;
13160 : } while (0);
13161 : do {
13162 0 : NonNull<mozilla::dom::ImageData> arg5;
13163 : {
13164 0 : nsresult rv = UnwrapObject<prototypes::id::ImageData, mozilla::dom::ImageData>(args[5], arg5);
13165 0 : if (NS_FAILED(rv)) {
13166 0 : break;
13167 : }
13168 : }
13169 0 : binding_detail::FastErrorResult rv;
13170 0 : self->TexImage2D(arg0, arg1, arg2, arg3, arg4, NonNullHelper(arg5), rv);
13171 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
13172 0 : return false;
13173 : }
13174 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13175 0 : args.rval().setUndefined();
13176 0 : return true;
13177 : } while (0);
13178 : do {
13179 0 : NonNull<mozilla::dom::HTMLImageElement> arg5;
13180 : {
13181 0 : nsresult rv = UnwrapObject<prototypes::id::HTMLImageElement, mozilla::dom::HTMLImageElement>(args[5], arg5);
13182 0 : if (NS_FAILED(rv)) {
13183 0 : break;
13184 : }
13185 : }
13186 0 : binding_detail::FastErrorResult rv;
13187 0 : self->TexImage2D(arg0, arg1, arg2, arg3, arg4, NonNullHelper(arg5), rv);
13188 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
13189 0 : return false;
13190 : }
13191 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13192 0 : args.rval().setUndefined();
13193 0 : return true;
13194 : } while (0);
13195 : do {
13196 0 : NonNull<mozilla::dom::HTMLCanvasElement> arg5;
13197 : {
13198 0 : nsresult rv = UnwrapObject<prototypes::id::HTMLCanvasElement, mozilla::dom::HTMLCanvasElement>(args[5], arg5);
13199 0 : if (NS_FAILED(rv)) {
13200 0 : break;
13201 : }
13202 : }
13203 0 : binding_detail::FastErrorResult rv;
13204 0 : self->TexImage2D(arg0, arg1, arg2, arg3, arg4, NonNullHelper(arg5), rv);
13205 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
13206 0 : return false;
13207 : }
13208 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13209 0 : args.rval().setUndefined();
13210 0 : return true;
13211 : } while (0);
13212 : do {
13213 0 : NonNull<mozilla::dom::HTMLVideoElement> arg5;
13214 : {
13215 0 : nsresult rv = UnwrapObject<prototypes::id::HTMLVideoElement, mozilla::dom::HTMLVideoElement>(args[5], arg5);
13216 0 : if (NS_FAILED(rv)) {
13217 0 : break;
13218 : }
13219 : }
13220 0 : binding_detail::FastErrorResult rv;
13221 0 : self->TexImage2D(arg0, arg1, arg2, arg3, arg4, NonNullHelper(arg5), rv);
13222 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
13223 0 : return false;
13224 : }
13225 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13226 0 : args.rval().setUndefined();
13227 0 : return true;
13228 : } while (0);
13229 : }
13230 0 : return ThrowErrorMessage(cx, MSG_OVERLOAD_RESOLUTION_FAILED, "6", "6", "WebGLRenderingContext.texImage2D");
13231 : break;
13232 : }
13233 : case 9: {
13234 : uint32_t arg0;
13235 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
13236 0 : return false;
13237 : }
13238 : int32_t arg1;
13239 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
13240 0 : return false;
13241 : }
13242 : int32_t arg2;
13243 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
13244 0 : return false;
13245 : }
13246 : int32_t arg3;
13247 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
13248 0 : return false;
13249 : }
13250 : int32_t arg4;
13251 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[4], &arg4)) {
13252 0 : return false;
13253 : }
13254 : int32_t arg5;
13255 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[5], &arg5)) {
13256 0 : return false;
13257 : }
13258 : uint32_t arg6;
13259 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[6], &arg6)) {
13260 0 : return false;
13261 : }
13262 : uint32_t arg7;
13263 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[7], &arg7)) {
13264 0 : return false;
13265 : }
13266 0 : RootedTypedArray<Nullable<ArrayBufferView>> arg8(cx);
13267 0 : if (args[8].isObject()) {
13268 0 : if (!arg8.SetValue().Init(&args[8].toObject())) {
13269 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 9 of WebGLRenderingContext.texImage2D", "ArrayBufferViewOrNull");
13270 0 : return false;
13271 : }
13272 0 : } else if (args[8].isNullOrUndefined()) {
13273 0 : arg8.SetNull();
13274 : } else {
13275 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 9 of WebGLRenderingContext.texImage2D");
13276 0 : return false;
13277 : }
13278 0 : binding_detail::FastErrorResult rv;
13279 0 : self->TexImage2D(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, Constify(arg8), rv);
13280 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
13281 0 : return false;
13282 : }
13283 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13284 0 : args.rval().setUndefined();
13285 0 : return true;
13286 : break;
13287 : }
13288 : default: {
13289 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.texImage2D");
13290 : break;
13291 : }
13292 : }
13293 : MOZ_CRASH("We have an always-returning default case");
13294 : return false;
13295 : }
13296 :
13297 : static const JSJitInfo texImage2D_methodinfo = {
13298 : { (JSJitGetterOp)texImage2D },
13299 : { prototypes::id::WebGLRenderingContext },
13300 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
13301 : JSJitInfo::Method,
13302 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
13303 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
13304 : false, /* isInfallible. False in setters. */
13305 : false, /* isMovable. Not relevant for setters. */
13306 : false, /* isEliminatable. Not relevant for setters. */
13307 : false, /* isAlwaysInSlot. Only relevant for getters. */
13308 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
13309 : false, /* isTypedMethod. Only relevant for methods. */
13310 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
13311 : };
13312 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
13313 : static_assert(0 < 1, "There is no slot for us");
13314 :
13315 : static bool
13316 0 : texSubImage2D(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
13317 : {
13318 0 : unsigned argcount = std::min(args.length(), 9u);
13319 0 : switch (argcount) {
13320 : case 7: {
13321 : uint32_t arg0;
13322 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
13323 0 : return false;
13324 : }
13325 : int32_t arg1;
13326 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
13327 0 : return false;
13328 : }
13329 : int32_t arg2;
13330 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
13331 0 : return false;
13332 : }
13333 : int32_t arg3;
13334 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
13335 0 : return false;
13336 : }
13337 : uint32_t arg4;
13338 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[4], &arg4)) {
13339 0 : return false;
13340 : }
13341 : uint32_t arg5;
13342 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[5], &arg5)) {
13343 0 : return false;
13344 : }
13345 0 : if (args[6].isObject()) {
13346 : do {
13347 0 : NonNull<mozilla::dom::ImageBitmap> arg6;
13348 : {
13349 0 : nsresult rv = UnwrapObject<prototypes::id::ImageBitmap, mozilla::dom::ImageBitmap>(args[6], arg6);
13350 0 : if (NS_FAILED(rv)) {
13351 0 : break;
13352 : }
13353 : }
13354 0 : binding_detail::FastErrorResult rv;
13355 0 : self->TexSubImage2D(arg0, arg1, arg2, arg3, arg4, arg5, NonNullHelper(arg6), rv);
13356 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
13357 0 : return false;
13358 : }
13359 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13360 0 : args.rval().setUndefined();
13361 0 : return true;
13362 : } while (0);
13363 : do {
13364 0 : NonNull<mozilla::dom::ImageData> arg6;
13365 : {
13366 0 : nsresult rv = UnwrapObject<prototypes::id::ImageData, mozilla::dom::ImageData>(args[6], arg6);
13367 0 : if (NS_FAILED(rv)) {
13368 0 : break;
13369 : }
13370 : }
13371 0 : binding_detail::FastErrorResult rv;
13372 0 : self->TexSubImage2D(arg0, arg1, arg2, arg3, arg4, arg5, NonNullHelper(arg6), rv);
13373 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
13374 0 : return false;
13375 : }
13376 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13377 0 : args.rval().setUndefined();
13378 0 : return true;
13379 : } while (0);
13380 : do {
13381 0 : NonNull<mozilla::dom::HTMLImageElement> arg6;
13382 : {
13383 0 : nsresult rv = UnwrapObject<prototypes::id::HTMLImageElement, mozilla::dom::HTMLImageElement>(args[6], arg6);
13384 0 : if (NS_FAILED(rv)) {
13385 0 : break;
13386 : }
13387 : }
13388 0 : binding_detail::FastErrorResult rv;
13389 0 : self->TexSubImage2D(arg0, arg1, arg2, arg3, arg4, arg5, NonNullHelper(arg6), rv);
13390 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
13391 0 : return false;
13392 : }
13393 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13394 0 : args.rval().setUndefined();
13395 0 : return true;
13396 : } while (0);
13397 : do {
13398 0 : NonNull<mozilla::dom::HTMLCanvasElement> arg6;
13399 : {
13400 0 : nsresult rv = UnwrapObject<prototypes::id::HTMLCanvasElement, mozilla::dom::HTMLCanvasElement>(args[6], arg6);
13401 0 : if (NS_FAILED(rv)) {
13402 0 : break;
13403 : }
13404 : }
13405 0 : binding_detail::FastErrorResult rv;
13406 0 : self->TexSubImage2D(arg0, arg1, arg2, arg3, arg4, arg5, NonNullHelper(arg6), rv);
13407 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
13408 0 : return false;
13409 : }
13410 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13411 0 : args.rval().setUndefined();
13412 0 : return true;
13413 : } while (0);
13414 : do {
13415 0 : NonNull<mozilla::dom::HTMLVideoElement> arg6;
13416 : {
13417 0 : nsresult rv = UnwrapObject<prototypes::id::HTMLVideoElement, mozilla::dom::HTMLVideoElement>(args[6], arg6);
13418 0 : if (NS_FAILED(rv)) {
13419 0 : break;
13420 : }
13421 : }
13422 0 : binding_detail::FastErrorResult rv;
13423 0 : self->TexSubImage2D(arg0, arg1, arg2, arg3, arg4, arg5, NonNullHelper(arg6), rv);
13424 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
13425 0 : return false;
13426 : }
13427 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13428 0 : args.rval().setUndefined();
13429 0 : return true;
13430 : } while (0);
13431 : }
13432 0 : return ThrowErrorMessage(cx, MSG_OVERLOAD_RESOLUTION_FAILED, "7", "7", "WebGLRenderingContext.texSubImage2D");
13433 : break;
13434 : }
13435 : case 9: {
13436 : uint32_t arg0;
13437 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
13438 0 : return false;
13439 : }
13440 : int32_t arg1;
13441 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
13442 0 : return false;
13443 : }
13444 : int32_t arg2;
13445 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
13446 0 : return false;
13447 : }
13448 : int32_t arg3;
13449 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
13450 0 : return false;
13451 : }
13452 : int32_t arg4;
13453 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[4], &arg4)) {
13454 0 : return false;
13455 : }
13456 : int32_t arg5;
13457 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[5], &arg5)) {
13458 0 : return false;
13459 : }
13460 : uint32_t arg6;
13461 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[6], &arg6)) {
13462 0 : return false;
13463 : }
13464 : uint32_t arg7;
13465 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[7], &arg7)) {
13466 0 : return false;
13467 : }
13468 0 : RootedTypedArray<Nullable<ArrayBufferView>> arg8(cx);
13469 0 : if (args[8].isObject()) {
13470 0 : if (!arg8.SetValue().Init(&args[8].toObject())) {
13471 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 9 of WebGLRenderingContext.texSubImage2D", "ArrayBufferViewOrNull");
13472 0 : return false;
13473 : }
13474 0 : } else if (args[8].isNullOrUndefined()) {
13475 0 : arg8.SetNull();
13476 : } else {
13477 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 9 of WebGLRenderingContext.texSubImage2D");
13478 0 : return false;
13479 : }
13480 0 : binding_detail::FastErrorResult rv;
13481 0 : self->TexSubImage2D(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, Constify(arg8), rv);
13482 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
13483 0 : return false;
13484 : }
13485 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13486 0 : args.rval().setUndefined();
13487 0 : return true;
13488 : break;
13489 : }
13490 : default: {
13491 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.texSubImage2D");
13492 : break;
13493 : }
13494 : }
13495 : MOZ_CRASH("We have an always-returning default case");
13496 : return false;
13497 : }
13498 :
13499 : static const JSJitInfo texSubImage2D_methodinfo = {
13500 : { (JSJitGetterOp)texSubImage2D },
13501 : { prototypes::id::WebGLRenderingContext },
13502 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
13503 : JSJitInfo::Method,
13504 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
13505 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
13506 : false, /* isInfallible. False in setters. */
13507 : false, /* isMovable. Not relevant for setters. */
13508 : false, /* isEliminatable. Not relevant for setters. */
13509 : false, /* isAlwaysInSlot. Only relevant for getters. */
13510 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
13511 : false, /* isTypedMethod. Only relevant for methods. */
13512 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
13513 : };
13514 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
13515 : static_assert(0 < 1, "There is no slot for us");
13516 :
13517 : static bool
13518 0 : uniform1fv(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
13519 : {
13520 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
13521 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform1fv");
13522 : }
13523 : mozilla::WebGLUniformLocation* arg0;
13524 0 : if (args[0].isObject()) {
13525 : {
13526 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
13527 0 : if (NS_FAILED(rv)) {
13528 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform1fv", "WebGLUniformLocation");
13529 0 : return false;
13530 : }
13531 : }
13532 0 : } else if (args[0].isNullOrUndefined()) {
13533 0 : arg0 = nullptr;
13534 : } else {
13535 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform1fv");
13536 0 : return false;
13537 : }
13538 0 : Float32ArrayOrUnrestrictedFloatSequence arg1;
13539 0 : Float32ArrayOrUnrestrictedFloatSequenceArgument arg1_holder(arg1);
13540 : {
13541 0 : bool done = false, failed = false, tryNext;
13542 0 : if (args[1].isObject()) {
13543 0 : done = (failed = !arg1_holder.TrySetToFloat32Array(cx, args[1], tryNext, false)) || !tryNext;
13544 :
13545 0 : if (!done) {
13546 0 : done = (failed = !arg1_holder.TrySetToUnrestrictedFloatSequence(cx, args[1], tryNext, false)) || !tryNext;
13547 : }
13548 : }
13549 0 : if (failed) {
13550 0 : return false;
13551 : }
13552 0 : if (!done) {
13553 0 : ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of WebGLRenderingContext.uniform1fv", "Float32Array, UnrestrictedFloatSequence");
13554 0 : return false;
13555 : }
13556 : }
13557 0 : self->Uniform1fv(Constify(arg0), Constify(arg1));
13558 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13559 0 : args.rval().setUndefined();
13560 0 : return true;
13561 : }
13562 :
13563 : static const JSJitInfo uniform1fv_methodinfo = {
13564 : { (JSJitGetterOp)uniform1fv },
13565 : { prototypes::id::WebGLRenderingContext },
13566 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
13567 : JSJitInfo::Method,
13568 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
13569 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
13570 : false, /* isInfallible. False in setters. */
13571 : false, /* isMovable. Not relevant for setters. */
13572 : false, /* isEliminatable. Not relevant for setters. */
13573 : false, /* isAlwaysInSlot. Only relevant for getters. */
13574 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
13575 : false, /* isTypedMethod. Only relevant for methods. */
13576 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
13577 : };
13578 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
13579 : static_assert(0 < 1, "There is no slot for us");
13580 :
13581 : static bool
13582 0 : uniform2fv(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
13583 : {
13584 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
13585 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform2fv");
13586 : }
13587 : mozilla::WebGLUniformLocation* arg0;
13588 0 : if (args[0].isObject()) {
13589 : {
13590 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
13591 0 : if (NS_FAILED(rv)) {
13592 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform2fv", "WebGLUniformLocation");
13593 0 : return false;
13594 : }
13595 : }
13596 0 : } else if (args[0].isNullOrUndefined()) {
13597 0 : arg0 = nullptr;
13598 : } else {
13599 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform2fv");
13600 0 : return false;
13601 : }
13602 0 : Float32ArrayOrUnrestrictedFloatSequence arg1;
13603 0 : Float32ArrayOrUnrestrictedFloatSequenceArgument arg1_holder(arg1);
13604 : {
13605 0 : bool done = false, failed = false, tryNext;
13606 0 : if (args[1].isObject()) {
13607 0 : done = (failed = !arg1_holder.TrySetToFloat32Array(cx, args[1], tryNext, false)) || !tryNext;
13608 :
13609 0 : if (!done) {
13610 0 : done = (failed = !arg1_holder.TrySetToUnrestrictedFloatSequence(cx, args[1], tryNext, false)) || !tryNext;
13611 : }
13612 : }
13613 0 : if (failed) {
13614 0 : return false;
13615 : }
13616 0 : if (!done) {
13617 0 : ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of WebGLRenderingContext.uniform2fv", "Float32Array, UnrestrictedFloatSequence");
13618 0 : return false;
13619 : }
13620 : }
13621 0 : self->Uniform2fv(Constify(arg0), Constify(arg1));
13622 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13623 0 : args.rval().setUndefined();
13624 0 : return true;
13625 : }
13626 :
13627 : static const JSJitInfo uniform2fv_methodinfo = {
13628 : { (JSJitGetterOp)uniform2fv },
13629 : { prototypes::id::WebGLRenderingContext },
13630 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
13631 : JSJitInfo::Method,
13632 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
13633 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
13634 : false, /* isInfallible. False in setters. */
13635 : false, /* isMovable. Not relevant for setters. */
13636 : false, /* isEliminatable. Not relevant for setters. */
13637 : false, /* isAlwaysInSlot. Only relevant for getters. */
13638 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
13639 : false, /* isTypedMethod. Only relevant for methods. */
13640 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
13641 : };
13642 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
13643 : static_assert(0 < 1, "There is no slot for us");
13644 :
13645 : static bool
13646 0 : uniform3fv(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
13647 : {
13648 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
13649 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform3fv");
13650 : }
13651 : mozilla::WebGLUniformLocation* arg0;
13652 0 : if (args[0].isObject()) {
13653 : {
13654 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
13655 0 : if (NS_FAILED(rv)) {
13656 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform3fv", "WebGLUniformLocation");
13657 0 : return false;
13658 : }
13659 : }
13660 0 : } else if (args[0].isNullOrUndefined()) {
13661 0 : arg0 = nullptr;
13662 : } else {
13663 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform3fv");
13664 0 : return false;
13665 : }
13666 0 : Float32ArrayOrUnrestrictedFloatSequence arg1;
13667 0 : Float32ArrayOrUnrestrictedFloatSequenceArgument arg1_holder(arg1);
13668 : {
13669 0 : bool done = false, failed = false, tryNext;
13670 0 : if (args[1].isObject()) {
13671 0 : done = (failed = !arg1_holder.TrySetToFloat32Array(cx, args[1], tryNext, false)) || !tryNext;
13672 :
13673 0 : if (!done) {
13674 0 : done = (failed = !arg1_holder.TrySetToUnrestrictedFloatSequence(cx, args[1], tryNext, false)) || !tryNext;
13675 : }
13676 : }
13677 0 : if (failed) {
13678 0 : return false;
13679 : }
13680 0 : if (!done) {
13681 0 : ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of WebGLRenderingContext.uniform3fv", "Float32Array, UnrestrictedFloatSequence");
13682 0 : return false;
13683 : }
13684 : }
13685 0 : self->Uniform3fv(Constify(arg0), Constify(arg1));
13686 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13687 0 : args.rval().setUndefined();
13688 0 : return true;
13689 : }
13690 :
13691 : static const JSJitInfo uniform3fv_methodinfo = {
13692 : { (JSJitGetterOp)uniform3fv },
13693 : { prototypes::id::WebGLRenderingContext },
13694 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
13695 : JSJitInfo::Method,
13696 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
13697 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
13698 : false, /* isInfallible. False in setters. */
13699 : false, /* isMovable. Not relevant for setters. */
13700 : false, /* isEliminatable. Not relevant for setters. */
13701 : false, /* isAlwaysInSlot. Only relevant for getters. */
13702 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
13703 : false, /* isTypedMethod. Only relevant for methods. */
13704 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
13705 : };
13706 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
13707 : static_assert(0 < 1, "There is no slot for us");
13708 :
13709 : static bool
13710 0 : uniform4fv(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
13711 : {
13712 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
13713 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform4fv");
13714 : }
13715 : mozilla::WebGLUniformLocation* arg0;
13716 0 : if (args[0].isObject()) {
13717 : {
13718 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
13719 0 : if (NS_FAILED(rv)) {
13720 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform4fv", "WebGLUniformLocation");
13721 0 : return false;
13722 : }
13723 : }
13724 0 : } else if (args[0].isNullOrUndefined()) {
13725 0 : arg0 = nullptr;
13726 : } else {
13727 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform4fv");
13728 0 : return false;
13729 : }
13730 0 : Float32ArrayOrUnrestrictedFloatSequence arg1;
13731 0 : Float32ArrayOrUnrestrictedFloatSequenceArgument arg1_holder(arg1);
13732 : {
13733 0 : bool done = false, failed = false, tryNext;
13734 0 : if (args[1].isObject()) {
13735 0 : done = (failed = !arg1_holder.TrySetToFloat32Array(cx, args[1], tryNext, false)) || !tryNext;
13736 :
13737 0 : if (!done) {
13738 0 : done = (failed = !arg1_holder.TrySetToUnrestrictedFloatSequence(cx, args[1], tryNext, false)) || !tryNext;
13739 : }
13740 : }
13741 0 : if (failed) {
13742 0 : return false;
13743 : }
13744 0 : if (!done) {
13745 0 : ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of WebGLRenderingContext.uniform4fv", "Float32Array, UnrestrictedFloatSequence");
13746 0 : return false;
13747 : }
13748 : }
13749 0 : self->Uniform4fv(Constify(arg0), Constify(arg1));
13750 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13751 0 : args.rval().setUndefined();
13752 0 : return true;
13753 : }
13754 :
13755 : static const JSJitInfo uniform4fv_methodinfo = {
13756 : { (JSJitGetterOp)uniform4fv },
13757 : { prototypes::id::WebGLRenderingContext },
13758 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
13759 : JSJitInfo::Method,
13760 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
13761 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
13762 : false, /* isInfallible. False in setters. */
13763 : false, /* isMovable. Not relevant for setters. */
13764 : false, /* isEliminatable. Not relevant for setters. */
13765 : false, /* isAlwaysInSlot. Only relevant for getters. */
13766 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
13767 : false, /* isTypedMethod. Only relevant for methods. */
13768 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
13769 : };
13770 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
13771 : static_assert(0 < 1, "There is no slot for us");
13772 :
13773 : static bool
13774 0 : uniform1iv(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
13775 : {
13776 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
13777 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform1iv");
13778 : }
13779 : mozilla::WebGLUniformLocation* arg0;
13780 0 : if (args[0].isObject()) {
13781 : {
13782 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
13783 0 : if (NS_FAILED(rv)) {
13784 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform1iv", "WebGLUniformLocation");
13785 0 : return false;
13786 : }
13787 : }
13788 0 : } else if (args[0].isNullOrUndefined()) {
13789 0 : arg0 = nullptr;
13790 : } else {
13791 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform1iv");
13792 0 : return false;
13793 : }
13794 0 : Int32ArrayOrLongSequence arg1;
13795 0 : Int32ArrayOrLongSequenceArgument arg1_holder(arg1);
13796 : {
13797 0 : bool done = false, failed = false, tryNext;
13798 0 : if (args[1].isObject()) {
13799 0 : done = (failed = !arg1_holder.TrySetToInt32Array(cx, args[1], tryNext, false)) || !tryNext;
13800 :
13801 0 : if (!done) {
13802 0 : done = (failed = !arg1_holder.TrySetToLongSequence(cx, args[1], tryNext, false)) || !tryNext;
13803 : }
13804 : }
13805 0 : if (failed) {
13806 0 : return false;
13807 : }
13808 0 : if (!done) {
13809 0 : ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of WebGLRenderingContext.uniform1iv", "Int32Array, LongSequence");
13810 0 : return false;
13811 : }
13812 : }
13813 0 : self->Uniform1iv(Constify(arg0), Constify(arg1));
13814 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13815 0 : args.rval().setUndefined();
13816 0 : return true;
13817 : }
13818 :
13819 : static const JSJitInfo uniform1iv_methodinfo = {
13820 : { (JSJitGetterOp)uniform1iv },
13821 : { prototypes::id::WebGLRenderingContext },
13822 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
13823 : JSJitInfo::Method,
13824 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
13825 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
13826 : false, /* isInfallible. False in setters. */
13827 : false, /* isMovable. Not relevant for setters. */
13828 : false, /* isEliminatable. Not relevant for setters. */
13829 : false, /* isAlwaysInSlot. Only relevant for getters. */
13830 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
13831 : false, /* isTypedMethod. Only relevant for methods. */
13832 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
13833 : };
13834 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
13835 : static_assert(0 < 1, "There is no slot for us");
13836 :
13837 : static bool
13838 0 : uniform2iv(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
13839 : {
13840 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
13841 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform2iv");
13842 : }
13843 : mozilla::WebGLUniformLocation* arg0;
13844 0 : if (args[0].isObject()) {
13845 : {
13846 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
13847 0 : if (NS_FAILED(rv)) {
13848 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform2iv", "WebGLUniformLocation");
13849 0 : return false;
13850 : }
13851 : }
13852 0 : } else if (args[0].isNullOrUndefined()) {
13853 0 : arg0 = nullptr;
13854 : } else {
13855 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform2iv");
13856 0 : return false;
13857 : }
13858 0 : Int32ArrayOrLongSequence arg1;
13859 0 : Int32ArrayOrLongSequenceArgument arg1_holder(arg1);
13860 : {
13861 0 : bool done = false, failed = false, tryNext;
13862 0 : if (args[1].isObject()) {
13863 0 : done = (failed = !arg1_holder.TrySetToInt32Array(cx, args[1], tryNext, false)) || !tryNext;
13864 :
13865 0 : if (!done) {
13866 0 : done = (failed = !arg1_holder.TrySetToLongSequence(cx, args[1], tryNext, false)) || !tryNext;
13867 : }
13868 : }
13869 0 : if (failed) {
13870 0 : return false;
13871 : }
13872 0 : if (!done) {
13873 0 : ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of WebGLRenderingContext.uniform2iv", "Int32Array, LongSequence");
13874 0 : return false;
13875 : }
13876 : }
13877 0 : self->Uniform2iv(Constify(arg0), Constify(arg1));
13878 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13879 0 : args.rval().setUndefined();
13880 0 : return true;
13881 : }
13882 :
13883 : static const JSJitInfo uniform2iv_methodinfo = {
13884 : { (JSJitGetterOp)uniform2iv },
13885 : { prototypes::id::WebGLRenderingContext },
13886 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
13887 : JSJitInfo::Method,
13888 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
13889 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
13890 : false, /* isInfallible. False in setters. */
13891 : false, /* isMovable. Not relevant for setters. */
13892 : false, /* isEliminatable. Not relevant for setters. */
13893 : false, /* isAlwaysInSlot. Only relevant for getters. */
13894 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
13895 : false, /* isTypedMethod. Only relevant for methods. */
13896 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
13897 : };
13898 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
13899 : static_assert(0 < 1, "There is no slot for us");
13900 :
13901 : static bool
13902 0 : uniform3iv(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
13903 : {
13904 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
13905 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform3iv");
13906 : }
13907 : mozilla::WebGLUniformLocation* arg0;
13908 0 : if (args[0].isObject()) {
13909 : {
13910 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
13911 0 : if (NS_FAILED(rv)) {
13912 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform3iv", "WebGLUniformLocation");
13913 0 : return false;
13914 : }
13915 : }
13916 0 : } else if (args[0].isNullOrUndefined()) {
13917 0 : arg0 = nullptr;
13918 : } else {
13919 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform3iv");
13920 0 : return false;
13921 : }
13922 0 : Int32ArrayOrLongSequence arg1;
13923 0 : Int32ArrayOrLongSequenceArgument arg1_holder(arg1);
13924 : {
13925 0 : bool done = false, failed = false, tryNext;
13926 0 : if (args[1].isObject()) {
13927 0 : done = (failed = !arg1_holder.TrySetToInt32Array(cx, args[1], tryNext, false)) || !tryNext;
13928 :
13929 0 : if (!done) {
13930 0 : done = (failed = !arg1_holder.TrySetToLongSequence(cx, args[1], tryNext, false)) || !tryNext;
13931 : }
13932 : }
13933 0 : if (failed) {
13934 0 : return false;
13935 : }
13936 0 : if (!done) {
13937 0 : ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of WebGLRenderingContext.uniform3iv", "Int32Array, LongSequence");
13938 0 : return false;
13939 : }
13940 : }
13941 0 : self->Uniform3iv(Constify(arg0), Constify(arg1));
13942 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
13943 0 : args.rval().setUndefined();
13944 0 : return true;
13945 : }
13946 :
13947 : static const JSJitInfo uniform3iv_methodinfo = {
13948 : { (JSJitGetterOp)uniform3iv },
13949 : { prototypes::id::WebGLRenderingContext },
13950 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
13951 : JSJitInfo::Method,
13952 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
13953 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
13954 : false, /* isInfallible. False in setters. */
13955 : false, /* isMovable. Not relevant for setters. */
13956 : false, /* isEliminatable. Not relevant for setters. */
13957 : false, /* isAlwaysInSlot. Only relevant for getters. */
13958 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
13959 : false, /* isTypedMethod. Only relevant for methods. */
13960 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
13961 : };
13962 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
13963 : static_assert(0 < 1, "There is no slot for us");
13964 :
13965 : static bool
13966 0 : uniform4iv(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
13967 : {
13968 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
13969 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform4iv");
13970 : }
13971 : mozilla::WebGLUniformLocation* arg0;
13972 0 : if (args[0].isObject()) {
13973 : {
13974 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
13975 0 : if (NS_FAILED(rv)) {
13976 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform4iv", "WebGLUniformLocation");
13977 0 : return false;
13978 : }
13979 : }
13980 0 : } else if (args[0].isNullOrUndefined()) {
13981 0 : arg0 = nullptr;
13982 : } else {
13983 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform4iv");
13984 0 : return false;
13985 : }
13986 0 : Int32ArrayOrLongSequence arg1;
13987 0 : Int32ArrayOrLongSequenceArgument arg1_holder(arg1);
13988 : {
13989 0 : bool done = false, failed = false, tryNext;
13990 0 : if (args[1].isObject()) {
13991 0 : done = (failed = !arg1_holder.TrySetToInt32Array(cx, args[1], tryNext, false)) || !tryNext;
13992 :
13993 0 : if (!done) {
13994 0 : done = (failed = !arg1_holder.TrySetToLongSequence(cx, args[1], tryNext, false)) || !tryNext;
13995 : }
13996 : }
13997 0 : if (failed) {
13998 0 : return false;
13999 : }
14000 0 : if (!done) {
14001 0 : ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of WebGLRenderingContext.uniform4iv", "Int32Array, LongSequence");
14002 0 : return false;
14003 : }
14004 : }
14005 0 : self->Uniform4iv(Constify(arg0), Constify(arg1));
14006 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14007 0 : args.rval().setUndefined();
14008 0 : return true;
14009 : }
14010 :
14011 : static const JSJitInfo uniform4iv_methodinfo = {
14012 : { (JSJitGetterOp)uniform4iv },
14013 : { prototypes::id::WebGLRenderingContext },
14014 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14015 : JSJitInfo::Method,
14016 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14017 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14018 : false, /* isInfallible. False in setters. */
14019 : false, /* isMovable. Not relevant for setters. */
14020 : false, /* isEliminatable. Not relevant for setters. */
14021 : false, /* isAlwaysInSlot. Only relevant for getters. */
14022 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14023 : false, /* isTypedMethod. Only relevant for methods. */
14024 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14025 : };
14026 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14027 : static_assert(0 < 1, "There is no slot for us");
14028 :
14029 : static bool
14030 0 : uniformMatrix2fv(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14031 : {
14032 0 : if (MOZ_UNLIKELY(args.length() < 3)) {
14033 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniformMatrix2fv");
14034 : }
14035 : mozilla::WebGLUniformLocation* arg0;
14036 0 : if (args[0].isObject()) {
14037 : {
14038 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
14039 0 : if (NS_FAILED(rv)) {
14040 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniformMatrix2fv", "WebGLUniformLocation");
14041 0 : return false;
14042 : }
14043 : }
14044 0 : } else if (args[0].isNullOrUndefined()) {
14045 0 : arg0 = nullptr;
14046 : } else {
14047 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniformMatrix2fv");
14048 0 : return false;
14049 : }
14050 : bool arg1;
14051 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[1], &arg1)) {
14052 0 : return false;
14053 : }
14054 0 : Float32ArrayOrUnrestrictedFloatSequence arg2;
14055 0 : Float32ArrayOrUnrestrictedFloatSequenceArgument arg2_holder(arg2);
14056 : {
14057 0 : bool done = false, failed = false, tryNext;
14058 0 : if (args[2].isObject()) {
14059 0 : done = (failed = !arg2_holder.TrySetToFloat32Array(cx, args[2], tryNext, false)) || !tryNext;
14060 :
14061 0 : if (!done) {
14062 0 : done = (failed = !arg2_holder.TrySetToUnrestrictedFloatSequence(cx, args[2], tryNext, false)) || !tryNext;
14063 : }
14064 : }
14065 0 : if (failed) {
14066 0 : return false;
14067 : }
14068 0 : if (!done) {
14069 0 : ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 3 of WebGLRenderingContext.uniformMatrix2fv", "Float32Array, UnrestrictedFloatSequence");
14070 0 : return false;
14071 : }
14072 : }
14073 0 : self->UniformMatrix2fv(Constify(arg0), arg1, Constify(arg2));
14074 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14075 0 : args.rval().setUndefined();
14076 0 : return true;
14077 : }
14078 :
14079 : static const JSJitInfo uniformMatrix2fv_methodinfo = {
14080 : { (JSJitGetterOp)uniformMatrix2fv },
14081 : { prototypes::id::WebGLRenderingContext },
14082 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14083 : JSJitInfo::Method,
14084 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14085 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14086 : false, /* isInfallible. False in setters. */
14087 : false, /* isMovable. Not relevant for setters. */
14088 : false, /* isEliminatable. Not relevant for setters. */
14089 : false, /* isAlwaysInSlot. Only relevant for getters. */
14090 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14091 : false, /* isTypedMethod. Only relevant for methods. */
14092 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14093 : };
14094 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14095 : static_assert(0 < 1, "There is no slot for us");
14096 :
14097 : static bool
14098 0 : uniformMatrix3fv(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14099 : {
14100 0 : if (MOZ_UNLIKELY(args.length() < 3)) {
14101 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniformMatrix3fv");
14102 : }
14103 : mozilla::WebGLUniformLocation* arg0;
14104 0 : if (args[0].isObject()) {
14105 : {
14106 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
14107 0 : if (NS_FAILED(rv)) {
14108 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniformMatrix3fv", "WebGLUniformLocation");
14109 0 : return false;
14110 : }
14111 : }
14112 0 : } else if (args[0].isNullOrUndefined()) {
14113 0 : arg0 = nullptr;
14114 : } else {
14115 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniformMatrix3fv");
14116 0 : return false;
14117 : }
14118 : bool arg1;
14119 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[1], &arg1)) {
14120 0 : return false;
14121 : }
14122 0 : Float32ArrayOrUnrestrictedFloatSequence arg2;
14123 0 : Float32ArrayOrUnrestrictedFloatSequenceArgument arg2_holder(arg2);
14124 : {
14125 0 : bool done = false, failed = false, tryNext;
14126 0 : if (args[2].isObject()) {
14127 0 : done = (failed = !arg2_holder.TrySetToFloat32Array(cx, args[2], tryNext, false)) || !tryNext;
14128 :
14129 0 : if (!done) {
14130 0 : done = (failed = !arg2_holder.TrySetToUnrestrictedFloatSequence(cx, args[2], tryNext, false)) || !tryNext;
14131 : }
14132 : }
14133 0 : if (failed) {
14134 0 : return false;
14135 : }
14136 0 : if (!done) {
14137 0 : ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 3 of WebGLRenderingContext.uniformMatrix3fv", "Float32Array, UnrestrictedFloatSequence");
14138 0 : return false;
14139 : }
14140 : }
14141 0 : self->UniformMatrix3fv(Constify(arg0), arg1, Constify(arg2));
14142 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14143 0 : args.rval().setUndefined();
14144 0 : return true;
14145 : }
14146 :
14147 : static const JSJitInfo uniformMatrix3fv_methodinfo = {
14148 : { (JSJitGetterOp)uniformMatrix3fv },
14149 : { prototypes::id::WebGLRenderingContext },
14150 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14151 : JSJitInfo::Method,
14152 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14153 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14154 : false, /* isInfallible. False in setters. */
14155 : false, /* isMovable. Not relevant for setters. */
14156 : false, /* isEliminatable. Not relevant for setters. */
14157 : false, /* isAlwaysInSlot. Only relevant for getters. */
14158 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14159 : false, /* isTypedMethod. Only relevant for methods. */
14160 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14161 : };
14162 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14163 : static_assert(0 < 1, "There is no slot for us");
14164 :
14165 : static bool
14166 0 : uniformMatrix4fv(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14167 : {
14168 0 : if (MOZ_UNLIKELY(args.length() < 3)) {
14169 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniformMatrix4fv");
14170 : }
14171 : mozilla::WebGLUniformLocation* arg0;
14172 0 : if (args[0].isObject()) {
14173 : {
14174 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
14175 0 : if (NS_FAILED(rv)) {
14176 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniformMatrix4fv", "WebGLUniformLocation");
14177 0 : return false;
14178 : }
14179 : }
14180 0 : } else if (args[0].isNullOrUndefined()) {
14181 0 : arg0 = nullptr;
14182 : } else {
14183 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniformMatrix4fv");
14184 0 : return false;
14185 : }
14186 : bool arg1;
14187 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[1], &arg1)) {
14188 0 : return false;
14189 : }
14190 0 : Float32ArrayOrUnrestrictedFloatSequence arg2;
14191 0 : Float32ArrayOrUnrestrictedFloatSequenceArgument arg2_holder(arg2);
14192 : {
14193 0 : bool done = false, failed = false, tryNext;
14194 0 : if (args[2].isObject()) {
14195 0 : done = (failed = !arg2_holder.TrySetToFloat32Array(cx, args[2], tryNext, false)) || !tryNext;
14196 :
14197 0 : if (!done) {
14198 0 : done = (failed = !arg2_holder.TrySetToUnrestrictedFloatSequence(cx, args[2], tryNext, false)) || !tryNext;
14199 : }
14200 : }
14201 0 : if (failed) {
14202 0 : return false;
14203 : }
14204 0 : if (!done) {
14205 0 : ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 3 of WebGLRenderingContext.uniformMatrix4fv", "Float32Array, UnrestrictedFloatSequence");
14206 0 : return false;
14207 : }
14208 : }
14209 0 : self->UniformMatrix4fv(Constify(arg0), arg1, Constify(arg2));
14210 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14211 0 : args.rval().setUndefined();
14212 0 : return true;
14213 : }
14214 :
14215 : static const JSJitInfo uniformMatrix4fv_methodinfo = {
14216 : { (JSJitGetterOp)uniformMatrix4fv },
14217 : { prototypes::id::WebGLRenderingContext },
14218 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14219 : JSJitInfo::Method,
14220 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14221 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14222 : false, /* isInfallible. False in setters. */
14223 : false, /* isMovable. Not relevant for setters. */
14224 : false, /* isEliminatable. Not relevant for setters. */
14225 : false, /* isAlwaysInSlot. Only relevant for getters. */
14226 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14227 : false, /* isTypedMethod. Only relevant for methods. */
14228 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14229 : };
14230 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14231 : static_assert(0 < 1, "There is no slot for us");
14232 :
14233 : static bool
14234 0 : commit(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14235 : {
14236 0 : self->Commit();
14237 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14238 0 : args.rval().setUndefined();
14239 0 : return true;
14240 : }
14241 :
14242 : static const JSJitInfo commit_methodinfo = {
14243 : { (JSJitGetterOp)commit },
14244 : { prototypes::id::WebGLRenderingContext },
14245 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14246 : JSJitInfo::Method,
14247 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14248 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14249 : true, /* isInfallible. False in setters. */
14250 : false, /* isMovable. Not relevant for setters. */
14251 : false, /* isEliminatable. Not relevant for setters. */
14252 : false, /* isAlwaysInSlot. Only relevant for getters. */
14253 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14254 : false, /* isTypedMethod. Only relevant for methods. */
14255 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14256 : };
14257 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14258 : static_assert(0 < 1, "There is no slot for us");
14259 :
14260 : static bool
14261 0 : get_canvas(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, JSJitGetterCallArgs args)
14262 : {
14263 0 : Nullable<OwningHTMLCanvasElementOrOffscreenCanvas> result;
14264 0 : self->GetCanvas(result);
14265 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14266 0 : if (result.IsNull()) {
14267 0 : args.rval().setNull();
14268 0 : return true;
14269 : }
14270 0 : if (!result.Value().ToJSVal(cx, obj, args.rval())) {
14271 0 : return false;
14272 : }
14273 0 : return true;
14274 : }
14275 :
14276 : static const JSJitInfo canvas_getterinfo = {
14277 : { (JSJitGetterOp)get_canvas },
14278 : { prototypes::id::WebGLRenderingContext },
14279 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14280 : JSJitInfo::Getter,
14281 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14282 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
14283 : false, /* isInfallible. False in setters. */
14284 : false, /* isMovable. Not relevant for setters. */
14285 : false, /* isEliminatable. Not relevant for setters. */
14286 : false, /* isAlwaysInSlot. Only relevant for getters. */
14287 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14288 : false, /* isTypedMethod. Only relevant for methods. */
14289 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14290 : };
14291 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14292 : static_assert(0 < 1, "There is no slot for us");
14293 :
14294 : static bool
14295 0 : get_drawingBufferWidth(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, JSJitGetterCallArgs args)
14296 : {
14297 0 : int32_t result(self->DrawingBufferWidth());
14298 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14299 0 : args.rval().setInt32(int32_t(result));
14300 0 : return true;
14301 : }
14302 :
14303 : static const JSJitInfo drawingBufferWidth_getterinfo = {
14304 : { (JSJitGetterOp)get_drawingBufferWidth },
14305 : { prototypes::id::WebGLRenderingContext },
14306 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14307 : JSJitInfo::Getter,
14308 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14309 : JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */
14310 : true, /* isInfallible. False in setters. */
14311 : false, /* isMovable. Not relevant for setters. */
14312 : false, /* isEliminatable. Not relevant for setters. */
14313 : false, /* isAlwaysInSlot. Only relevant for getters. */
14314 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14315 : false, /* isTypedMethod. Only relevant for methods. */
14316 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14317 : };
14318 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14319 : static_assert(0 < 1, "There is no slot for us");
14320 :
14321 : static bool
14322 0 : get_drawingBufferHeight(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, JSJitGetterCallArgs args)
14323 : {
14324 0 : int32_t result(self->DrawingBufferHeight());
14325 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14326 0 : args.rval().setInt32(int32_t(result));
14327 0 : return true;
14328 : }
14329 :
14330 : static const JSJitInfo drawingBufferHeight_getterinfo = {
14331 : { (JSJitGetterOp)get_drawingBufferHeight },
14332 : { prototypes::id::WebGLRenderingContext },
14333 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14334 : JSJitInfo::Getter,
14335 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14336 : JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */
14337 : true, /* isInfallible. False in setters. */
14338 : false, /* isMovable. Not relevant for setters. */
14339 : false, /* isEliminatable. Not relevant for setters. */
14340 : false, /* isAlwaysInSlot. Only relevant for getters. */
14341 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14342 : false, /* isTypedMethod. Only relevant for methods. */
14343 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14344 : };
14345 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14346 : static_assert(0 < 1, "There is no slot for us");
14347 :
14348 : static bool
14349 0 : getContextAttributes(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14350 : {
14351 0 : Nullable<WebGLContextAttributes> result;
14352 0 : self->GetContextAttributes(result);
14353 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14354 0 : if (result.IsNull()) {
14355 0 : args.rval().setNull();
14356 0 : return true;
14357 : }
14358 0 : if (!result.Value().ToObjectInternal(cx, args.rval())) {
14359 0 : return false;
14360 : }
14361 0 : return true;
14362 : }
14363 :
14364 : static const JSJitInfo getContextAttributes_methodinfo = {
14365 : { (JSJitGetterOp)getContextAttributes },
14366 : { prototypes::id::WebGLRenderingContext },
14367 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14368 : JSJitInfo::Method,
14369 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14370 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
14371 : false, /* isInfallible. False in setters. */
14372 : false, /* isMovable. Not relevant for setters. */
14373 : false, /* isEliminatable. Not relevant for setters. */
14374 : false, /* isAlwaysInSlot. Only relevant for getters. */
14375 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14376 : false, /* isTypedMethod. Only relevant for methods. */
14377 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14378 : };
14379 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14380 : static_assert(0 < 1, "There is no slot for us");
14381 :
14382 : static bool
14383 0 : isContextLost(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14384 : {
14385 0 : bool result(self->IsContextLost());
14386 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14387 0 : args.rval().setBoolean(result);
14388 0 : return true;
14389 : }
14390 :
14391 : static const JSJitInfo isContextLost_methodinfo = {
14392 : { (JSJitGetterOp)isContextLost },
14393 : { prototypes::id::WebGLRenderingContext },
14394 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14395 : JSJitInfo::Method,
14396 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14397 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
14398 : true, /* isInfallible. False in setters. */
14399 : false, /* isMovable. Not relevant for setters. */
14400 : false, /* isEliminatable. Not relevant for setters. */
14401 : false, /* isAlwaysInSlot. Only relevant for getters. */
14402 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14403 : false, /* isTypedMethod. Only relevant for methods. */
14404 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14405 : };
14406 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14407 : static_assert(0 < 1, "There is no slot for us");
14408 :
14409 : static bool
14410 0 : getSupportedExtensions(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14411 : {
14412 0 : Nullable<nsTArray<nsString>> result;
14413 0 : self->GetSupportedExtensions(result, nsContentUtils::ThreadsafeIsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem);
14414 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14415 :
14416 0 : if (result.IsNull()) {
14417 0 : args.rval().setNull();
14418 0 : return true;
14419 : }
14420 :
14421 0 : uint32_t length = result.Value().Length();
14422 0 : JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
14423 0 : if (!returnArray) {
14424 0 : return false;
14425 : }
14426 : // Scope for 'tmp'
14427 : {
14428 0 : JS::Rooted<JS::Value> tmp(cx);
14429 0 : for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
14430 : // Control block to let us common up the JS_DefineElement calls when there
14431 : // are different ways to succeed at wrapping the object.
14432 : do {
14433 0 : if (!xpc::NonVoidStringToJsval(cx, result.Value()[sequenceIdx0], &tmp)) {
14434 0 : return false;
14435 : }
14436 0 : break;
14437 : } while (0);
14438 0 : if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
14439 : JSPROP_ENUMERATE)) {
14440 0 : return false;
14441 : }
14442 : }
14443 : }
14444 0 : args.rval().setObject(*returnArray);
14445 0 : return true;
14446 : }
14447 :
14448 : static const JSJitInfo getSupportedExtensions_methodinfo = {
14449 : { (JSJitGetterOp)getSupportedExtensions },
14450 : { prototypes::id::WebGLRenderingContext },
14451 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14452 : JSJitInfo::Method,
14453 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14454 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
14455 : false, /* isInfallible. False in setters. */
14456 : false, /* isMovable. Not relevant for setters. */
14457 : false, /* isEliminatable. Not relevant for setters. */
14458 : false, /* isAlwaysInSlot. Only relevant for getters. */
14459 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14460 : false, /* isTypedMethod. Only relevant for methods. */
14461 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14462 : };
14463 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14464 : static_assert(0 < 1, "There is no slot for us");
14465 :
14466 : static bool
14467 0 : getExtension(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14468 : {
14469 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
14470 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getExtension");
14471 : }
14472 0 : binding_detail::FakeString arg0;
14473 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
14474 0 : return false;
14475 : }
14476 0 : binding_detail::FastErrorResult rv;
14477 0 : JS::Rooted<JSObject*> result(cx);
14478 0 : self->GetExtension(cx, NonNullHelper(Constify(arg0)), &result, nsContentUtils::ThreadsafeIsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv);
14479 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
14480 0 : return false;
14481 : }
14482 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14483 0 : if (result) {
14484 0 : JS::ExposeObjectToActiveJS(result);
14485 : }
14486 0 : args.rval().setObjectOrNull(result);
14487 0 : if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
14488 0 : return false;
14489 : }
14490 0 : return true;
14491 : }
14492 :
14493 : static const JSJitInfo getExtension_methodinfo = {
14494 : { (JSJitGetterOp)getExtension },
14495 : { prototypes::id::WebGLRenderingContext },
14496 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14497 : JSJitInfo::Method,
14498 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14499 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
14500 : false, /* isInfallible. False in setters. */
14501 : false, /* isMovable. Not relevant for setters. */
14502 : false, /* isEliminatable. Not relevant for setters. */
14503 : false, /* isAlwaysInSlot. Only relevant for getters. */
14504 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14505 : false, /* isTypedMethod. Only relevant for methods. */
14506 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14507 : };
14508 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14509 : static_assert(0 < 1, "There is no slot for us");
14510 :
14511 : static bool
14512 0 : activeTexture(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14513 : {
14514 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
14515 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.activeTexture");
14516 : }
14517 : uint32_t arg0;
14518 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
14519 0 : return false;
14520 : }
14521 0 : self->ActiveTexture(arg0);
14522 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14523 0 : args.rval().setUndefined();
14524 0 : return true;
14525 : }
14526 :
14527 : static const JSJitInfo activeTexture_methodinfo = {
14528 : { (JSJitGetterOp)activeTexture },
14529 : { prototypes::id::WebGLRenderingContext },
14530 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14531 : JSJitInfo::Method,
14532 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14533 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14534 : false, /* isInfallible. False in setters. */
14535 : false, /* isMovable. Not relevant for setters. */
14536 : false, /* isEliminatable. Not relevant for setters. */
14537 : false, /* isAlwaysInSlot. Only relevant for getters. */
14538 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14539 : false, /* isTypedMethod. Only relevant for methods. */
14540 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14541 : };
14542 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14543 : static_assert(0 < 1, "There is no slot for us");
14544 :
14545 : static bool
14546 0 : attachShader(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14547 : {
14548 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
14549 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.attachShader");
14550 : }
14551 0 : NonNull<mozilla::WebGLProgram> arg0;
14552 0 : if (args[0].isObject()) {
14553 : {
14554 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
14555 0 : if (NS_FAILED(rv)) {
14556 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.attachShader", "WebGLProgram");
14557 0 : return false;
14558 : }
14559 : }
14560 : } else {
14561 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.attachShader");
14562 0 : return false;
14563 : }
14564 0 : NonNull<mozilla::WebGLShader> arg1;
14565 0 : if (args[1].isObject()) {
14566 : {
14567 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLShader, mozilla::WebGLShader>(args[1], arg1);
14568 0 : if (NS_FAILED(rv)) {
14569 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of WebGLRenderingContext.attachShader", "WebGLShader");
14570 0 : return false;
14571 : }
14572 : }
14573 : } else {
14574 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of WebGLRenderingContext.attachShader");
14575 0 : return false;
14576 : }
14577 0 : self->AttachShader(NonNullHelper(arg0), NonNullHelper(arg1));
14578 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14579 0 : args.rval().setUndefined();
14580 0 : return true;
14581 : }
14582 :
14583 : static const JSJitInfo attachShader_methodinfo = {
14584 : { (JSJitGetterOp)attachShader },
14585 : { prototypes::id::WebGLRenderingContext },
14586 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14587 : JSJitInfo::Method,
14588 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14589 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14590 : false, /* isInfallible. False in setters. */
14591 : false, /* isMovable. Not relevant for setters. */
14592 : false, /* isEliminatable. Not relevant for setters. */
14593 : false, /* isAlwaysInSlot. Only relevant for getters. */
14594 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14595 : false, /* isTypedMethod. Only relevant for methods. */
14596 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14597 : };
14598 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14599 : static_assert(0 < 1, "There is no slot for us");
14600 :
14601 : static bool
14602 0 : bindAttribLocation(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14603 : {
14604 0 : if (MOZ_UNLIKELY(args.length() < 3)) {
14605 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.bindAttribLocation");
14606 : }
14607 0 : NonNull<mozilla::WebGLProgram> arg0;
14608 0 : if (args[0].isObject()) {
14609 : {
14610 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
14611 0 : if (NS_FAILED(rv)) {
14612 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.bindAttribLocation", "WebGLProgram");
14613 0 : return false;
14614 : }
14615 : }
14616 : } else {
14617 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.bindAttribLocation");
14618 0 : return false;
14619 : }
14620 : uint32_t arg1;
14621 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
14622 0 : return false;
14623 : }
14624 0 : binding_detail::FakeString arg2;
14625 0 : if (!ConvertJSValueToString(cx, args[2], eStringify, eStringify, arg2)) {
14626 0 : return false;
14627 : }
14628 0 : self->BindAttribLocation(NonNullHelper(arg0), arg1, NonNullHelper(Constify(arg2)));
14629 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14630 0 : args.rval().setUndefined();
14631 0 : return true;
14632 : }
14633 :
14634 : static const JSJitInfo bindAttribLocation_methodinfo = {
14635 : { (JSJitGetterOp)bindAttribLocation },
14636 : { prototypes::id::WebGLRenderingContext },
14637 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14638 : JSJitInfo::Method,
14639 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14640 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14641 : false, /* isInfallible. False in setters. */
14642 : false, /* isMovable. Not relevant for setters. */
14643 : false, /* isEliminatable. Not relevant for setters. */
14644 : false, /* isAlwaysInSlot. Only relevant for getters. */
14645 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14646 : false, /* isTypedMethod. Only relevant for methods. */
14647 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14648 : };
14649 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14650 : static_assert(0 < 1, "There is no slot for us");
14651 :
14652 : static bool
14653 0 : bindBuffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14654 : {
14655 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
14656 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.bindBuffer");
14657 : }
14658 : uint32_t arg0;
14659 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
14660 0 : return false;
14661 : }
14662 : mozilla::WebGLBuffer* arg1;
14663 0 : if (args[1].isObject()) {
14664 : {
14665 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLBuffer, mozilla::WebGLBuffer>(args[1], arg1);
14666 0 : if (NS_FAILED(rv)) {
14667 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of WebGLRenderingContext.bindBuffer", "WebGLBuffer");
14668 0 : return false;
14669 : }
14670 : }
14671 0 : } else if (args[1].isNullOrUndefined()) {
14672 0 : arg1 = nullptr;
14673 : } else {
14674 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of WebGLRenderingContext.bindBuffer");
14675 0 : return false;
14676 : }
14677 0 : self->BindBuffer(arg0, Constify(arg1));
14678 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14679 0 : args.rval().setUndefined();
14680 0 : return true;
14681 : }
14682 :
14683 : static const JSJitInfo bindBuffer_methodinfo = {
14684 : { (JSJitGetterOp)bindBuffer },
14685 : { prototypes::id::WebGLRenderingContext },
14686 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14687 : JSJitInfo::Method,
14688 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14689 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14690 : false, /* isInfallible. False in setters. */
14691 : false, /* isMovable. Not relevant for setters. */
14692 : false, /* isEliminatable. Not relevant for setters. */
14693 : false, /* isAlwaysInSlot. Only relevant for getters. */
14694 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14695 : false, /* isTypedMethod. Only relevant for methods. */
14696 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14697 : };
14698 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14699 : static_assert(0 < 1, "There is no slot for us");
14700 :
14701 : static bool
14702 0 : bindFramebuffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14703 : {
14704 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
14705 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.bindFramebuffer");
14706 : }
14707 : uint32_t arg0;
14708 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
14709 0 : return false;
14710 : }
14711 : mozilla::WebGLFramebuffer* arg1;
14712 0 : if (args[1].isObject()) {
14713 : {
14714 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLFramebuffer, mozilla::WebGLFramebuffer>(args[1], arg1);
14715 0 : if (NS_FAILED(rv)) {
14716 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of WebGLRenderingContext.bindFramebuffer", "WebGLFramebuffer");
14717 0 : return false;
14718 : }
14719 : }
14720 0 : } else if (args[1].isNullOrUndefined()) {
14721 0 : arg1 = nullptr;
14722 : } else {
14723 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of WebGLRenderingContext.bindFramebuffer");
14724 0 : return false;
14725 : }
14726 0 : self->BindFramebuffer(arg0, Constify(arg1));
14727 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14728 0 : args.rval().setUndefined();
14729 0 : return true;
14730 : }
14731 :
14732 : static const JSJitInfo bindFramebuffer_methodinfo = {
14733 : { (JSJitGetterOp)bindFramebuffer },
14734 : { prototypes::id::WebGLRenderingContext },
14735 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14736 : JSJitInfo::Method,
14737 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14738 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14739 : false, /* isInfallible. False in setters. */
14740 : false, /* isMovable. Not relevant for setters. */
14741 : false, /* isEliminatable. Not relevant for setters. */
14742 : false, /* isAlwaysInSlot. Only relevant for getters. */
14743 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14744 : false, /* isTypedMethod. Only relevant for methods. */
14745 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14746 : };
14747 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14748 : static_assert(0 < 1, "There is no slot for us");
14749 :
14750 : static bool
14751 0 : bindRenderbuffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14752 : {
14753 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
14754 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.bindRenderbuffer");
14755 : }
14756 : uint32_t arg0;
14757 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
14758 0 : return false;
14759 : }
14760 : mozilla::WebGLRenderbuffer* arg1;
14761 0 : if (args[1].isObject()) {
14762 : {
14763 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLRenderbuffer, mozilla::WebGLRenderbuffer>(args[1], arg1);
14764 0 : if (NS_FAILED(rv)) {
14765 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of WebGLRenderingContext.bindRenderbuffer", "WebGLRenderbuffer");
14766 0 : return false;
14767 : }
14768 : }
14769 0 : } else if (args[1].isNullOrUndefined()) {
14770 0 : arg1 = nullptr;
14771 : } else {
14772 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of WebGLRenderingContext.bindRenderbuffer");
14773 0 : return false;
14774 : }
14775 0 : self->BindRenderbuffer(arg0, Constify(arg1));
14776 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14777 0 : args.rval().setUndefined();
14778 0 : return true;
14779 : }
14780 :
14781 : static const JSJitInfo bindRenderbuffer_methodinfo = {
14782 : { (JSJitGetterOp)bindRenderbuffer },
14783 : { prototypes::id::WebGLRenderingContext },
14784 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14785 : JSJitInfo::Method,
14786 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14787 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14788 : false, /* isInfallible. False in setters. */
14789 : false, /* isMovable. Not relevant for setters. */
14790 : false, /* isEliminatable. Not relevant for setters. */
14791 : false, /* isAlwaysInSlot. Only relevant for getters. */
14792 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14793 : false, /* isTypedMethod. Only relevant for methods. */
14794 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14795 : };
14796 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14797 : static_assert(0 < 1, "There is no slot for us");
14798 :
14799 : static bool
14800 0 : bindTexture(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14801 : {
14802 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
14803 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.bindTexture");
14804 : }
14805 : uint32_t arg0;
14806 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
14807 0 : return false;
14808 : }
14809 : mozilla::WebGLTexture* arg1;
14810 0 : if (args[1].isObject()) {
14811 : {
14812 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLTexture, mozilla::WebGLTexture>(args[1], arg1);
14813 0 : if (NS_FAILED(rv)) {
14814 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of WebGLRenderingContext.bindTexture", "WebGLTexture");
14815 0 : return false;
14816 : }
14817 : }
14818 0 : } else if (args[1].isNullOrUndefined()) {
14819 0 : arg1 = nullptr;
14820 : } else {
14821 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of WebGLRenderingContext.bindTexture");
14822 0 : return false;
14823 : }
14824 0 : self->BindTexture(arg0, Constify(arg1));
14825 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14826 0 : args.rval().setUndefined();
14827 0 : return true;
14828 : }
14829 :
14830 : static const JSJitInfo bindTexture_methodinfo = {
14831 : { (JSJitGetterOp)bindTexture },
14832 : { prototypes::id::WebGLRenderingContext },
14833 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14834 : JSJitInfo::Method,
14835 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14836 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14837 : false, /* isInfallible. False in setters. */
14838 : false, /* isMovable. Not relevant for setters. */
14839 : false, /* isEliminatable. Not relevant for setters. */
14840 : false, /* isAlwaysInSlot. Only relevant for getters. */
14841 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14842 : false, /* isTypedMethod. Only relevant for methods. */
14843 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14844 : };
14845 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14846 : static_assert(0 < 1, "There is no slot for us");
14847 :
14848 : static bool
14849 0 : blendColor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14850 : {
14851 0 : if (MOZ_UNLIKELY(args.length() < 4)) {
14852 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.blendColor");
14853 : }
14854 : float arg0;
14855 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
14856 0 : return false;
14857 : }
14858 : float arg1;
14859 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
14860 0 : return false;
14861 : }
14862 : float arg2;
14863 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[2], &arg2)) {
14864 0 : return false;
14865 : }
14866 : float arg3;
14867 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[3], &arg3)) {
14868 0 : return false;
14869 : }
14870 0 : self->BlendColor(arg0, arg1, arg2, arg3);
14871 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14872 0 : args.rval().setUndefined();
14873 0 : return true;
14874 : }
14875 :
14876 : static const JSJitInfo blendColor_methodinfo = {
14877 : { (JSJitGetterOp)blendColor },
14878 : { prototypes::id::WebGLRenderingContext },
14879 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14880 : JSJitInfo::Method,
14881 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14882 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14883 : false, /* isInfallible. False in setters. */
14884 : false, /* isMovable. Not relevant for setters. */
14885 : false, /* isEliminatable. Not relevant for setters. */
14886 : false, /* isAlwaysInSlot. Only relevant for getters. */
14887 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14888 : false, /* isTypedMethod. Only relevant for methods. */
14889 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14890 : };
14891 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14892 : static_assert(0 < 1, "There is no slot for us");
14893 :
14894 : static bool
14895 0 : blendEquation(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14896 : {
14897 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
14898 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.blendEquation");
14899 : }
14900 : uint32_t arg0;
14901 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
14902 0 : return false;
14903 : }
14904 0 : self->BlendEquation(arg0);
14905 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14906 0 : args.rval().setUndefined();
14907 0 : return true;
14908 : }
14909 :
14910 : static const JSJitInfo blendEquation_methodinfo = {
14911 : { (JSJitGetterOp)blendEquation },
14912 : { prototypes::id::WebGLRenderingContext },
14913 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14914 : JSJitInfo::Method,
14915 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14916 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14917 : false, /* isInfallible. False in setters. */
14918 : false, /* isMovable. Not relevant for setters. */
14919 : false, /* isEliminatable. Not relevant for setters. */
14920 : false, /* isAlwaysInSlot. Only relevant for getters. */
14921 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14922 : false, /* isTypedMethod. Only relevant for methods. */
14923 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14924 : };
14925 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14926 : static_assert(0 < 1, "There is no slot for us");
14927 :
14928 : static bool
14929 0 : blendEquationSeparate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14930 : {
14931 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
14932 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.blendEquationSeparate");
14933 : }
14934 : uint32_t arg0;
14935 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
14936 0 : return false;
14937 : }
14938 : uint32_t arg1;
14939 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
14940 0 : return false;
14941 : }
14942 0 : self->BlendEquationSeparate(arg0, arg1);
14943 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14944 0 : args.rval().setUndefined();
14945 0 : return true;
14946 : }
14947 :
14948 : static const JSJitInfo blendEquationSeparate_methodinfo = {
14949 : { (JSJitGetterOp)blendEquationSeparate },
14950 : { prototypes::id::WebGLRenderingContext },
14951 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14952 : JSJitInfo::Method,
14953 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14954 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14955 : false, /* isInfallible. False in setters. */
14956 : false, /* isMovable. Not relevant for setters. */
14957 : false, /* isEliminatable. Not relevant for setters. */
14958 : false, /* isAlwaysInSlot. Only relevant for getters. */
14959 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14960 : false, /* isTypedMethod. Only relevant for methods. */
14961 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
14962 : };
14963 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
14964 : static_assert(0 < 1, "There is no slot for us");
14965 :
14966 : static bool
14967 0 : blendFunc(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
14968 : {
14969 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
14970 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.blendFunc");
14971 : }
14972 : uint32_t arg0;
14973 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
14974 0 : return false;
14975 : }
14976 : uint32_t arg1;
14977 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
14978 0 : return false;
14979 : }
14980 0 : self->BlendFunc(arg0, arg1);
14981 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
14982 0 : args.rval().setUndefined();
14983 0 : return true;
14984 : }
14985 :
14986 : static const JSJitInfo blendFunc_methodinfo = {
14987 : { (JSJitGetterOp)blendFunc },
14988 : { prototypes::id::WebGLRenderingContext },
14989 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
14990 : JSJitInfo::Method,
14991 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
14992 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
14993 : false, /* isInfallible. False in setters. */
14994 : false, /* isMovable. Not relevant for setters. */
14995 : false, /* isEliminatable. Not relevant for setters. */
14996 : false, /* isAlwaysInSlot. Only relevant for getters. */
14997 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
14998 : false, /* isTypedMethod. Only relevant for methods. */
14999 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15000 : };
15001 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15002 : static_assert(0 < 1, "There is no slot for us");
15003 :
15004 : static bool
15005 0 : blendFuncSeparate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15006 : {
15007 0 : if (MOZ_UNLIKELY(args.length() < 4)) {
15008 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.blendFuncSeparate");
15009 : }
15010 : uint32_t arg0;
15011 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
15012 0 : return false;
15013 : }
15014 : uint32_t arg1;
15015 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
15016 0 : return false;
15017 : }
15018 : uint32_t arg2;
15019 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
15020 0 : return false;
15021 : }
15022 : uint32_t arg3;
15023 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[3], &arg3)) {
15024 0 : return false;
15025 : }
15026 0 : self->BlendFuncSeparate(arg0, arg1, arg2, arg3);
15027 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15028 0 : args.rval().setUndefined();
15029 0 : return true;
15030 : }
15031 :
15032 : static const JSJitInfo blendFuncSeparate_methodinfo = {
15033 : { (JSJitGetterOp)blendFuncSeparate },
15034 : { prototypes::id::WebGLRenderingContext },
15035 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15036 : JSJitInfo::Method,
15037 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15038 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15039 : false, /* isInfallible. False in setters. */
15040 : false, /* isMovable. Not relevant for setters. */
15041 : false, /* isEliminatable. Not relevant for setters. */
15042 : false, /* isAlwaysInSlot. Only relevant for getters. */
15043 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15044 : false, /* isTypedMethod. Only relevant for methods. */
15045 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15046 : };
15047 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15048 : static_assert(0 < 1, "There is no slot for us");
15049 :
15050 : static bool
15051 0 : checkFramebufferStatus(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15052 : {
15053 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
15054 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.checkFramebufferStatus");
15055 : }
15056 : uint32_t arg0;
15057 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
15058 0 : return false;
15059 : }
15060 0 : uint32_t result(self->CheckFramebufferStatus(arg0));
15061 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15062 0 : args.rval().setNumber(result);
15063 0 : return true;
15064 : }
15065 :
15066 : static const JSJitInfo checkFramebufferStatus_methodinfo = {
15067 : { (JSJitGetterOp)checkFramebufferStatus },
15068 : { prototypes::id::WebGLRenderingContext },
15069 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15070 : JSJitInfo::Method,
15071 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15072 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
15073 : false, /* isInfallible. False in setters. */
15074 : false, /* isMovable. Not relevant for setters. */
15075 : false, /* isEliminatable. Not relevant for setters. */
15076 : false, /* isAlwaysInSlot. Only relevant for getters. */
15077 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15078 : false, /* isTypedMethod. Only relevant for methods. */
15079 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15080 : };
15081 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15082 : static_assert(0 < 1, "There is no slot for us");
15083 :
15084 : static bool
15085 0 : clear(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15086 : {
15087 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
15088 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.clear");
15089 : }
15090 : uint32_t arg0;
15091 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
15092 0 : return false;
15093 : }
15094 0 : self->Clear(arg0);
15095 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15096 0 : args.rval().setUndefined();
15097 0 : return true;
15098 : }
15099 :
15100 : static const JSJitInfo clear_methodinfo = {
15101 : { (JSJitGetterOp)clear },
15102 : { prototypes::id::WebGLRenderingContext },
15103 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15104 : JSJitInfo::Method,
15105 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15106 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15107 : false, /* isInfallible. False in setters. */
15108 : false, /* isMovable. Not relevant for setters. */
15109 : false, /* isEliminatable. Not relevant for setters. */
15110 : false, /* isAlwaysInSlot. Only relevant for getters. */
15111 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15112 : false, /* isTypedMethod. Only relevant for methods. */
15113 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15114 : };
15115 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15116 : static_assert(0 < 1, "There is no slot for us");
15117 :
15118 : static bool
15119 0 : clearColor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15120 : {
15121 0 : if (MOZ_UNLIKELY(args.length() < 4)) {
15122 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.clearColor");
15123 : }
15124 : float arg0;
15125 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
15126 0 : return false;
15127 : }
15128 : float arg1;
15129 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
15130 0 : return false;
15131 : }
15132 : float arg2;
15133 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[2], &arg2)) {
15134 0 : return false;
15135 : }
15136 : float arg3;
15137 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[3], &arg3)) {
15138 0 : return false;
15139 : }
15140 0 : self->ClearColor(arg0, arg1, arg2, arg3);
15141 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15142 0 : args.rval().setUndefined();
15143 0 : return true;
15144 : }
15145 :
15146 : static const JSJitInfo clearColor_methodinfo = {
15147 : { (JSJitGetterOp)clearColor },
15148 : { prototypes::id::WebGLRenderingContext },
15149 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15150 : JSJitInfo::Method,
15151 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15152 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15153 : false, /* isInfallible. False in setters. */
15154 : false, /* isMovable. Not relevant for setters. */
15155 : false, /* isEliminatable. Not relevant for setters. */
15156 : false, /* isAlwaysInSlot. Only relevant for getters. */
15157 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15158 : false, /* isTypedMethod. Only relevant for methods. */
15159 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15160 : };
15161 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15162 : static_assert(0 < 1, "There is no slot for us");
15163 :
15164 : static bool
15165 0 : clearDepth(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15166 : {
15167 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
15168 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.clearDepth");
15169 : }
15170 : float arg0;
15171 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
15172 0 : return false;
15173 : }
15174 0 : self->ClearDepth(arg0);
15175 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15176 0 : args.rval().setUndefined();
15177 0 : return true;
15178 : }
15179 :
15180 : static const JSJitInfo clearDepth_methodinfo = {
15181 : { (JSJitGetterOp)clearDepth },
15182 : { prototypes::id::WebGLRenderingContext },
15183 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15184 : JSJitInfo::Method,
15185 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15186 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15187 : false, /* isInfallible. False in setters. */
15188 : false, /* isMovable. Not relevant for setters. */
15189 : false, /* isEliminatable. Not relevant for setters. */
15190 : false, /* isAlwaysInSlot. Only relevant for getters. */
15191 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15192 : false, /* isTypedMethod. Only relevant for methods. */
15193 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15194 : };
15195 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15196 : static_assert(0 < 1, "There is no slot for us");
15197 :
15198 : static bool
15199 0 : clearStencil(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15200 : {
15201 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
15202 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.clearStencil");
15203 : }
15204 : int32_t arg0;
15205 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
15206 0 : return false;
15207 : }
15208 0 : self->ClearStencil(arg0);
15209 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15210 0 : args.rval().setUndefined();
15211 0 : return true;
15212 : }
15213 :
15214 : static const JSJitInfo clearStencil_methodinfo = {
15215 : { (JSJitGetterOp)clearStencil },
15216 : { prototypes::id::WebGLRenderingContext },
15217 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15218 : JSJitInfo::Method,
15219 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15220 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15221 : false, /* isInfallible. False in setters. */
15222 : false, /* isMovable. Not relevant for setters. */
15223 : false, /* isEliminatable. Not relevant for setters. */
15224 : false, /* isAlwaysInSlot. Only relevant for getters. */
15225 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15226 : false, /* isTypedMethod. Only relevant for methods. */
15227 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15228 : };
15229 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15230 : static_assert(0 < 1, "There is no slot for us");
15231 :
15232 : static bool
15233 0 : colorMask(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15234 : {
15235 0 : if (MOZ_UNLIKELY(args.length() < 4)) {
15236 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.colorMask");
15237 : }
15238 : bool arg0;
15239 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
15240 0 : return false;
15241 : }
15242 : bool arg1;
15243 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[1], &arg1)) {
15244 0 : return false;
15245 : }
15246 : bool arg2;
15247 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[2], &arg2)) {
15248 0 : return false;
15249 : }
15250 : bool arg3;
15251 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[3], &arg3)) {
15252 0 : return false;
15253 : }
15254 0 : self->ColorMask(arg0, arg1, arg2, arg3);
15255 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15256 0 : args.rval().setUndefined();
15257 0 : return true;
15258 : }
15259 :
15260 : static const JSJitInfo colorMask_methodinfo = {
15261 : { (JSJitGetterOp)colorMask },
15262 : { prototypes::id::WebGLRenderingContext },
15263 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15264 : JSJitInfo::Method,
15265 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15266 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15267 : false, /* isInfallible. False in setters. */
15268 : false, /* isMovable. Not relevant for setters. */
15269 : false, /* isEliminatable. Not relevant for setters. */
15270 : false, /* isAlwaysInSlot. Only relevant for getters. */
15271 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15272 : false, /* isTypedMethod. Only relevant for methods. */
15273 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15274 : };
15275 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15276 : static_assert(0 < 1, "There is no slot for us");
15277 :
15278 : static bool
15279 0 : compileShader(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15280 : {
15281 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
15282 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.compileShader");
15283 : }
15284 0 : NonNull<mozilla::WebGLShader> arg0;
15285 0 : if (args[0].isObject()) {
15286 : {
15287 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLShader, mozilla::WebGLShader>(args[0], arg0);
15288 0 : if (NS_FAILED(rv)) {
15289 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.compileShader", "WebGLShader");
15290 0 : return false;
15291 : }
15292 : }
15293 : } else {
15294 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.compileShader");
15295 0 : return false;
15296 : }
15297 0 : self->CompileShader(NonNullHelper(arg0));
15298 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15299 0 : args.rval().setUndefined();
15300 0 : return true;
15301 : }
15302 :
15303 : static const JSJitInfo compileShader_methodinfo = {
15304 : { (JSJitGetterOp)compileShader },
15305 : { prototypes::id::WebGLRenderingContext },
15306 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15307 : JSJitInfo::Method,
15308 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15309 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15310 : false, /* isInfallible. False in setters. */
15311 : false, /* isMovable. Not relevant for setters. */
15312 : false, /* isEliminatable. Not relevant for setters. */
15313 : false, /* isAlwaysInSlot. Only relevant for getters. */
15314 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15315 : false, /* isTypedMethod. Only relevant for methods. */
15316 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15317 : };
15318 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15319 : static_assert(0 < 1, "There is no slot for us");
15320 :
15321 : static bool
15322 0 : copyTexImage2D(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15323 : {
15324 0 : if (MOZ_UNLIKELY(args.length() < 8)) {
15325 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.copyTexImage2D");
15326 : }
15327 : uint32_t arg0;
15328 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
15329 0 : return false;
15330 : }
15331 : int32_t arg1;
15332 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
15333 0 : return false;
15334 : }
15335 : uint32_t arg2;
15336 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
15337 0 : return false;
15338 : }
15339 : int32_t arg3;
15340 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
15341 0 : return false;
15342 : }
15343 : int32_t arg4;
15344 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[4], &arg4)) {
15345 0 : return false;
15346 : }
15347 : int32_t arg5;
15348 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[5], &arg5)) {
15349 0 : return false;
15350 : }
15351 : int32_t arg6;
15352 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[6], &arg6)) {
15353 0 : return false;
15354 : }
15355 : int32_t arg7;
15356 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[7], &arg7)) {
15357 0 : return false;
15358 : }
15359 0 : self->CopyTexImage2D(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
15360 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15361 0 : args.rval().setUndefined();
15362 0 : return true;
15363 : }
15364 :
15365 : static const JSJitInfo copyTexImage2D_methodinfo = {
15366 : { (JSJitGetterOp)copyTexImage2D },
15367 : { prototypes::id::WebGLRenderingContext },
15368 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15369 : JSJitInfo::Method,
15370 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15371 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15372 : false, /* isInfallible. False in setters. */
15373 : false, /* isMovable. Not relevant for setters. */
15374 : false, /* isEliminatable. Not relevant for setters. */
15375 : false, /* isAlwaysInSlot. Only relevant for getters. */
15376 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15377 : false, /* isTypedMethod. Only relevant for methods. */
15378 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15379 : };
15380 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15381 : static_assert(0 < 1, "There is no slot for us");
15382 :
15383 : static bool
15384 0 : copyTexSubImage2D(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15385 : {
15386 0 : if (MOZ_UNLIKELY(args.length() < 8)) {
15387 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.copyTexSubImage2D");
15388 : }
15389 : uint32_t arg0;
15390 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
15391 0 : return false;
15392 : }
15393 : int32_t arg1;
15394 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
15395 0 : return false;
15396 : }
15397 : int32_t arg2;
15398 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
15399 0 : return false;
15400 : }
15401 : int32_t arg3;
15402 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
15403 0 : return false;
15404 : }
15405 : int32_t arg4;
15406 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[4], &arg4)) {
15407 0 : return false;
15408 : }
15409 : int32_t arg5;
15410 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[5], &arg5)) {
15411 0 : return false;
15412 : }
15413 : int32_t arg6;
15414 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[6], &arg6)) {
15415 0 : return false;
15416 : }
15417 : int32_t arg7;
15418 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[7], &arg7)) {
15419 0 : return false;
15420 : }
15421 0 : self->CopyTexSubImage2D(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
15422 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15423 0 : args.rval().setUndefined();
15424 0 : return true;
15425 : }
15426 :
15427 : static const JSJitInfo copyTexSubImage2D_methodinfo = {
15428 : { (JSJitGetterOp)copyTexSubImage2D },
15429 : { prototypes::id::WebGLRenderingContext },
15430 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15431 : JSJitInfo::Method,
15432 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15433 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15434 : false, /* isInfallible. False in setters. */
15435 : false, /* isMovable. Not relevant for setters. */
15436 : false, /* isEliminatable. Not relevant for setters. */
15437 : false, /* isAlwaysInSlot. Only relevant for getters. */
15438 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15439 : false, /* isTypedMethod. Only relevant for methods. */
15440 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15441 : };
15442 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15443 : static_assert(0 < 1, "There is no slot for us");
15444 :
15445 : static bool
15446 0 : createBuffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15447 : {
15448 0 : auto result(StrongOrRawPtr<mozilla::WebGLBuffer>(self->CreateBuffer()));
15449 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15450 0 : if (!result) {
15451 0 : args.rval().setNull();
15452 0 : return true;
15453 : }
15454 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
15455 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
15456 0 : return false;
15457 : }
15458 0 : return true;
15459 : }
15460 :
15461 : static const JSJitInfo createBuffer_methodinfo = {
15462 : { (JSJitGetterOp)createBuffer },
15463 : { prototypes::id::WebGLRenderingContext },
15464 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15465 : JSJitInfo::Method,
15466 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15467 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
15468 : false, /* isInfallible. False in setters. */
15469 : false, /* isMovable. Not relevant for setters. */
15470 : false, /* isEliminatable. Not relevant for setters. */
15471 : false, /* isAlwaysInSlot. Only relevant for getters. */
15472 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15473 : false, /* isTypedMethod. Only relevant for methods. */
15474 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15475 : };
15476 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15477 : static_assert(0 < 1, "There is no slot for us");
15478 :
15479 : static bool
15480 0 : createFramebuffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15481 : {
15482 0 : auto result(StrongOrRawPtr<mozilla::WebGLFramebuffer>(self->CreateFramebuffer()));
15483 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15484 0 : if (!result) {
15485 0 : args.rval().setNull();
15486 0 : return true;
15487 : }
15488 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
15489 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
15490 0 : return false;
15491 : }
15492 0 : return true;
15493 : }
15494 :
15495 : static const JSJitInfo createFramebuffer_methodinfo = {
15496 : { (JSJitGetterOp)createFramebuffer },
15497 : { prototypes::id::WebGLRenderingContext },
15498 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15499 : JSJitInfo::Method,
15500 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15501 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
15502 : false, /* isInfallible. False in setters. */
15503 : false, /* isMovable. Not relevant for setters. */
15504 : false, /* isEliminatable. Not relevant for setters. */
15505 : false, /* isAlwaysInSlot. Only relevant for getters. */
15506 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15507 : false, /* isTypedMethod. Only relevant for methods. */
15508 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15509 : };
15510 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15511 : static_assert(0 < 1, "There is no slot for us");
15512 :
15513 : static bool
15514 0 : createProgram(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15515 : {
15516 0 : auto result(StrongOrRawPtr<mozilla::WebGLProgram>(self->CreateProgram()));
15517 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15518 0 : if (!result) {
15519 0 : args.rval().setNull();
15520 0 : return true;
15521 : }
15522 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
15523 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
15524 0 : return false;
15525 : }
15526 0 : return true;
15527 : }
15528 :
15529 : static const JSJitInfo createProgram_methodinfo = {
15530 : { (JSJitGetterOp)createProgram },
15531 : { prototypes::id::WebGLRenderingContext },
15532 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15533 : JSJitInfo::Method,
15534 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15535 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
15536 : false, /* isInfallible. False in setters. */
15537 : false, /* isMovable. Not relevant for setters. */
15538 : false, /* isEliminatable. Not relevant for setters. */
15539 : false, /* isAlwaysInSlot. Only relevant for getters. */
15540 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15541 : false, /* isTypedMethod. Only relevant for methods. */
15542 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15543 : };
15544 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15545 : static_assert(0 < 1, "There is no slot for us");
15546 :
15547 : static bool
15548 0 : createRenderbuffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15549 : {
15550 0 : auto result(StrongOrRawPtr<mozilla::WebGLRenderbuffer>(self->CreateRenderbuffer()));
15551 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15552 0 : if (!result) {
15553 0 : args.rval().setNull();
15554 0 : return true;
15555 : }
15556 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
15557 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
15558 0 : return false;
15559 : }
15560 0 : return true;
15561 : }
15562 :
15563 : static const JSJitInfo createRenderbuffer_methodinfo = {
15564 : { (JSJitGetterOp)createRenderbuffer },
15565 : { prototypes::id::WebGLRenderingContext },
15566 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15567 : JSJitInfo::Method,
15568 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15569 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
15570 : false, /* isInfallible. False in setters. */
15571 : false, /* isMovable. Not relevant for setters. */
15572 : false, /* isEliminatable. Not relevant for setters. */
15573 : false, /* isAlwaysInSlot. Only relevant for getters. */
15574 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15575 : false, /* isTypedMethod. Only relevant for methods. */
15576 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15577 : };
15578 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15579 : static_assert(0 < 1, "There is no slot for us");
15580 :
15581 : static bool
15582 0 : createShader(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15583 : {
15584 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
15585 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.createShader");
15586 : }
15587 : uint32_t arg0;
15588 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
15589 0 : return false;
15590 : }
15591 0 : auto result(StrongOrRawPtr<mozilla::WebGLShader>(self->CreateShader(arg0)));
15592 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15593 0 : if (!result) {
15594 0 : args.rval().setNull();
15595 0 : return true;
15596 : }
15597 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
15598 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
15599 0 : return false;
15600 : }
15601 0 : return true;
15602 : }
15603 :
15604 : static const JSJitInfo createShader_methodinfo = {
15605 : { (JSJitGetterOp)createShader },
15606 : { prototypes::id::WebGLRenderingContext },
15607 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15608 : JSJitInfo::Method,
15609 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15610 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
15611 : false, /* isInfallible. False in setters. */
15612 : false, /* isMovable. Not relevant for setters. */
15613 : false, /* isEliminatable. Not relevant for setters. */
15614 : false, /* isAlwaysInSlot. Only relevant for getters. */
15615 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15616 : false, /* isTypedMethod. Only relevant for methods. */
15617 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15618 : };
15619 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15620 : static_assert(0 < 1, "There is no slot for us");
15621 :
15622 : static bool
15623 0 : createTexture(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15624 : {
15625 0 : auto result(StrongOrRawPtr<mozilla::WebGLTexture>(self->CreateTexture()));
15626 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15627 0 : if (!result) {
15628 0 : args.rval().setNull();
15629 0 : return true;
15630 : }
15631 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
15632 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
15633 0 : return false;
15634 : }
15635 0 : return true;
15636 : }
15637 :
15638 : static const JSJitInfo createTexture_methodinfo = {
15639 : { (JSJitGetterOp)createTexture },
15640 : { prototypes::id::WebGLRenderingContext },
15641 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15642 : JSJitInfo::Method,
15643 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15644 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
15645 : false, /* isInfallible. False in setters. */
15646 : false, /* isMovable. Not relevant for setters. */
15647 : false, /* isEliminatable. Not relevant for setters. */
15648 : false, /* isAlwaysInSlot. Only relevant for getters. */
15649 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15650 : false, /* isTypedMethod. Only relevant for methods. */
15651 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15652 : };
15653 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15654 : static_assert(0 < 1, "There is no slot for us");
15655 :
15656 : static bool
15657 0 : cullFace(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15658 : {
15659 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
15660 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.cullFace");
15661 : }
15662 : uint32_t arg0;
15663 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
15664 0 : return false;
15665 : }
15666 0 : self->CullFace(arg0);
15667 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15668 0 : args.rval().setUndefined();
15669 0 : return true;
15670 : }
15671 :
15672 : static const JSJitInfo cullFace_methodinfo = {
15673 : { (JSJitGetterOp)cullFace },
15674 : { prototypes::id::WebGLRenderingContext },
15675 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15676 : JSJitInfo::Method,
15677 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15678 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15679 : false, /* isInfallible. False in setters. */
15680 : false, /* isMovable. Not relevant for setters. */
15681 : false, /* isEliminatable. Not relevant for setters. */
15682 : false, /* isAlwaysInSlot. Only relevant for getters. */
15683 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15684 : false, /* isTypedMethod. Only relevant for methods. */
15685 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15686 : };
15687 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15688 : static_assert(0 < 1, "There is no slot for us");
15689 :
15690 : static bool
15691 0 : deleteBuffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15692 : {
15693 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
15694 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.deleteBuffer");
15695 : }
15696 : mozilla::WebGLBuffer* arg0;
15697 0 : if (args[0].isObject()) {
15698 : {
15699 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLBuffer, mozilla::WebGLBuffer>(args[0], arg0);
15700 0 : if (NS_FAILED(rv)) {
15701 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.deleteBuffer", "WebGLBuffer");
15702 0 : return false;
15703 : }
15704 : }
15705 0 : } else if (args[0].isNullOrUndefined()) {
15706 0 : arg0 = nullptr;
15707 : } else {
15708 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.deleteBuffer");
15709 0 : return false;
15710 : }
15711 0 : self->DeleteBuffer(Constify(arg0));
15712 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15713 0 : args.rval().setUndefined();
15714 0 : return true;
15715 : }
15716 :
15717 : static const JSJitInfo deleteBuffer_methodinfo = {
15718 : { (JSJitGetterOp)deleteBuffer },
15719 : { prototypes::id::WebGLRenderingContext },
15720 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15721 : JSJitInfo::Method,
15722 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15723 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15724 : false, /* isInfallible. False in setters. */
15725 : false, /* isMovable. Not relevant for setters. */
15726 : false, /* isEliminatable. Not relevant for setters. */
15727 : false, /* isAlwaysInSlot. Only relevant for getters. */
15728 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15729 : false, /* isTypedMethod. Only relevant for methods. */
15730 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15731 : };
15732 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15733 : static_assert(0 < 1, "There is no slot for us");
15734 :
15735 : static bool
15736 0 : deleteFramebuffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15737 : {
15738 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
15739 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.deleteFramebuffer");
15740 : }
15741 : mozilla::WebGLFramebuffer* arg0;
15742 0 : if (args[0].isObject()) {
15743 : {
15744 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLFramebuffer, mozilla::WebGLFramebuffer>(args[0], arg0);
15745 0 : if (NS_FAILED(rv)) {
15746 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.deleteFramebuffer", "WebGLFramebuffer");
15747 0 : return false;
15748 : }
15749 : }
15750 0 : } else if (args[0].isNullOrUndefined()) {
15751 0 : arg0 = nullptr;
15752 : } else {
15753 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.deleteFramebuffer");
15754 0 : return false;
15755 : }
15756 0 : self->DeleteFramebuffer(Constify(arg0));
15757 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15758 0 : args.rval().setUndefined();
15759 0 : return true;
15760 : }
15761 :
15762 : static const JSJitInfo deleteFramebuffer_methodinfo = {
15763 : { (JSJitGetterOp)deleteFramebuffer },
15764 : { prototypes::id::WebGLRenderingContext },
15765 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15766 : JSJitInfo::Method,
15767 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15768 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15769 : false, /* isInfallible. False in setters. */
15770 : false, /* isMovable. Not relevant for setters. */
15771 : false, /* isEliminatable. Not relevant for setters. */
15772 : false, /* isAlwaysInSlot. Only relevant for getters. */
15773 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15774 : false, /* isTypedMethod. Only relevant for methods. */
15775 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15776 : };
15777 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15778 : static_assert(0 < 1, "There is no slot for us");
15779 :
15780 : static bool
15781 0 : deleteProgram(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15782 : {
15783 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
15784 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.deleteProgram");
15785 : }
15786 : mozilla::WebGLProgram* arg0;
15787 0 : if (args[0].isObject()) {
15788 : {
15789 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
15790 0 : if (NS_FAILED(rv)) {
15791 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.deleteProgram", "WebGLProgram");
15792 0 : return false;
15793 : }
15794 : }
15795 0 : } else if (args[0].isNullOrUndefined()) {
15796 0 : arg0 = nullptr;
15797 : } else {
15798 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.deleteProgram");
15799 0 : return false;
15800 : }
15801 0 : self->DeleteProgram(Constify(arg0));
15802 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15803 0 : args.rval().setUndefined();
15804 0 : return true;
15805 : }
15806 :
15807 : static const JSJitInfo deleteProgram_methodinfo = {
15808 : { (JSJitGetterOp)deleteProgram },
15809 : { prototypes::id::WebGLRenderingContext },
15810 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15811 : JSJitInfo::Method,
15812 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15813 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15814 : false, /* isInfallible. False in setters. */
15815 : false, /* isMovable. Not relevant for setters. */
15816 : false, /* isEliminatable. Not relevant for setters. */
15817 : false, /* isAlwaysInSlot. Only relevant for getters. */
15818 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15819 : false, /* isTypedMethod. Only relevant for methods. */
15820 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15821 : };
15822 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15823 : static_assert(0 < 1, "There is no slot for us");
15824 :
15825 : static bool
15826 0 : deleteRenderbuffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15827 : {
15828 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
15829 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.deleteRenderbuffer");
15830 : }
15831 : mozilla::WebGLRenderbuffer* arg0;
15832 0 : if (args[0].isObject()) {
15833 : {
15834 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLRenderbuffer, mozilla::WebGLRenderbuffer>(args[0], arg0);
15835 0 : if (NS_FAILED(rv)) {
15836 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.deleteRenderbuffer", "WebGLRenderbuffer");
15837 0 : return false;
15838 : }
15839 : }
15840 0 : } else if (args[0].isNullOrUndefined()) {
15841 0 : arg0 = nullptr;
15842 : } else {
15843 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.deleteRenderbuffer");
15844 0 : return false;
15845 : }
15846 0 : self->DeleteRenderbuffer(Constify(arg0));
15847 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15848 0 : args.rval().setUndefined();
15849 0 : return true;
15850 : }
15851 :
15852 : static const JSJitInfo deleteRenderbuffer_methodinfo = {
15853 : { (JSJitGetterOp)deleteRenderbuffer },
15854 : { prototypes::id::WebGLRenderingContext },
15855 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15856 : JSJitInfo::Method,
15857 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15858 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15859 : false, /* isInfallible. False in setters. */
15860 : false, /* isMovable. Not relevant for setters. */
15861 : false, /* isEliminatable. Not relevant for setters. */
15862 : false, /* isAlwaysInSlot. Only relevant for getters. */
15863 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15864 : false, /* isTypedMethod. Only relevant for methods. */
15865 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15866 : };
15867 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15868 : static_assert(0 < 1, "There is no slot for us");
15869 :
15870 : static bool
15871 0 : deleteShader(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15872 : {
15873 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
15874 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.deleteShader");
15875 : }
15876 : mozilla::WebGLShader* arg0;
15877 0 : if (args[0].isObject()) {
15878 : {
15879 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLShader, mozilla::WebGLShader>(args[0], arg0);
15880 0 : if (NS_FAILED(rv)) {
15881 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.deleteShader", "WebGLShader");
15882 0 : return false;
15883 : }
15884 : }
15885 0 : } else if (args[0].isNullOrUndefined()) {
15886 0 : arg0 = nullptr;
15887 : } else {
15888 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.deleteShader");
15889 0 : return false;
15890 : }
15891 0 : self->DeleteShader(Constify(arg0));
15892 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15893 0 : args.rval().setUndefined();
15894 0 : return true;
15895 : }
15896 :
15897 : static const JSJitInfo deleteShader_methodinfo = {
15898 : { (JSJitGetterOp)deleteShader },
15899 : { prototypes::id::WebGLRenderingContext },
15900 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15901 : JSJitInfo::Method,
15902 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15903 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15904 : false, /* isInfallible. False in setters. */
15905 : false, /* isMovable. Not relevant for setters. */
15906 : false, /* isEliminatable. Not relevant for setters. */
15907 : false, /* isAlwaysInSlot. Only relevant for getters. */
15908 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15909 : false, /* isTypedMethod. Only relevant for methods. */
15910 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15911 : };
15912 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15913 : static_assert(0 < 1, "There is no slot for us");
15914 :
15915 : static bool
15916 0 : deleteTexture(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15917 : {
15918 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
15919 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.deleteTexture");
15920 : }
15921 : mozilla::WebGLTexture* arg0;
15922 0 : if (args[0].isObject()) {
15923 : {
15924 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLTexture, mozilla::WebGLTexture>(args[0], arg0);
15925 0 : if (NS_FAILED(rv)) {
15926 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.deleteTexture", "WebGLTexture");
15927 0 : return false;
15928 : }
15929 : }
15930 0 : } else if (args[0].isNullOrUndefined()) {
15931 0 : arg0 = nullptr;
15932 : } else {
15933 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.deleteTexture");
15934 0 : return false;
15935 : }
15936 0 : self->DeleteTexture(Constify(arg0));
15937 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15938 0 : args.rval().setUndefined();
15939 0 : return true;
15940 : }
15941 :
15942 : static const JSJitInfo deleteTexture_methodinfo = {
15943 : { (JSJitGetterOp)deleteTexture },
15944 : { prototypes::id::WebGLRenderingContext },
15945 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15946 : JSJitInfo::Method,
15947 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15948 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15949 : false, /* isInfallible. False in setters. */
15950 : false, /* isMovable. Not relevant for setters. */
15951 : false, /* isEliminatable. Not relevant for setters. */
15952 : false, /* isAlwaysInSlot. Only relevant for getters. */
15953 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15954 : false, /* isTypedMethod. Only relevant for methods. */
15955 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15956 : };
15957 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15958 : static_assert(0 < 1, "There is no slot for us");
15959 :
15960 : static bool
15961 0 : depthFunc(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15962 : {
15963 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
15964 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.depthFunc");
15965 : }
15966 : uint32_t arg0;
15967 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
15968 0 : return false;
15969 : }
15970 0 : self->DepthFunc(arg0);
15971 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
15972 0 : args.rval().setUndefined();
15973 0 : return true;
15974 : }
15975 :
15976 : static const JSJitInfo depthFunc_methodinfo = {
15977 : { (JSJitGetterOp)depthFunc },
15978 : { prototypes::id::WebGLRenderingContext },
15979 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
15980 : JSJitInfo::Method,
15981 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
15982 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
15983 : false, /* isInfallible. False in setters. */
15984 : false, /* isMovable. Not relevant for setters. */
15985 : false, /* isEliminatable. Not relevant for setters. */
15986 : false, /* isAlwaysInSlot. Only relevant for getters. */
15987 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
15988 : false, /* isTypedMethod. Only relevant for methods. */
15989 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
15990 : };
15991 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
15992 : static_assert(0 < 1, "There is no slot for us");
15993 :
15994 : static bool
15995 0 : depthMask(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
15996 : {
15997 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
15998 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.depthMask");
15999 : }
16000 : bool arg0;
16001 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
16002 0 : return false;
16003 : }
16004 0 : self->DepthMask(arg0);
16005 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16006 0 : args.rval().setUndefined();
16007 0 : return true;
16008 : }
16009 :
16010 : static const JSJitInfo depthMask_methodinfo = {
16011 : { (JSJitGetterOp)depthMask },
16012 : { prototypes::id::WebGLRenderingContext },
16013 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16014 : JSJitInfo::Method,
16015 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16016 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
16017 : false, /* isInfallible. False in setters. */
16018 : false, /* isMovable. Not relevant for setters. */
16019 : false, /* isEliminatable. Not relevant for setters. */
16020 : false, /* isAlwaysInSlot. Only relevant for getters. */
16021 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16022 : false, /* isTypedMethod. Only relevant for methods. */
16023 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16024 : };
16025 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16026 : static_assert(0 < 1, "There is no slot for us");
16027 :
16028 : static bool
16029 0 : depthRange(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16030 : {
16031 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
16032 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.depthRange");
16033 : }
16034 : float arg0;
16035 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
16036 0 : return false;
16037 : }
16038 : float arg1;
16039 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
16040 0 : return false;
16041 : }
16042 0 : self->DepthRange(arg0, arg1);
16043 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16044 0 : args.rval().setUndefined();
16045 0 : return true;
16046 : }
16047 :
16048 : static const JSJitInfo depthRange_methodinfo = {
16049 : { (JSJitGetterOp)depthRange },
16050 : { prototypes::id::WebGLRenderingContext },
16051 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16052 : JSJitInfo::Method,
16053 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16054 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
16055 : false, /* isInfallible. False in setters. */
16056 : false, /* isMovable. Not relevant for setters. */
16057 : false, /* isEliminatable. Not relevant for setters. */
16058 : false, /* isAlwaysInSlot. Only relevant for getters. */
16059 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16060 : false, /* isTypedMethod. Only relevant for methods. */
16061 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16062 : };
16063 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16064 : static_assert(0 < 1, "There is no slot for us");
16065 :
16066 : static bool
16067 0 : detachShader(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16068 : {
16069 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
16070 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.detachShader");
16071 : }
16072 0 : NonNull<mozilla::WebGLProgram> arg0;
16073 0 : if (args[0].isObject()) {
16074 : {
16075 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
16076 0 : if (NS_FAILED(rv)) {
16077 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.detachShader", "WebGLProgram");
16078 0 : return false;
16079 : }
16080 : }
16081 : } else {
16082 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.detachShader");
16083 0 : return false;
16084 : }
16085 0 : NonNull<mozilla::WebGLShader> arg1;
16086 0 : if (args[1].isObject()) {
16087 : {
16088 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLShader, mozilla::WebGLShader>(args[1], arg1);
16089 0 : if (NS_FAILED(rv)) {
16090 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of WebGLRenderingContext.detachShader", "WebGLShader");
16091 0 : return false;
16092 : }
16093 : }
16094 : } else {
16095 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of WebGLRenderingContext.detachShader");
16096 0 : return false;
16097 : }
16098 0 : self->DetachShader(NonNullHelper(arg0), NonNullHelper(arg1));
16099 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16100 0 : args.rval().setUndefined();
16101 0 : return true;
16102 : }
16103 :
16104 : static const JSJitInfo detachShader_methodinfo = {
16105 : { (JSJitGetterOp)detachShader },
16106 : { prototypes::id::WebGLRenderingContext },
16107 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16108 : JSJitInfo::Method,
16109 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16110 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
16111 : false, /* isInfallible. False in setters. */
16112 : false, /* isMovable. Not relevant for setters. */
16113 : false, /* isEliminatable. Not relevant for setters. */
16114 : false, /* isAlwaysInSlot. Only relevant for getters. */
16115 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16116 : false, /* isTypedMethod. Only relevant for methods. */
16117 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16118 : };
16119 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16120 : static_assert(0 < 1, "There is no slot for us");
16121 :
16122 : static bool
16123 0 : disable(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16124 : {
16125 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
16126 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.disable");
16127 : }
16128 : uint32_t arg0;
16129 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
16130 0 : return false;
16131 : }
16132 0 : self->Disable(arg0);
16133 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16134 0 : args.rval().setUndefined();
16135 0 : return true;
16136 : }
16137 :
16138 : static const JSJitInfo disable_methodinfo = {
16139 : { (JSJitGetterOp)disable },
16140 : { prototypes::id::WebGLRenderingContext },
16141 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16142 : JSJitInfo::Method,
16143 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16144 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
16145 : false, /* isInfallible. False in setters. */
16146 : false, /* isMovable. Not relevant for setters. */
16147 : false, /* isEliminatable. Not relevant for setters. */
16148 : false, /* isAlwaysInSlot. Only relevant for getters. */
16149 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16150 : false, /* isTypedMethod. Only relevant for methods. */
16151 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16152 : };
16153 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16154 : static_assert(0 < 1, "There is no slot for us");
16155 :
16156 : static bool
16157 0 : disableVertexAttribArray(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16158 : {
16159 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
16160 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.disableVertexAttribArray");
16161 : }
16162 : uint32_t arg0;
16163 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
16164 0 : return false;
16165 : }
16166 0 : self->DisableVertexAttribArray(arg0);
16167 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16168 0 : args.rval().setUndefined();
16169 0 : return true;
16170 : }
16171 :
16172 : static const JSJitInfo disableVertexAttribArray_methodinfo = {
16173 : { (JSJitGetterOp)disableVertexAttribArray },
16174 : { prototypes::id::WebGLRenderingContext },
16175 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16176 : JSJitInfo::Method,
16177 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16178 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
16179 : false, /* isInfallible. False in setters. */
16180 : false, /* isMovable. Not relevant for setters. */
16181 : false, /* isEliminatable. Not relevant for setters. */
16182 : false, /* isAlwaysInSlot. Only relevant for getters. */
16183 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16184 : false, /* isTypedMethod. Only relevant for methods. */
16185 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16186 : };
16187 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16188 : static_assert(0 < 1, "There is no slot for us");
16189 :
16190 : static bool
16191 0 : drawArrays(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16192 : {
16193 0 : if (MOZ_UNLIKELY(args.length() < 3)) {
16194 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.drawArrays");
16195 : }
16196 : uint32_t arg0;
16197 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
16198 0 : return false;
16199 : }
16200 : int32_t arg1;
16201 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
16202 0 : return false;
16203 : }
16204 : int32_t arg2;
16205 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
16206 0 : return false;
16207 : }
16208 0 : self->DrawArrays(arg0, arg1, arg2);
16209 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16210 0 : args.rval().setUndefined();
16211 0 : return true;
16212 : }
16213 :
16214 : static const JSJitInfo drawArrays_methodinfo = {
16215 : { (JSJitGetterOp)drawArrays },
16216 : { prototypes::id::WebGLRenderingContext },
16217 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16218 : JSJitInfo::Method,
16219 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16220 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
16221 : false, /* isInfallible. False in setters. */
16222 : false, /* isMovable. Not relevant for setters. */
16223 : false, /* isEliminatable. Not relevant for setters. */
16224 : false, /* isAlwaysInSlot. Only relevant for getters. */
16225 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16226 : false, /* isTypedMethod. Only relevant for methods. */
16227 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16228 : };
16229 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16230 : static_assert(0 < 1, "There is no slot for us");
16231 :
16232 : static bool
16233 0 : drawElements(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16234 : {
16235 0 : if (MOZ_UNLIKELY(args.length() < 4)) {
16236 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.drawElements");
16237 : }
16238 : uint32_t arg0;
16239 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
16240 0 : return false;
16241 : }
16242 : int32_t arg1;
16243 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
16244 0 : return false;
16245 : }
16246 : uint32_t arg2;
16247 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
16248 0 : return false;
16249 : }
16250 : int64_t arg3;
16251 0 : if (!ValueToPrimitive<int64_t, eDefault>(cx, args[3], &arg3)) {
16252 0 : return false;
16253 : }
16254 0 : self->DrawElements(arg0, arg1, arg2, arg3);
16255 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16256 0 : args.rval().setUndefined();
16257 0 : return true;
16258 : }
16259 :
16260 : static const JSJitInfo drawElements_methodinfo = {
16261 : { (JSJitGetterOp)drawElements },
16262 : { prototypes::id::WebGLRenderingContext },
16263 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16264 : JSJitInfo::Method,
16265 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16266 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
16267 : false, /* isInfallible. False in setters. */
16268 : false, /* isMovable. Not relevant for setters. */
16269 : false, /* isEliminatable. Not relevant for setters. */
16270 : false, /* isAlwaysInSlot. Only relevant for getters. */
16271 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16272 : false, /* isTypedMethod. Only relevant for methods. */
16273 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16274 : };
16275 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16276 : static_assert(0 < 1, "There is no slot for us");
16277 :
16278 : static bool
16279 0 : enable(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16280 : {
16281 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
16282 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.enable");
16283 : }
16284 : uint32_t arg0;
16285 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
16286 0 : return false;
16287 : }
16288 0 : self->Enable(arg0);
16289 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16290 0 : args.rval().setUndefined();
16291 0 : return true;
16292 : }
16293 :
16294 : static const JSJitInfo enable_methodinfo = {
16295 : { (JSJitGetterOp)enable },
16296 : { prototypes::id::WebGLRenderingContext },
16297 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16298 : JSJitInfo::Method,
16299 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16300 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
16301 : false, /* isInfallible. False in setters. */
16302 : false, /* isMovable. Not relevant for setters. */
16303 : false, /* isEliminatable. Not relevant for setters. */
16304 : false, /* isAlwaysInSlot. Only relevant for getters. */
16305 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16306 : false, /* isTypedMethod. Only relevant for methods. */
16307 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16308 : };
16309 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16310 : static_assert(0 < 1, "There is no slot for us");
16311 :
16312 : static bool
16313 0 : enableVertexAttribArray(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16314 : {
16315 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
16316 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.enableVertexAttribArray");
16317 : }
16318 : uint32_t arg0;
16319 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
16320 0 : return false;
16321 : }
16322 0 : self->EnableVertexAttribArray(arg0);
16323 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16324 0 : args.rval().setUndefined();
16325 0 : return true;
16326 : }
16327 :
16328 : static const JSJitInfo enableVertexAttribArray_methodinfo = {
16329 : { (JSJitGetterOp)enableVertexAttribArray },
16330 : { prototypes::id::WebGLRenderingContext },
16331 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16332 : JSJitInfo::Method,
16333 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16334 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
16335 : false, /* isInfallible. False in setters. */
16336 : false, /* isMovable. Not relevant for setters. */
16337 : false, /* isEliminatable. Not relevant for setters. */
16338 : false, /* isAlwaysInSlot. Only relevant for getters. */
16339 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16340 : false, /* isTypedMethod. Only relevant for methods. */
16341 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16342 : };
16343 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16344 : static_assert(0 < 1, "There is no slot for us");
16345 :
16346 : static bool
16347 0 : finish(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16348 : {
16349 0 : self->Finish();
16350 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16351 0 : args.rval().setUndefined();
16352 0 : return true;
16353 : }
16354 :
16355 : static const JSJitInfo finish_methodinfo = {
16356 : { (JSJitGetterOp)finish },
16357 : { prototypes::id::WebGLRenderingContext },
16358 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16359 : JSJitInfo::Method,
16360 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16361 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
16362 : true, /* isInfallible. False in setters. */
16363 : false, /* isMovable. Not relevant for setters. */
16364 : false, /* isEliminatable. Not relevant for setters. */
16365 : false, /* isAlwaysInSlot. Only relevant for getters. */
16366 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16367 : false, /* isTypedMethod. Only relevant for methods. */
16368 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16369 : };
16370 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16371 : static_assert(0 < 1, "There is no slot for us");
16372 :
16373 : static bool
16374 0 : flush(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16375 : {
16376 0 : self->Flush();
16377 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16378 0 : args.rval().setUndefined();
16379 0 : return true;
16380 : }
16381 :
16382 : static const JSJitInfo flush_methodinfo = {
16383 : { (JSJitGetterOp)flush },
16384 : { prototypes::id::WebGLRenderingContext },
16385 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16386 : JSJitInfo::Method,
16387 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16388 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
16389 : true, /* isInfallible. False in setters. */
16390 : false, /* isMovable. Not relevant for setters. */
16391 : false, /* isEliminatable. Not relevant for setters. */
16392 : false, /* isAlwaysInSlot. Only relevant for getters. */
16393 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16394 : false, /* isTypedMethod. Only relevant for methods. */
16395 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16396 : };
16397 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16398 : static_assert(0 < 1, "There is no slot for us");
16399 :
16400 : static bool
16401 0 : framebufferRenderbuffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16402 : {
16403 0 : if (MOZ_UNLIKELY(args.length() < 4)) {
16404 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.framebufferRenderbuffer");
16405 : }
16406 : uint32_t arg0;
16407 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
16408 0 : return false;
16409 : }
16410 : uint32_t arg1;
16411 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
16412 0 : return false;
16413 : }
16414 : uint32_t arg2;
16415 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
16416 0 : return false;
16417 : }
16418 : mozilla::WebGLRenderbuffer* arg3;
16419 0 : if (args[3].isObject()) {
16420 : {
16421 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLRenderbuffer, mozilla::WebGLRenderbuffer>(args[3], arg3);
16422 0 : if (NS_FAILED(rv)) {
16423 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 4 of WebGLRenderingContext.framebufferRenderbuffer", "WebGLRenderbuffer");
16424 0 : return false;
16425 : }
16426 : }
16427 0 : } else if (args[3].isNullOrUndefined()) {
16428 0 : arg3 = nullptr;
16429 : } else {
16430 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 4 of WebGLRenderingContext.framebufferRenderbuffer");
16431 0 : return false;
16432 : }
16433 0 : self->FramebufferRenderbuffer(arg0, arg1, arg2, Constify(arg3));
16434 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16435 0 : args.rval().setUndefined();
16436 0 : return true;
16437 : }
16438 :
16439 : static const JSJitInfo framebufferRenderbuffer_methodinfo = {
16440 : { (JSJitGetterOp)framebufferRenderbuffer },
16441 : { prototypes::id::WebGLRenderingContext },
16442 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16443 : JSJitInfo::Method,
16444 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16445 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
16446 : false, /* isInfallible. False in setters. */
16447 : false, /* isMovable. Not relevant for setters. */
16448 : false, /* isEliminatable. Not relevant for setters. */
16449 : false, /* isAlwaysInSlot. Only relevant for getters. */
16450 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16451 : false, /* isTypedMethod. Only relevant for methods. */
16452 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16453 : };
16454 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16455 : static_assert(0 < 1, "There is no slot for us");
16456 :
16457 : static bool
16458 0 : framebufferTexture2D(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16459 : {
16460 0 : if (MOZ_UNLIKELY(args.length() < 5)) {
16461 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.framebufferTexture2D");
16462 : }
16463 : uint32_t arg0;
16464 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
16465 0 : return false;
16466 : }
16467 : uint32_t arg1;
16468 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
16469 0 : return false;
16470 : }
16471 : uint32_t arg2;
16472 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
16473 0 : return false;
16474 : }
16475 : mozilla::WebGLTexture* arg3;
16476 0 : if (args[3].isObject()) {
16477 : {
16478 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLTexture, mozilla::WebGLTexture>(args[3], arg3);
16479 0 : if (NS_FAILED(rv)) {
16480 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 4 of WebGLRenderingContext.framebufferTexture2D", "WebGLTexture");
16481 0 : return false;
16482 : }
16483 : }
16484 0 : } else if (args[3].isNullOrUndefined()) {
16485 0 : arg3 = nullptr;
16486 : } else {
16487 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 4 of WebGLRenderingContext.framebufferTexture2D");
16488 0 : return false;
16489 : }
16490 : int32_t arg4;
16491 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[4], &arg4)) {
16492 0 : return false;
16493 : }
16494 0 : self->FramebufferTexture2D(arg0, arg1, arg2, Constify(arg3), arg4);
16495 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16496 0 : args.rval().setUndefined();
16497 0 : return true;
16498 : }
16499 :
16500 : static const JSJitInfo framebufferTexture2D_methodinfo = {
16501 : { (JSJitGetterOp)framebufferTexture2D },
16502 : { prototypes::id::WebGLRenderingContext },
16503 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16504 : JSJitInfo::Method,
16505 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16506 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
16507 : false, /* isInfallible. False in setters. */
16508 : false, /* isMovable. Not relevant for setters. */
16509 : false, /* isEliminatable. Not relevant for setters. */
16510 : false, /* isAlwaysInSlot. Only relevant for getters. */
16511 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16512 : false, /* isTypedMethod. Only relevant for methods. */
16513 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16514 : };
16515 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16516 : static_assert(0 < 1, "There is no slot for us");
16517 :
16518 : static bool
16519 0 : frontFace(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16520 : {
16521 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
16522 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.frontFace");
16523 : }
16524 : uint32_t arg0;
16525 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
16526 0 : return false;
16527 : }
16528 0 : self->FrontFace(arg0);
16529 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16530 0 : args.rval().setUndefined();
16531 0 : return true;
16532 : }
16533 :
16534 : static const JSJitInfo frontFace_methodinfo = {
16535 : { (JSJitGetterOp)frontFace },
16536 : { prototypes::id::WebGLRenderingContext },
16537 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16538 : JSJitInfo::Method,
16539 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16540 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
16541 : false, /* isInfallible. False in setters. */
16542 : false, /* isMovable. Not relevant for setters. */
16543 : false, /* isEliminatable. Not relevant for setters. */
16544 : false, /* isAlwaysInSlot. Only relevant for getters. */
16545 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16546 : false, /* isTypedMethod. Only relevant for methods. */
16547 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16548 : };
16549 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16550 : static_assert(0 < 1, "There is no slot for us");
16551 :
16552 : static bool
16553 0 : generateMipmap(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16554 : {
16555 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
16556 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.generateMipmap");
16557 : }
16558 : uint32_t arg0;
16559 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
16560 0 : return false;
16561 : }
16562 0 : self->GenerateMipmap(arg0);
16563 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16564 0 : args.rval().setUndefined();
16565 0 : return true;
16566 : }
16567 :
16568 : static const JSJitInfo generateMipmap_methodinfo = {
16569 : { (JSJitGetterOp)generateMipmap },
16570 : { prototypes::id::WebGLRenderingContext },
16571 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16572 : JSJitInfo::Method,
16573 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16574 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
16575 : false, /* isInfallible. False in setters. */
16576 : false, /* isMovable. Not relevant for setters. */
16577 : false, /* isEliminatable. Not relevant for setters. */
16578 : false, /* isAlwaysInSlot. Only relevant for getters. */
16579 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16580 : false, /* isTypedMethod. Only relevant for methods. */
16581 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16582 : };
16583 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16584 : static_assert(0 < 1, "There is no slot for us");
16585 :
16586 : static bool
16587 0 : getActiveAttrib(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16588 : {
16589 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
16590 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getActiveAttrib");
16591 : }
16592 0 : NonNull<mozilla::WebGLProgram> arg0;
16593 0 : if (args[0].isObject()) {
16594 : {
16595 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
16596 0 : if (NS_FAILED(rv)) {
16597 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.getActiveAttrib", "WebGLProgram");
16598 0 : return false;
16599 : }
16600 : }
16601 : } else {
16602 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.getActiveAttrib");
16603 0 : return false;
16604 : }
16605 : uint32_t arg1;
16606 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
16607 0 : return false;
16608 : }
16609 0 : auto result(StrongOrRawPtr<mozilla::WebGLActiveInfo>(self->GetActiveAttrib(NonNullHelper(arg0), arg1)));
16610 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16611 : static_assert(!IsPointer<decltype(result)>::value,
16612 : "NewObject implies that we need to keep the object alive with a strong reference.");
16613 0 : if (!result) {
16614 0 : args.rval().setNull();
16615 0 : return true;
16616 : }
16617 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
16618 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
16619 0 : return false;
16620 : }
16621 0 : return true;
16622 : }
16623 :
16624 : static const JSJitInfo getActiveAttrib_methodinfo = {
16625 : { (JSJitGetterOp)getActiveAttrib },
16626 : { prototypes::id::WebGLRenderingContext },
16627 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16628 : JSJitInfo::Method,
16629 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16630 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
16631 : false, /* isInfallible. False in setters. */
16632 : false, /* isMovable. Not relevant for setters. */
16633 : false, /* isEliminatable. Not relevant for setters. */
16634 : false, /* isAlwaysInSlot. Only relevant for getters. */
16635 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16636 : false, /* isTypedMethod. Only relevant for methods. */
16637 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16638 : };
16639 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16640 : static_assert(0 < 1, "There is no slot for us");
16641 :
16642 : static bool
16643 0 : getActiveUniform(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16644 : {
16645 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
16646 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getActiveUniform");
16647 : }
16648 0 : NonNull<mozilla::WebGLProgram> arg0;
16649 0 : if (args[0].isObject()) {
16650 : {
16651 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
16652 0 : if (NS_FAILED(rv)) {
16653 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.getActiveUniform", "WebGLProgram");
16654 0 : return false;
16655 : }
16656 : }
16657 : } else {
16658 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.getActiveUniform");
16659 0 : return false;
16660 : }
16661 : uint32_t arg1;
16662 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
16663 0 : return false;
16664 : }
16665 0 : auto result(StrongOrRawPtr<mozilla::WebGLActiveInfo>(self->GetActiveUniform(NonNullHelper(arg0), arg1)));
16666 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16667 : static_assert(!IsPointer<decltype(result)>::value,
16668 : "NewObject implies that we need to keep the object alive with a strong reference.");
16669 0 : if (!result) {
16670 0 : args.rval().setNull();
16671 0 : return true;
16672 : }
16673 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
16674 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
16675 0 : return false;
16676 : }
16677 0 : return true;
16678 : }
16679 :
16680 : static const JSJitInfo getActiveUniform_methodinfo = {
16681 : { (JSJitGetterOp)getActiveUniform },
16682 : { prototypes::id::WebGLRenderingContext },
16683 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16684 : JSJitInfo::Method,
16685 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16686 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
16687 : false, /* isInfallible. False in setters. */
16688 : false, /* isMovable. Not relevant for setters. */
16689 : false, /* isEliminatable. Not relevant for setters. */
16690 : false, /* isAlwaysInSlot. Only relevant for getters. */
16691 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16692 : false, /* isTypedMethod. Only relevant for methods. */
16693 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16694 : };
16695 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16696 : static_assert(0 < 1, "There is no slot for us");
16697 :
16698 : static bool
16699 0 : getAttachedShaders(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16700 : {
16701 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
16702 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getAttachedShaders");
16703 : }
16704 0 : NonNull<mozilla::WebGLProgram> arg0;
16705 0 : if (args[0].isObject()) {
16706 : {
16707 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
16708 0 : if (NS_FAILED(rv)) {
16709 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.getAttachedShaders", "WebGLProgram");
16710 0 : return false;
16711 : }
16712 : }
16713 : } else {
16714 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.getAttachedShaders");
16715 0 : return false;
16716 : }
16717 0 : Nullable<nsTArray<StrongPtrForMember<mozilla::WebGLShader>::Type>> result;
16718 0 : self->GetAttachedShaders(NonNullHelper(arg0), result);
16719 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16720 :
16721 0 : if (result.IsNull()) {
16722 0 : args.rval().setNull();
16723 0 : return true;
16724 : }
16725 :
16726 0 : uint32_t length = result.Value().Length();
16727 0 : JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
16728 0 : if (!returnArray) {
16729 0 : return false;
16730 : }
16731 : // Scope for 'tmp'
16732 : {
16733 0 : JS::Rooted<JS::Value> tmp(cx);
16734 0 : for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
16735 : // Control block to let us common up the JS_DefineElement calls when there
16736 : // are different ways to succeed at wrapping the object.
16737 : do {
16738 0 : if (!GetOrCreateDOMReflector(cx, result.Value()[sequenceIdx0], &tmp)) {
16739 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
16740 0 : return false;
16741 : }
16742 0 : break;
16743 : } while (0);
16744 0 : if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
16745 : JSPROP_ENUMERATE)) {
16746 0 : return false;
16747 : }
16748 : }
16749 : }
16750 0 : args.rval().setObject(*returnArray);
16751 0 : return true;
16752 : }
16753 :
16754 : static const JSJitInfo getAttachedShaders_methodinfo = {
16755 : { (JSJitGetterOp)getAttachedShaders },
16756 : { prototypes::id::WebGLRenderingContext },
16757 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16758 : JSJitInfo::Method,
16759 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16760 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
16761 : false, /* isInfallible. False in setters. */
16762 : false, /* isMovable. Not relevant for setters. */
16763 : false, /* isEliminatable. Not relevant for setters. */
16764 : false, /* isAlwaysInSlot. Only relevant for getters. */
16765 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16766 : false, /* isTypedMethod. Only relevant for methods. */
16767 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16768 : };
16769 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16770 : static_assert(0 < 1, "There is no slot for us");
16771 :
16772 : static bool
16773 0 : getAttribLocation(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16774 : {
16775 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
16776 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getAttribLocation");
16777 : }
16778 0 : NonNull<mozilla::WebGLProgram> arg0;
16779 0 : if (args[0].isObject()) {
16780 : {
16781 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
16782 0 : if (NS_FAILED(rv)) {
16783 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.getAttribLocation", "WebGLProgram");
16784 0 : return false;
16785 : }
16786 : }
16787 : } else {
16788 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.getAttribLocation");
16789 0 : return false;
16790 : }
16791 0 : binding_detail::FakeString arg1;
16792 0 : if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
16793 0 : return false;
16794 : }
16795 0 : int32_t result(self->GetAttribLocation(NonNullHelper(arg0), NonNullHelper(Constify(arg1))));
16796 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16797 0 : args.rval().setInt32(int32_t(result));
16798 0 : return true;
16799 : }
16800 :
16801 : static const JSJitInfo getAttribLocation_methodinfo = {
16802 : { (JSJitGetterOp)getAttribLocation },
16803 : { prototypes::id::WebGLRenderingContext },
16804 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16805 : JSJitInfo::Method,
16806 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16807 : JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */
16808 : false, /* isInfallible. False in setters. */
16809 : false, /* isMovable. Not relevant for setters. */
16810 : false, /* isEliminatable. Not relevant for setters. */
16811 : false, /* isAlwaysInSlot. Only relevant for getters. */
16812 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16813 : false, /* isTypedMethod. Only relevant for methods. */
16814 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16815 : };
16816 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16817 : static_assert(0 < 1, "There is no slot for us");
16818 :
16819 : static bool
16820 0 : getBufferParameter(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16821 : {
16822 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
16823 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getBufferParameter");
16824 : }
16825 : uint32_t arg0;
16826 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
16827 0 : return false;
16828 : }
16829 : uint32_t arg1;
16830 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
16831 0 : return false;
16832 : }
16833 0 : JS::Rooted<JS::Value> result(cx);
16834 0 : self->GetBufferParameter(cx, arg0, arg1, &result);
16835 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16836 0 : JS::ExposeValueToActiveJS(result);
16837 0 : args.rval().set(result);
16838 0 : if (!MaybeWrapValue(cx, args.rval())) {
16839 0 : return false;
16840 : }
16841 0 : return true;
16842 : }
16843 :
16844 : static const JSJitInfo getBufferParameter_methodinfo = {
16845 : { (JSJitGetterOp)getBufferParameter },
16846 : { prototypes::id::WebGLRenderingContext },
16847 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16848 : JSJitInfo::Method,
16849 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16850 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
16851 : false, /* isInfallible. False in setters. */
16852 : false, /* isMovable. Not relevant for setters. */
16853 : false, /* isEliminatable. Not relevant for setters. */
16854 : false, /* isAlwaysInSlot. Only relevant for getters. */
16855 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16856 : false, /* isTypedMethod. Only relevant for methods. */
16857 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16858 : };
16859 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16860 : static_assert(0 < 1, "There is no slot for us");
16861 :
16862 : static bool
16863 0 : getParameter(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16864 : {
16865 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
16866 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getParameter");
16867 : }
16868 : uint32_t arg0;
16869 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
16870 0 : return false;
16871 : }
16872 0 : binding_detail::FastErrorResult rv;
16873 0 : JS::Rooted<JS::Value> result(cx);
16874 0 : self->GetParameter(cx, arg0, &result, rv);
16875 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
16876 0 : return false;
16877 : }
16878 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16879 0 : JS::ExposeValueToActiveJS(result);
16880 0 : args.rval().set(result);
16881 0 : if (!MaybeWrapValue(cx, args.rval())) {
16882 0 : return false;
16883 : }
16884 0 : return true;
16885 : }
16886 :
16887 : static const JSJitInfo getParameter_methodinfo = {
16888 : { (JSJitGetterOp)getParameter },
16889 : { prototypes::id::WebGLRenderingContext },
16890 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16891 : JSJitInfo::Method,
16892 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16893 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
16894 : false, /* isInfallible. False in setters. */
16895 : false, /* isMovable. Not relevant for setters. */
16896 : false, /* isEliminatable. Not relevant for setters. */
16897 : false, /* isAlwaysInSlot. Only relevant for getters. */
16898 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16899 : false, /* isTypedMethod. Only relevant for methods. */
16900 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16901 : };
16902 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16903 : static_assert(0 < 1, "There is no slot for us");
16904 :
16905 : static bool
16906 0 : getError(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16907 : {
16908 0 : uint32_t result(self->GetError());
16909 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16910 0 : args.rval().setNumber(result);
16911 0 : return true;
16912 : }
16913 :
16914 : static const JSJitInfo getError_methodinfo = {
16915 : { (JSJitGetterOp)getError },
16916 : { prototypes::id::WebGLRenderingContext },
16917 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16918 : JSJitInfo::Method,
16919 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16920 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
16921 : true, /* isInfallible. False in setters. */
16922 : false, /* isMovable. Not relevant for setters. */
16923 : false, /* isEliminatable. Not relevant for setters. */
16924 : false, /* isAlwaysInSlot. Only relevant for getters. */
16925 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16926 : false, /* isTypedMethod. Only relevant for methods. */
16927 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16928 : };
16929 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16930 : static_assert(0 < 1, "There is no slot for us");
16931 :
16932 : static bool
16933 0 : getFramebufferAttachmentParameter(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16934 : {
16935 0 : if (MOZ_UNLIKELY(args.length() < 3)) {
16936 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getFramebufferAttachmentParameter");
16937 : }
16938 : uint32_t arg0;
16939 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
16940 0 : return false;
16941 : }
16942 : uint32_t arg1;
16943 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
16944 0 : return false;
16945 : }
16946 : uint32_t arg2;
16947 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
16948 0 : return false;
16949 : }
16950 0 : binding_detail::FastErrorResult rv;
16951 0 : JS::Rooted<JS::Value> result(cx);
16952 0 : self->GetFramebufferAttachmentParameter(cx, arg0, arg1, arg2, &result, rv);
16953 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
16954 0 : return false;
16955 : }
16956 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
16957 0 : JS::ExposeValueToActiveJS(result);
16958 0 : args.rval().set(result);
16959 0 : if (!MaybeWrapValue(cx, args.rval())) {
16960 0 : return false;
16961 : }
16962 0 : return true;
16963 : }
16964 :
16965 : static const JSJitInfo getFramebufferAttachmentParameter_methodinfo = {
16966 : { (JSJitGetterOp)getFramebufferAttachmentParameter },
16967 : { prototypes::id::WebGLRenderingContext },
16968 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
16969 : JSJitInfo::Method,
16970 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
16971 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
16972 : false, /* isInfallible. False in setters. */
16973 : false, /* isMovable. Not relevant for setters. */
16974 : false, /* isEliminatable. Not relevant for setters. */
16975 : false, /* isAlwaysInSlot. Only relevant for getters. */
16976 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
16977 : false, /* isTypedMethod. Only relevant for methods. */
16978 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
16979 : };
16980 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
16981 : static_assert(0 < 1, "There is no slot for us");
16982 :
16983 : static bool
16984 0 : getProgramParameter(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
16985 : {
16986 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
16987 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getProgramParameter");
16988 : }
16989 0 : NonNull<mozilla::WebGLProgram> arg0;
16990 0 : if (args[0].isObject()) {
16991 : {
16992 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
16993 0 : if (NS_FAILED(rv)) {
16994 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.getProgramParameter", "WebGLProgram");
16995 0 : return false;
16996 : }
16997 : }
16998 : } else {
16999 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.getProgramParameter");
17000 0 : return false;
17001 : }
17002 : uint32_t arg1;
17003 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
17004 0 : return false;
17005 : }
17006 0 : JS::Rooted<JS::Value> result(cx);
17007 0 : self->GetProgramParameter(cx, NonNullHelper(arg0), arg1, &result);
17008 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17009 0 : JS::ExposeValueToActiveJS(result);
17010 0 : args.rval().set(result);
17011 0 : if (!MaybeWrapValue(cx, args.rval())) {
17012 0 : return false;
17013 : }
17014 0 : return true;
17015 : }
17016 :
17017 : static const JSJitInfo getProgramParameter_methodinfo = {
17018 : { (JSJitGetterOp)getProgramParameter },
17019 : { prototypes::id::WebGLRenderingContext },
17020 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17021 : JSJitInfo::Method,
17022 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17023 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
17024 : false, /* isInfallible. False in setters. */
17025 : false, /* isMovable. Not relevant for setters. */
17026 : false, /* isEliminatable. Not relevant for setters. */
17027 : false, /* isAlwaysInSlot. Only relevant for getters. */
17028 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17029 : false, /* isTypedMethod. Only relevant for methods. */
17030 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17031 : };
17032 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17033 : static_assert(0 < 1, "There is no slot for us");
17034 :
17035 : static bool
17036 0 : getProgramInfoLog(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17037 : {
17038 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
17039 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getProgramInfoLog");
17040 : }
17041 0 : NonNull<mozilla::WebGLProgram> arg0;
17042 0 : if (args[0].isObject()) {
17043 : {
17044 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
17045 0 : if (NS_FAILED(rv)) {
17046 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.getProgramInfoLog", "WebGLProgram");
17047 0 : return false;
17048 : }
17049 : }
17050 : } else {
17051 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.getProgramInfoLog");
17052 0 : return false;
17053 : }
17054 0 : DOMString result;
17055 0 : self->GetProgramInfoLog(NonNullHelper(arg0), result);
17056 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17057 0 : if (!xpc::StringToJsval(cx, result, args.rval())) {
17058 0 : return false;
17059 : }
17060 0 : return true;
17061 : }
17062 :
17063 : static const JSJitInfo getProgramInfoLog_methodinfo = {
17064 : { (JSJitGetterOp)getProgramInfoLog },
17065 : { prototypes::id::WebGLRenderingContext },
17066 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17067 : JSJitInfo::Method,
17068 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17069 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
17070 : false, /* isInfallible. False in setters. */
17071 : false, /* isMovable. Not relevant for setters. */
17072 : false, /* isEliminatable. Not relevant for setters. */
17073 : false, /* isAlwaysInSlot. Only relevant for getters. */
17074 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17075 : false, /* isTypedMethod. Only relevant for methods. */
17076 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17077 : };
17078 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17079 : static_assert(0 < 1, "There is no slot for us");
17080 :
17081 : static bool
17082 0 : getRenderbufferParameter(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17083 : {
17084 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
17085 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getRenderbufferParameter");
17086 : }
17087 : uint32_t arg0;
17088 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
17089 0 : return false;
17090 : }
17091 : uint32_t arg1;
17092 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
17093 0 : return false;
17094 : }
17095 0 : JS::Rooted<JS::Value> result(cx);
17096 0 : self->GetRenderbufferParameter(cx, arg0, arg1, &result);
17097 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17098 0 : JS::ExposeValueToActiveJS(result);
17099 0 : args.rval().set(result);
17100 0 : if (!MaybeWrapValue(cx, args.rval())) {
17101 0 : return false;
17102 : }
17103 0 : return true;
17104 : }
17105 :
17106 : static const JSJitInfo getRenderbufferParameter_methodinfo = {
17107 : { (JSJitGetterOp)getRenderbufferParameter },
17108 : { prototypes::id::WebGLRenderingContext },
17109 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17110 : JSJitInfo::Method,
17111 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17112 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
17113 : false, /* isInfallible. False in setters. */
17114 : false, /* isMovable. Not relevant for setters. */
17115 : false, /* isEliminatable. Not relevant for setters. */
17116 : false, /* isAlwaysInSlot. Only relevant for getters. */
17117 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17118 : false, /* isTypedMethod. Only relevant for methods. */
17119 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17120 : };
17121 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17122 : static_assert(0 < 1, "There is no slot for us");
17123 :
17124 : static bool
17125 0 : getShaderParameter(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17126 : {
17127 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
17128 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getShaderParameter");
17129 : }
17130 0 : NonNull<mozilla::WebGLShader> arg0;
17131 0 : if (args[0].isObject()) {
17132 : {
17133 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLShader, mozilla::WebGLShader>(args[0], arg0);
17134 0 : if (NS_FAILED(rv)) {
17135 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.getShaderParameter", "WebGLShader");
17136 0 : return false;
17137 : }
17138 : }
17139 : } else {
17140 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.getShaderParameter");
17141 0 : return false;
17142 : }
17143 : uint32_t arg1;
17144 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
17145 0 : return false;
17146 : }
17147 0 : JS::Rooted<JS::Value> result(cx);
17148 0 : self->GetShaderParameter(cx, NonNullHelper(arg0), arg1, &result);
17149 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17150 0 : JS::ExposeValueToActiveJS(result);
17151 0 : args.rval().set(result);
17152 0 : if (!MaybeWrapValue(cx, args.rval())) {
17153 0 : return false;
17154 : }
17155 0 : return true;
17156 : }
17157 :
17158 : static const JSJitInfo getShaderParameter_methodinfo = {
17159 : { (JSJitGetterOp)getShaderParameter },
17160 : { prototypes::id::WebGLRenderingContext },
17161 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17162 : JSJitInfo::Method,
17163 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17164 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
17165 : false, /* isInfallible. False in setters. */
17166 : false, /* isMovable. Not relevant for setters. */
17167 : false, /* isEliminatable. Not relevant for setters. */
17168 : false, /* isAlwaysInSlot. Only relevant for getters. */
17169 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17170 : false, /* isTypedMethod. Only relevant for methods. */
17171 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17172 : };
17173 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17174 : static_assert(0 < 1, "There is no slot for us");
17175 :
17176 : static bool
17177 0 : getShaderPrecisionFormat(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17178 : {
17179 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
17180 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getShaderPrecisionFormat");
17181 : }
17182 : uint32_t arg0;
17183 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
17184 0 : return false;
17185 : }
17186 : uint32_t arg1;
17187 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
17188 0 : return false;
17189 : }
17190 0 : auto result(StrongOrRawPtr<mozilla::WebGLShaderPrecisionFormat>(self->GetShaderPrecisionFormat(arg0, arg1)));
17191 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17192 : static_assert(!IsPointer<decltype(result)>::value,
17193 : "NewObject implies that we need to keep the object alive with a strong reference.");
17194 0 : if (!result) {
17195 0 : args.rval().setNull();
17196 0 : return true;
17197 : }
17198 0 : if (!WrapNewBindingNonWrapperCachedObject(cx, obj, result, args.rval())) {
17199 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
17200 0 : return false;
17201 : }
17202 0 : return true;
17203 : }
17204 :
17205 : static const JSJitInfo getShaderPrecisionFormat_methodinfo = {
17206 : { (JSJitGetterOp)getShaderPrecisionFormat },
17207 : { prototypes::id::WebGLRenderingContext },
17208 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17209 : JSJitInfo::Method,
17210 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17211 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
17212 : false, /* isInfallible. False in setters. */
17213 : false, /* isMovable. Not relevant for setters. */
17214 : false, /* isEliminatable. Not relevant for setters. */
17215 : false, /* isAlwaysInSlot. Only relevant for getters. */
17216 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17217 : false, /* isTypedMethod. Only relevant for methods. */
17218 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17219 : };
17220 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17221 : static_assert(0 < 1, "There is no slot for us");
17222 :
17223 : static bool
17224 0 : getShaderInfoLog(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17225 : {
17226 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
17227 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getShaderInfoLog");
17228 : }
17229 0 : NonNull<mozilla::WebGLShader> arg0;
17230 0 : if (args[0].isObject()) {
17231 : {
17232 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLShader, mozilla::WebGLShader>(args[0], arg0);
17233 0 : if (NS_FAILED(rv)) {
17234 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.getShaderInfoLog", "WebGLShader");
17235 0 : return false;
17236 : }
17237 : }
17238 : } else {
17239 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.getShaderInfoLog");
17240 0 : return false;
17241 : }
17242 0 : DOMString result;
17243 0 : self->GetShaderInfoLog(NonNullHelper(arg0), result);
17244 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17245 0 : if (!xpc::StringToJsval(cx, result, args.rval())) {
17246 0 : return false;
17247 : }
17248 0 : return true;
17249 : }
17250 :
17251 : static const JSJitInfo getShaderInfoLog_methodinfo = {
17252 : { (JSJitGetterOp)getShaderInfoLog },
17253 : { prototypes::id::WebGLRenderingContext },
17254 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17255 : JSJitInfo::Method,
17256 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17257 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
17258 : false, /* isInfallible. False in setters. */
17259 : false, /* isMovable. Not relevant for setters. */
17260 : false, /* isEliminatable. Not relevant for setters. */
17261 : false, /* isAlwaysInSlot. Only relevant for getters. */
17262 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17263 : false, /* isTypedMethod. Only relevant for methods. */
17264 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17265 : };
17266 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17267 : static_assert(0 < 1, "There is no slot for us");
17268 :
17269 : static bool
17270 0 : getShaderSource(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17271 : {
17272 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
17273 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getShaderSource");
17274 : }
17275 0 : NonNull<mozilla::WebGLShader> arg0;
17276 0 : if (args[0].isObject()) {
17277 : {
17278 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLShader, mozilla::WebGLShader>(args[0], arg0);
17279 0 : if (NS_FAILED(rv)) {
17280 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.getShaderSource", "WebGLShader");
17281 0 : return false;
17282 : }
17283 : }
17284 : } else {
17285 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.getShaderSource");
17286 0 : return false;
17287 : }
17288 0 : DOMString result;
17289 0 : self->GetShaderSource(NonNullHelper(arg0), result);
17290 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17291 0 : if (!xpc::StringToJsval(cx, result, args.rval())) {
17292 0 : return false;
17293 : }
17294 0 : return true;
17295 : }
17296 :
17297 : static const JSJitInfo getShaderSource_methodinfo = {
17298 : { (JSJitGetterOp)getShaderSource },
17299 : { prototypes::id::WebGLRenderingContext },
17300 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17301 : JSJitInfo::Method,
17302 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17303 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
17304 : false, /* isInfallible. False in setters. */
17305 : false, /* isMovable. Not relevant for setters. */
17306 : false, /* isEliminatable. Not relevant for setters. */
17307 : false, /* isAlwaysInSlot. Only relevant for getters. */
17308 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17309 : false, /* isTypedMethod. Only relevant for methods. */
17310 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17311 : };
17312 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17313 : static_assert(0 < 1, "There is no slot for us");
17314 :
17315 : static bool
17316 0 : getTexParameter(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17317 : {
17318 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
17319 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getTexParameter");
17320 : }
17321 : uint32_t arg0;
17322 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
17323 0 : return false;
17324 : }
17325 : uint32_t arg1;
17326 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
17327 0 : return false;
17328 : }
17329 0 : JS::Rooted<JS::Value> result(cx);
17330 0 : self->GetTexParameter(cx, arg0, arg1, &result);
17331 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17332 0 : JS::ExposeValueToActiveJS(result);
17333 0 : args.rval().set(result);
17334 0 : if (!MaybeWrapValue(cx, args.rval())) {
17335 0 : return false;
17336 : }
17337 0 : return true;
17338 : }
17339 :
17340 : static const JSJitInfo getTexParameter_methodinfo = {
17341 : { (JSJitGetterOp)getTexParameter },
17342 : { prototypes::id::WebGLRenderingContext },
17343 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17344 : JSJitInfo::Method,
17345 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17346 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
17347 : false, /* isInfallible. False in setters. */
17348 : false, /* isMovable. Not relevant for setters. */
17349 : false, /* isEliminatable. Not relevant for setters. */
17350 : false, /* isAlwaysInSlot. Only relevant for getters. */
17351 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17352 : false, /* isTypedMethod. Only relevant for methods. */
17353 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17354 : };
17355 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17356 : static_assert(0 < 1, "There is no slot for us");
17357 :
17358 : static bool
17359 0 : getUniform(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17360 : {
17361 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
17362 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getUniform");
17363 : }
17364 0 : NonNull<mozilla::WebGLProgram> arg0;
17365 0 : if (args[0].isObject()) {
17366 : {
17367 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
17368 0 : if (NS_FAILED(rv)) {
17369 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.getUniform", "WebGLProgram");
17370 0 : return false;
17371 : }
17372 : }
17373 : } else {
17374 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.getUniform");
17375 0 : return false;
17376 : }
17377 0 : NonNull<mozilla::WebGLUniformLocation> arg1;
17378 0 : if (args[1].isObject()) {
17379 : {
17380 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[1], arg1);
17381 0 : if (NS_FAILED(rv)) {
17382 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of WebGLRenderingContext.getUniform", "WebGLUniformLocation");
17383 0 : return false;
17384 : }
17385 : }
17386 : } else {
17387 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of WebGLRenderingContext.getUniform");
17388 0 : return false;
17389 : }
17390 0 : JS::Rooted<JS::Value> result(cx);
17391 0 : self->GetUniform(cx, NonNullHelper(arg0), NonNullHelper(arg1), &result);
17392 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17393 0 : JS::ExposeValueToActiveJS(result);
17394 0 : args.rval().set(result);
17395 0 : if (!MaybeWrapValue(cx, args.rval())) {
17396 0 : return false;
17397 : }
17398 0 : return true;
17399 : }
17400 :
17401 : static const JSJitInfo getUniform_methodinfo = {
17402 : { (JSJitGetterOp)getUniform },
17403 : { prototypes::id::WebGLRenderingContext },
17404 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17405 : JSJitInfo::Method,
17406 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17407 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
17408 : false, /* isInfallible. False in setters. */
17409 : false, /* isMovable. Not relevant for setters. */
17410 : false, /* isEliminatable. Not relevant for setters. */
17411 : false, /* isAlwaysInSlot. Only relevant for getters. */
17412 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17413 : false, /* isTypedMethod. Only relevant for methods. */
17414 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17415 : };
17416 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17417 : static_assert(0 < 1, "There is no slot for us");
17418 :
17419 : static bool
17420 0 : getUniformLocation(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17421 : {
17422 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
17423 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getUniformLocation");
17424 : }
17425 0 : NonNull<mozilla::WebGLProgram> arg0;
17426 0 : if (args[0].isObject()) {
17427 : {
17428 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
17429 0 : if (NS_FAILED(rv)) {
17430 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.getUniformLocation", "WebGLProgram");
17431 0 : return false;
17432 : }
17433 : }
17434 : } else {
17435 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.getUniformLocation");
17436 0 : return false;
17437 : }
17438 0 : binding_detail::FakeString arg1;
17439 0 : if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
17440 0 : return false;
17441 : }
17442 0 : auto result(StrongOrRawPtr<mozilla::WebGLUniformLocation>(self->GetUniformLocation(NonNullHelper(arg0), NonNullHelper(Constify(arg1)))));
17443 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17444 : static_assert(!IsPointer<decltype(result)>::value,
17445 : "NewObject implies that we need to keep the object alive with a strong reference.");
17446 0 : if (!result) {
17447 0 : args.rval().setNull();
17448 0 : return true;
17449 : }
17450 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
17451 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
17452 0 : return false;
17453 : }
17454 0 : return true;
17455 : }
17456 :
17457 : static const JSJitInfo getUniformLocation_methodinfo = {
17458 : { (JSJitGetterOp)getUniformLocation },
17459 : { prototypes::id::WebGLRenderingContext },
17460 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17461 : JSJitInfo::Method,
17462 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17463 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
17464 : false, /* isInfallible. False in setters. */
17465 : false, /* isMovable. Not relevant for setters. */
17466 : false, /* isEliminatable. Not relevant for setters. */
17467 : false, /* isAlwaysInSlot. Only relevant for getters. */
17468 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17469 : false, /* isTypedMethod. Only relevant for methods. */
17470 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17471 : };
17472 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17473 : static_assert(0 < 1, "There is no slot for us");
17474 :
17475 : static bool
17476 0 : getVertexAttrib(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17477 : {
17478 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
17479 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getVertexAttrib");
17480 : }
17481 : uint32_t arg0;
17482 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
17483 0 : return false;
17484 : }
17485 : uint32_t arg1;
17486 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
17487 0 : return false;
17488 : }
17489 0 : binding_detail::FastErrorResult rv;
17490 0 : JS::Rooted<JS::Value> result(cx);
17491 0 : self->GetVertexAttrib(cx, arg0, arg1, &result, rv);
17492 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
17493 0 : return false;
17494 : }
17495 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17496 0 : JS::ExposeValueToActiveJS(result);
17497 0 : args.rval().set(result);
17498 0 : if (!MaybeWrapValue(cx, args.rval())) {
17499 0 : return false;
17500 : }
17501 0 : return true;
17502 : }
17503 :
17504 : static const JSJitInfo getVertexAttrib_methodinfo = {
17505 : { (JSJitGetterOp)getVertexAttrib },
17506 : { prototypes::id::WebGLRenderingContext },
17507 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17508 : JSJitInfo::Method,
17509 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17510 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
17511 : false, /* isInfallible. False in setters. */
17512 : false, /* isMovable. Not relevant for setters. */
17513 : false, /* isEliminatable. Not relevant for setters. */
17514 : false, /* isAlwaysInSlot. Only relevant for getters. */
17515 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17516 : false, /* isTypedMethod. Only relevant for methods. */
17517 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17518 : };
17519 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17520 : static_assert(0 < 1, "There is no slot for us");
17521 :
17522 : static bool
17523 0 : getVertexAttribOffset(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17524 : {
17525 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
17526 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.getVertexAttribOffset");
17527 : }
17528 : uint32_t arg0;
17529 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
17530 0 : return false;
17531 : }
17532 : uint32_t arg1;
17533 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
17534 0 : return false;
17535 : }
17536 0 : int64_t result(self->GetVertexAttribOffset(arg0, arg1));
17537 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17538 0 : args.rval().set(JS_NumberValue(double(result)));
17539 0 : return true;
17540 : }
17541 :
17542 : static const JSJitInfo getVertexAttribOffset_methodinfo = {
17543 : { (JSJitGetterOp)getVertexAttribOffset },
17544 : { prototypes::id::WebGLRenderingContext },
17545 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17546 : JSJitInfo::Method,
17547 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17548 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
17549 : false, /* isInfallible. False in setters. */
17550 : false, /* isMovable. Not relevant for setters. */
17551 : false, /* isEliminatable. Not relevant for setters. */
17552 : false, /* isAlwaysInSlot. Only relevant for getters. */
17553 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17554 : false, /* isTypedMethod. Only relevant for methods. */
17555 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17556 : };
17557 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17558 : static_assert(0 < 1, "There is no slot for us");
17559 :
17560 : static bool
17561 0 : hint(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17562 : {
17563 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
17564 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.hint");
17565 : }
17566 : uint32_t arg0;
17567 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
17568 0 : return false;
17569 : }
17570 : uint32_t arg1;
17571 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
17572 0 : return false;
17573 : }
17574 0 : self->Hint(arg0, arg1);
17575 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17576 0 : args.rval().setUndefined();
17577 0 : return true;
17578 : }
17579 :
17580 : static const JSJitInfo hint_methodinfo = {
17581 : { (JSJitGetterOp)hint },
17582 : { prototypes::id::WebGLRenderingContext },
17583 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17584 : JSJitInfo::Method,
17585 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17586 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
17587 : false, /* isInfallible. False in setters. */
17588 : false, /* isMovable. Not relevant for setters. */
17589 : false, /* isEliminatable. Not relevant for setters. */
17590 : false, /* isAlwaysInSlot. Only relevant for getters. */
17591 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17592 : false, /* isTypedMethod. Only relevant for methods. */
17593 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17594 : };
17595 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17596 : static_assert(0 < 1, "There is no slot for us");
17597 :
17598 : static bool
17599 0 : isBuffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17600 : {
17601 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
17602 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.isBuffer");
17603 : }
17604 : mozilla::WebGLBuffer* arg0;
17605 0 : if (args[0].isObject()) {
17606 : {
17607 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLBuffer, mozilla::WebGLBuffer>(args[0], arg0);
17608 0 : if (NS_FAILED(rv)) {
17609 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.isBuffer", "WebGLBuffer");
17610 0 : return false;
17611 : }
17612 : }
17613 0 : } else if (args[0].isNullOrUndefined()) {
17614 0 : arg0 = nullptr;
17615 : } else {
17616 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.isBuffer");
17617 0 : return false;
17618 : }
17619 0 : bool result(self->IsBuffer(Constify(arg0)));
17620 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17621 0 : args.rval().setBoolean(result);
17622 0 : return true;
17623 : }
17624 :
17625 : static const JSJitInfo isBuffer_methodinfo = {
17626 : { (JSJitGetterOp)isBuffer },
17627 : { prototypes::id::WebGLRenderingContext },
17628 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17629 : JSJitInfo::Method,
17630 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17631 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
17632 : false, /* isInfallible. False in setters. */
17633 : false, /* isMovable. Not relevant for setters. */
17634 : false, /* isEliminatable. Not relevant for setters. */
17635 : false, /* isAlwaysInSlot. Only relevant for getters. */
17636 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17637 : false, /* isTypedMethod. Only relevant for methods. */
17638 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17639 : };
17640 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17641 : static_assert(0 < 1, "There is no slot for us");
17642 :
17643 : static bool
17644 0 : isEnabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17645 : {
17646 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
17647 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.isEnabled");
17648 : }
17649 : uint32_t arg0;
17650 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
17651 0 : return false;
17652 : }
17653 0 : bool result(self->IsEnabled(arg0));
17654 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17655 0 : args.rval().setBoolean(result);
17656 0 : return true;
17657 : }
17658 :
17659 : static const JSJitInfo isEnabled_methodinfo = {
17660 : { (JSJitGetterOp)isEnabled },
17661 : { prototypes::id::WebGLRenderingContext },
17662 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17663 : JSJitInfo::Method,
17664 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17665 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
17666 : false, /* isInfallible. False in setters. */
17667 : false, /* isMovable. Not relevant for setters. */
17668 : false, /* isEliminatable. Not relevant for setters. */
17669 : false, /* isAlwaysInSlot. Only relevant for getters. */
17670 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17671 : false, /* isTypedMethod. Only relevant for methods. */
17672 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17673 : };
17674 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17675 : static_assert(0 < 1, "There is no slot for us");
17676 :
17677 : static bool
17678 0 : isFramebuffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17679 : {
17680 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
17681 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.isFramebuffer");
17682 : }
17683 : mozilla::WebGLFramebuffer* arg0;
17684 0 : if (args[0].isObject()) {
17685 : {
17686 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLFramebuffer, mozilla::WebGLFramebuffer>(args[0], arg0);
17687 0 : if (NS_FAILED(rv)) {
17688 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.isFramebuffer", "WebGLFramebuffer");
17689 0 : return false;
17690 : }
17691 : }
17692 0 : } else if (args[0].isNullOrUndefined()) {
17693 0 : arg0 = nullptr;
17694 : } else {
17695 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.isFramebuffer");
17696 0 : return false;
17697 : }
17698 0 : bool result(self->IsFramebuffer(Constify(arg0)));
17699 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17700 0 : args.rval().setBoolean(result);
17701 0 : return true;
17702 : }
17703 :
17704 : static const JSJitInfo isFramebuffer_methodinfo = {
17705 : { (JSJitGetterOp)isFramebuffer },
17706 : { prototypes::id::WebGLRenderingContext },
17707 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17708 : JSJitInfo::Method,
17709 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17710 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
17711 : false, /* isInfallible. False in setters. */
17712 : false, /* isMovable. Not relevant for setters. */
17713 : false, /* isEliminatable. Not relevant for setters. */
17714 : false, /* isAlwaysInSlot. Only relevant for getters. */
17715 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17716 : false, /* isTypedMethod. Only relevant for methods. */
17717 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17718 : };
17719 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17720 : static_assert(0 < 1, "There is no slot for us");
17721 :
17722 : static bool
17723 0 : isProgram(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17724 : {
17725 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
17726 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.isProgram");
17727 : }
17728 : mozilla::WebGLProgram* arg0;
17729 0 : if (args[0].isObject()) {
17730 : {
17731 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
17732 0 : if (NS_FAILED(rv)) {
17733 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.isProgram", "WebGLProgram");
17734 0 : return false;
17735 : }
17736 : }
17737 0 : } else if (args[0].isNullOrUndefined()) {
17738 0 : arg0 = nullptr;
17739 : } else {
17740 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.isProgram");
17741 0 : return false;
17742 : }
17743 0 : bool result(self->IsProgram(Constify(arg0)));
17744 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17745 0 : args.rval().setBoolean(result);
17746 0 : return true;
17747 : }
17748 :
17749 : static const JSJitInfo isProgram_methodinfo = {
17750 : { (JSJitGetterOp)isProgram },
17751 : { prototypes::id::WebGLRenderingContext },
17752 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17753 : JSJitInfo::Method,
17754 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17755 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
17756 : false, /* isInfallible. False in setters. */
17757 : false, /* isMovable. Not relevant for setters. */
17758 : false, /* isEliminatable. Not relevant for setters. */
17759 : false, /* isAlwaysInSlot. Only relevant for getters. */
17760 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17761 : false, /* isTypedMethod. Only relevant for methods. */
17762 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17763 : };
17764 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17765 : static_assert(0 < 1, "There is no slot for us");
17766 :
17767 : static bool
17768 0 : isRenderbuffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17769 : {
17770 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
17771 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.isRenderbuffer");
17772 : }
17773 : mozilla::WebGLRenderbuffer* arg0;
17774 0 : if (args[0].isObject()) {
17775 : {
17776 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLRenderbuffer, mozilla::WebGLRenderbuffer>(args[0], arg0);
17777 0 : if (NS_FAILED(rv)) {
17778 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.isRenderbuffer", "WebGLRenderbuffer");
17779 0 : return false;
17780 : }
17781 : }
17782 0 : } else if (args[0].isNullOrUndefined()) {
17783 0 : arg0 = nullptr;
17784 : } else {
17785 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.isRenderbuffer");
17786 0 : return false;
17787 : }
17788 0 : bool result(self->IsRenderbuffer(Constify(arg0)));
17789 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17790 0 : args.rval().setBoolean(result);
17791 0 : return true;
17792 : }
17793 :
17794 : static const JSJitInfo isRenderbuffer_methodinfo = {
17795 : { (JSJitGetterOp)isRenderbuffer },
17796 : { prototypes::id::WebGLRenderingContext },
17797 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17798 : JSJitInfo::Method,
17799 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17800 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
17801 : false, /* isInfallible. False in setters. */
17802 : false, /* isMovable. Not relevant for setters. */
17803 : false, /* isEliminatable. Not relevant for setters. */
17804 : false, /* isAlwaysInSlot. Only relevant for getters. */
17805 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17806 : false, /* isTypedMethod. Only relevant for methods. */
17807 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17808 : };
17809 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17810 : static_assert(0 < 1, "There is no slot for us");
17811 :
17812 : static bool
17813 0 : isShader(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17814 : {
17815 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
17816 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.isShader");
17817 : }
17818 : mozilla::WebGLShader* arg0;
17819 0 : if (args[0].isObject()) {
17820 : {
17821 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLShader, mozilla::WebGLShader>(args[0], arg0);
17822 0 : if (NS_FAILED(rv)) {
17823 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.isShader", "WebGLShader");
17824 0 : return false;
17825 : }
17826 : }
17827 0 : } else if (args[0].isNullOrUndefined()) {
17828 0 : arg0 = nullptr;
17829 : } else {
17830 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.isShader");
17831 0 : return false;
17832 : }
17833 0 : bool result(self->IsShader(Constify(arg0)));
17834 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17835 0 : args.rval().setBoolean(result);
17836 0 : return true;
17837 : }
17838 :
17839 : static const JSJitInfo isShader_methodinfo = {
17840 : { (JSJitGetterOp)isShader },
17841 : { prototypes::id::WebGLRenderingContext },
17842 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17843 : JSJitInfo::Method,
17844 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17845 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
17846 : false, /* isInfallible. False in setters. */
17847 : false, /* isMovable. Not relevant for setters. */
17848 : false, /* isEliminatable. Not relevant for setters. */
17849 : false, /* isAlwaysInSlot. Only relevant for getters. */
17850 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17851 : false, /* isTypedMethod. Only relevant for methods. */
17852 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17853 : };
17854 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17855 : static_assert(0 < 1, "There is no slot for us");
17856 :
17857 : static bool
17858 0 : isTexture(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17859 : {
17860 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
17861 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.isTexture");
17862 : }
17863 : mozilla::WebGLTexture* arg0;
17864 0 : if (args[0].isObject()) {
17865 : {
17866 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLTexture, mozilla::WebGLTexture>(args[0], arg0);
17867 0 : if (NS_FAILED(rv)) {
17868 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.isTexture", "WebGLTexture");
17869 0 : return false;
17870 : }
17871 : }
17872 0 : } else if (args[0].isNullOrUndefined()) {
17873 0 : arg0 = nullptr;
17874 : } else {
17875 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.isTexture");
17876 0 : return false;
17877 : }
17878 0 : bool result(self->IsTexture(Constify(arg0)));
17879 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17880 0 : args.rval().setBoolean(result);
17881 0 : return true;
17882 : }
17883 :
17884 : static const JSJitInfo isTexture_methodinfo = {
17885 : { (JSJitGetterOp)isTexture },
17886 : { prototypes::id::WebGLRenderingContext },
17887 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17888 : JSJitInfo::Method,
17889 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17890 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
17891 : false, /* isInfallible. False in setters. */
17892 : false, /* isMovable. Not relevant for setters. */
17893 : false, /* isEliminatable. Not relevant for setters. */
17894 : false, /* isAlwaysInSlot. Only relevant for getters. */
17895 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17896 : false, /* isTypedMethod. Only relevant for methods. */
17897 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17898 : };
17899 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17900 : static_assert(0 < 1, "There is no slot for us");
17901 :
17902 : static bool
17903 0 : lineWidth(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17904 : {
17905 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
17906 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.lineWidth");
17907 : }
17908 : float arg0;
17909 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
17910 0 : return false;
17911 : }
17912 0 : self->LineWidth(arg0);
17913 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17914 0 : args.rval().setUndefined();
17915 0 : return true;
17916 : }
17917 :
17918 : static const JSJitInfo lineWidth_methodinfo = {
17919 : { (JSJitGetterOp)lineWidth },
17920 : { prototypes::id::WebGLRenderingContext },
17921 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17922 : JSJitInfo::Method,
17923 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17924 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
17925 : false, /* isInfallible. False in setters. */
17926 : false, /* isMovable. Not relevant for setters. */
17927 : false, /* isEliminatable. Not relevant for setters. */
17928 : false, /* isAlwaysInSlot. Only relevant for getters. */
17929 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17930 : false, /* isTypedMethod. Only relevant for methods. */
17931 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17932 : };
17933 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17934 : static_assert(0 < 1, "There is no slot for us");
17935 :
17936 : static bool
17937 0 : linkProgram(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17938 : {
17939 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
17940 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.linkProgram");
17941 : }
17942 0 : NonNull<mozilla::WebGLProgram> arg0;
17943 0 : if (args[0].isObject()) {
17944 : {
17945 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
17946 0 : if (NS_FAILED(rv)) {
17947 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.linkProgram", "WebGLProgram");
17948 0 : return false;
17949 : }
17950 : }
17951 : } else {
17952 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.linkProgram");
17953 0 : return false;
17954 : }
17955 0 : self->LinkProgram(NonNullHelper(arg0));
17956 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17957 0 : args.rval().setUndefined();
17958 0 : return true;
17959 : }
17960 :
17961 : static const JSJitInfo linkProgram_methodinfo = {
17962 : { (JSJitGetterOp)linkProgram },
17963 : { prototypes::id::WebGLRenderingContext },
17964 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
17965 : JSJitInfo::Method,
17966 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
17967 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
17968 : false, /* isInfallible. False in setters. */
17969 : false, /* isMovable. Not relevant for setters. */
17970 : false, /* isEliminatable. Not relevant for setters. */
17971 : false, /* isAlwaysInSlot. Only relevant for getters. */
17972 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
17973 : false, /* isTypedMethod. Only relevant for methods. */
17974 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
17975 : };
17976 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
17977 : static_assert(0 < 1, "There is no slot for us");
17978 :
17979 : static bool
17980 0 : pixelStorei(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
17981 : {
17982 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
17983 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.pixelStorei");
17984 : }
17985 : uint32_t arg0;
17986 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
17987 0 : return false;
17988 : }
17989 : int32_t arg1;
17990 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
17991 0 : return false;
17992 : }
17993 0 : self->PixelStorei(arg0, arg1);
17994 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
17995 0 : args.rval().setUndefined();
17996 0 : return true;
17997 : }
17998 :
17999 : static const JSJitInfo pixelStorei_methodinfo = {
18000 : { (JSJitGetterOp)pixelStorei },
18001 : { prototypes::id::WebGLRenderingContext },
18002 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18003 : JSJitInfo::Method,
18004 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18005 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18006 : false, /* isInfallible. False in setters. */
18007 : false, /* isMovable. Not relevant for setters. */
18008 : false, /* isEliminatable. Not relevant for setters. */
18009 : false, /* isAlwaysInSlot. Only relevant for getters. */
18010 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18011 : false, /* isTypedMethod. Only relevant for methods. */
18012 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18013 : };
18014 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18015 : static_assert(0 < 1, "There is no slot for us");
18016 :
18017 : static bool
18018 0 : polygonOffset(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18019 : {
18020 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
18021 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.polygonOffset");
18022 : }
18023 : float arg0;
18024 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
18025 0 : return false;
18026 : }
18027 : float arg1;
18028 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
18029 0 : return false;
18030 : }
18031 0 : self->PolygonOffset(arg0, arg1);
18032 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18033 0 : args.rval().setUndefined();
18034 0 : return true;
18035 : }
18036 :
18037 : static const JSJitInfo polygonOffset_methodinfo = {
18038 : { (JSJitGetterOp)polygonOffset },
18039 : { prototypes::id::WebGLRenderingContext },
18040 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18041 : JSJitInfo::Method,
18042 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18043 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18044 : false, /* isInfallible. False in setters. */
18045 : false, /* isMovable. Not relevant for setters. */
18046 : false, /* isEliminatable. Not relevant for setters. */
18047 : false, /* isAlwaysInSlot. Only relevant for getters. */
18048 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18049 : false, /* isTypedMethod. Only relevant for methods. */
18050 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18051 : };
18052 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18053 : static_assert(0 < 1, "There is no slot for us");
18054 :
18055 : static bool
18056 0 : renderbufferStorage(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18057 : {
18058 0 : if (MOZ_UNLIKELY(args.length() < 4)) {
18059 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.renderbufferStorage");
18060 : }
18061 : uint32_t arg0;
18062 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
18063 0 : return false;
18064 : }
18065 : uint32_t arg1;
18066 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
18067 0 : return false;
18068 : }
18069 : int32_t arg2;
18070 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
18071 0 : return false;
18072 : }
18073 : int32_t arg3;
18074 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
18075 0 : return false;
18076 : }
18077 0 : self->RenderbufferStorage(arg0, arg1, arg2, arg3);
18078 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18079 0 : args.rval().setUndefined();
18080 0 : return true;
18081 : }
18082 :
18083 : static const JSJitInfo renderbufferStorage_methodinfo = {
18084 : { (JSJitGetterOp)renderbufferStorage },
18085 : { prototypes::id::WebGLRenderingContext },
18086 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18087 : JSJitInfo::Method,
18088 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18089 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18090 : false, /* isInfallible. False in setters. */
18091 : false, /* isMovable. Not relevant for setters. */
18092 : false, /* isEliminatable. Not relevant for setters. */
18093 : false, /* isAlwaysInSlot. Only relevant for getters. */
18094 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18095 : false, /* isTypedMethod. Only relevant for methods. */
18096 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18097 : };
18098 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18099 : static_assert(0 < 1, "There is no slot for us");
18100 :
18101 : static bool
18102 0 : sampleCoverage(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18103 : {
18104 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
18105 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.sampleCoverage");
18106 : }
18107 : float arg0;
18108 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
18109 0 : return false;
18110 : }
18111 : bool arg1;
18112 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[1], &arg1)) {
18113 0 : return false;
18114 : }
18115 0 : self->SampleCoverage(arg0, arg1);
18116 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18117 0 : args.rval().setUndefined();
18118 0 : return true;
18119 : }
18120 :
18121 : static const JSJitInfo sampleCoverage_methodinfo = {
18122 : { (JSJitGetterOp)sampleCoverage },
18123 : { prototypes::id::WebGLRenderingContext },
18124 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18125 : JSJitInfo::Method,
18126 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18127 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18128 : false, /* isInfallible. False in setters. */
18129 : false, /* isMovable. Not relevant for setters. */
18130 : false, /* isEliminatable. Not relevant for setters. */
18131 : false, /* isAlwaysInSlot. Only relevant for getters. */
18132 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18133 : false, /* isTypedMethod. Only relevant for methods. */
18134 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18135 : };
18136 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18137 : static_assert(0 < 1, "There is no slot for us");
18138 :
18139 : static bool
18140 0 : scissor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18141 : {
18142 0 : if (MOZ_UNLIKELY(args.length() < 4)) {
18143 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.scissor");
18144 : }
18145 : int32_t arg0;
18146 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
18147 0 : return false;
18148 : }
18149 : int32_t arg1;
18150 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
18151 0 : return false;
18152 : }
18153 : int32_t arg2;
18154 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
18155 0 : return false;
18156 : }
18157 : int32_t arg3;
18158 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
18159 0 : return false;
18160 : }
18161 0 : self->Scissor(arg0, arg1, arg2, arg3);
18162 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18163 0 : args.rval().setUndefined();
18164 0 : return true;
18165 : }
18166 :
18167 : static const JSJitInfo scissor_methodinfo = {
18168 : { (JSJitGetterOp)scissor },
18169 : { prototypes::id::WebGLRenderingContext },
18170 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18171 : JSJitInfo::Method,
18172 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18173 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18174 : false, /* isInfallible. False in setters. */
18175 : false, /* isMovable. Not relevant for setters. */
18176 : false, /* isEliminatable. Not relevant for setters. */
18177 : false, /* isAlwaysInSlot. Only relevant for getters. */
18178 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18179 : false, /* isTypedMethod. Only relevant for methods. */
18180 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18181 : };
18182 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18183 : static_assert(0 < 1, "There is no slot for us");
18184 :
18185 : static bool
18186 0 : shaderSource(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18187 : {
18188 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
18189 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.shaderSource");
18190 : }
18191 0 : NonNull<mozilla::WebGLShader> arg0;
18192 0 : if (args[0].isObject()) {
18193 : {
18194 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLShader, mozilla::WebGLShader>(args[0], arg0);
18195 0 : if (NS_FAILED(rv)) {
18196 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.shaderSource", "WebGLShader");
18197 0 : return false;
18198 : }
18199 : }
18200 : } else {
18201 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.shaderSource");
18202 0 : return false;
18203 : }
18204 0 : binding_detail::FakeString arg1;
18205 0 : if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
18206 0 : return false;
18207 : }
18208 0 : self->ShaderSource(NonNullHelper(arg0), NonNullHelper(Constify(arg1)));
18209 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18210 0 : args.rval().setUndefined();
18211 0 : return true;
18212 : }
18213 :
18214 : static const JSJitInfo shaderSource_methodinfo = {
18215 : { (JSJitGetterOp)shaderSource },
18216 : { prototypes::id::WebGLRenderingContext },
18217 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18218 : JSJitInfo::Method,
18219 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18220 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18221 : false, /* isInfallible. False in setters. */
18222 : false, /* isMovable. Not relevant for setters. */
18223 : false, /* isEliminatable. Not relevant for setters. */
18224 : false, /* isAlwaysInSlot. Only relevant for getters. */
18225 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18226 : false, /* isTypedMethod. Only relevant for methods. */
18227 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18228 : };
18229 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18230 : static_assert(0 < 1, "There is no slot for us");
18231 :
18232 : static bool
18233 0 : stencilFunc(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18234 : {
18235 0 : if (MOZ_UNLIKELY(args.length() < 3)) {
18236 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.stencilFunc");
18237 : }
18238 : uint32_t arg0;
18239 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
18240 0 : return false;
18241 : }
18242 : int32_t arg1;
18243 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
18244 0 : return false;
18245 : }
18246 : uint32_t arg2;
18247 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
18248 0 : return false;
18249 : }
18250 0 : self->StencilFunc(arg0, arg1, arg2);
18251 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18252 0 : args.rval().setUndefined();
18253 0 : return true;
18254 : }
18255 :
18256 : static const JSJitInfo stencilFunc_methodinfo = {
18257 : { (JSJitGetterOp)stencilFunc },
18258 : { prototypes::id::WebGLRenderingContext },
18259 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18260 : JSJitInfo::Method,
18261 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18262 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18263 : false, /* isInfallible. False in setters. */
18264 : false, /* isMovable. Not relevant for setters. */
18265 : false, /* isEliminatable. Not relevant for setters. */
18266 : false, /* isAlwaysInSlot. Only relevant for getters. */
18267 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18268 : false, /* isTypedMethod. Only relevant for methods. */
18269 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18270 : };
18271 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18272 : static_assert(0 < 1, "There is no slot for us");
18273 :
18274 : static bool
18275 0 : stencilFuncSeparate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18276 : {
18277 0 : if (MOZ_UNLIKELY(args.length() < 4)) {
18278 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.stencilFuncSeparate");
18279 : }
18280 : uint32_t arg0;
18281 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
18282 0 : return false;
18283 : }
18284 : uint32_t arg1;
18285 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
18286 0 : return false;
18287 : }
18288 : int32_t arg2;
18289 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
18290 0 : return false;
18291 : }
18292 : uint32_t arg3;
18293 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[3], &arg3)) {
18294 0 : return false;
18295 : }
18296 0 : self->StencilFuncSeparate(arg0, arg1, arg2, arg3);
18297 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18298 0 : args.rval().setUndefined();
18299 0 : return true;
18300 : }
18301 :
18302 : static const JSJitInfo stencilFuncSeparate_methodinfo = {
18303 : { (JSJitGetterOp)stencilFuncSeparate },
18304 : { prototypes::id::WebGLRenderingContext },
18305 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18306 : JSJitInfo::Method,
18307 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18308 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18309 : false, /* isInfallible. False in setters. */
18310 : false, /* isMovable. Not relevant for setters. */
18311 : false, /* isEliminatable. Not relevant for setters. */
18312 : false, /* isAlwaysInSlot. Only relevant for getters. */
18313 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18314 : false, /* isTypedMethod. Only relevant for methods. */
18315 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18316 : };
18317 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18318 : static_assert(0 < 1, "There is no slot for us");
18319 :
18320 : static bool
18321 0 : stencilMask(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18322 : {
18323 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
18324 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.stencilMask");
18325 : }
18326 : uint32_t arg0;
18327 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
18328 0 : return false;
18329 : }
18330 0 : self->StencilMask(arg0);
18331 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18332 0 : args.rval().setUndefined();
18333 0 : return true;
18334 : }
18335 :
18336 : static const JSJitInfo stencilMask_methodinfo = {
18337 : { (JSJitGetterOp)stencilMask },
18338 : { prototypes::id::WebGLRenderingContext },
18339 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18340 : JSJitInfo::Method,
18341 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18342 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18343 : false, /* isInfallible. False in setters. */
18344 : false, /* isMovable. Not relevant for setters. */
18345 : false, /* isEliminatable. Not relevant for setters. */
18346 : false, /* isAlwaysInSlot. Only relevant for getters. */
18347 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18348 : false, /* isTypedMethod. Only relevant for methods. */
18349 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18350 : };
18351 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18352 : static_assert(0 < 1, "There is no slot for us");
18353 :
18354 : static bool
18355 0 : stencilMaskSeparate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18356 : {
18357 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
18358 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.stencilMaskSeparate");
18359 : }
18360 : uint32_t arg0;
18361 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
18362 0 : return false;
18363 : }
18364 : uint32_t arg1;
18365 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
18366 0 : return false;
18367 : }
18368 0 : self->StencilMaskSeparate(arg0, arg1);
18369 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18370 0 : args.rval().setUndefined();
18371 0 : return true;
18372 : }
18373 :
18374 : static const JSJitInfo stencilMaskSeparate_methodinfo = {
18375 : { (JSJitGetterOp)stencilMaskSeparate },
18376 : { prototypes::id::WebGLRenderingContext },
18377 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18378 : JSJitInfo::Method,
18379 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18380 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18381 : false, /* isInfallible. False in setters. */
18382 : false, /* isMovable. Not relevant for setters. */
18383 : false, /* isEliminatable. Not relevant for setters. */
18384 : false, /* isAlwaysInSlot. Only relevant for getters. */
18385 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18386 : false, /* isTypedMethod. Only relevant for methods. */
18387 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18388 : };
18389 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18390 : static_assert(0 < 1, "There is no slot for us");
18391 :
18392 : static bool
18393 0 : stencilOp(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18394 : {
18395 0 : if (MOZ_UNLIKELY(args.length() < 3)) {
18396 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.stencilOp");
18397 : }
18398 : uint32_t arg0;
18399 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
18400 0 : return false;
18401 : }
18402 : uint32_t arg1;
18403 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
18404 0 : return false;
18405 : }
18406 : uint32_t arg2;
18407 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
18408 0 : return false;
18409 : }
18410 0 : self->StencilOp(arg0, arg1, arg2);
18411 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18412 0 : args.rval().setUndefined();
18413 0 : return true;
18414 : }
18415 :
18416 : static const JSJitInfo stencilOp_methodinfo = {
18417 : { (JSJitGetterOp)stencilOp },
18418 : { prototypes::id::WebGLRenderingContext },
18419 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18420 : JSJitInfo::Method,
18421 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18422 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18423 : false, /* isInfallible. False in setters. */
18424 : false, /* isMovable. Not relevant for setters. */
18425 : false, /* isEliminatable. Not relevant for setters. */
18426 : false, /* isAlwaysInSlot. Only relevant for getters. */
18427 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18428 : false, /* isTypedMethod. Only relevant for methods. */
18429 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18430 : };
18431 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18432 : static_assert(0 < 1, "There is no slot for us");
18433 :
18434 : static bool
18435 0 : stencilOpSeparate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18436 : {
18437 0 : if (MOZ_UNLIKELY(args.length() < 4)) {
18438 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.stencilOpSeparate");
18439 : }
18440 : uint32_t arg0;
18441 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
18442 0 : return false;
18443 : }
18444 : uint32_t arg1;
18445 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
18446 0 : return false;
18447 : }
18448 : uint32_t arg2;
18449 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
18450 0 : return false;
18451 : }
18452 : uint32_t arg3;
18453 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[3], &arg3)) {
18454 0 : return false;
18455 : }
18456 0 : self->StencilOpSeparate(arg0, arg1, arg2, arg3);
18457 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18458 0 : args.rval().setUndefined();
18459 0 : return true;
18460 : }
18461 :
18462 : static const JSJitInfo stencilOpSeparate_methodinfo = {
18463 : { (JSJitGetterOp)stencilOpSeparate },
18464 : { prototypes::id::WebGLRenderingContext },
18465 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18466 : JSJitInfo::Method,
18467 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18468 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18469 : false, /* isInfallible. False in setters. */
18470 : false, /* isMovable. Not relevant for setters. */
18471 : false, /* isEliminatable. Not relevant for setters. */
18472 : false, /* isAlwaysInSlot. Only relevant for getters. */
18473 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18474 : false, /* isTypedMethod. Only relevant for methods. */
18475 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18476 : };
18477 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18478 : static_assert(0 < 1, "There is no slot for us");
18479 :
18480 : static bool
18481 0 : texParameterf(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18482 : {
18483 0 : if (MOZ_UNLIKELY(args.length() < 3)) {
18484 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.texParameterf");
18485 : }
18486 : uint32_t arg0;
18487 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
18488 0 : return false;
18489 : }
18490 : uint32_t arg1;
18491 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
18492 0 : return false;
18493 : }
18494 : float arg2;
18495 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[2], &arg2)) {
18496 0 : return false;
18497 : }
18498 0 : self->TexParameterf(arg0, arg1, arg2);
18499 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18500 0 : args.rval().setUndefined();
18501 0 : return true;
18502 : }
18503 :
18504 : static const JSJitInfo texParameterf_methodinfo = {
18505 : { (JSJitGetterOp)texParameterf },
18506 : { prototypes::id::WebGLRenderingContext },
18507 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18508 : JSJitInfo::Method,
18509 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18510 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18511 : false, /* isInfallible. False in setters. */
18512 : false, /* isMovable. Not relevant for setters. */
18513 : false, /* isEliminatable. Not relevant for setters. */
18514 : false, /* isAlwaysInSlot. Only relevant for getters. */
18515 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18516 : false, /* isTypedMethod. Only relevant for methods. */
18517 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18518 : };
18519 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18520 : static_assert(0 < 1, "There is no slot for us");
18521 :
18522 : static bool
18523 0 : texParameteri(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18524 : {
18525 0 : if (MOZ_UNLIKELY(args.length() < 3)) {
18526 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.texParameteri");
18527 : }
18528 : uint32_t arg0;
18529 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
18530 0 : return false;
18531 : }
18532 : uint32_t arg1;
18533 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
18534 0 : return false;
18535 : }
18536 : int32_t arg2;
18537 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
18538 0 : return false;
18539 : }
18540 0 : self->TexParameteri(arg0, arg1, arg2);
18541 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18542 0 : args.rval().setUndefined();
18543 0 : return true;
18544 : }
18545 :
18546 : static const JSJitInfo texParameteri_methodinfo = {
18547 : { (JSJitGetterOp)texParameteri },
18548 : { prototypes::id::WebGLRenderingContext },
18549 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18550 : JSJitInfo::Method,
18551 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18552 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18553 : false, /* isInfallible. False in setters. */
18554 : false, /* isMovable. Not relevant for setters. */
18555 : false, /* isEliminatable. Not relevant for setters. */
18556 : false, /* isAlwaysInSlot. Only relevant for getters. */
18557 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18558 : false, /* isTypedMethod. Only relevant for methods. */
18559 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18560 : };
18561 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18562 : static_assert(0 < 1, "There is no slot for us");
18563 :
18564 : static bool
18565 0 : uniform1f(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18566 : {
18567 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
18568 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform1f");
18569 : }
18570 : mozilla::WebGLUniformLocation* arg0;
18571 0 : if (args[0].isObject()) {
18572 : {
18573 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
18574 0 : if (NS_FAILED(rv)) {
18575 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform1f", "WebGLUniformLocation");
18576 0 : return false;
18577 : }
18578 : }
18579 0 : } else if (args[0].isNullOrUndefined()) {
18580 0 : arg0 = nullptr;
18581 : } else {
18582 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform1f");
18583 0 : return false;
18584 : }
18585 : float arg1;
18586 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
18587 0 : return false;
18588 : }
18589 0 : self->Uniform1f(Constify(arg0), arg1);
18590 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18591 0 : args.rval().setUndefined();
18592 0 : return true;
18593 : }
18594 :
18595 : static const JSJitInfo uniform1f_methodinfo = {
18596 : { (JSJitGetterOp)uniform1f },
18597 : { prototypes::id::WebGLRenderingContext },
18598 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18599 : JSJitInfo::Method,
18600 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18601 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18602 : false, /* isInfallible. False in setters. */
18603 : false, /* isMovable. Not relevant for setters. */
18604 : false, /* isEliminatable. Not relevant for setters. */
18605 : false, /* isAlwaysInSlot. Only relevant for getters. */
18606 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18607 : false, /* isTypedMethod. Only relevant for methods. */
18608 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18609 : };
18610 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18611 : static_assert(0 < 1, "There is no slot for us");
18612 :
18613 : static bool
18614 0 : uniform2f(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18615 : {
18616 0 : if (MOZ_UNLIKELY(args.length() < 3)) {
18617 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform2f");
18618 : }
18619 : mozilla::WebGLUniformLocation* arg0;
18620 0 : if (args[0].isObject()) {
18621 : {
18622 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
18623 0 : if (NS_FAILED(rv)) {
18624 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform2f", "WebGLUniformLocation");
18625 0 : return false;
18626 : }
18627 : }
18628 0 : } else if (args[0].isNullOrUndefined()) {
18629 0 : arg0 = nullptr;
18630 : } else {
18631 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform2f");
18632 0 : return false;
18633 : }
18634 : float arg1;
18635 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
18636 0 : return false;
18637 : }
18638 : float arg2;
18639 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[2], &arg2)) {
18640 0 : return false;
18641 : }
18642 0 : self->Uniform2f(Constify(arg0), arg1, arg2);
18643 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18644 0 : args.rval().setUndefined();
18645 0 : return true;
18646 : }
18647 :
18648 : static const JSJitInfo uniform2f_methodinfo = {
18649 : { (JSJitGetterOp)uniform2f },
18650 : { prototypes::id::WebGLRenderingContext },
18651 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18652 : JSJitInfo::Method,
18653 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18654 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18655 : false, /* isInfallible. False in setters. */
18656 : false, /* isMovable. Not relevant for setters. */
18657 : false, /* isEliminatable. Not relevant for setters. */
18658 : false, /* isAlwaysInSlot. Only relevant for getters. */
18659 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18660 : false, /* isTypedMethod. Only relevant for methods. */
18661 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18662 : };
18663 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18664 : static_assert(0 < 1, "There is no slot for us");
18665 :
18666 : static bool
18667 0 : uniform3f(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18668 : {
18669 0 : if (MOZ_UNLIKELY(args.length() < 4)) {
18670 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform3f");
18671 : }
18672 : mozilla::WebGLUniformLocation* arg0;
18673 0 : if (args[0].isObject()) {
18674 : {
18675 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
18676 0 : if (NS_FAILED(rv)) {
18677 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform3f", "WebGLUniformLocation");
18678 0 : return false;
18679 : }
18680 : }
18681 0 : } else if (args[0].isNullOrUndefined()) {
18682 0 : arg0 = nullptr;
18683 : } else {
18684 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform3f");
18685 0 : return false;
18686 : }
18687 : float arg1;
18688 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
18689 0 : return false;
18690 : }
18691 : float arg2;
18692 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[2], &arg2)) {
18693 0 : return false;
18694 : }
18695 : float arg3;
18696 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[3], &arg3)) {
18697 0 : return false;
18698 : }
18699 0 : self->Uniform3f(Constify(arg0), arg1, arg2, arg3);
18700 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18701 0 : args.rval().setUndefined();
18702 0 : return true;
18703 : }
18704 :
18705 : static const JSJitInfo uniform3f_methodinfo = {
18706 : { (JSJitGetterOp)uniform3f },
18707 : { prototypes::id::WebGLRenderingContext },
18708 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18709 : JSJitInfo::Method,
18710 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18711 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18712 : false, /* isInfallible. False in setters. */
18713 : false, /* isMovable. Not relevant for setters. */
18714 : false, /* isEliminatable. Not relevant for setters. */
18715 : false, /* isAlwaysInSlot. Only relevant for getters. */
18716 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18717 : false, /* isTypedMethod. Only relevant for methods. */
18718 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18719 : };
18720 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18721 : static_assert(0 < 1, "There is no slot for us");
18722 :
18723 : static bool
18724 0 : uniform4f(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18725 : {
18726 0 : if (MOZ_UNLIKELY(args.length() < 5)) {
18727 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform4f");
18728 : }
18729 : mozilla::WebGLUniformLocation* arg0;
18730 0 : if (args[0].isObject()) {
18731 : {
18732 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
18733 0 : if (NS_FAILED(rv)) {
18734 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform4f", "WebGLUniformLocation");
18735 0 : return false;
18736 : }
18737 : }
18738 0 : } else if (args[0].isNullOrUndefined()) {
18739 0 : arg0 = nullptr;
18740 : } else {
18741 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform4f");
18742 0 : return false;
18743 : }
18744 : float arg1;
18745 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
18746 0 : return false;
18747 : }
18748 : float arg2;
18749 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[2], &arg2)) {
18750 0 : return false;
18751 : }
18752 : float arg3;
18753 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[3], &arg3)) {
18754 0 : return false;
18755 : }
18756 : float arg4;
18757 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[4], &arg4)) {
18758 0 : return false;
18759 : }
18760 0 : self->Uniform4f(Constify(arg0), arg1, arg2, arg3, arg4);
18761 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18762 0 : args.rval().setUndefined();
18763 0 : return true;
18764 : }
18765 :
18766 : static const JSJitInfo uniform4f_methodinfo = {
18767 : { (JSJitGetterOp)uniform4f },
18768 : { prototypes::id::WebGLRenderingContext },
18769 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18770 : JSJitInfo::Method,
18771 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18772 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18773 : false, /* isInfallible. False in setters. */
18774 : false, /* isMovable. Not relevant for setters. */
18775 : false, /* isEliminatable. Not relevant for setters. */
18776 : false, /* isAlwaysInSlot. Only relevant for getters. */
18777 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18778 : false, /* isTypedMethod. Only relevant for methods. */
18779 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18780 : };
18781 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18782 : static_assert(0 < 1, "There is no slot for us");
18783 :
18784 : static bool
18785 0 : uniform1i(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18786 : {
18787 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
18788 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform1i");
18789 : }
18790 : mozilla::WebGLUniformLocation* arg0;
18791 0 : if (args[0].isObject()) {
18792 : {
18793 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
18794 0 : if (NS_FAILED(rv)) {
18795 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform1i", "WebGLUniformLocation");
18796 0 : return false;
18797 : }
18798 : }
18799 0 : } else if (args[0].isNullOrUndefined()) {
18800 0 : arg0 = nullptr;
18801 : } else {
18802 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform1i");
18803 0 : return false;
18804 : }
18805 : int32_t arg1;
18806 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
18807 0 : return false;
18808 : }
18809 0 : self->Uniform1i(Constify(arg0), arg1);
18810 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18811 0 : args.rval().setUndefined();
18812 0 : return true;
18813 : }
18814 :
18815 : static const JSJitInfo uniform1i_methodinfo = {
18816 : { (JSJitGetterOp)uniform1i },
18817 : { prototypes::id::WebGLRenderingContext },
18818 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18819 : JSJitInfo::Method,
18820 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18821 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18822 : false, /* isInfallible. False in setters. */
18823 : false, /* isMovable. Not relevant for setters. */
18824 : false, /* isEliminatable. Not relevant for setters. */
18825 : false, /* isAlwaysInSlot. Only relevant for getters. */
18826 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18827 : false, /* isTypedMethod. Only relevant for methods. */
18828 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18829 : };
18830 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18831 : static_assert(0 < 1, "There is no slot for us");
18832 :
18833 : static bool
18834 0 : uniform2i(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18835 : {
18836 0 : if (MOZ_UNLIKELY(args.length() < 3)) {
18837 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform2i");
18838 : }
18839 : mozilla::WebGLUniformLocation* arg0;
18840 0 : if (args[0].isObject()) {
18841 : {
18842 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
18843 0 : if (NS_FAILED(rv)) {
18844 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform2i", "WebGLUniformLocation");
18845 0 : return false;
18846 : }
18847 : }
18848 0 : } else if (args[0].isNullOrUndefined()) {
18849 0 : arg0 = nullptr;
18850 : } else {
18851 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform2i");
18852 0 : return false;
18853 : }
18854 : int32_t arg1;
18855 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
18856 0 : return false;
18857 : }
18858 : int32_t arg2;
18859 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
18860 0 : return false;
18861 : }
18862 0 : self->Uniform2i(Constify(arg0), arg1, arg2);
18863 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18864 0 : args.rval().setUndefined();
18865 0 : return true;
18866 : }
18867 :
18868 : static const JSJitInfo uniform2i_methodinfo = {
18869 : { (JSJitGetterOp)uniform2i },
18870 : { prototypes::id::WebGLRenderingContext },
18871 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18872 : JSJitInfo::Method,
18873 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18874 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18875 : false, /* isInfallible. False in setters. */
18876 : false, /* isMovable. Not relevant for setters. */
18877 : false, /* isEliminatable. Not relevant for setters. */
18878 : false, /* isAlwaysInSlot. Only relevant for getters. */
18879 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18880 : false, /* isTypedMethod. Only relevant for methods. */
18881 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18882 : };
18883 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18884 : static_assert(0 < 1, "There is no slot for us");
18885 :
18886 : static bool
18887 0 : uniform3i(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18888 : {
18889 0 : if (MOZ_UNLIKELY(args.length() < 4)) {
18890 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform3i");
18891 : }
18892 : mozilla::WebGLUniformLocation* arg0;
18893 0 : if (args[0].isObject()) {
18894 : {
18895 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
18896 0 : if (NS_FAILED(rv)) {
18897 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform3i", "WebGLUniformLocation");
18898 0 : return false;
18899 : }
18900 : }
18901 0 : } else if (args[0].isNullOrUndefined()) {
18902 0 : arg0 = nullptr;
18903 : } else {
18904 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform3i");
18905 0 : return false;
18906 : }
18907 : int32_t arg1;
18908 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
18909 0 : return false;
18910 : }
18911 : int32_t arg2;
18912 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
18913 0 : return false;
18914 : }
18915 : int32_t arg3;
18916 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
18917 0 : return false;
18918 : }
18919 0 : self->Uniform3i(Constify(arg0), arg1, arg2, arg3);
18920 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18921 0 : args.rval().setUndefined();
18922 0 : return true;
18923 : }
18924 :
18925 : static const JSJitInfo uniform3i_methodinfo = {
18926 : { (JSJitGetterOp)uniform3i },
18927 : { prototypes::id::WebGLRenderingContext },
18928 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18929 : JSJitInfo::Method,
18930 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18931 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18932 : false, /* isInfallible. False in setters. */
18933 : false, /* isMovable. Not relevant for setters. */
18934 : false, /* isEliminatable. Not relevant for setters. */
18935 : false, /* isAlwaysInSlot. Only relevant for getters. */
18936 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18937 : false, /* isTypedMethod. Only relevant for methods. */
18938 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
18939 : };
18940 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
18941 : static_assert(0 < 1, "There is no slot for us");
18942 :
18943 : static bool
18944 0 : uniform4i(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
18945 : {
18946 0 : if (MOZ_UNLIKELY(args.length() < 5)) {
18947 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.uniform4i");
18948 : }
18949 : mozilla::WebGLUniformLocation* arg0;
18950 0 : if (args[0].isObject()) {
18951 : {
18952 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLUniformLocation, mozilla::WebGLUniformLocation>(args[0], arg0);
18953 0 : if (NS_FAILED(rv)) {
18954 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.uniform4i", "WebGLUniformLocation");
18955 0 : return false;
18956 : }
18957 : }
18958 0 : } else if (args[0].isNullOrUndefined()) {
18959 0 : arg0 = nullptr;
18960 : } else {
18961 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.uniform4i");
18962 0 : return false;
18963 : }
18964 : int32_t arg1;
18965 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
18966 0 : return false;
18967 : }
18968 : int32_t arg2;
18969 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
18970 0 : return false;
18971 : }
18972 : int32_t arg3;
18973 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
18974 0 : return false;
18975 : }
18976 : int32_t arg4;
18977 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[4], &arg4)) {
18978 0 : return false;
18979 : }
18980 0 : self->Uniform4i(Constify(arg0), arg1, arg2, arg3, arg4);
18981 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
18982 0 : args.rval().setUndefined();
18983 0 : return true;
18984 : }
18985 :
18986 : static const JSJitInfo uniform4i_methodinfo = {
18987 : { (JSJitGetterOp)uniform4i },
18988 : { prototypes::id::WebGLRenderingContext },
18989 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
18990 : JSJitInfo::Method,
18991 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
18992 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
18993 : false, /* isInfallible. False in setters. */
18994 : false, /* isMovable. Not relevant for setters. */
18995 : false, /* isEliminatable. Not relevant for setters. */
18996 : false, /* isAlwaysInSlot. Only relevant for getters. */
18997 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
18998 : false, /* isTypedMethod. Only relevant for methods. */
18999 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
19000 : };
19001 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
19002 : static_assert(0 < 1, "There is no slot for us");
19003 :
19004 : static bool
19005 0 : useProgram(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
19006 : {
19007 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
19008 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.useProgram");
19009 : }
19010 : mozilla::WebGLProgram* arg0;
19011 0 : if (args[0].isObject()) {
19012 : {
19013 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
19014 0 : if (NS_FAILED(rv)) {
19015 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.useProgram", "WebGLProgram");
19016 0 : return false;
19017 : }
19018 : }
19019 0 : } else if (args[0].isNullOrUndefined()) {
19020 0 : arg0 = nullptr;
19021 : } else {
19022 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.useProgram");
19023 0 : return false;
19024 : }
19025 0 : self->UseProgram(Constify(arg0));
19026 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
19027 0 : args.rval().setUndefined();
19028 0 : return true;
19029 : }
19030 :
19031 : static const JSJitInfo useProgram_methodinfo = {
19032 : { (JSJitGetterOp)useProgram },
19033 : { prototypes::id::WebGLRenderingContext },
19034 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
19035 : JSJitInfo::Method,
19036 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
19037 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
19038 : false, /* isInfallible. False in setters. */
19039 : false, /* isMovable. Not relevant for setters. */
19040 : false, /* isEliminatable. Not relevant for setters. */
19041 : false, /* isAlwaysInSlot. Only relevant for getters. */
19042 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
19043 : false, /* isTypedMethod. Only relevant for methods. */
19044 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
19045 : };
19046 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
19047 : static_assert(0 < 1, "There is no slot for us");
19048 :
19049 : static bool
19050 0 : validateProgram(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
19051 : {
19052 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
19053 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.validateProgram");
19054 : }
19055 0 : NonNull<mozilla::WebGLProgram> arg0;
19056 0 : if (args[0].isObject()) {
19057 : {
19058 0 : nsresult rv = UnwrapObject<prototypes::id::WebGLProgram, mozilla::WebGLProgram>(args[0], arg0);
19059 0 : if (NS_FAILED(rv)) {
19060 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of WebGLRenderingContext.validateProgram", "WebGLProgram");
19061 0 : return false;
19062 : }
19063 : }
19064 : } else {
19065 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of WebGLRenderingContext.validateProgram");
19066 0 : return false;
19067 : }
19068 0 : self->ValidateProgram(NonNullHelper(arg0));
19069 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
19070 0 : args.rval().setUndefined();
19071 0 : return true;
19072 : }
19073 :
19074 : static const JSJitInfo validateProgram_methodinfo = {
19075 : { (JSJitGetterOp)validateProgram },
19076 : { prototypes::id::WebGLRenderingContext },
19077 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
19078 : JSJitInfo::Method,
19079 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
19080 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
19081 : false, /* isInfallible. False in setters. */
19082 : false, /* isMovable. Not relevant for setters. */
19083 : false, /* isEliminatable. Not relevant for setters. */
19084 : false, /* isAlwaysInSlot. Only relevant for getters. */
19085 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
19086 : false, /* isTypedMethod. Only relevant for methods. */
19087 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
19088 : };
19089 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
19090 : static_assert(0 < 1, "There is no slot for us");
19091 :
19092 : static bool
19093 0 : vertexAttrib1f(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
19094 : {
19095 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
19096 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.vertexAttrib1f");
19097 : }
19098 : uint32_t arg0;
19099 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
19100 0 : return false;
19101 : }
19102 : float arg1;
19103 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
19104 0 : return false;
19105 : }
19106 0 : self->VertexAttrib1f(arg0, arg1);
19107 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
19108 0 : args.rval().setUndefined();
19109 0 : return true;
19110 : }
19111 :
19112 : static const JSJitInfo vertexAttrib1f_methodinfo = {
19113 : { (JSJitGetterOp)vertexAttrib1f },
19114 : { prototypes::id::WebGLRenderingContext },
19115 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
19116 : JSJitInfo::Method,
19117 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
19118 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
19119 : false, /* isInfallible. False in setters. */
19120 : false, /* isMovable. Not relevant for setters. */
19121 : false, /* isEliminatable. Not relevant for setters. */
19122 : false, /* isAlwaysInSlot. Only relevant for getters. */
19123 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
19124 : false, /* isTypedMethod. Only relevant for methods. */
19125 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
19126 : };
19127 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
19128 : static_assert(0 < 1, "There is no slot for us");
19129 :
19130 : static bool
19131 0 : vertexAttrib1fv(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
19132 : {
19133 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
19134 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.vertexAttrib1fv");
19135 : }
19136 : uint32_t arg0;
19137 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
19138 0 : return false;
19139 : }
19140 0 : Float32ArrayOrUnrestrictedFloatSequence arg1;
19141 0 : Float32ArrayOrUnrestrictedFloatSequenceArgument arg1_holder(arg1);
19142 : {
19143 0 : bool done = false, failed = false, tryNext;
19144 0 : if (args[1].isObject()) {
19145 0 : done = (failed = !arg1_holder.TrySetToFloat32Array(cx, args[1], tryNext, false)) || !tryNext;
19146 :
19147 0 : if (!done) {
19148 0 : done = (failed = !arg1_holder.TrySetToUnrestrictedFloatSequence(cx, args[1], tryNext, false)) || !tryNext;
19149 : }
19150 : }
19151 0 : if (failed) {
19152 0 : return false;
19153 : }
19154 0 : if (!done) {
19155 0 : ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of WebGLRenderingContext.vertexAttrib1fv", "Float32Array, UnrestrictedFloatSequence");
19156 0 : return false;
19157 : }
19158 : }
19159 0 : self->VertexAttrib1fv(arg0, Constify(arg1));
19160 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
19161 0 : args.rval().setUndefined();
19162 0 : return true;
19163 : }
19164 :
19165 : static const JSJitInfo vertexAttrib1fv_methodinfo = {
19166 : { (JSJitGetterOp)vertexAttrib1fv },
19167 : { prototypes::id::WebGLRenderingContext },
19168 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
19169 : JSJitInfo::Method,
19170 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
19171 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
19172 : false, /* isInfallible. False in setters. */
19173 : false, /* isMovable. Not relevant for setters. */
19174 : false, /* isEliminatable. Not relevant for setters. */
19175 : false, /* isAlwaysInSlot. Only relevant for getters. */
19176 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
19177 : false, /* isTypedMethod. Only relevant for methods. */
19178 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
19179 : };
19180 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
19181 : static_assert(0 < 1, "There is no slot for us");
19182 :
19183 : static bool
19184 0 : vertexAttrib2f(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
19185 : {
19186 0 : if (MOZ_UNLIKELY(args.length() < 3)) {
19187 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.vertexAttrib2f");
19188 : }
19189 : uint32_t arg0;
19190 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
19191 0 : return false;
19192 : }
19193 : float arg1;
19194 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
19195 0 : return false;
19196 : }
19197 : float arg2;
19198 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[2], &arg2)) {
19199 0 : return false;
19200 : }
19201 0 : self->VertexAttrib2f(arg0, arg1, arg2);
19202 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
19203 0 : args.rval().setUndefined();
19204 0 : return true;
19205 : }
19206 :
19207 : static const JSJitInfo vertexAttrib2f_methodinfo = {
19208 : { (JSJitGetterOp)vertexAttrib2f },
19209 : { prototypes::id::WebGLRenderingContext },
19210 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
19211 : JSJitInfo::Method,
19212 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
19213 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
19214 : false, /* isInfallible. False in setters. */
19215 : false, /* isMovable. Not relevant for setters. */
19216 : false, /* isEliminatable. Not relevant for setters. */
19217 : false, /* isAlwaysInSlot. Only relevant for getters. */
19218 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
19219 : false, /* isTypedMethod. Only relevant for methods. */
19220 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
19221 : };
19222 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
19223 : static_assert(0 < 1, "There is no slot for us");
19224 :
19225 : static bool
19226 0 : vertexAttrib2fv(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
19227 : {
19228 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
19229 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.vertexAttrib2fv");
19230 : }
19231 : uint32_t arg0;
19232 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
19233 0 : return false;
19234 : }
19235 0 : Float32ArrayOrUnrestrictedFloatSequence arg1;
19236 0 : Float32ArrayOrUnrestrictedFloatSequenceArgument arg1_holder(arg1);
19237 : {
19238 0 : bool done = false, failed = false, tryNext;
19239 0 : if (args[1].isObject()) {
19240 0 : done = (failed = !arg1_holder.TrySetToFloat32Array(cx, args[1], tryNext, false)) || !tryNext;
19241 :
19242 0 : if (!done) {
19243 0 : done = (failed = !arg1_holder.TrySetToUnrestrictedFloatSequence(cx, args[1], tryNext, false)) || !tryNext;
19244 : }
19245 : }
19246 0 : if (failed) {
19247 0 : return false;
19248 : }
19249 0 : if (!done) {
19250 0 : ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of WebGLRenderingContext.vertexAttrib2fv", "Float32Array, UnrestrictedFloatSequence");
19251 0 : return false;
19252 : }
19253 : }
19254 0 : self->VertexAttrib2fv(arg0, Constify(arg1));
19255 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
19256 0 : args.rval().setUndefined();
19257 0 : return true;
19258 : }
19259 :
19260 : static const JSJitInfo vertexAttrib2fv_methodinfo = {
19261 : { (JSJitGetterOp)vertexAttrib2fv },
19262 : { prototypes::id::WebGLRenderingContext },
19263 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
19264 : JSJitInfo::Method,
19265 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
19266 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
19267 : false, /* isInfallible. False in setters. */
19268 : false, /* isMovable. Not relevant for setters. */
19269 : false, /* isEliminatable. Not relevant for setters. */
19270 : false, /* isAlwaysInSlot. Only relevant for getters. */
19271 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
19272 : false, /* isTypedMethod. Only relevant for methods. */
19273 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
19274 : };
19275 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
19276 : static_assert(0 < 1, "There is no slot for us");
19277 :
19278 : static bool
19279 0 : vertexAttrib3f(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
19280 : {
19281 0 : if (MOZ_UNLIKELY(args.length() < 4)) {
19282 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.vertexAttrib3f");
19283 : }
19284 : uint32_t arg0;
19285 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
19286 0 : return false;
19287 : }
19288 : float arg1;
19289 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
19290 0 : return false;
19291 : }
19292 : float arg2;
19293 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[2], &arg2)) {
19294 0 : return false;
19295 : }
19296 : float arg3;
19297 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[3], &arg3)) {
19298 0 : return false;
19299 : }
19300 0 : self->VertexAttrib3f(arg0, arg1, arg2, arg3);
19301 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
19302 0 : args.rval().setUndefined();
19303 0 : return true;
19304 : }
19305 :
19306 : static const JSJitInfo vertexAttrib3f_methodinfo = {
19307 : { (JSJitGetterOp)vertexAttrib3f },
19308 : { prototypes::id::WebGLRenderingContext },
19309 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
19310 : JSJitInfo::Method,
19311 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
19312 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
19313 : false, /* isInfallible. False in setters. */
19314 : false, /* isMovable. Not relevant for setters. */
19315 : false, /* isEliminatable. Not relevant for setters. */
19316 : false, /* isAlwaysInSlot. Only relevant for getters. */
19317 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
19318 : false, /* isTypedMethod. Only relevant for methods. */
19319 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
19320 : };
19321 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
19322 : static_assert(0 < 1, "There is no slot for us");
19323 :
19324 : static bool
19325 0 : vertexAttrib3fv(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
19326 : {
19327 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
19328 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.vertexAttrib3fv");
19329 : }
19330 : uint32_t arg0;
19331 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
19332 0 : return false;
19333 : }
19334 0 : Float32ArrayOrUnrestrictedFloatSequence arg1;
19335 0 : Float32ArrayOrUnrestrictedFloatSequenceArgument arg1_holder(arg1);
19336 : {
19337 0 : bool done = false, failed = false, tryNext;
19338 0 : if (args[1].isObject()) {
19339 0 : done = (failed = !arg1_holder.TrySetToFloat32Array(cx, args[1], tryNext, false)) || !tryNext;
19340 :
19341 0 : if (!done) {
19342 0 : done = (failed = !arg1_holder.TrySetToUnrestrictedFloatSequence(cx, args[1], tryNext, false)) || !tryNext;
19343 : }
19344 : }
19345 0 : if (failed) {
19346 0 : return false;
19347 : }
19348 0 : if (!done) {
19349 0 : ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of WebGLRenderingContext.vertexAttrib3fv", "Float32Array, UnrestrictedFloatSequence");
19350 0 : return false;
19351 : }
19352 : }
19353 0 : self->VertexAttrib3fv(arg0, Constify(arg1));
19354 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
19355 0 : args.rval().setUndefined();
19356 0 : return true;
19357 : }
19358 :
19359 : static const JSJitInfo vertexAttrib3fv_methodinfo = {
19360 : { (JSJitGetterOp)vertexAttrib3fv },
19361 : { prototypes::id::WebGLRenderingContext },
19362 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
19363 : JSJitInfo::Method,
19364 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
19365 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
19366 : false, /* isInfallible. False in setters. */
19367 : false, /* isMovable. Not relevant for setters. */
19368 : false, /* isEliminatable. Not relevant for setters. */
19369 : false, /* isAlwaysInSlot. Only relevant for getters. */
19370 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
19371 : false, /* isTypedMethod. Only relevant for methods. */
19372 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
19373 : };
19374 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
19375 : static_assert(0 < 1, "There is no slot for us");
19376 :
19377 : static bool
19378 0 : vertexAttrib4f(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
19379 : {
19380 0 : if (MOZ_UNLIKELY(args.length() < 5)) {
19381 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.vertexAttrib4f");
19382 : }
19383 : uint32_t arg0;
19384 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
19385 0 : return false;
19386 : }
19387 : float arg1;
19388 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
19389 0 : return false;
19390 : }
19391 : float arg2;
19392 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[2], &arg2)) {
19393 0 : return false;
19394 : }
19395 : float arg3;
19396 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[3], &arg3)) {
19397 0 : return false;
19398 : }
19399 : float arg4;
19400 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[4], &arg4)) {
19401 0 : return false;
19402 : }
19403 0 : self->VertexAttrib4f(arg0, arg1, arg2, arg3, arg4);
19404 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
19405 0 : args.rval().setUndefined();
19406 0 : return true;
19407 : }
19408 :
19409 : static const JSJitInfo vertexAttrib4f_methodinfo = {
19410 : { (JSJitGetterOp)vertexAttrib4f },
19411 : { prototypes::id::WebGLRenderingContext },
19412 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
19413 : JSJitInfo::Method,
19414 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
19415 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
19416 : false, /* isInfallible. False in setters. */
19417 : false, /* isMovable. Not relevant for setters. */
19418 : false, /* isEliminatable. Not relevant for setters. */
19419 : false, /* isAlwaysInSlot. Only relevant for getters. */
19420 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
19421 : false, /* isTypedMethod. Only relevant for methods. */
19422 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
19423 : };
19424 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
19425 : static_assert(0 < 1, "There is no slot for us");
19426 :
19427 : static bool
19428 0 : vertexAttrib4fv(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
19429 : {
19430 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
19431 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.vertexAttrib4fv");
19432 : }
19433 : uint32_t arg0;
19434 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
19435 0 : return false;
19436 : }
19437 0 : Float32ArrayOrUnrestrictedFloatSequence arg1;
19438 0 : Float32ArrayOrUnrestrictedFloatSequenceArgument arg1_holder(arg1);
19439 : {
19440 0 : bool done = false, failed = false, tryNext;
19441 0 : if (args[1].isObject()) {
19442 0 : done = (failed = !arg1_holder.TrySetToFloat32Array(cx, args[1], tryNext, false)) || !tryNext;
19443 :
19444 0 : if (!done) {
19445 0 : done = (failed = !arg1_holder.TrySetToUnrestrictedFloatSequence(cx, args[1], tryNext, false)) || !tryNext;
19446 : }
19447 : }
19448 0 : if (failed) {
19449 0 : return false;
19450 : }
19451 0 : if (!done) {
19452 0 : ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of WebGLRenderingContext.vertexAttrib4fv", "Float32Array, UnrestrictedFloatSequence");
19453 0 : return false;
19454 : }
19455 : }
19456 0 : self->VertexAttrib4fv(arg0, Constify(arg1));
19457 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
19458 0 : args.rval().setUndefined();
19459 0 : return true;
19460 : }
19461 :
19462 : static const JSJitInfo vertexAttrib4fv_methodinfo = {
19463 : { (JSJitGetterOp)vertexAttrib4fv },
19464 : { prototypes::id::WebGLRenderingContext },
19465 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
19466 : JSJitInfo::Method,
19467 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
19468 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
19469 : false, /* isInfallible. False in setters. */
19470 : false, /* isMovable. Not relevant for setters. */
19471 : false, /* isEliminatable. Not relevant for setters. */
19472 : false, /* isAlwaysInSlot. Only relevant for getters. */
19473 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
19474 : false, /* isTypedMethod. Only relevant for methods. */
19475 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
19476 : };
19477 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
19478 : static_assert(0 < 1, "There is no slot for us");
19479 :
19480 : static bool
19481 0 : vertexAttribPointer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
19482 : {
19483 0 : if (MOZ_UNLIKELY(args.length() < 6)) {
19484 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.vertexAttribPointer");
19485 : }
19486 : uint32_t arg0;
19487 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
19488 0 : return false;
19489 : }
19490 : int32_t arg1;
19491 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
19492 0 : return false;
19493 : }
19494 : uint32_t arg2;
19495 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
19496 0 : return false;
19497 : }
19498 : bool arg3;
19499 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[3], &arg3)) {
19500 0 : return false;
19501 : }
19502 : int32_t arg4;
19503 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[4], &arg4)) {
19504 0 : return false;
19505 : }
19506 : int64_t arg5;
19507 0 : if (!ValueToPrimitive<int64_t, eDefault>(cx, args[5], &arg5)) {
19508 0 : return false;
19509 : }
19510 0 : self->VertexAttribPointer(arg0, arg1, arg2, arg3, arg4, arg5);
19511 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
19512 0 : args.rval().setUndefined();
19513 0 : return true;
19514 : }
19515 :
19516 : static const JSJitInfo vertexAttribPointer_methodinfo = {
19517 : { (JSJitGetterOp)vertexAttribPointer },
19518 : { prototypes::id::WebGLRenderingContext },
19519 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
19520 : JSJitInfo::Method,
19521 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
19522 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
19523 : false, /* isInfallible. False in setters. */
19524 : false, /* isMovable. Not relevant for setters. */
19525 : false, /* isEliminatable. Not relevant for setters. */
19526 : false, /* isAlwaysInSlot. Only relevant for getters. */
19527 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
19528 : false, /* isTypedMethod. Only relevant for methods. */
19529 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
19530 : };
19531 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
19532 : static_assert(0 < 1, "There is no slot for us");
19533 :
19534 : static bool
19535 0 : viewport(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLContext* self, const JSJitMethodCallArgs& args)
19536 : {
19537 0 : if (MOZ_UNLIKELY(args.length() < 4)) {
19538 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "WebGLRenderingContext.viewport");
19539 : }
19540 : int32_t arg0;
19541 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
19542 0 : return false;
19543 : }
19544 : int32_t arg1;
19545 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
19546 0 : return false;
19547 : }
19548 : int32_t arg2;
19549 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
19550 0 : return false;
19551 : }
19552 : int32_t arg3;
19553 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
19554 0 : return false;
19555 : }
19556 0 : self->Viewport(arg0, arg1, arg2, arg3);
19557 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
19558 0 : args.rval().setUndefined();
19559 0 : return true;
19560 : }
19561 :
19562 : static const JSJitInfo viewport_methodinfo = {
19563 : { (JSJitGetterOp)viewport },
19564 : { prototypes::id::WebGLRenderingContext },
19565 : { PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth },
19566 : JSJitInfo::Method,
19567 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
19568 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
19569 : false, /* isInfallible. False in setters. */
19570 : false, /* isMovable. Not relevant for setters. */
19571 : false, /* isEliminatable. Not relevant for setters. */
19572 : false, /* isAlwaysInSlot. Only relevant for getters. */
19573 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
19574 : false, /* isTypedMethod. Only relevant for methods. */
19575 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
19576 : };
19577 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
19578 : static_assert(0 < 1, "There is no slot for us");
19579 :
19580 : static bool
19581 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
19582 : {
19583 0 : mozilla::WebGLContext* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLContext>(obj);
19584 : // We don't want to preserve if we don't have a wrapper, and we
19585 : // obviously can't preserve if we're not initialized.
19586 0 : if (self && self->GetWrapperPreserveColor()) {
19587 0 : PreserveWrapper(self);
19588 : }
19589 0 : return true;
19590 : }
19591 :
19592 : static void
19593 0 : _finalize(js::FreeOp* fop, JSObject* obj)
19594 : {
19595 0 : mozilla::WebGLContext* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLContext>(obj);
19596 0 : if (self) {
19597 0 : ClearWrapper(self, self, obj);
19598 0 : AddForDeferredFinalization<mozilla::WebGLContext>(self);
19599 : }
19600 0 : }
19601 :
19602 : static void
19603 0 : _objectMoved(JSObject* obj, const JSObject* old)
19604 : {
19605 0 : mozilla::WebGLContext* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLContext>(obj);
19606 0 : if (self) {
19607 0 : UpdateWrapper(self, self, obj, old);
19608 : }
19609 0 : }
19610 :
19611 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
19612 : #if defined(__clang__)
19613 : #pragma clang diagnostic push
19614 : #pragma clang diagnostic ignored "-Wmissing-braces"
19615 : #endif
19616 : static const JSFunctionSpec sMethods_specs[] = {
19617 : JS_FNSPEC("bufferData", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&bufferData_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
19618 : JS_FNSPEC("bufferSubData", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&bufferSubData_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
19619 : JS_FNSPEC("compressedTexImage2D", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&compressedTexImage2D_methodinfo), 7, JSPROP_ENUMERATE, nullptr),
19620 : JS_FNSPEC("compressedTexSubImage2D", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&compressedTexSubImage2D_methodinfo), 8, JSPROP_ENUMERATE, nullptr),
19621 : JS_FNSPEC("readPixels", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&readPixels_methodinfo), 7, JSPROP_ENUMERATE, nullptr),
19622 : JS_FNSPEC("texImage2D", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&texImage2D_methodinfo), 6, JSPROP_ENUMERATE, nullptr),
19623 : JS_FNSPEC("texSubImage2D", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&texSubImage2D_methodinfo), 7, JSPROP_ENUMERATE, nullptr),
19624 : JS_FNSPEC("uniform1fv", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform1fv_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19625 : JS_FNSPEC("uniform2fv", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform2fv_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19626 : JS_FNSPEC("uniform3fv", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform3fv_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19627 : JS_FNSPEC("uniform4fv", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform4fv_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19628 : JS_FNSPEC("uniform1iv", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform1iv_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19629 : JS_FNSPEC("uniform2iv", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform2iv_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19630 : JS_FNSPEC("uniform3iv", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform3iv_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19631 : JS_FNSPEC("uniform4iv", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform4iv_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19632 : JS_FNSPEC("uniformMatrix2fv", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniformMatrix2fv_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
19633 : JS_FNSPEC("uniformMatrix3fv", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniformMatrix3fv_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
19634 : JS_FNSPEC("uniformMatrix4fv", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniformMatrix4fv_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
19635 : JS_FS_END,
19636 : JS_FNSPEC("commit", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&commit_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
19637 : JS_FS_END,
19638 : JS_FNSPEC("getContextAttributes", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getContextAttributes_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
19639 : JS_FNSPEC("isContextLost", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&isContextLost_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
19640 : JS_FNSPEC("getSupportedExtensions", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getSupportedExtensions_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
19641 : JS_FNSPEC("getExtension", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getExtension_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19642 : JS_FNSPEC("activeTexture", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&activeTexture_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19643 : JS_FNSPEC("attachShader", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&attachShader_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19644 : JS_FNSPEC("bindAttribLocation", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&bindAttribLocation_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
19645 : JS_FNSPEC("bindBuffer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&bindBuffer_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19646 : JS_FNSPEC("bindFramebuffer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&bindFramebuffer_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19647 : JS_FNSPEC("bindRenderbuffer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&bindRenderbuffer_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19648 : JS_FNSPEC("bindTexture", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&bindTexture_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19649 : JS_FNSPEC("blendColor", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&blendColor_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
19650 : JS_FNSPEC("blendEquation", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&blendEquation_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19651 : JS_FNSPEC("blendEquationSeparate", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&blendEquationSeparate_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19652 : JS_FNSPEC("blendFunc", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&blendFunc_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19653 : JS_FNSPEC("blendFuncSeparate", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&blendFuncSeparate_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
19654 : JS_FNSPEC("checkFramebufferStatus", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&checkFramebufferStatus_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19655 : JS_FNSPEC("clear", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&clear_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19656 : JS_FNSPEC("clearColor", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&clearColor_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
19657 : JS_FNSPEC("clearDepth", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&clearDepth_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19658 : JS_FNSPEC("clearStencil", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&clearStencil_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19659 : JS_FNSPEC("colorMask", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&colorMask_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
19660 : JS_FNSPEC("compileShader", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&compileShader_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19661 : JS_FNSPEC("copyTexImage2D", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(©TexImage2D_methodinfo), 8, JSPROP_ENUMERATE, nullptr),
19662 : JS_FNSPEC("copyTexSubImage2D", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(©TexSubImage2D_methodinfo), 8, JSPROP_ENUMERATE, nullptr),
19663 : JS_FNSPEC("createBuffer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createBuffer_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
19664 : JS_FNSPEC("createFramebuffer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createFramebuffer_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
19665 : JS_FNSPEC("createProgram", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createProgram_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
19666 : JS_FNSPEC("createRenderbuffer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createRenderbuffer_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
19667 : JS_FNSPEC("createShader", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createShader_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19668 : JS_FNSPEC("createTexture", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createTexture_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
19669 : JS_FNSPEC("cullFace", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&cullFace_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19670 : JS_FNSPEC("deleteBuffer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&deleteBuffer_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19671 : JS_FNSPEC("deleteFramebuffer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&deleteFramebuffer_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19672 : JS_FNSPEC("deleteProgram", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&deleteProgram_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19673 : JS_FNSPEC("deleteRenderbuffer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&deleteRenderbuffer_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19674 : JS_FNSPEC("deleteShader", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&deleteShader_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19675 : JS_FNSPEC("deleteTexture", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&deleteTexture_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19676 : JS_FNSPEC("depthFunc", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&depthFunc_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19677 : JS_FNSPEC("depthMask", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&depthMask_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19678 : JS_FNSPEC("depthRange", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&depthRange_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19679 : JS_FNSPEC("detachShader", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&detachShader_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19680 : JS_FNSPEC("disable", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&disable_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19681 : JS_FNSPEC("disableVertexAttribArray", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&disableVertexAttribArray_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19682 : JS_FNSPEC("drawArrays", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&drawArrays_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
19683 : JS_FNSPEC("drawElements", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&drawElements_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
19684 : JS_FNSPEC("enable", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&enable_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19685 : JS_FNSPEC("enableVertexAttribArray", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&enableVertexAttribArray_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19686 : JS_FNSPEC("finish", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&finish_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
19687 : JS_FNSPEC("flush", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&flush_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
19688 : JS_FNSPEC("framebufferRenderbuffer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&framebufferRenderbuffer_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
19689 : JS_FNSPEC("framebufferTexture2D", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&framebufferTexture2D_methodinfo), 5, JSPROP_ENUMERATE, nullptr),
19690 : JS_FNSPEC("frontFace", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&frontFace_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19691 : JS_FNSPEC("generateMipmap", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&generateMipmap_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19692 : JS_FNSPEC("getActiveAttrib", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getActiveAttrib_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19693 : JS_FNSPEC("getActiveUniform", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getActiveUniform_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19694 : JS_FNSPEC("getAttachedShaders", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getAttachedShaders_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19695 : JS_FNSPEC("getAttribLocation", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getAttribLocation_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19696 : JS_FNSPEC("getBufferParameter", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getBufferParameter_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19697 : JS_FNSPEC("getParameter", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getParameter_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19698 : JS_FNSPEC("getError", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getError_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
19699 : JS_FNSPEC("getFramebufferAttachmentParameter", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getFramebufferAttachmentParameter_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
19700 : JS_FNSPEC("getProgramParameter", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getProgramParameter_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19701 : JS_FNSPEC("getProgramInfoLog", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getProgramInfoLog_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19702 : JS_FNSPEC("getRenderbufferParameter", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getRenderbufferParameter_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19703 : JS_FNSPEC("getShaderParameter", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getShaderParameter_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19704 : JS_FNSPEC("getShaderPrecisionFormat", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getShaderPrecisionFormat_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19705 : JS_FNSPEC("getShaderInfoLog", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getShaderInfoLog_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19706 : JS_FNSPEC("getShaderSource", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getShaderSource_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19707 : JS_FNSPEC("getTexParameter", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getTexParameter_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19708 : JS_FNSPEC("getUniform", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getUniform_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19709 : JS_FNSPEC("getUniformLocation", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getUniformLocation_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19710 : JS_FNSPEC("getVertexAttrib", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getVertexAttrib_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19711 : JS_FNSPEC("getVertexAttribOffset", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getVertexAttribOffset_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19712 : JS_FNSPEC("hint", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&hint_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19713 : JS_FNSPEC("isBuffer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&isBuffer_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19714 : JS_FNSPEC("isEnabled", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&isEnabled_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19715 : JS_FNSPEC("isFramebuffer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&isFramebuffer_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19716 : JS_FNSPEC("isProgram", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&isProgram_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19717 : JS_FNSPEC("isRenderbuffer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&isRenderbuffer_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19718 : JS_FNSPEC("isShader", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&isShader_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19719 : JS_FNSPEC("isTexture", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&isTexture_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19720 : JS_FNSPEC("lineWidth", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&lineWidth_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19721 : JS_FNSPEC("linkProgram", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&linkProgram_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19722 : JS_FNSPEC("pixelStorei", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&pixelStorei_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19723 : JS_FNSPEC("polygonOffset", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&polygonOffset_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19724 : JS_FNSPEC("renderbufferStorage", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&renderbufferStorage_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
19725 : JS_FNSPEC("sampleCoverage", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&sampleCoverage_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19726 : JS_FNSPEC("scissor", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&scissor_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
19727 : JS_FNSPEC("shaderSource", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&shaderSource_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19728 : JS_FNSPEC("stencilFunc", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&stencilFunc_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
19729 : JS_FNSPEC("stencilFuncSeparate", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&stencilFuncSeparate_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
19730 : JS_FNSPEC("stencilMask", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&stencilMask_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19731 : JS_FNSPEC("stencilMaskSeparate", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&stencilMaskSeparate_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19732 : JS_FNSPEC("stencilOp", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&stencilOp_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
19733 : JS_FNSPEC("stencilOpSeparate", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&stencilOpSeparate_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
19734 : JS_FNSPEC("texParameterf", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&texParameterf_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
19735 : JS_FNSPEC("texParameteri", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&texParameteri_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
19736 : JS_FNSPEC("uniform1f", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform1f_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19737 : JS_FNSPEC("uniform2f", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform2f_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
19738 : JS_FNSPEC("uniform3f", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform3f_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
19739 : JS_FNSPEC("uniform4f", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform4f_methodinfo), 5, JSPROP_ENUMERATE, nullptr),
19740 : JS_FNSPEC("uniform1i", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform1i_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19741 : JS_FNSPEC("uniform2i", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform2i_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
19742 : JS_FNSPEC("uniform3i", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform3i_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
19743 : JS_FNSPEC("uniform4i", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&uniform4i_methodinfo), 5, JSPROP_ENUMERATE, nullptr),
19744 : JS_FNSPEC("useProgram", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&useProgram_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19745 : JS_FNSPEC("validateProgram", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&validateProgram_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
19746 : JS_FNSPEC("vertexAttrib1f", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&vertexAttrib1f_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19747 : JS_FNSPEC("vertexAttrib1fv", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&vertexAttrib1fv_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19748 : JS_FNSPEC("vertexAttrib2f", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&vertexAttrib2f_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
19749 : JS_FNSPEC("vertexAttrib2fv", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&vertexAttrib2fv_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19750 : JS_FNSPEC("vertexAttrib3f", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&vertexAttrib3f_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
19751 : JS_FNSPEC("vertexAttrib3fv", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&vertexAttrib3fv_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19752 : JS_FNSPEC("vertexAttrib4f", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&vertexAttrib4f_methodinfo), 5, JSPROP_ENUMERATE, nullptr),
19753 : JS_FNSPEC("vertexAttrib4fv", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&vertexAttrib4fv_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
19754 : JS_FNSPEC("vertexAttribPointer", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&vertexAttribPointer_methodinfo), 6, JSPROP_ENUMERATE, nullptr),
19755 : JS_FNSPEC("viewport", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&viewport_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
19756 : JS_FS_END
19757 : };
19758 : #if defined(__clang__)
19759 : #pragma clang diagnostic pop
19760 : #endif
19761 :
19762 : static PrefableDisablers sMethods_disablers19 = {
19763 : true, false, 0, &mozilla::dom::OffscreenCanvas::PrefEnabled
19764 : };
19765 :
19766 : // Can't be const because the pref-enabled boolean needs to be writable
19767 : static Prefable<const JSFunctionSpec> sMethods[] = {
19768 : { nullptr, &sMethods_specs[0] },
19769 : { &sMethods_disablers19, &sMethods_specs[19] },
19770 : { nullptr, &sMethods_specs[21] },
19771 : { nullptr, nullptr }
19772 : };
19773 :
19774 : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
19775 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
19776 : static_assert(118 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
19777 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
19778 :
19779 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
19780 : #if defined(__clang__)
19781 : #pragma clang diagnostic push
19782 : #pragma clang diagnostic ignored "-Wmissing-braces"
19783 : #endif
19784 : static const JSPropertySpec sAttributes_specs[] = {
19785 : { "canvas", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &canvas_getterinfo, nullptr, nullptr },
19786 : { "drawingBufferWidth", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &drawingBufferWidth_getterinfo, nullptr, nullptr },
19787 : { "drawingBufferHeight", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &drawingBufferHeight_getterinfo, nullptr, nullptr },
19788 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
19789 : };
19790 : #if defined(__clang__)
19791 : #pragma clang diagnostic pop
19792 : #endif
19793 :
19794 :
19795 : // Can't be const because the pref-enabled boolean needs to be writable
19796 : static Prefable<const JSPropertySpec> sAttributes[] = {
19797 : { nullptr, &sAttributes_specs[0] },
19798 : { nullptr, nullptr }
19799 : };
19800 :
19801 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
19802 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
19803 : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
19804 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
19805 :
19806 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
19807 : #if defined(__clang__)
19808 : #pragma clang diagnostic push
19809 : #pragma clang diagnostic ignored "-Wmissing-braces"
19810 : #endif
19811 : static const ConstantSpec sConstants_specs[] = {
19812 : { "DEPTH_BUFFER_BIT", JS::NumberValue(256U) },
19813 : { "STENCIL_BUFFER_BIT", JS::NumberValue(1024U) },
19814 : { "COLOR_BUFFER_BIT", JS::NumberValue(16384U) },
19815 : { "POINTS", JS::NumberValue(0U) },
19816 : { "LINES", JS::NumberValue(1U) },
19817 : { "LINE_LOOP", JS::NumberValue(2U) },
19818 : { "LINE_STRIP", JS::NumberValue(3U) },
19819 : { "TRIANGLES", JS::NumberValue(4U) },
19820 : { "TRIANGLE_STRIP", JS::NumberValue(5U) },
19821 : { "TRIANGLE_FAN", JS::NumberValue(6U) },
19822 : { "ZERO", JS::NumberValue(0U) },
19823 : { "ONE", JS::NumberValue(1U) },
19824 : { "SRC_COLOR", JS::NumberValue(768U) },
19825 : { "ONE_MINUS_SRC_COLOR", JS::NumberValue(769U) },
19826 : { "SRC_ALPHA", JS::NumberValue(770U) },
19827 : { "ONE_MINUS_SRC_ALPHA", JS::NumberValue(771U) },
19828 : { "DST_ALPHA", JS::NumberValue(772U) },
19829 : { "ONE_MINUS_DST_ALPHA", JS::NumberValue(773U) },
19830 : { "DST_COLOR", JS::NumberValue(774U) },
19831 : { "ONE_MINUS_DST_COLOR", JS::NumberValue(775U) },
19832 : { "SRC_ALPHA_SATURATE", JS::NumberValue(776U) },
19833 : { "FUNC_ADD", JS::NumberValue(32774U) },
19834 : { "BLEND_EQUATION", JS::NumberValue(32777U) },
19835 : { "BLEND_EQUATION_RGB", JS::NumberValue(32777U) },
19836 : { "BLEND_EQUATION_ALPHA", JS::NumberValue(34877U) },
19837 : { "FUNC_SUBTRACT", JS::NumberValue(32778U) },
19838 : { "FUNC_REVERSE_SUBTRACT", JS::NumberValue(32779U) },
19839 : { "BLEND_DST_RGB", JS::NumberValue(32968U) },
19840 : { "BLEND_SRC_RGB", JS::NumberValue(32969U) },
19841 : { "BLEND_DST_ALPHA", JS::NumberValue(32970U) },
19842 : { "BLEND_SRC_ALPHA", JS::NumberValue(32971U) },
19843 : { "CONSTANT_COLOR", JS::NumberValue(32769U) },
19844 : { "ONE_MINUS_CONSTANT_COLOR", JS::NumberValue(32770U) },
19845 : { "CONSTANT_ALPHA", JS::NumberValue(32771U) },
19846 : { "ONE_MINUS_CONSTANT_ALPHA", JS::NumberValue(32772U) },
19847 : { "BLEND_COLOR", JS::NumberValue(32773U) },
19848 : { "ARRAY_BUFFER", JS::NumberValue(34962U) },
19849 : { "ELEMENT_ARRAY_BUFFER", JS::NumberValue(34963U) },
19850 : { "ARRAY_BUFFER_BINDING", JS::NumberValue(34964U) },
19851 : { "ELEMENT_ARRAY_BUFFER_BINDING", JS::NumberValue(34965U) },
19852 : { "STREAM_DRAW", JS::NumberValue(35040U) },
19853 : { "STATIC_DRAW", JS::NumberValue(35044U) },
19854 : { "DYNAMIC_DRAW", JS::NumberValue(35048U) },
19855 : { "BUFFER_SIZE", JS::NumberValue(34660U) },
19856 : { "BUFFER_USAGE", JS::NumberValue(34661U) },
19857 : { "CURRENT_VERTEX_ATTRIB", JS::NumberValue(34342U) },
19858 : { "FRONT", JS::NumberValue(1028U) },
19859 : { "BACK", JS::NumberValue(1029U) },
19860 : { "FRONT_AND_BACK", JS::NumberValue(1032U) },
19861 : { "CULL_FACE", JS::NumberValue(2884U) },
19862 : { "BLEND", JS::NumberValue(3042U) },
19863 : { "DITHER", JS::NumberValue(3024U) },
19864 : { "STENCIL_TEST", JS::NumberValue(2960U) },
19865 : { "DEPTH_TEST", JS::NumberValue(2929U) },
19866 : { "SCISSOR_TEST", JS::NumberValue(3089U) },
19867 : { "POLYGON_OFFSET_FILL", JS::NumberValue(32823U) },
19868 : { "SAMPLE_ALPHA_TO_COVERAGE", JS::NumberValue(32926U) },
19869 : { "SAMPLE_COVERAGE", JS::NumberValue(32928U) },
19870 : { "NO_ERROR", JS::NumberValue(0U) },
19871 : { "INVALID_ENUM", JS::NumberValue(1280U) },
19872 : { "INVALID_VALUE", JS::NumberValue(1281U) },
19873 : { "INVALID_OPERATION", JS::NumberValue(1282U) },
19874 : { "OUT_OF_MEMORY", JS::NumberValue(1285U) },
19875 : { "CW", JS::NumberValue(2304U) },
19876 : { "CCW", JS::NumberValue(2305U) },
19877 : { "LINE_WIDTH", JS::NumberValue(2849U) },
19878 : { "ALIASED_POINT_SIZE_RANGE", JS::NumberValue(33901U) },
19879 : { "ALIASED_LINE_WIDTH_RANGE", JS::NumberValue(33902U) },
19880 : { "CULL_FACE_MODE", JS::NumberValue(2885U) },
19881 : { "FRONT_FACE", JS::NumberValue(2886U) },
19882 : { "DEPTH_RANGE", JS::NumberValue(2928U) },
19883 : { "DEPTH_WRITEMASK", JS::NumberValue(2930U) },
19884 : { "DEPTH_CLEAR_VALUE", JS::NumberValue(2931U) },
19885 : { "DEPTH_FUNC", JS::NumberValue(2932U) },
19886 : { "STENCIL_CLEAR_VALUE", JS::NumberValue(2961U) },
19887 : { "STENCIL_FUNC", JS::NumberValue(2962U) },
19888 : { "STENCIL_FAIL", JS::NumberValue(2964U) },
19889 : { "STENCIL_PASS_DEPTH_FAIL", JS::NumberValue(2965U) },
19890 : { "STENCIL_PASS_DEPTH_PASS", JS::NumberValue(2966U) },
19891 : { "STENCIL_REF", JS::NumberValue(2967U) },
19892 : { "STENCIL_VALUE_MASK", JS::NumberValue(2963U) },
19893 : { "STENCIL_WRITEMASK", JS::NumberValue(2968U) },
19894 : { "STENCIL_BACK_FUNC", JS::NumberValue(34816U) },
19895 : { "STENCIL_BACK_FAIL", JS::NumberValue(34817U) },
19896 : { "STENCIL_BACK_PASS_DEPTH_FAIL", JS::NumberValue(34818U) },
19897 : { "STENCIL_BACK_PASS_DEPTH_PASS", JS::NumberValue(34819U) },
19898 : { "STENCIL_BACK_REF", JS::NumberValue(36003U) },
19899 : { "STENCIL_BACK_VALUE_MASK", JS::NumberValue(36004U) },
19900 : { "STENCIL_BACK_WRITEMASK", JS::NumberValue(36005U) },
19901 : { "VIEWPORT", JS::NumberValue(2978U) },
19902 : { "SCISSOR_BOX", JS::NumberValue(3088U) },
19903 : { "COLOR_CLEAR_VALUE", JS::NumberValue(3106U) },
19904 : { "COLOR_WRITEMASK", JS::NumberValue(3107U) },
19905 : { "UNPACK_ALIGNMENT", JS::NumberValue(3317U) },
19906 : { "PACK_ALIGNMENT", JS::NumberValue(3333U) },
19907 : { "MAX_TEXTURE_SIZE", JS::NumberValue(3379U) },
19908 : { "MAX_VIEWPORT_DIMS", JS::NumberValue(3386U) },
19909 : { "SUBPIXEL_BITS", JS::NumberValue(3408U) },
19910 : { "RED_BITS", JS::NumberValue(3410U) },
19911 : { "GREEN_BITS", JS::NumberValue(3411U) },
19912 : { "BLUE_BITS", JS::NumberValue(3412U) },
19913 : { "ALPHA_BITS", JS::NumberValue(3413U) },
19914 : { "DEPTH_BITS", JS::NumberValue(3414U) },
19915 : { "STENCIL_BITS", JS::NumberValue(3415U) },
19916 : { "POLYGON_OFFSET_UNITS", JS::NumberValue(10752U) },
19917 : { "POLYGON_OFFSET_FACTOR", JS::NumberValue(32824U) },
19918 : { "TEXTURE_BINDING_2D", JS::NumberValue(32873U) },
19919 : { "SAMPLE_BUFFERS", JS::NumberValue(32936U) },
19920 : { "SAMPLES", JS::NumberValue(32937U) },
19921 : { "SAMPLE_COVERAGE_VALUE", JS::NumberValue(32938U) },
19922 : { "SAMPLE_COVERAGE_INVERT", JS::NumberValue(32939U) },
19923 : { "COMPRESSED_TEXTURE_FORMATS", JS::NumberValue(34467U) },
19924 : { "DONT_CARE", JS::NumberValue(4352U) },
19925 : { "FASTEST", JS::NumberValue(4353U) },
19926 : { "NICEST", JS::NumberValue(4354U) },
19927 : { "GENERATE_MIPMAP_HINT", JS::NumberValue(33170U) },
19928 : { "BYTE", JS::NumberValue(5120U) },
19929 : { "UNSIGNED_BYTE", JS::NumberValue(5121U) },
19930 : { "SHORT", JS::NumberValue(5122U) },
19931 : { "UNSIGNED_SHORT", JS::NumberValue(5123U) },
19932 : { "INT", JS::NumberValue(5124U) },
19933 : { "UNSIGNED_INT", JS::NumberValue(5125U) },
19934 : { "FLOAT", JS::NumberValue(5126U) },
19935 : { "DEPTH_COMPONENT", JS::NumberValue(6402U) },
19936 : { "ALPHA", JS::NumberValue(6406U) },
19937 : { "RGB", JS::NumberValue(6407U) },
19938 : { "RGBA", JS::NumberValue(6408U) },
19939 : { "LUMINANCE", JS::NumberValue(6409U) },
19940 : { "LUMINANCE_ALPHA", JS::NumberValue(6410U) },
19941 : { "UNSIGNED_SHORT_4_4_4_4", JS::NumberValue(32819U) },
19942 : { "UNSIGNED_SHORT_5_5_5_1", JS::NumberValue(32820U) },
19943 : { "UNSIGNED_SHORT_5_6_5", JS::NumberValue(33635U) },
19944 : { "FRAGMENT_SHADER", JS::NumberValue(35632U) },
19945 : { "VERTEX_SHADER", JS::NumberValue(35633U) },
19946 : { "MAX_VERTEX_ATTRIBS", JS::NumberValue(34921U) },
19947 : { "MAX_VERTEX_UNIFORM_VECTORS", JS::NumberValue(36347U) },
19948 : { "MAX_VARYING_VECTORS", JS::NumberValue(36348U) },
19949 : { "MAX_COMBINED_TEXTURE_IMAGE_UNITS", JS::NumberValue(35661U) },
19950 : { "MAX_VERTEX_TEXTURE_IMAGE_UNITS", JS::NumberValue(35660U) },
19951 : { "MAX_TEXTURE_IMAGE_UNITS", JS::NumberValue(34930U) },
19952 : { "MAX_FRAGMENT_UNIFORM_VECTORS", JS::NumberValue(36349U) },
19953 : { "SHADER_TYPE", JS::NumberValue(35663U) },
19954 : { "DELETE_STATUS", JS::NumberValue(35712U) },
19955 : { "LINK_STATUS", JS::NumberValue(35714U) },
19956 : { "VALIDATE_STATUS", JS::NumberValue(35715U) },
19957 : { "ATTACHED_SHADERS", JS::NumberValue(35717U) },
19958 : { "ACTIVE_UNIFORMS", JS::NumberValue(35718U) },
19959 : { "ACTIVE_ATTRIBUTES", JS::NumberValue(35721U) },
19960 : { "SHADING_LANGUAGE_VERSION", JS::NumberValue(35724U) },
19961 : { "CURRENT_PROGRAM", JS::NumberValue(35725U) },
19962 : { "NEVER", JS::NumberValue(512U) },
19963 : { "LESS", JS::NumberValue(513U) },
19964 : { "EQUAL", JS::NumberValue(514U) },
19965 : { "LEQUAL", JS::NumberValue(515U) },
19966 : { "GREATER", JS::NumberValue(516U) },
19967 : { "NOTEQUAL", JS::NumberValue(517U) },
19968 : { "GEQUAL", JS::NumberValue(518U) },
19969 : { "ALWAYS", JS::NumberValue(519U) },
19970 : { "KEEP", JS::NumberValue(7680U) },
19971 : { "REPLACE", JS::NumberValue(7681U) },
19972 : { "INCR", JS::NumberValue(7682U) },
19973 : { "DECR", JS::NumberValue(7683U) },
19974 : { "INVERT", JS::NumberValue(5386U) },
19975 : { "INCR_WRAP", JS::NumberValue(34055U) },
19976 : { "DECR_WRAP", JS::NumberValue(34056U) },
19977 : { "VENDOR", JS::NumberValue(7936U) },
19978 : { "RENDERER", JS::NumberValue(7937U) },
19979 : { "VERSION", JS::NumberValue(7938U) },
19980 : { "NEAREST", JS::NumberValue(9728U) },
19981 : { "LINEAR", JS::NumberValue(9729U) },
19982 : { "NEAREST_MIPMAP_NEAREST", JS::NumberValue(9984U) },
19983 : { "LINEAR_MIPMAP_NEAREST", JS::NumberValue(9985U) },
19984 : { "NEAREST_MIPMAP_LINEAR", JS::NumberValue(9986U) },
19985 : { "LINEAR_MIPMAP_LINEAR", JS::NumberValue(9987U) },
19986 : { "TEXTURE_MAG_FILTER", JS::NumberValue(10240U) },
19987 : { "TEXTURE_MIN_FILTER", JS::NumberValue(10241U) },
19988 : { "TEXTURE_WRAP_S", JS::NumberValue(10242U) },
19989 : { "TEXTURE_WRAP_T", JS::NumberValue(10243U) },
19990 : { "TEXTURE_2D", JS::NumberValue(3553U) },
19991 : { "TEXTURE", JS::NumberValue(5890U) },
19992 : { "TEXTURE_CUBE_MAP", JS::NumberValue(34067U) },
19993 : { "TEXTURE_BINDING_CUBE_MAP", JS::NumberValue(34068U) },
19994 : { "TEXTURE_CUBE_MAP_POSITIVE_X", JS::NumberValue(34069U) },
19995 : { "TEXTURE_CUBE_MAP_NEGATIVE_X", JS::NumberValue(34070U) },
19996 : { "TEXTURE_CUBE_MAP_POSITIVE_Y", JS::NumberValue(34071U) },
19997 : { "TEXTURE_CUBE_MAP_NEGATIVE_Y", JS::NumberValue(34072U) },
19998 : { "TEXTURE_CUBE_MAP_POSITIVE_Z", JS::NumberValue(34073U) },
19999 : { "TEXTURE_CUBE_MAP_NEGATIVE_Z", JS::NumberValue(34074U) },
20000 : { "MAX_CUBE_MAP_TEXTURE_SIZE", JS::NumberValue(34076U) },
20001 : { "TEXTURE0", JS::NumberValue(33984U) },
20002 : { "TEXTURE1", JS::NumberValue(33985U) },
20003 : { "TEXTURE2", JS::NumberValue(33986U) },
20004 : { "TEXTURE3", JS::NumberValue(33987U) },
20005 : { "TEXTURE4", JS::NumberValue(33988U) },
20006 : { "TEXTURE5", JS::NumberValue(33989U) },
20007 : { "TEXTURE6", JS::NumberValue(33990U) },
20008 : { "TEXTURE7", JS::NumberValue(33991U) },
20009 : { "TEXTURE8", JS::NumberValue(33992U) },
20010 : { "TEXTURE9", JS::NumberValue(33993U) },
20011 : { "TEXTURE10", JS::NumberValue(33994U) },
20012 : { "TEXTURE11", JS::NumberValue(33995U) },
20013 : { "TEXTURE12", JS::NumberValue(33996U) },
20014 : { "TEXTURE13", JS::NumberValue(33997U) },
20015 : { "TEXTURE14", JS::NumberValue(33998U) },
20016 : { "TEXTURE15", JS::NumberValue(33999U) },
20017 : { "TEXTURE16", JS::NumberValue(34000U) },
20018 : { "TEXTURE17", JS::NumberValue(34001U) },
20019 : { "TEXTURE18", JS::NumberValue(34002U) },
20020 : { "TEXTURE19", JS::NumberValue(34003U) },
20021 : { "TEXTURE20", JS::NumberValue(34004U) },
20022 : { "TEXTURE21", JS::NumberValue(34005U) },
20023 : { "TEXTURE22", JS::NumberValue(34006U) },
20024 : { "TEXTURE23", JS::NumberValue(34007U) },
20025 : { "TEXTURE24", JS::NumberValue(34008U) },
20026 : { "TEXTURE25", JS::NumberValue(34009U) },
20027 : { "TEXTURE26", JS::NumberValue(34010U) },
20028 : { "TEXTURE27", JS::NumberValue(34011U) },
20029 : { "TEXTURE28", JS::NumberValue(34012U) },
20030 : { "TEXTURE29", JS::NumberValue(34013U) },
20031 : { "TEXTURE30", JS::NumberValue(34014U) },
20032 : { "TEXTURE31", JS::NumberValue(34015U) },
20033 : { "ACTIVE_TEXTURE", JS::NumberValue(34016U) },
20034 : { "REPEAT", JS::NumberValue(10497U) },
20035 : { "CLAMP_TO_EDGE", JS::NumberValue(33071U) },
20036 : { "MIRRORED_REPEAT", JS::NumberValue(33648U) },
20037 : { "FLOAT_VEC2", JS::NumberValue(35664U) },
20038 : { "FLOAT_VEC3", JS::NumberValue(35665U) },
20039 : { "FLOAT_VEC4", JS::NumberValue(35666U) },
20040 : { "INT_VEC2", JS::NumberValue(35667U) },
20041 : { "INT_VEC3", JS::NumberValue(35668U) },
20042 : { "INT_VEC4", JS::NumberValue(35669U) },
20043 : { "BOOL", JS::NumberValue(35670U) },
20044 : { "BOOL_VEC2", JS::NumberValue(35671U) },
20045 : { "BOOL_VEC3", JS::NumberValue(35672U) },
20046 : { "BOOL_VEC4", JS::NumberValue(35673U) },
20047 : { "FLOAT_MAT2", JS::NumberValue(35674U) },
20048 : { "FLOAT_MAT3", JS::NumberValue(35675U) },
20049 : { "FLOAT_MAT4", JS::NumberValue(35676U) },
20050 : { "SAMPLER_2D", JS::NumberValue(35678U) },
20051 : { "SAMPLER_CUBE", JS::NumberValue(35680U) },
20052 : { "VERTEX_ATTRIB_ARRAY_ENABLED", JS::NumberValue(34338U) },
20053 : { "VERTEX_ATTRIB_ARRAY_SIZE", JS::NumberValue(34339U) },
20054 : { "VERTEX_ATTRIB_ARRAY_STRIDE", JS::NumberValue(34340U) },
20055 : { "VERTEX_ATTRIB_ARRAY_TYPE", JS::NumberValue(34341U) },
20056 : { "VERTEX_ATTRIB_ARRAY_NORMALIZED", JS::NumberValue(34922U) },
20057 : { "VERTEX_ATTRIB_ARRAY_POINTER", JS::NumberValue(34373U) },
20058 : { "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", JS::NumberValue(34975U) },
20059 : { "IMPLEMENTATION_COLOR_READ_TYPE", JS::NumberValue(35738U) },
20060 : { "IMPLEMENTATION_COLOR_READ_FORMAT", JS::NumberValue(35739U) },
20061 : { "COMPILE_STATUS", JS::NumberValue(35713U) },
20062 : { "LOW_FLOAT", JS::NumberValue(36336U) },
20063 : { "MEDIUM_FLOAT", JS::NumberValue(36337U) },
20064 : { "HIGH_FLOAT", JS::NumberValue(36338U) },
20065 : { "LOW_INT", JS::NumberValue(36339U) },
20066 : { "MEDIUM_INT", JS::NumberValue(36340U) },
20067 : { "HIGH_INT", JS::NumberValue(36341U) },
20068 : { "FRAMEBUFFER", JS::NumberValue(36160U) },
20069 : { "RENDERBUFFER", JS::NumberValue(36161U) },
20070 : { "RGBA4", JS::NumberValue(32854U) },
20071 : { "RGB5_A1", JS::NumberValue(32855U) },
20072 : { "RGB565", JS::NumberValue(36194U) },
20073 : { "DEPTH_COMPONENT16", JS::NumberValue(33189U) },
20074 : { "STENCIL_INDEX8", JS::NumberValue(36168U) },
20075 : { "DEPTH_STENCIL", JS::NumberValue(34041U) },
20076 : { "RENDERBUFFER_WIDTH", JS::NumberValue(36162U) },
20077 : { "RENDERBUFFER_HEIGHT", JS::NumberValue(36163U) },
20078 : { "RENDERBUFFER_INTERNAL_FORMAT", JS::NumberValue(36164U) },
20079 : { "RENDERBUFFER_RED_SIZE", JS::NumberValue(36176U) },
20080 : { "RENDERBUFFER_GREEN_SIZE", JS::NumberValue(36177U) },
20081 : { "RENDERBUFFER_BLUE_SIZE", JS::NumberValue(36178U) },
20082 : { "RENDERBUFFER_ALPHA_SIZE", JS::NumberValue(36179U) },
20083 : { "RENDERBUFFER_DEPTH_SIZE", JS::NumberValue(36180U) },
20084 : { "RENDERBUFFER_STENCIL_SIZE", JS::NumberValue(36181U) },
20085 : { "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE", JS::NumberValue(36048U) },
20086 : { "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME", JS::NumberValue(36049U) },
20087 : { "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL", JS::NumberValue(36050U) },
20088 : { "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE", JS::NumberValue(36051U) },
20089 : { "COLOR_ATTACHMENT0", JS::NumberValue(36064U) },
20090 : { "DEPTH_ATTACHMENT", JS::NumberValue(36096U) },
20091 : { "STENCIL_ATTACHMENT", JS::NumberValue(36128U) },
20092 : { "DEPTH_STENCIL_ATTACHMENT", JS::NumberValue(33306U) },
20093 : { "NONE", JS::NumberValue(0U) },
20094 : { "FRAMEBUFFER_COMPLETE", JS::NumberValue(36053U) },
20095 : { "FRAMEBUFFER_INCOMPLETE_ATTACHMENT", JS::NumberValue(36054U) },
20096 : { "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT", JS::NumberValue(36055U) },
20097 : { "FRAMEBUFFER_INCOMPLETE_DIMENSIONS", JS::NumberValue(36057U) },
20098 : { "FRAMEBUFFER_UNSUPPORTED", JS::NumberValue(36061U) },
20099 : { "FRAMEBUFFER_BINDING", JS::NumberValue(36006U) },
20100 : { "RENDERBUFFER_BINDING", JS::NumberValue(36007U) },
20101 : { "MAX_RENDERBUFFER_SIZE", JS::NumberValue(34024U) },
20102 : { "INVALID_FRAMEBUFFER_OPERATION", JS::NumberValue(1286U) },
20103 : { "UNPACK_FLIP_Y_WEBGL", JS::NumberValue(37440U) },
20104 : { "UNPACK_PREMULTIPLY_ALPHA_WEBGL", JS::NumberValue(37441U) },
20105 : { "CONTEXT_LOST_WEBGL", JS::NumberValue(37442U) },
20106 : { "UNPACK_COLORSPACE_CONVERSION_WEBGL", JS::NumberValue(37443U) },
20107 : { "BROWSER_DEFAULT_WEBGL", JS::NumberValue(37444U) },
20108 : { 0, JS::UndefinedValue() }
20109 : };
20110 : #if defined(__clang__)
20111 : #pragma clang diagnostic pop
20112 : #endif
20113 :
20114 :
20115 : // Can't be const because the pref-enabled boolean needs to be writable
20116 : static Prefable<const ConstantSpec> sConstants[] = {
20117 : { nullptr, &sConstants_specs[0] },
20118 : { nullptr, nullptr }
20119 : };
20120 :
20121 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
20122 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
20123 : static_assert(296 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
20124 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
20125 :
20126 :
20127 : static uint16_t sNativeProperties_sortedPropertyIndices[436];
20128 : static PropertyInfo sNativeProperties_propertyInfos[436];
20129 :
20130 : static const NativePropertiesN<3> sNativeProperties = {
20131 : false, 0,
20132 : false, 0,
20133 : true, 0 /* sMethods */,
20134 : true, 1 /* sAttributes */,
20135 : false, 0,
20136 : false, 0,
20137 : true, 2 /* sConstants */,
20138 : -1,
20139 : 436,
20140 : sNativeProperties_sortedPropertyIndices,
20141 : {
20142 : { sMethods, &sNativeProperties_propertyInfos[0] },
20143 : { sAttributes, &sNativeProperties_propertyInfos[137] },
20144 : { sConstants, &sNativeProperties_propertyInfos[140] }
20145 : }
20146 : };
20147 : static_assert(436 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
20148 : "We have a property info count that is oversized");
20149 :
20150 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
20151 : {
20152 : "Function",
20153 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
20154 : &sBoringInterfaceObjectClassClassOps,
20155 : JS_NULL_CLASS_SPEC,
20156 : JS_NULL_CLASS_EXT,
20157 : &sInterfaceObjectClassObjectOps
20158 : },
20159 : eInterface,
20160 : true,
20161 : prototypes::id::WebGLRenderingContext,
20162 : PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth,
20163 : sNativePropertyHooks,
20164 : "function WebGLRenderingContext() {\n [native code]\n}",
20165 : JS::GetRealmFunctionPrototype
20166 : };
20167 :
20168 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
20169 : {
20170 : "WebGLRenderingContextPrototype",
20171 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
20172 : JS_NULL_CLASS_OPS,
20173 : JS_NULL_CLASS_SPEC,
20174 : JS_NULL_CLASS_EXT,
20175 : JS_NULL_OBJECT_OPS
20176 : },
20177 : eInterfacePrototype,
20178 : false,
20179 : prototypes::id::WebGLRenderingContext,
20180 : PrototypeTraits<prototypes::id::WebGLRenderingContext>::Depth,
20181 : sNativePropertyHooks,
20182 : "[object WebGLRenderingContextPrototype]",
20183 : JS::GetRealmObjectPrototype
20184 : };
20185 :
20186 : bool
20187 1 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
20188 : {
20189 1 : return mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread(aCx, aObj);
20190 : }
20191 :
20192 : JSObject*
20193 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
20194 : {
20195 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
20196 : }
20197 :
20198 : static const js::ClassOps sClassOps = {
20199 : _addProperty, /* addProperty */
20200 : nullptr, /* delProperty */
20201 : nullptr, /* getProperty */
20202 : nullptr, /* setProperty */
20203 : nullptr, /* enumerate */
20204 : nullptr, /* newEnumerate */
20205 : nullptr, /* resolve */
20206 : nullptr, /* mayResolve */
20207 : _finalize, /* finalize */
20208 : nullptr, /* call */
20209 : nullptr, /* hasInstance */
20210 : nullptr, /* construct */
20211 : nullptr, /* trace */
20212 : };
20213 :
20214 : static const js::ClassExtension sClassExtension = {
20215 : nullptr, /* weakmapKeyDelegateOp */
20216 : _objectMoved /* objectMovedOp */
20217 : };
20218 :
20219 : static const DOMJSClass sClass = {
20220 : { "WebGLRenderingContext",
20221 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
20222 : &sClassOps,
20223 : JS_NULL_CLASS_SPEC,
20224 : &sClassExtension,
20225 : JS_NULL_OBJECT_OPS
20226 : },
20227 : { prototypes::id::WebGLRenderingContext, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
20228 : IsBaseOf<nsISupports, mozilla::WebGLContext >::value,
20229 : sNativePropertyHooks,
20230 : FindAssociatedGlobalForNative<mozilla::WebGLContext>::Get,
20231 : GetProtoObjectHandle,
20232 : GetCCParticipant<mozilla::WebGLContext>::Get()
20233 : };
20234 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
20235 : "Must have the right minimal number of reserved slots.");
20236 : static_assert(1 >= 1,
20237 : "Must have enough reserved slots.");
20238 :
20239 : const JSClass*
20240 0 : GetJSClass()
20241 : {
20242 0 : return sClass.ToJSClass();
20243 : }
20244 :
20245 : bool
20246 0 : Wrap(JSContext* aCx, mozilla::WebGLContext* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
20247 : {
20248 : MOZ_ASSERT(static_cast<mozilla::WebGLContext*>(aObject) ==
20249 : reinterpret_cast<mozilla::WebGLContext*>(aObject),
20250 : "Multiple inheritance for mozilla::WebGLContext is broken.");
20251 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
20252 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
20253 0 : MOZ_ASSERT(!aCache->GetWrapper(),
20254 : "You should probably not be using Wrap() directly; use "
20255 : "GetOrCreateDOMReflector instead");
20256 :
20257 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
20258 : "nsISupports must be on our primary inheritance chain");
20259 :
20260 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
20261 0 : if (!global) {
20262 0 : return false;
20263 : }
20264 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
20265 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
20266 :
20267 : // That might have ended up wrapping us already, due to the wonders
20268 : // of XBL. Check for that, and bail out as needed.
20269 0 : aReflector.set(aCache->GetWrapper());
20270 0 : if (aReflector) {
20271 : #ifdef DEBUG
20272 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
20273 : #endif // DEBUG
20274 0 : return true;
20275 : }
20276 :
20277 0 : JSAutoCompartment ac(aCx, global);
20278 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
20279 0 : if (!canonicalProto) {
20280 0 : return false;
20281 : }
20282 0 : JS::Rooted<JSObject*> proto(aCx);
20283 0 : if (aGivenProto) {
20284 0 : proto = aGivenProto;
20285 : // Unfortunately, while aGivenProto was in the compartment of aCx
20286 : // coming in, we changed compartments to that of "parent" so may need
20287 : // to wrap the proto here.
20288 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
20289 0 : if (!JS_WrapObject(aCx, &proto)) {
20290 0 : return false;
20291 : }
20292 : }
20293 : } else {
20294 0 : proto = canonicalProto;
20295 : }
20296 :
20297 0 : BindingJSObjectCreator<mozilla::WebGLContext> creator(aCx);
20298 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
20299 0 : if (!aReflector) {
20300 0 : return false;
20301 : }
20302 :
20303 0 : aCache->SetWrapper(aReflector);
20304 0 : creator.InitializationSucceeded();
20305 :
20306 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
20307 : aCache->GetWrapperPreserveColor() == aReflector);
20308 : // If proto != canonicalProto, we have to preserve our wrapper;
20309 : // otherwise we won't be able to properly recreate it later, since
20310 : // we won't know what proto to use. Note that we don't check
20311 : // aGivenProto here, since it's entirely possible (and even
20312 : // somewhat common) to have a non-null aGivenProto which is the
20313 : // same as canonicalProto.
20314 0 : if (proto != canonicalProto) {
20315 0 : PreserveWrapper(aObject);
20316 : }
20317 :
20318 0 : return true;
20319 : }
20320 :
20321 : const NativePropertyHooks sNativePropertyHooks[] = { {
20322 : nullptr,
20323 : nullptr,
20324 : nullptr,
20325 : { sNativeProperties.Upcast(), nullptr },
20326 : prototypes::id::WebGLRenderingContext,
20327 : constructors::id::WebGLRenderingContext,
20328 : nullptr,
20329 : &DefaultXrayExpandoObjectClass
20330 : } };
20331 :
20332 : void
20333 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
20334 : {
20335 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
20336 0 : if (!parentProto) {
20337 0 : return;
20338 : }
20339 :
20340 0 : JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
20341 0 : if (!constructorProto) {
20342 0 : return;
20343 : }
20344 :
20345 : static bool sIdsInited = false;
20346 0 : if (!sIdsInited && NS_IsMainThread()) {
20347 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
20348 0 : return;
20349 : }
20350 0 : sIdsInited = true;
20351 : }
20352 :
20353 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WebGLRenderingContext);
20354 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::WebGLRenderingContext);
20355 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
20356 : &sPrototypeClass.mBase, protoCache,
20357 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
20358 : interfaceCache,
20359 : sNativeProperties.Upcast(),
20360 : nullptr,
20361 : "WebGLRenderingContext", aDefineOnGlobal,
20362 : nullptr,
20363 0 : false);
20364 : }
20365 :
20366 : JS::Handle<JSObject*>
20367 0 : GetProtoObjectHandle(JSContext* aCx)
20368 : {
20369 : /* Get the interface prototype object for this class. This will create the
20370 : object as needed. */
20371 0 : bool aDefineOnGlobal = true;
20372 :
20373 : /* Make sure our global is sane. Hopefully we can remove this sometime */
20374 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
20375 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
20376 0 : return nullptr;
20377 : }
20378 :
20379 : /* Check to see whether the interface objects are already installed */
20380 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
20381 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WebGLRenderingContext)) {
20382 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
20383 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
20384 : }
20385 :
20386 : /*
20387 : * The object might _still_ be null, but that's OK.
20388 : *
20389 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
20390 : * traced by TraceProtoAndIfaceCache() and its contents are never
20391 : * changed after they have been set.
20392 : *
20393 : * Calling address() avoids the read read barrier that does gray
20394 : * unmarking, but it's not possible for the object to be gray here.
20395 : */
20396 :
20397 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WebGLRenderingContext);
20398 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
20399 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
20400 : }
20401 :
20402 : JS::Handle<JSObject*>
20403 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
20404 : {
20405 : /* Get the interface object for this class. This will create the object as
20406 : needed. */
20407 :
20408 : /* Make sure our global is sane. Hopefully we can remove this sometime */
20409 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
20410 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
20411 0 : return nullptr;
20412 : }
20413 :
20414 : /* Check to see whether the interface objects are already installed */
20415 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
20416 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::WebGLRenderingContext)) {
20417 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
20418 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
20419 : }
20420 :
20421 : /*
20422 : * The object might _still_ be null, but that's OK.
20423 : *
20424 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
20425 : * traced by TraceProtoAndIfaceCache() and its contents are never
20426 : * changed after they have been set.
20427 : *
20428 : * Calling address() avoids the read read barrier that does gray
20429 : * unmarking, but it's not possible for the object to be gray here.
20430 : */
20431 :
20432 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::WebGLRenderingContext);
20433 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
20434 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
20435 : }
20436 :
20437 : JSObject*
20438 0 : GetConstructorObject(JSContext* aCx)
20439 : {
20440 0 : return GetConstructorObjectHandle(aCx);
20441 : }
20442 :
20443 : } // namespace WebGLRenderingContextBinding
20444 :
20445 :
20446 :
20447 : namespace WebGLShaderBinding {
20448 :
20449 : static bool
20450 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
20451 : {
20452 0 : mozilla::WebGLShader* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLShader>(obj);
20453 : // We don't want to preserve if we don't have a wrapper, and we
20454 : // obviously can't preserve if we're not initialized.
20455 0 : if (self && self->GetWrapperPreserveColor()) {
20456 0 : PreserveWrapper(self);
20457 : }
20458 0 : return true;
20459 : }
20460 :
20461 : static void
20462 0 : _finalize(js::FreeOp* fop, JSObject* obj)
20463 : {
20464 0 : mozilla::WebGLShader* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLShader>(obj);
20465 0 : if (self) {
20466 0 : ClearWrapper(self, self, obj);
20467 0 : AddForDeferredFinalization<mozilla::WebGLShader>(self);
20468 : }
20469 0 : }
20470 :
20471 : static void
20472 0 : _objectMoved(JSObject* obj, const JSObject* old)
20473 : {
20474 0 : mozilla::WebGLShader* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLShader>(obj);
20475 0 : if (self) {
20476 0 : UpdateWrapper(self, self, obj, old);
20477 : }
20478 0 : }
20479 :
20480 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
20481 : {
20482 : "Function",
20483 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
20484 : &sBoringInterfaceObjectClassClassOps,
20485 : JS_NULL_CLASS_SPEC,
20486 : JS_NULL_CLASS_EXT,
20487 : &sInterfaceObjectClassObjectOps
20488 : },
20489 : eInterface,
20490 : true,
20491 : prototypes::id::WebGLShader,
20492 : PrototypeTraits<prototypes::id::WebGLShader>::Depth,
20493 : sNativePropertyHooks,
20494 : "function WebGLShader() {\n [native code]\n}",
20495 : JS::GetRealmFunctionPrototype
20496 : };
20497 :
20498 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
20499 : {
20500 : "WebGLShaderPrototype",
20501 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
20502 : JS_NULL_CLASS_OPS,
20503 : JS_NULL_CLASS_SPEC,
20504 : JS_NULL_CLASS_EXT,
20505 : JS_NULL_OBJECT_OPS
20506 : },
20507 : eInterfacePrototype,
20508 : false,
20509 : prototypes::id::WebGLShader,
20510 : PrototypeTraits<prototypes::id::WebGLShader>::Depth,
20511 : sNativePropertyHooks,
20512 : "[object WebGLShaderPrototype]",
20513 : JS::GetRealmObjectPrototype
20514 : };
20515 :
20516 : bool
20517 1 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
20518 : {
20519 1 : return mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread(aCx, aObj);
20520 : }
20521 :
20522 : JSObject*
20523 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
20524 : {
20525 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
20526 : }
20527 :
20528 : static const js::ClassOps sClassOps = {
20529 : _addProperty, /* addProperty */
20530 : nullptr, /* delProperty */
20531 : nullptr, /* getProperty */
20532 : nullptr, /* setProperty */
20533 : nullptr, /* enumerate */
20534 : nullptr, /* newEnumerate */
20535 : nullptr, /* resolve */
20536 : nullptr, /* mayResolve */
20537 : _finalize, /* finalize */
20538 : nullptr, /* call */
20539 : nullptr, /* hasInstance */
20540 : nullptr, /* construct */
20541 : nullptr, /* trace */
20542 : };
20543 :
20544 : static const js::ClassExtension sClassExtension = {
20545 : nullptr, /* weakmapKeyDelegateOp */
20546 : _objectMoved /* objectMovedOp */
20547 : };
20548 :
20549 : static const DOMJSClass sClass = {
20550 : { "WebGLShader",
20551 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
20552 : &sClassOps,
20553 : JS_NULL_CLASS_SPEC,
20554 : &sClassExtension,
20555 : JS_NULL_OBJECT_OPS
20556 : },
20557 : { prototypes::id::WebGLShader, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
20558 : IsBaseOf<nsISupports, mozilla::WebGLShader >::value,
20559 : sNativePropertyHooks,
20560 : FindAssociatedGlobalForNative<mozilla::WebGLShader>::Get,
20561 : GetProtoObjectHandle,
20562 : GetCCParticipant<mozilla::WebGLShader>::Get()
20563 : };
20564 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
20565 : "Must have the right minimal number of reserved slots.");
20566 : static_assert(1 >= 1,
20567 : "Must have enough reserved slots.");
20568 :
20569 : const JSClass*
20570 0 : GetJSClass()
20571 : {
20572 0 : return sClass.ToJSClass();
20573 : }
20574 :
20575 : bool
20576 0 : Wrap(JSContext* aCx, mozilla::WebGLShader* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
20577 : {
20578 : MOZ_ASSERT(static_cast<mozilla::WebGLShader*>(aObject) ==
20579 : reinterpret_cast<mozilla::WebGLShader*>(aObject),
20580 : "Multiple inheritance for mozilla::WebGLShader is broken.");
20581 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
20582 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
20583 0 : MOZ_ASSERT(!aCache->GetWrapper(),
20584 : "You should probably not be using Wrap() directly; use "
20585 : "GetOrCreateDOMReflector instead");
20586 :
20587 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
20588 : "nsISupports must be on our primary inheritance chain");
20589 :
20590 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
20591 0 : if (!global) {
20592 0 : return false;
20593 : }
20594 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
20595 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
20596 :
20597 : // That might have ended up wrapping us already, due to the wonders
20598 : // of XBL. Check for that, and bail out as needed.
20599 0 : aReflector.set(aCache->GetWrapper());
20600 0 : if (aReflector) {
20601 : #ifdef DEBUG
20602 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
20603 : #endif // DEBUG
20604 0 : return true;
20605 : }
20606 :
20607 0 : JSAutoCompartment ac(aCx, global);
20608 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
20609 0 : if (!canonicalProto) {
20610 0 : return false;
20611 : }
20612 0 : JS::Rooted<JSObject*> proto(aCx);
20613 0 : if (aGivenProto) {
20614 0 : proto = aGivenProto;
20615 : // Unfortunately, while aGivenProto was in the compartment of aCx
20616 : // coming in, we changed compartments to that of "parent" so may need
20617 : // to wrap the proto here.
20618 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
20619 0 : if (!JS_WrapObject(aCx, &proto)) {
20620 0 : return false;
20621 : }
20622 : }
20623 : } else {
20624 0 : proto = canonicalProto;
20625 : }
20626 :
20627 0 : BindingJSObjectCreator<mozilla::WebGLShader> creator(aCx);
20628 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
20629 0 : if (!aReflector) {
20630 0 : return false;
20631 : }
20632 :
20633 0 : aCache->SetWrapper(aReflector);
20634 0 : creator.InitializationSucceeded();
20635 :
20636 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
20637 : aCache->GetWrapperPreserveColor() == aReflector);
20638 : // If proto != canonicalProto, we have to preserve our wrapper;
20639 : // otherwise we won't be able to properly recreate it later, since
20640 : // we won't know what proto to use. Note that we don't check
20641 : // aGivenProto here, since it's entirely possible (and even
20642 : // somewhat common) to have a non-null aGivenProto which is the
20643 : // same as canonicalProto.
20644 0 : if (proto != canonicalProto) {
20645 0 : PreserveWrapper(aObject);
20646 : }
20647 :
20648 0 : return true;
20649 : }
20650 :
20651 : const NativePropertyHooks sNativePropertyHooks[] = { {
20652 : nullptr,
20653 : nullptr,
20654 : nullptr,
20655 : { nullptr, nullptr },
20656 : prototypes::id::WebGLShader,
20657 : constructors::id::WebGLShader,
20658 : nullptr,
20659 : &DefaultXrayExpandoObjectClass
20660 : } };
20661 :
20662 : void
20663 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
20664 : {
20665 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
20666 0 : if (!parentProto) {
20667 0 : return;
20668 : }
20669 :
20670 0 : JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
20671 0 : if (!constructorProto) {
20672 0 : return;
20673 : }
20674 :
20675 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WebGLShader);
20676 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::WebGLShader);
20677 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
20678 : &sPrototypeClass.mBase, protoCache,
20679 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
20680 : interfaceCache,
20681 : nullptr,
20682 : nullptr,
20683 : "WebGLShader", aDefineOnGlobal,
20684 : nullptr,
20685 0 : false);
20686 : }
20687 :
20688 : JS::Handle<JSObject*>
20689 0 : GetProtoObjectHandle(JSContext* aCx)
20690 : {
20691 : /* Get the interface prototype object for this class. This will create the
20692 : object as needed. */
20693 0 : bool aDefineOnGlobal = true;
20694 :
20695 : /* Make sure our global is sane. Hopefully we can remove this sometime */
20696 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
20697 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
20698 0 : return nullptr;
20699 : }
20700 :
20701 : /* Check to see whether the interface objects are already installed */
20702 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
20703 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WebGLShader)) {
20704 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
20705 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
20706 : }
20707 :
20708 : /*
20709 : * The object might _still_ be null, but that's OK.
20710 : *
20711 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
20712 : * traced by TraceProtoAndIfaceCache() and its contents are never
20713 : * changed after they have been set.
20714 : *
20715 : * Calling address() avoids the read read barrier that does gray
20716 : * unmarking, but it's not possible for the object to be gray here.
20717 : */
20718 :
20719 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WebGLShader);
20720 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
20721 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
20722 : }
20723 :
20724 : JS::Handle<JSObject*>
20725 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
20726 : {
20727 : /* Get the interface object for this class. This will create the object as
20728 : needed. */
20729 :
20730 : /* Make sure our global is sane. Hopefully we can remove this sometime */
20731 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
20732 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
20733 0 : return nullptr;
20734 : }
20735 :
20736 : /* Check to see whether the interface objects are already installed */
20737 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
20738 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::WebGLShader)) {
20739 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
20740 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
20741 : }
20742 :
20743 : /*
20744 : * The object might _still_ be null, but that's OK.
20745 : *
20746 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
20747 : * traced by TraceProtoAndIfaceCache() and its contents are never
20748 : * changed after they have been set.
20749 : *
20750 : * Calling address() avoids the read read barrier that does gray
20751 : * unmarking, but it's not possible for the object to be gray here.
20752 : */
20753 :
20754 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::WebGLShader);
20755 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
20756 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
20757 : }
20758 :
20759 : JSObject*
20760 0 : GetConstructorObject(JSContext* aCx)
20761 : {
20762 0 : return GetConstructorObjectHandle(aCx);
20763 : }
20764 :
20765 : } // namespace WebGLShaderBinding
20766 :
20767 :
20768 :
20769 : namespace WebGLShaderPrecisionFormatBinding {
20770 :
20771 : static bool
20772 0 : get_rangeMin(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLShaderPrecisionFormat* self, JSJitGetterCallArgs args)
20773 : {
20774 0 : int32_t result(self->RangeMin());
20775 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
20776 0 : args.rval().setInt32(int32_t(result));
20777 0 : return true;
20778 : }
20779 :
20780 : static const JSJitInfo rangeMin_getterinfo = {
20781 : { (JSJitGetterOp)get_rangeMin },
20782 : { prototypes::id::WebGLShaderPrecisionFormat },
20783 : { PrototypeTraits<prototypes::id::WebGLShaderPrecisionFormat>::Depth },
20784 : JSJitInfo::Getter,
20785 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
20786 : JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */
20787 : true, /* isInfallible. False in setters. */
20788 : false, /* isMovable. Not relevant for setters. */
20789 : false, /* isEliminatable. Not relevant for setters. */
20790 : false, /* isAlwaysInSlot. Only relevant for getters. */
20791 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
20792 : false, /* isTypedMethod. Only relevant for methods. */
20793 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
20794 : };
20795 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
20796 : static_assert(0 < 1, "There is no slot for us");
20797 :
20798 : static bool
20799 0 : get_rangeMax(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLShaderPrecisionFormat* self, JSJitGetterCallArgs args)
20800 : {
20801 0 : int32_t result(self->RangeMax());
20802 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
20803 0 : args.rval().setInt32(int32_t(result));
20804 0 : return true;
20805 : }
20806 :
20807 : static const JSJitInfo rangeMax_getterinfo = {
20808 : { (JSJitGetterOp)get_rangeMax },
20809 : { prototypes::id::WebGLShaderPrecisionFormat },
20810 : { PrototypeTraits<prototypes::id::WebGLShaderPrecisionFormat>::Depth },
20811 : JSJitInfo::Getter,
20812 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
20813 : JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */
20814 : true, /* isInfallible. False in setters. */
20815 : false, /* isMovable. Not relevant for setters. */
20816 : false, /* isEliminatable. Not relevant for setters. */
20817 : false, /* isAlwaysInSlot. Only relevant for getters. */
20818 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
20819 : false, /* isTypedMethod. Only relevant for methods. */
20820 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
20821 : };
20822 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
20823 : static_assert(0 < 1, "There is no slot for us");
20824 :
20825 : static bool
20826 0 : get_precision(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::WebGLShaderPrecisionFormat* self, JSJitGetterCallArgs args)
20827 : {
20828 0 : int32_t result(self->Precision());
20829 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
20830 0 : args.rval().setInt32(int32_t(result));
20831 0 : return true;
20832 : }
20833 :
20834 : static const JSJitInfo precision_getterinfo = {
20835 : { (JSJitGetterOp)get_precision },
20836 : { prototypes::id::WebGLShaderPrecisionFormat },
20837 : { PrototypeTraits<prototypes::id::WebGLShaderPrecisionFormat>::Depth },
20838 : JSJitInfo::Getter,
20839 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
20840 : JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */
20841 : true, /* isInfallible. False in setters. */
20842 : false, /* isMovable. Not relevant for setters. */
20843 : false, /* isEliminatable. Not relevant for setters. */
20844 : false, /* isAlwaysInSlot. Only relevant for getters. */
20845 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
20846 : false, /* isTypedMethod. Only relevant for methods. */
20847 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
20848 : };
20849 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
20850 : static_assert(0 < 1, "There is no slot for us");
20851 :
20852 : static void
20853 0 : _finalize(js::FreeOp* fop, JSObject* obj)
20854 : {
20855 0 : mozilla::WebGLShaderPrecisionFormat* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLShaderPrecisionFormat>(obj);
20856 0 : if (self) {
20857 0 : AddForDeferredFinalization<mozilla::WebGLShaderPrecisionFormat>(self);
20858 : }
20859 0 : }
20860 :
20861 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
20862 : #if defined(__clang__)
20863 : #pragma clang diagnostic push
20864 : #pragma clang diagnostic ignored "-Wmissing-braces"
20865 : #endif
20866 : static const JSPropertySpec sAttributes_specs[] = {
20867 : { "rangeMin", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &rangeMin_getterinfo, nullptr, nullptr },
20868 : { "rangeMax", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &rangeMax_getterinfo, nullptr, nullptr },
20869 : { "precision", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &precision_getterinfo, nullptr, nullptr },
20870 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
20871 : };
20872 : #if defined(__clang__)
20873 : #pragma clang diagnostic pop
20874 : #endif
20875 :
20876 :
20877 : // Can't be const because the pref-enabled boolean needs to be writable
20878 : static Prefable<const JSPropertySpec> sAttributes[] = {
20879 : { nullptr, &sAttributes_specs[0] },
20880 : { nullptr, nullptr }
20881 : };
20882 :
20883 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
20884 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
20885 : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
20886 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
20887 :
20888 :
20889 : static uint16_t sNativeProperties_sortedPropertyIndices[3];
20890 : static PropertyInfo sNativeProperties_propertyInfos[3];
20891 :
20892 : static const NativePropertiesN<1> sNativeProperties = {
20893 : false, 0,
20894 : false, 0,
20895 : false, 0,
20896 : true, 0 /* sAttributes */,
20897 : false, 0,
20898 : false, 0,
20899 : false, 0,
20900 : -1,
20901 : 3,
20902 : sNativeProperties_sortedPropertyIndices,
20903 : {
20904 : { sAttributes, &sNativeProperties_propertyInfos[0] }
20905 : }
20906 : };
20907 : static_assert(3 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
20908 : "We have a property info count that is oversized");
20909 :
20910 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
20911 : {
20912 : "Function",
20913 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
20914 : &sBoringInterfaceObjectClassClassOps,
20915 : JS_NULL_CLASS_SPEC,
20916 : JS_NULL_CLASS_EXT,
20917 : &sInterfaceObjectClassObjectOps
20918 : },
20919 : eInterface,
20920 : true,
20921 : prototypes::id::WebGLShaderPrecisionFormat,
20922 : PrototypeTraits<prototypes::id::WebGLShaderPrecisionFormat>::Depth,
20923 : sNativePropertyHooks,
20924 : "function WebGLShaderPrecisionFormat() {\n [native code]\n}",
20925 : JS::GetRealmFunctionPrototype
20926 : };
20927 :
20928 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
20929 : {
20930 : "WebGLShaderPrecisionFormatPrototype",
20931 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
20932 : JS_NULL_CLASS_OPS,
20933 : JS_NULL_CLASS_SPEC,
20934 : JS_NULL_CLASS_EXT,
20935 : JS_NULL_OBJECT_OPS
20936 : },
20937 : eInterfacePrototype,
20938 : false,
20939 : prototypes::id::WebGLShaderPrecisionFormat,
20940 : PrototypeTraits<prototypes::id::WebGLShaderPrecisionFormat>::Depth,
20941 : sNativePropertyHooks,
20942 : "[object WebGLShaderPrecisionFormatPrototype]",
20943 : JS::GetRealmObjectPrototype
20944 : };
20945 :
20946 : bool
20947 1 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
20948 : {
20949 1 : return mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread(aCx, aObj);
20950 : }
20951 :
20952 : JSObject*
20953 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
20954 : {
20955 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
20956 : }
20957 :
20958 : static const js::ClassOps sClassOps = {
20959 : nullptr, /* addProperty */
20960 : nullptr, /* delProperty */
20961 : nullptr, /* getProperty */
20962 : nullptr, /* setProperty */
20963 : nullptr, /* enumerate */
20964 : nullptr, /* newEnumerate */
20965 : nullptr, /* resolve */
20966 : nullptr, /* mayResolve */
20967 : _finalize, /* finalize */
20968 : nullptr, /* call */
20969 : nullptr, /* hasInstance */
20970 : nullptr, /* construct */
20971 : nullptr, /* trace */
20972 : };
20973 :
20974 : static const js::ClassExtension sClassExtension = {
20975 : nullptr, /* weakmapKeyDelegateOp */
20976 : nullptr /* objectMovedOp */
20977 : };
20978 :
20979 : static const DOMJSClass sClass = {
20980 : { "WebGLShaderPrecisionFormat",
20981 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
20982 : &sClassOps,
20983 : JS_NULL_CLASS_SPEC,
20984 : &sClassExtension,
20985 : JS_NULL_OBJECT_OPS
20986 : },
20987 : { prototypes::id::WebGLShaderPrecisionFormat, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
20988 : IsBaseOf<nsISupports, mozilla::WebGLShaderPrecisionFormat >::value,
20989 : sNativePropertyHooks,
20990 : FindAssociatedGlobalForNative<mozilla::WebGLShaderPrecisionFormat>::Get,
20991 : GetProtoObjectHandle,
20992 : GetCCParticipant<mozilla::WebGLShaderPrecisionFormat>::Get()
20993 : };
20994 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
20995 : "Must have the right minimal number of reserved slots.");
20996 : static_assert(1 >= 1,
20997 : "Must have enough reserved slots.");
20998 :
20999 : const JSClass*
21000 0 : GetJSClass()
21001 : {
21002 0 : return sClass.ToJSClass();
21003 : }
21004 :
21005 : bool
21006 0 : Wrap(JSContext* aCx, mozilla::WebGLShaderPrecisionFormat* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
21007 : {
21008 : MOZ_ASSERT(static_cast<mozilla::WebGLShaderPrecisionFormat*>(aObject) ==
21009 : reinterpret_cast<mozilla::WebGLShaderPrecisionFormat*>(aObject),
21010 : "Multiple inheritance for mozilla::WebGLShaderPrecisionFormat is broken.");
21011 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
21012 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
21013 :
21014 0 : JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx));
21015 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
21016 0 : if (!canonicalProto) {
21017 0 : return false;
21018 : }
21019 0 : JS::Rooted<JSObject*> proto(aCx);
21020 0 : if (aGivenProto) {
21021 0 : proto = aGivenProto;
21022 : // Unfortunately, while aGivenProto was in the compartment of aCx
21023 : // coming in, we changed compartments to that of "parent" so may need
21024 : // to wrap the proto here.
21025 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
21026 0 : if (!JS_WrapObject(aCx, &proto)) {
21027 0 : return false;
21028 : }
21029 : }
21030 : } else {
21031 0 : proto = canonicalProto;
21032 : }
21033 :
21034 0 : BindingJSObjectCreator<mozilla::WebGLShaderPrecisionFormat> creator(aCx);
21035 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
21036 0 : if (!aReflector) {
21037 0 : return false;
21038 : }
21039 :
21040 :
21041 :
21042 0 : creator.InitializationSucceeded();
21043 0 : return true;
21044 : }
21045 :
21046 : const NativePropertyHooks sNativePropertyHooks[] = { {
21047 : nullptr,
21048 : nullptr,
21049 : nullptr,
21050 : { sNativeProperties.Upcast(), nullptr },
21051 : prototypes::id::WebGLShaderPrecisionFormat,
21052 : constructors::id::WebGLShaderPrecisionFormat,
21053 : nullptr,
21054 : &DefaultXrayExpandoObjectClass
21055 : } };
21056 :
21057 : void
21058 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
21059 : {
21060 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
21061 0 : if (!parentProto) {
21062 0 : return;
21063 : }
21064 :
21065 0 : JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
21066 0 : if (!constructorProto) {
21067 0 : return;
21068 : }
21069 :
21070 : static bool sIdsInited = false;
21071 0 : if (!sIdsInited && NS_IsMainThread()) {
21072 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
21073 0 : return;
21074 : }
21075 0 : sIdsInited = true;
21076 : }
21077 :
21078 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WebGLShaderPrecisionFormat);
21079 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::WebGLShaderPrecisionFormat);
21080 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
21081 : &sPrototypeClass.mBase, protoCache,
21082 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
21083 : interfaceCache,
21084 : sNativeProperties.Upcast(),
21085 : nullptr,
21086 : "WebGLShaderPrecisionFormat", aDefineOnGlobal,
21087 : nullptr,
21088 0 : false);
21089 : }
21090 :
21091 : JS::Handle<JSObject*>
21092 0 : GetProtoObjectHandle(JSContext* aCx)
21093 : {
21094 : /* Get the interface prototype object for this class. This will create the
21095 : object as needed. */
21096 0 : bool aDefineOnGlobal = true;
21097 :
21098 : /* Make sure our global is sane. Hopefully we can remove this sometime */
21099 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
21100 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
21101 0 : return nullptr;
21102 : }
21103 :
21104 : /* Check to see whether the interface objects are already installed */
21105 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
21106 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WebGLShaderPrecisionFormat)) {
21107 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
21108 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
21109 : }
21110 :
21111 : /*
21112 : * The object might _still_ be null, but that's OK.
21113 : *
21114 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
21115 : * traced by TraceProtoAndIfaceCache() and its contents are never
21116 : * changed after they have been set.
21117 : *
21118 : * Calling address() avoids the read read barrier that does gray
21119 : * unmarking, but it's not possible for the object to be gray here.
21120 : */
21121 :
21122 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WebGLShaderPrecisionFormat);
21123 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
21124 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
21125 : }
21126 :
21127 : JS::Handle<JSObject*>
21128 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
21129 : {
21130 : /* Get the interface object for this class. This will create the object as
21131 : needed. */
21132 :
21133 : /* Make sure our global is sane. Hopefully we can remove this sometime */
21134 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
21135 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
21136 0 : return nullptr;
21137 : }
21138 :
21139 : /* Check to see whether the interface objects are already installed */
21140 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
21141 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::WebGLShaderPrecisionFormat)) {
21142 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
21143 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
21144 : }
21145 :
21146 : /*
21147 : * The object might _still_ be null, but that's OK.
21148 : *
21149 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
21150 : * traced by TraceProtoAndIfaceCache() and its contents are never
21151 : * changed after they have been set.
21152 : *
21153 : * Calling address() avoids the read read barrier that does gray
21154 : * unmarking, but it's not possible for the object to be gray here.
21155 : */
21156 :
21157 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::WebGLShaderPrecisionFormat);
21158 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
21159 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
21160 : }
21161 :
21162 : JSObject*
21163 0 : GetConstructorObject(JSContext* aCx)
21164 : {
21165 0 : return GetConstructorObjectHandle(aCx);
21166 : }
21167 :
21168 : } // namespace WebGLShaderPrecisionFormatBinding
21169 :
21170 :
21171 :
21172 : namespace WebGLTextureBinding {
21173 :
21174 : static bool
21175 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
21176 : {
21177 0 : mozilla::WebGLTexture* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLTexture>(obj);
21178 : // We don't want to preserve if we don't have a wrapper, and we
21179 : // obviously can't preserve if we're not initialized.
21180 0 : if (self && self->GetWrapperPreserveColor()) {
21181 0 : PreserveWrapper(self);
21182 : }
21183 0 : return true;
21184 : }
21185 :
21186 : static void
21187 0 : _finalize(js::FreeOp* fop, JSObject* obj)
21188 : {
21189 0 : mozilla::WebGLTexture* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLTexture>(obj);
21190 0 : if (self) {
21191 0 : ClearWrapper(self, self, obj);
21192 0 : AddForDeferredFinalization<mozilla::WebGLTexture>(self);
21193 : }
21194 0 : }
21195 :
21196 : static void
21197 0 : _objectMoved(JSObject* obj, const JSObject* old)
21198 : {
21199 0 : mozilla::WebGLTexture* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLTexture>(obj);
21200 0 : if (self) {
21201 0 : UpdateWrapper(self, self, obj, old);
21202 : }
21203 0 : }
21204 :
21205 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
21206 : {
21207 : "Function",
21208 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
21209 : &sBoringInterfaceObjectClassClassOps,
21210 : JS_NULL_CLASS_SPEC,
21211 : JS_NULL_CLASS_EXT,
21212 : &sInterfaceObjectClassObjectOps
21213 : },
21214 : eInterface,
21215 : true,
21216 : prototypes::id::WebGLTexture,
21217 : PrototypeTraits<prototypes::id::WebGLTexture>::Depth,
21218 : sNativePropertyHooks,
21219 : "function WebGLTexture() {\n [native code]\n}",
21220 : JS::GetRealmFunctionPrototype
21221 : };
21222 :
21223 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
21224 : {
21225 : "WebGLTexturePrototype",
21226 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
21227 : JS_NULL_CLASS_OPS,
21228 : JS_NULL_CLASS_SPEC,
21229 : JS_NULL_CLASS_EXT,
21230 : JS_NULL_OBJECT_OPS
21231 : },
21232 : eInterfacePrototype,
21233 : false,
21234 : prototypes::id::WebGLTexture,
21235 : PrototypeTraits<prototypes::id::WebGLTexture>::Depth,
21236 : sNativePropertyHooks,
21237 : "[object WebGLTexturePrototype]",
21238 : JS::GetRealmObjectPrototype
21239 : };
21240 :
21241 : bool
21242 1 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
21243 : {
21244 1 : return mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread(aCx, aObj);
21245 : }
21246 :
21247 : JSObject*
21248 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
21249 : {
21250 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
21251 : }
21252 :
21253 : static const js::ClassOps sClassOps = {
21254 : _addProperty, /* addProperty */
21255 : nullptr, /* delProperty */
21256 : nullptr, /* getProperty */
21257 : nullptr, /* setProperty */
21258 : nullptr, /* enumerate */
21259 : nullptr, /* newEnumerate */
21260 : nullptr, /* resolve */
21261 : nullptr, /* mayResolve */
21262 : _finalize, /* finalize */
21263 : nullptr, /* call */
21264 : nullptr, /* hasInstance */
21265 : nullptr, /* construct */
21266 : nullptr, /* trace */
21267 : };
21268 :
21269 : static const js::ClassExtension sClassExtension = {
21270 : nullptr, /* weakmapKeyDelegateOp */
21271 : _objectMoved /* objectMovedOp */
21272 : };
21273 :
21274 : static const DOMJSClass sClass = {
21275 : { "WebGLTexture",
21276 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
21277 : &sClassOps,
21278 : JS_NULL_CLASS_SPEC,
21279 : &sClassExtension,
21280 : JS_NULL_OBJECT_OPS
21281 : },
21282 : { prototypes::id::WebGLTexture, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
21283 : IsBaseOf<nsISupports, mozilla::WebGLTexture >::value,
21284 : sNativePropertyHooks,
21285 : FindAssociatedGlobalForNative<mozilla::WebGLTexture>::Get,
21286 : GetProtoObjectHandle,
21287 : GetCCParticipant<mozilla::WebGLTexture>::Get()
21288 : };
21289 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
21290 : "Must have the right minimal number of reserved slots.");
21291 : static_assert(1 >= 1,
21292 : "Must have enough reserved slots.");
21293 :
21294 : const JSClass*
21295 0 : GetJSClass()
21296 : {
21297 0 : return sClass.ToJSClass();
21298 : }
21299 :
21300 : bool
21301 0 : Wrap(JSContext* aCx, mozilla::WebGLTexture* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
21302 : {
21303 : MOZ_ASSERT(static_cast<mozilla::WebGLTexture*>(aObject) ==
21304 : reinterpret_cast<mozilla::WebGLTexture*>(aObject),
21305 : "Multiple inheritance for mozilla::WebGLTexture is broken.");
21306 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
21307 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
21308 0 : MOZ_ASSERT(!aCache->GetWrapper(),
21309 : "You should probably not be using Wrap() directly; use "
21310 : "GetOrCreateDOMReflector instead");
21311 :
21312 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
21313 : "nsISupports must be on our primary inheritance chain");
21314 :
21315 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
21316 0 : if (!global) {
21317 0 : return false;
21318 : }
21319 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
21320 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
21321 :
21322 : // That might have ended up wrapping us already, due to the wonders
21323 : // of XBL. Check for that, and bail out as needed.
21324 0 : aReflector.set(aCache->GetWrapper());
21325 0 : if (aReflector) {
21326 : #ifdef DEBUG
21327 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
21328 : #endif // DEBUG
21329 0 : return true;
21330 : }
21331 :
21332 0 : JSAutoCompartment ac(aCx, global);
21333 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
21334 0 : if (!canonicalProto) {
21335 0 : return false;
21336 : }
21337 0 : JS::Rooted<JSObject*> proto(aCx);
21338 0 : if (aGivenProto) {
21339 0 : proto = aGivenProto;
21340 : // Unfortunately, while aGivenProto was in the compartment of aCx
21341 : // coming in, we changed compartments to that of "parent" so may need
21342 : // to wrap the proto here.
21343 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
21344 0 : if (!JS_WrapObject(aCx, &proto)) {
21345 0 : return false;
21346 : }
21347 : }
21348 : } else {
21349 0 : proto = canonicalProto;
21350 : }
21351 :
21352 0 : BindingJSObjectCreator<mozilla::WebGLTexture> creator(aCx);
21353 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
21354 0 : if (!aReflector) {
21355 0 : return false;
21356 : }
21357 :
21358 0 : aCache->SetWrapper(aReflector);
21359 0 : creator.InitializationSucceeded();
21360 :
21361 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
21362 : aCache->GetWrapperPreserveColor() == aReflector);
21363 : // If proto != canonicalProto, we have to preserve our wrapper;
21364 : // otherwise we won't be able to properly recreate it later, since
21365 : // we won't know what proto to use. Note that we don't check
21366 : // aGivenProto here, since it's entirely possible (and even
21367 : // somewhat common) to have a non-null aGivenProto which is the
21368 : // same as canonicalProto.
21369 0 : if (proto != canonicalProto) {
21370 0 : PreserveWrapper(aObject);
21371 : }
21372 :
21373 0 : return true;
21374 : }
21375 :
21376 : const NativePropertyHooks sNativePropertyHooks[] = { {
21377 : nullptr,
21378 : nullptr,
21379 : nullptr,
21380 : { nullptr, nullptr },
21381 : prototypes::id::WebGLTexture,
21382 : constructors::id::WebGLTexture,
21383 : nullptr,
21384 : &DefaultXrayExpandoObjectClass
21385 : } };
21386 :
21387 : void
21388 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
21389 : {
21390 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
21391 0 : if (!parentProto) {
21392 0 : return;
21393 : }
21394 :
21395 0 : JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
21396 0 : if (!constructorProto) {
21397 0 : return;
21398 : }
21399 :
21400 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WebGLTexture);
21401 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::WebGLTexture);
21402 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
21403 : &sPrototypeClass.mBase, protoCache,
21404 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
21405 : interfaceCache,
21406 : nullptr,
21407 : nullptr,
21408 : "WebGLTexture", aDefineOnGlobal,
21409 : nullptr,
21410 0 : false);
21411 : }
21412 :
21413 : JS::Handle<JSObject*>
21414 0 : GetProtoObjectHandle(JSContext* aCx)
21415 : {
21416 : /* Get the interface prototype object for this class. This will create the
21417 : object as needed. */
21418 0 : bool aDefineOnGlobal = true;
21419 :
21420 : /* Make sure our global is sane. Hopefully we can remove this sometime */
21421 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
21422 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
21423 0 : return nullptr;
21424 : }
21425 :
21426 : /* Check to see whether the interface objects are already installed */
21427 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
21428 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WebGLTexture)) {
21429 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
21430 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
21431 : }
21432 :
21433 : /*
21434 : * The object might _still_ be null, but that's OK.
21435 : *
21436 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
21437 : * traced by TraceProtoAndIfaceCache() and its contents are never
21438 : * changed after they have been set.
21439 : *
21440 : * Calling address() avoids the read read barrier that does gray
21441 : * unmarking, but it's not possible for the object to be gray here.
21442 : */
21443 :
21444 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WebGLTexture);
21445 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
21446 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
21447 : }
21448 :
21449 : JS::Handle<JSObject*>
21450 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
21451 : {
21452 : /* Get the interface object for this class. This will create the object as
21453 : needed. */
21454 :
21455 : /* Make sure our global is sane. Hopefully we can remove this sometime */
21456 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
21457 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
21458 0 : return nullptr;
21459 : }
21460 :
21461 : /* Check to see whether the interface objects are already installed */
21462 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
21463 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::WebGLTexture)) {
21464 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
21465 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
21466 : }
21467 :
21468 : /*
21469 : * The object might _still_ be null, but that's OK.
21470 : *
21471 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
21472 : * traced by TraceProtoAndIfaceCache() and its contents are never
21473 : * changed after they have been set.
21474 : *
21475 : * Calling address() avoids the read read barrier that does gray
21476 : * unmarking, but it's not possible for the object to be gray here.
21477 : */
21478 :
21479 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::WebGLTexture);
21480 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
21481 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
21482 : }
21483 :
21484 : JSObject*
21485 0 : GetConstructorObject(JSContext* aCx)
21486 : {
21487 0 : return GetConstructorObjectHandle(aCx);
21488 : }
21489 :
21490 : } // namespace WebGLTextureBinding
21491 :
21492 :
21493 :
21494 : namespace WebGLUniformLocationBinding {
21495 :
21496 : static bool
21497 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
21498 : {
21499 0 : mozilla::WebGLUniformLocation* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLUniformLocation>(obj);
21500 : // We don't want to preserve if we don't have a wrapper, and we
21501 : // obviously can't preserve if we're not initialized.
21502 0 : if (self && self->GetWrapperPreserveColor()) {
21503 0 : PreserveWrapper(self);
21504 : }
21505 0 : return true;
21506 : }
21507 :
21508 : static void
21509 0 : _finalize(js::FreeOp* fop, JSObject* obj)
21510 : {
21511 0 : mozilla::WebGLUniformLocation* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLUniformLocation>(obj);
21512 0 : if (self) {
21513 0 : ClearWrapper(self, self, obj);
21514 0 : AddForDeferredFinalization<mozilla::WebGLUniformLocation>(self);
21515 : }
21516 0 : }
21517 :
21518 : static void
21519 0 : _objectMoved(JSObject* obj, const JSObject* old)
21520 : {
21521 0 : mozilla::WebGLUniformLocation* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLUniformLocation>(obj);
21522 0 : if (self) {
21523 0 : UpdateWrapper(self, self, obj, old);
21524 : }
21525 0 : }
21526 :
21527 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
21528 : {
21529 : "Function",
21530 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
21531 : &sBoringInterfaceObjectClassClassOps,
21532 : JS_NULL_CLASS_SPEC,
21533 : JS_NULL_CLASS_EXT,
21534 : &sInterfaceObjectClassObjectOps
21535 : },
21536 : eInterface,
21537 : true,
21538 : prototypes::id::WebGLUniformLocation,
21539 : PrototypeTraits<prototypes::id::WebGLUniformLocation>::Depth,
21540 : sNativePropertyHooks,
21541 : "function WebGLUniformLocation() {\n [native code]\n}",
21542 : JS::GetRealmFunctionPrototype
21543 : };
21544 :
21545 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
21546 : {
21547 : "WebGLUniformLocationPrototype",
21548 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
21549 : JS_NULL_CLASS_OPS,
21550 : JS_NULL_CLASS_SPEC,
21551 : JS_NULL_CLASS_EXT,
21552 : JS_NULL_OBJECT_OPS
21553 : },
21554 : eInterfacePrototype,
21555 : false,
21556 : prototypes::id::WebGLUniformLocation,
21557 : PrototypeTraits<prototypes::id::WebGLUniformLocation>::Depth,
21558 : sNativePropertyHooks,
21559 : "[object WebGLUniformLocationPrototype]",
21560 : JS::GetRealmObjectPrototype
21561 : };
21562 :
21563 : bool
21564 1 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
21565 : {
21566 1 : return mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread(aCx, aObj);
21567 : }
21568 :
21569 : JSObject*
21570 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
21571 : {
21572 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
21573 : }
21574 :
21575 : static const js::ClassOps sClassOps = {
21576 : _addProperty, /* addProperty */
21577 : nullptr, /* delProperty */
21578 : nullptr, /* getProperty */
21579 : nullptr, /* setProperty */
21580 : nullptr, /* enumerate */
21581 : nullptr, /* newEnumerate */
21582 : nullptr, /* resolve */
21583 : nullptr, /* mayResolve */
21584 : _finalize, /* finalize */
21585 : nullptr, /* call */
21586 : nullptr, /* hasInstance */
21587 : nullptr, /* construct */
21588 : nullptr, /* trace */
21589 : };
21590 :
21591 : static const js::ClassExtension sClassExtension = {
21592 : nullptr, /* weakmapKeyDelegateOp */
21593 : _objectMoved /* objectMovedOp */
21594 : };
21595 :
21596 : static const DOMJSClass sClass = {
21597 : { "WebGLUniformLocation",
21598 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
21599 : &sClassOps,
21600 : JS_NULL_CLASS_SPEC,
21601 : &sClassExtension,
21602 : JS_NULL_OBJECT_OPS
21603 : },
21604 : { prototypes::id::WebGLUniformLocation, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
21605 : IsBaseOf<nsISupports, mozilla::WebGLUniformLocation >::value,
21606 : sNativePropertyHooks,
21607 : FindAssociatedGlobalForNative<mozilla::WebGLUniformLocation>::Get,
21608 : GetProtoObjectHandle,
21609 : GetCCParticipant<mozilla::WebGLUniformLocation>::Get()
21610 : };
21611 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
21612 : "Must have the right minimal number of reserved slots.");
21613 : static_assert(1 >= 1,
21614 : "Must have enough reserved slots.");
21615 :
21616 : const JSClass*
21617 0 : GetJSClass()
21618 : {
21619 0 : return sClass.ToJSClass();
21620 : }
21621 :
21622 : bool
21623 0 : Wrap(JSContext* aCx, mozilla::WebGLUniformLocation* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
21624 : {
21625 : MOZ_ASSERT(static_cast<mozilla::WebGLUniformLocation*>(aObject) ==
21626 : reinterpret_cast<mozilla::WebGLUniformLocation*>(aObject),
21627 : "Multiple inheritance for mozilla::WebGLUniformLocation is broken.");
21628 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
21629 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
21630 0 : MOZ_ASSERT(!aCache->GetWrapper(),
21631 : "You should probably not be using Wrap() directly; use "
21632 : "GetOrCreateDOMReflector instead");
21633 :
21634 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
21635 : "nsISupports must be on our primary inheritance chain");
21636 :
21637 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
21638 0 : if (!global) {
21639 0 : return false;
21640 : }
21641 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
21642 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
21643 :
21644 : // That might have ended up wrapping us already, due to the wonders
21645 : // of XBL. Check for that, and bail out as needed.
21646 0 : aReflector.set(aCache->GetWrapper());
21647 0 : if (aReflector) {
21648 : #ifdef DEBUG
21649 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
21650 : #endif // DEBUG
21651 0 : return true;
21652 : }
21653 :
21654 0 : JSAutoCompartment ac(aCx, global);
21655 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
21656 0 : if (!canonicalProto) {
21657 0 : return false;
21658 : }
21659 0 : JS::Rooted<JSObject*> proto(aCx);
21660 0 : if (aGivenProto) {
21661 0 : proto = aGivenProto;
21662 : // Unfortunately, while aGivenProto was in the compartment of aCx
21663 : // coming in, we changed compartments to that of "parent" so may need
21664 : // to wrap the proto here.
21665 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
21666 0 : if (!JS_WrapObject(aCx, &proto)) {
21667 0 : return false;
21668 : }
21669 : }
21670 : } else {
21671 0 : proto = canonicalProto;
21672 : }
21673 :
21674 0 : BindingJSObjectCreator<mozilla::WebGLUniformLocation> creator(aCx);
21675 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
21676 0 : if (!aReflector) {
21677 0 : return false;
21678 : }
21679 :
21680 0 : aCache->SetWrapper(aReflector);
21681 0 : creator.InitializationSucceeded();
21682 :
21683 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
21684 : aCache->GetWrapperPreserveColor() == aReflector);
21685 : // If proto != canonicalProto, we have to preserve our wrapper;
21686 : // otherwise we won't be able to properly recreate it later, since
21687 : // we won't know what proto to use. Note that we don't check
21688 : // aGivenProto here, since it's entirely possible (and even
21689 : // somewhat common) to have a non-null aGivenProto which is the
21690 : // same as canonicalProto.
21691 0 : if (proto != canonicalProto) {
21692 0 : PreserveWrapper(aObject);
21693 : }
21694 :
21695 0 : return true;
21696 : }
21697 :
21698 : const NativePropertyHooks sNativePropertyHooks[] = { {
21699 : nullptr,
21700 : nullptr,
21701 : nullptr,
21702 : { nullptr, nullptr },
21703 : prototypes::id::WebGLUniformLocation,
21704 : constructors::id::WebGLUniformLocation,
21705 : nullptr,
21706 : &DefaultXrayExpandoObjectClass
21707 : } };
21708 :
21709 : void
21710 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
21711 : {
21712 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
21713 0 : if (!parentProto) {
21714 0 : return;
21715 : }
21716 :
21717 0 : JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
21718 0 : if (!constructorProto) {
21719 0 : return;
21720 : }
21721 :
21722 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WebGLUniformLocation);
21723 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::WebGLUniformLocation);
21724 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
21725 : &sPrototypeClass.mBase, protoCache,
21726 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
21727 : interfaceCache,
21728 : nullptr,
21729 : nullptr,
21730 : "WebGLUniformLocation", aDefineOnGlobal,
21731 : nullptr,
21732 0 : false);
21733 : }
21734 :
21735 : JS::Handle<JSObject*>
21736 0 : GetProtoObjectHandle(JSContext* aCx)
21737 : {
21738 : /* Get the interface prototype object for this class. This will create the
21739 : object as needed. */
21740 0 : bool aDefineOnGlobal = true;
21741 :
21742 : /* Make sure our global is sane. Hopefully we can remove this sometime */
21743 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
21744 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
21745 0 : return nullptr;
21746 : }
21747 :
21748 : /* Check to see whether the interface objects are already installed */
21749 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
21750 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WebGLUniformLocation)) {
21751 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
21752 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
21753 : }
21754 :
21755 : /*
21756 : * The object might _still_ be null, but that's OK.
21757 : *
21758 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
21759 : * traced by TraceProtoAndIfaceCache() and its contents are never
21760 : * changed after they have been set.
21761 : *
21762 : * Calling address() avoids the read read barrier that does gray
21763 : * unmarking, but it's not possible for the object to be gray here.
21764 : */
21765 :
21766 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WebGLUniformLocation);
21767 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
21768 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
21769 : }
21770 :
21771 : JS::Handle<JSObject*>
21772 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
21773 : {
21774 : /* Get the interface object for this class. This will create the object as
21775 : needed. */
21776 :
21777 : /* Make sure our global is sane. Hopefully we can remove this sometime */
21778 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
21779 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
21780 0 : return nullptr;
21781 : }
21782 :
21783 : /* Check to see whether the interface objects are already installed */
21784 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
21785 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::WebGLUniformLocation)) {
21786 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
21787 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
21788 : }
21789 :
21790 : /*
21791 : * The object might _still_ be null, but that's OK.
21792 : *
21793 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
21794 : * traced by TraceProtoAndIfaceCache() and its contents are never
21795 : * changed after they have been set.
21796 : *
21797 : * Calling address() avoids the read read barrier that does gray
21798 : * unmarking, but it's not possible for the object to be gray here.
21799 : */
21800 :
21801 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::WebGLUniformLocation);
21802 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
21803 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
21804 : }
21805 :
21806 : JSObject*
21807 0 : GetConstructorObject(JSContext* aCx)
21808 : {
21809 0 : return GetConstructorObjectHandle(aCx);
21810 : }
21811 :
21812 : } // namespace WebGLUniformLocationBinding
21813 :
21814 :
21815 :
21816 : namespace WebGLVertexArrayObjectBinding {
21817 :
21818 : static bool
21819 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
21820 : {
21821 0 : mozilla::WebGLVertexArray* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLVertexArray>(obj);
21822 : // We don't want to preserve if we don't have a wrapper, and we
21823 : // obviously can't preserve if we're not initialized.
21824 0 : if (self && self->GetWrapperPreserveColor()) {
21825 0 : PreserveWrapper(self);
21826 : }
21827 0 : return true;
21828 : }
21829 :
21830 : static void
21831 0 : _finalize(js::FreeOp* fop, JSObject* obj)
21832 : {
21833 0 : mozilla::WebGLVertexArray* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLVertexArray>(obj);
21834 0 : if (self) {
21835 0 : ClearWrapper(self, self, obj);
21836 0 : AddForDeferredFinalization<mozilla::WebGLVertexArray>(self);
21837 : }
21838 0 : }
21839 :
21840 : static void
21841 0 : _objectMoved(JSObject* obj, const JSObject* old)
21842 : {
21843 0 : mozilla::WebGLVertexArray* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::WebGLVertexArray>(obj);
21844 0 : if (self) {
21845 0 : UpdateWrapper(self, self, obj, old);
21846 : }
21847 0 : }
21848 :
21849 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
21850 : {
21851 : "Function",
21852 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
21853 : &sBoringInterfaceObjectClassClassOps,
21854 : JS_NULL_CLASS_SPEC,
21855 : JS_NULL_CLASS_EXT,
21856 : &sInterfaceObjectClassObjectOps
21857 : },
21858 : eInterface,
21859 : true,
21860 : prototypes::id::WebGLVertexArrayObject,
21861 : PrototypeTraits<prototypes::id::WebGLVertexArrayObject>::Depth,
21862 : sNativePropertyHooks,
21863 : "function WebGLVertexArrayObject() {\n [native code]\n}",
21864 : JS::GetRealmFunctionPrototype
21865 : };
21866 :
21867 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
21868 : {
21869 : "WebGLVertexArrayObjectPrototype",
21870 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
21871 : JS_NULL_CLASS_OPS,
21872 : JS_NULL_CLASS_SPEC,
21873 : JS_NULL_CLASS_EXT,
21874 : JS_NULL_OBJECT_OPS
21875 : },
21876 : eInterfacePrototype,
21877 : false,
21878 : prototypes::id::WebGLVertexArrayObject,
21879 : PrototypeTraits<prototypes::id::WebGLVertexArrayObject>::Depth,
21880 : sNativePropertyHooks,
21881 : "[object WebGLVertexArrayObjectPrototype]",
21882 : JS::GetRealmObjectPrototype
21883 : };
21884 :
21885 : JSObject*
21886 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
21887 : {
21888 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
21889 : }
21890 :
21891 : static const js::ClassOps sClassOps = {
21892 : _addProperty, /* addProperty */
21893 : nullptr, /* delProperty */
21894 : nullptr, /* getProperty */
21895 : nullptr, /* setProperty */
21896 : nullptr, /* enumerate */
21897 : nullptr, /* newEnumerate */
21898 : nullptr, /* resolve */
21899 : nullptr, /* mayResolve */
21900 : _finalize, /* finalize */
21901 : nullptr, /* call */
21902 : nullptr, /* hasInstance */
21903 : nullptr, /* construct */
21904 : nullptr, /* trace */
21905 : };
21906 :
21907 : static const js::ClassExtension sClassExtension = {
21908 : nullptr, /* weakmapKeyDelegateOp */
21909 : _objectMoved /* objectMovedOp */
21910 : };
21911 :
21912 : static const DOMJSClass sClass = {
21913 : { "WebGLVertexArrayObject",
21914 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
21915 : &sClassOps,
21916 : JS_NULL_CLASS_SPEC,
21917 : &sClassExtension,
21918 : JS_NULL_OBJECT_OPS
21919 : },
21920 : { prototypes::id::WebGLVertexArrayObject, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
21921 : IsBaseOf<nsISupports, mozilla::WebGLVertexArray >::value,
21922 : sNativePropertyHooks,
21923 : FindAssociatedGlobalForNative<mozilla::WebGLVertexArray>::Get,
21924 : GetProtoObjectHandle,
21925 : GetCCParticipant<mozilla::WebGLVertexArray>::Get()
21926 : };
21927 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
21928 : "Must have the right minimal number of reserved slots.");
21929 : static_assert(1 >= 1,
21930 : "Must have enough reserved slots.");
21931 :
21932 : const JSClass*
21933 0 : GetJSClass()
21934 : {
21935 0 : return sClass.ToJSClass();
21936 : }
21937 :
21938 : bool
21939 0 : Wrap(JSContext* aCx, mozilla::WebGLVertexArray* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
21940 : {
21941 : MOZ_ASSERT(static_cast<mozilla::WebGLVertexArray*>(aObject) ==
21942 : reinterpret_cast<mozilla::WebGLVertexArray*>(aObject),
21943 : "Multiple inheritance for mozilla::WebGLVertexArray is broken.");
21944 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
21945 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
21946 0 : MOZ_ASSERT(!aCache->GetWrapper(),
21947 : "You should probably not be using Wrap() directly; use "
21948 : "GetOrCreateDOMReflector instead");
21949 :
21950 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
21951 : "nsISupports must be on our primary inheritance chain");
21952 :
21953 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
21954 0 : if (!global) {
21955 0 : return false;
21956 : }
21957 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
21958 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
21959 :
21960 : // That might have ended up wrapping us already, due to the wonders
21961 : // of XBL. Check for that, and bail out as needed.
21962 0 : aReflector.set(aCache->GetWrapper());
21963 0 : if (aReflector) {
21964 : #ifdef DEBUG
21965 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
21966 : #endif // DEBUG
21967 0 : return true;
21968 : }
21969 :
21970 0 : JSAutoCompartment ac(aCx, global);
21971 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
21972 0 : if (!canonicalProto) {
21973 0 : return false;
21974 : }
21975 0 : JS::Rooted<JSObject*> proto(aCx);
21976 0 : if (aGivenProto) {
21977 0 : proto = aGivenProto;
21978 : // Unfortunately, while aGivenProto was in the compartment of aCx
21979 : // coming in, we changed compartments to that of "parent" so may need
21980 : // to wrap the proto here.
21981 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
21982 0 : if (!JS_WrapObject(aCx, &proto)) {
21983 0 : return false;
21984 : }
21985 : }
21986 : } else {
21987 0 : proto = canonicalProto;
21988 : }
21989 :
21990 0 : BindingJSObjectCreator<mozilla::WebGLVertexArray> creator(aCx);
21991 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
21992 0 : if (!aReflector) {
21993 0 : return false;
21994 : }
21995 :
21996 0 : aCache->SetWrapper(aReflector);
21997 0 : creator.InitializationSucceeded();
21998 :
21999 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
22000 : aCache->GetWrapperPreserveColor() == aReflector);
22001 : // If proto != canonicalProto, we have to preserve our wrapper;
22002 : // otherwise we won't be able to properly recreate it later, since
22003 : // we won't know what proto to use. Note that we don't check
22004 : // aGivenProto here, since it's entirely possible (and even
22005 : // somewhat common) to have a non-null aGivenProto which is the
22006 : // same as canonicalProto.
22007 0 : if (proto != canonicalProto) {
22008 0 : PreserveWrapper(aObject);
22009 : }
22010 :
22011 0 : return true;
22012 : }
22013 :
22014 : const NativePropertyHooks sNativePropertyHooks[] = { {
22015 : nullptr,
22016 : nullptr,
22017 : nullptr,
22018 : { nullptr, nullptr },
22019 : prototypes::id::WebGLVertexArrayObject,
22020 : constructors::id::WebGLVertexArrayObject,
22021 : nullptr,
22022 : &DefaultXrayExpandoObjectClass
22023 : } };
22024 :
22025 : void
22026 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
22027 : {
22028 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
22029 0 : if (!parentProto) {
22030 0 : return;
22031 : }
22032 :
22033 0 : JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
22034 0 : if (!constructorProto) {
22035 0 : return;
22036 : }
22037 :
22038 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::WebGLVertexArrayObject);
22039 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::WebGLVertexArrayObject);
22040 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
22041 : &sPrototypeClass.mBase, protoCache,
22042 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
22043 : interfaceCache,
22044 : nullptr,
22045 : nullptr,
22046 : "WebGLVertexArrayObject", aDefineOnGlobal,
22047 : nullptr,
22048 0 : false);
22049 : }
22050 :
22051 : JS::Handle<JSObject*>
22052 0 : GetProtoObjectHandle(JSContext* aCx)
22053 : {
22054 : /* Get the interface prototype object for this class. This will create the
22055 : object as needed. */
22056 0 : bool aDefineOnGlobal = true;
22057 :
22058 : /* Make sure our global is sane. Hopefully we can remove this sometime */
22059 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
22060 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
22061 0 : return nullptr;
22062 : }
22063 :
22064 : /* Check to see whether the interface objects are already installed */
22065 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
22066 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::WebGLVertexArrayObject)) {
22067 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
22068 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
22069 : }
22070 :
22071 : /*
22072 : * The object might _still_ be null, but that's OK.
22073 : *
22074 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
22075 : * traced by TraceProtoAndIfaceCache() and its contents are never
22076 : * changed after they have been set.
22077 : *
22078 : * Calling address() avoids the read read barrier that does gray
22079 : * unmarking, but it's not possible for the object to be gray here.
22080 : */
22081 :
22082 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::WebGLVertexArrayObject);
22083 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
22084 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
22085 : }
22086 :
22087 : JS::Handle<JSObject*>
22088 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
22089 : {
22090 : /* Get the interface object for this class. This will create the object as
22091 : needed. */
22092 :
22093 : /* Make sure our global is sane. Hopefully we can remove this sometime */
22094 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
22095 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
22096 0 : return nullptr;
22097 : }
22098 :
22099 : /* Check to see whether the interface objects are already installed */
22100 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
22101 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::WebGLVertexArrayObject)) {
22102 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
22103 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
22104 : }
22105 :
22106 : /*
22107 : * The object might _still_ be null, but that's OK.
22108 : *
22109 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
22110 : * traced by TraceProtoAndIfaceCache() and its contents are never
22111 : * changed after they have been set.
22112 : *
22113 : * Calling address() avoids the read read barrier that does gray
22114 : * unmarking, but it's not possible for the object to be gray here.
22115 : */
22116 :
22117 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::WebGLVertexArrayObject);
22118 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
22119 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
22120 : }
22121 :
22122 : JSObject*
22123 0 : GetConstructorObject(JSContext* aCx)
22124 : {
22125 0 : return GetConstructorObjectHandle(aCx);
22126 : }
22127 :
22128 : } // namespace WebGLVertexArrayObjectBinding
22129 :
22130 :
22131 :
22132 : } // namespace dom
22133 : } // namespace mozilla
|