Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM RTCTrackEvent.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "AtomList.h"
4 : #include "DOMMediaStream.h"
5 : #include "EventBinding.h"
6 : #include "RTCRtpReceiverBinding.h"
7 : #include "RTCTrackEventBinding.h"
8 : #include "WrapperFactory.h"
9 : #include "XrayWrapper.h"
10 : #include "mozilla/OwningNonNull.h"
11 : #include "mozilla/Preferences.h"
12 : #include "mozilla/dom/BindingUtils.h"
13 : #include "mozilla/dom/DOMJSClass.h"
14 : #include "mozilla/dom/MediaStreamTrack.h"
15 : #include "mozilla/dom/NonRefcountedDOMObject.h"
16 : #include "mozilla/dom/PrimitiveConversions.h"
17 : #include "mozilla/dom/RTCTrackEvent.h"
18 : #include "mozilla/dom/ScriptSettings.h"
19 : #include "mozilla/dom/XrayExpandoClass.h"
20 :
21 : namespace mozilla {
22 : namespace dom {
23 :
24 :
25 0 : RTCTrackEventInit::RTCTrackEventInit()
26 0 : : EventInit(FastDictionaryInitializer())
27 : {
28 : // Safe to pass a null context if we pass a null value
29 0 : Init(nullptr, JS::NullHandleValue);
30 0 : }
31 :
32 :
33 :
34 : bool
35 0 : RTCTrackEventInit::InitIds(JSContext* cx, RTCTrackEventInitAtoms* atomsCache)
36 : {
37 0 : MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache));
38 :
39 : // Initialize these in reverse order so that any failure leaves the first one
40 : // uninitialized.
41 0 : if (!atomsCache->track_id.init(cx, "track") ||
42 0 : !atomsCache->streams_id.init(cx, "streams") ||
43 0 : !atomsCache->receiver_id.init(cx, "receiver")) {
44 0 : return false;
45 : }
46 0 : return true;
47 : }
48 :
49 : bool
50 0 : RTCTrackEventInit::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
51 : {
52 : // Passing a null JSContext is OK only if we're initing from null,
53 : // Since in that case we will not have to do any property gets
54 : // Also evaluate isNullOrUndefined in order to avoid false-positive
55 : // checkers by static analysis tools
56 0 : MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
57 0 : RTCTrackEventInitAtoms* atomsCache = nullptr;
58 0 : if (cx) {
59 0 : atomsCache = GetAtomCache<RTCTrackEventInitAtoms>(cx);
60 0 : if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
61 0 : return false;
62 : }
63 : }
64 :
65 : // Per spec, we init the parent's members first
66 0 : if (!EventInit::Init(cx, val)) {
67 0 : return false;
68 : }
69 :
70 0 : bool isNull = val.isNullOrUndefined();
71 : // We only need these if !isNull, in which case we have |cx|.
72 0 : Maybe<JS::Rooted<JSObject *> > object;
73 0 : Maybe<JS::Rooted<JS::Value> > temp;
74 0 : if (!isNull) {
75 0 : MOZ_ASSERT(cx);
76 0 : object.emplace(cx, &val.toObject());
77 0 : temp.emplace(cx);
78 : }
79 0 : if (!isNull) {
80 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->receiver_id, temp.ptr())) {
81 0 : return false;
82 : }
83 : }
84 0 : if (!isNull && !temp->isUndefined()) {
85 0 : if (temp.ref().isObject()) {
86 : static_assert(IsRefcounted<mozilla::dom::RTCRtpReceiver>::value, "We can only store refcounted classes.");{
87 0 : nsresult rv = UnwrapObject<prototypes::id::RTCRtpReceiver, mozilla::dom::RTCRtpReceiver>(temp.ptr(), mReceiver);
88 0 : if (NS_FAILED(rv)) {
89 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "'receiver' member of RTCTrackEventInit", "RTCRtpReceiver");
90 0 : return false;
91 : }
92 : }
93 : } else {
94 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "'receiver' member of RTCTrackEventInit");
95 0 : return false;
96 : }
97 0 : mIsAnyMemberPresent = true;
98 0 : } else if (cx) {
99 : // Don't error out if we have no cx. In that
100 : // situation the caller is default-constructing us and we'll
101 : // just assume they know what they're doing.
102 0 : return ThrowErrorMessage(cx, MSG_MISSING_REQUIRED_DICTIONARY_MEMBER,
103 0 : "'receiver' member of RTCTrackEventInit");
104 : }
105 :
106 0 : if (!isNull) {
107 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->streams_id, temp.ptr())) {
108 0 : return false;
109 : }
110 : }
111 0 : if (!isNull && !temp->isUndefined()) {
112 0 : if (temp.ref().isObject()) {
113 0 : JS::ForOfIterator iter(cx);
114 0 : if (!iter.init(temp.ref(), JS::ForOfIterator::AllowNonIterable)) {
115 0 : return false;
116 : }
117 0 : if (!iter.valueIsIterable()) {
118 0 : ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "'streams' member of RTCTrackEventInit");
119 0 : return false;
120 : }
121 0 : Sequence<OwningNonNull<mozilla::DOMMediaStream>> &arr = mStreams;
122 0 : JS::Rooted<JS::Value> temp(cx);
123 : while (true) {
124 : bool done;
125 0 : if (!iter.next(&temp, &done)) {
126 0 : return false;
127 : }
128 0 : if (done) {
129 0 : break;
130 : }
131 0 : OwningNonNull<mozilla::DOMMediaStream>* slotPtr = arr.AppendElement(mozilla::fallible);
132 0 : if (!slotPtr) {
133 0 : JS_ReportOutOfMemory(cx);
134 0 : return false;
135 : }
136 0 : OwningNonNull<mozilla::DOMMediaStream>& slot = *slotPtr;
137 0 : if (temp.isObject()) {
138 : static_assert(IsRefcounted<mozilla::DOMMediaStream>::value, "We can only store refcounted classes.");{
139 0 : nsresult rv = UnwrapObject<prototypes::id::MediaStream, mozilla::DOMMediaStream>(&temp, slot);
140 0 : if (NS_FAILED(rv)) {
141 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Element of 'streams' member of RTCTrackEventInit", "MediaStream");
142 0 : return false;
143 : }
144 : }
145 : } else {
146 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Element of 'streams' member of RTCTrackEventInit");
147 0 : return false;
148 : }
149 0 : }
150 : } else {
151 0 : ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "'streams' member of RTCTrackEventInit");
152 0 : return false;
153 : }
154 : } else {
155 : /* Array is already empty; nothing to do */
156 : }
157 0 : mIsAnyMemberPresent = true;
158 :
159 0 : if (!isNull) {
160 0 : if (!JS_GetPropertyById(cx, *object, atomsCache->track_id, temp.ptr())) {
161 0 : return false;
162 : }
163 : }
164 0 : if (!isNull && !temp->isUndefined()) {
165 0 : if (temp.ref().isObject()) {
166 : static_assert(IsRefcounted<mozilla::dom::MediaStreamTrack>::value, "We can only store refcounted classes.");{
167 0 : nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(temp.ptr(), mTrack);
168 0 : if (NS_FAILED(rv)) {
169 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "'track' member of RTCTrackEventInit", "MediaStreamTrack");
170 0 : return false;
171 : }
172 : }
173 : } else {
174 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "'track' member of RTCTrackEventInit");
175 0 : return false;
176 : }
177 0 : mIsAnyMemberPresent = true;
178 0 : } else if (cx) {
179 : // Don't error out if we have no cx. In that
180 : // situation the caller is default-constructing us and we'll
181 : // just assume they know what they're doing.
182 0 : return ThrowErrorMessage(cx, MSG_MISSING_REQUIRED_DICTIONARY_MEMBER,
183 0 : "'track' member of RTCTrackEventInit");
184 : }
185 0 : return true;
186 : }
187 :
188 : bool
189 0 : RTCTrackEventInit::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
190 : {
191 0 : RTCTrackEventInitAtoms* atomsCache = GetAtomCache<RTCTrackEventInitAtoms>(cx);
192 0 : if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
193 0 : return false;
194 : }
195 :
196 : // Per spec, we define the parent's members first
197 0 : if (!EventInit::ToObjectInternal(cx, rval)) {
198 0 : return false;
199 : }
200 0 : JS::Rooted<JSObject*> obj(cx, &rval.toObject());
201 :
202 : do {
203 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
204 0 : JS::Rooted<JS::Value> temp(cx);
205 0 : OwningNonNull<mozilla::dom::RTCRtpReceiver> const & currentValue = mReceiver;
206 0 : if (!GetOrCreateDOMReflector(cx, currentValue, &temp)) {
207 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
208 0 : return false;
209 : }
210 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->receiver_id, temp, JSPROP_ENUMERATE)) {
211 0 : return false;
212 : }
213 0 : break;
214 : } while(0);
215 :
216 : do {
217 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
218 0 : JS::Rooted<JS::Value> temp(cx);
219 0 : Sequence<OwningNonNull<mozilla::DOMMediaStream>> const & currentValue = mStreams;
220 :
221 0 : uint32_t length = currentValue.Length();
222 0 : JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
223 0 : if (!returnArray) {
224 0 : return false;
225 : }
226 : // Scope for 'tmp'
227 : {
228 0 : JS::Rooted<JS::Value> tmp(cx);
229 0 : for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
230 : // Control block to let us common up the JS_DefineElement calls when there
231 : // are different ways to succeed at wrapping the object.
232 : do {
233 0 : if (!GetOrCreateDOMReflector(cx, currentValue[sequenceIdx0], &tmp)) {
234 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
235 0 : return false;
236 : }
237 0 : break;
238 : } while (0);
239 0 : if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
240 : JSPROP_ENUMERATE)) {
241 0 : return false;
242 : }
243 : }
244 : }
245 0 : temp.setObject(*returnArray);
246 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->streams_id, temp, JSPROP_ENUMERATE)) {
247 0 : return false;
248 : }
249 0 : break;
250 : } while(0);
251 :
252 : do {
253 : // block for our 'break' successCode and scope for 'temp' and 'currentValue'
254 0 : JS::Rooted<JS::Value> temp(cx);
255 0 : OwningNonNull<mozilla::dom::MediaStreamTrack> const & currentValue = mTrack;
256 0 : if (!GetOrCreateDOMReflector(cx, currentValue, &temp)) {
257 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
258 0 : return false;
259 : }
260 0 : if (!JS_DefinePropertyById(cx, obj, atomsCache->track_id, temp, JSPROP_ENUMERATE)) {
261 0 : return false;
262 : }
263 0 : break;
264 : } while(0);
265 :
266 0 : return true;
267 : }
268 :
269 : void
270 0 : RTCTrackEventInit::TraceDictionary(JSTracer* trc)
271 : {
272 0 : EventInit::TraceDictionary(trc);
273 0 : }
274 :
275 : RTCTrackEventInit&
276 0 : RTCTrackEventInit::operator=(const RTCTrackEventInit& aOther)
277 : {
278 0 : EventInit::operator=(aOther);
279 0 : mReceiver = aOther.mReceiver;
280 0 : mStreams = aOther.mStreams;
281 0 : mTrack = aOther.mTrack;
282 0 : return *this;
283 : }
284 :
285 : namespace binding_detail {
286 : } // namespace binding_detail
287 :
288 :
289 : namespace RTCTrackEventBinding {
290 :
291 : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<EventBinding::NativeType>::value,
292 : "Can't inherit from an interface with a different ownership model.");
293 :
294 : static bool
295 0 : get_receiver(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::RTCTrackEvent* self, JSJitGetterCallArgs args)
296 : {
297 0 : auto result(StrongOrRawPtr<mozilla::dom::RTCRtpReceiver>(self->Receiver()));
298 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
299 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
300 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
301 0 : return false;
302 : }
303 0 : return true;
304 : }
305 :
306 : static const JSJitInfo receiver_getterinfo = {
307 : { (JSJitGetterOp)get_receiver },
308 : { prototypes::id::RTCTrackEvent },
309 : { PrototypeTraits<prototypes::id::RTCTrackEvent>::Depth },
310 : JSJitInfo::Getter,
311 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
312 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
313 : false, /* isInfallible. False in setters. */
314 : false, /* isMovable. Not relevant for setters. */
315 : false, /* isEliminatable. Not relevant for setters. */
316 : false, /* isAlwaysInSlot. Only relevant for getters. */
317 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
318 : false, /* isTypedMethod. Only relevant for methods. */
319 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
320 : };
321 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
322 : static_assert(0 < 2, "There is no slot for us");
323 :
324 : static bool
325 0 : get_track(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::RTCTrackEvent* self, JSJitGetterCallArgs args)
326 : {
327 0 : auto result(StrongOrRawPtr<mozilla::dom::MediaStreamTrack>(self->Track()));
328 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
329 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
330 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
331 0 : return false;
332 : }
333 0 : return true;
334 : }
335 :
336 : static const JSJitInfo track_getterinfo = {
337 : { (JSJitGetterOp)get_track },
338 : { prototypes::id::RTCTrackEvent },
339 : { PrototypeTraits<prototypes::id::RTCTrackEvent>::Depth },
340 : JSJitInfo::Getter,
341 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
342 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
343 : false, /* isInfallible. False in setters. */
344 : false, /* isMovable. Not relevant for setters. */
345 : false, /* isEliminatable. Not relevant for setters. */
346 : false, /* isAlwaysInSlot. Only relevant for getters. */
347 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
348 : false, /* isTypedMethod. Only relevant for methods. */
349 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
350 : };
351 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
352 : static_assert(0 < 2, "There is no slot for us");
353 :
354 : static bool
355 0 : get_streams(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::RTCTrackEvent* self, JSJitGetterCallArgs args)
356 : {
357 : // Have to either root across the getter call or reget after.
358 : bool isXray;
359 0 : JS::Rooted<JSObject*> slotStorage(cx, GetCachedSlotStorageObject(cx, obj, &isXray));
360 0 : if (!slotStorage) {
361 0 : return false;
362 : }
363 0 : const size_t slotIndex = isXray ? (xpc::JSSLOT_EXPANDO_COUNT + 0) : (DOM_INSTANCE_RESERVED_SLOTS + 0);
364 0 : MOZ_ASSERT(JSCLASS_RESERVED_SLOTS(js::GetObjectClass(slotStorage)) > slotIndex);
365 : {
366 : // Scope for cachedVal
367 0 : JS::Value cachedVal = js::GetReservedSlot(slotStorage, slotIndex);
368 0 : if (!cachedVal.isUndefined()) {
369 0 : args.rval().set(cachedVal);
370 : // The cached value is in the compartment of slotStorage,
371 : // so wrap into the caller compartment as needed.
372 0 : return MaybeWrapNonDOMObjectValue(cx, args.rval());
373 : }
374 : }
375 :
376 0 : nsTArray<StrongPtrForMember<mozilla::DOMMediaStream>::Type> result;
377 0 : self->GetStreams(result);
378 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
379 : {
380 0 : JS::Rooted<JSObject*> conversionScope(cx, isXray ? obj : slotStorage);
381 0 : JSAutoCompartment ac(cx, conversionScope);
382 : do { // block we break out of when done wrapping
383 :
384 0 : uint32_t length = result.Length();
385 0 : JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
386 0 : if (!returnArray) {
387 0 : return false;
388 : }
389 : // Scope for 'tmp'
390 : {
391 0 : JS::Rooted<JS::Value> tmp(cx);
392 0 : for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
393 : // Control block to let us common up the JS_DefineElement calls when there
394 : // are different ways to succeed at wrapping the object.
395 : do {
396 0 : if (!GetOrCreateDOMReflector(cx, result[sequenceIdx0], &tmp)) {
397 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
398 0 : return false;
399 : }
400 0 : break;
401 : } while (0);
402 0 : if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
403 : JSPROP_ENUMERATE)) {
404 0 : return false;
405 : }
406 : }
407 : }
408 0 : args.rval().setObject(*returnArray);
409 0 : break;
410 : } while (0);
411 0 : JS::Rooted<JSObject*> rvalObj(cx, &args.rval().toObject());
412 0 : if (!JS_FreezeObject(cx, rvalObj)) {
413 0 : return false;
414 : }
415 : }
416 : { // And now store things in the compartment of our slotStorage.
417 0 : JSAutoCompartment ac(cx, slotStorage);
418 : // Make a copy so that we don't do unnecessary wrapping on args.rval().
419 0 : JS::Rooted<JS::Value> storedVal(cx, args.rval());
420 0 : if (!MaybeWrapNonDOMObjectValue(cx, &storedVal)) {
421 0 : return false;
422 : }
423 0 : js::SetReservedSlot(slotStorage, slotIndex, storedVal);
424 0 : if (!isXray) {
425 : // In the Xray case we don't need to do this, because getting the
426 : // expando object already preserved our wrapper.
427 0 : PreserveWrapper(self);
428 : }
429 : }
430 : // And now make sure args.rval() is in the caller compartment
431 0 : return MaybeWrapNonDOMObjectValue(cx, args.rval());
432 : }
433 :
434 : static const JSJitInfo streams_getterinfo = {
435 : { (JSJitGetterOp)get_streams },
436 : { prototypes::id::RTCTrackEvent },
437 : { PrototypeTraits<prototypes::id::RTCTrackEvent>::Depth },
438 : JSJitInfo::Getter,
439 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
440 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
441 : false, /* isInfallible. False in setters. */
442 : true, /* isMovable. Not relevant for setters. */
443 : true, /* isEliminatable. Not relevant for setters. */
444 : false, /* isAlwaysInSlot. Only relevant for getters. */
445 : true, /* isLazilyCachedInSlot. Only relevant for getters. */
446 : false, /* isTypedMethod. Only relevant for methods. */
447 : (DOM_INSTANCE_RESERVED_SLOTS + 0) /* Reserved slot index, if we're stored in a slot, else 0. */
448 : };
449 : static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) <= JSJitInfo::maxSlotIndex, "We won't fit");
450 : static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) < 2, "There is no slot for us");
451 :
452 : static bool
453 0 : get_isTrusted(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::RTCTrackEvent* self, JSJitGetterCallArgs args)
454 : {
455 0 : bool result(self->IsTrusted());
456 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
457 0 : args.rval().setBoolean(result);
458 0 : return true;
459 : }
460 :
461 : static const JSJitInfo isTrusted_getterinfo = {
462 : { (JSJitGetterOp)get_isTrusted },
463 : { prototypes::id::RTCTrackEvent },
464 : { PrototypeTraits<prototypes::id::RTCTrackEvent>::Depth },
465 : JSJitInfo::Getter,
466 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
467 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
468 : true, /* isInfallible. False in setters. */
469 : true, /* isMovable. Not relevant for setters. */
470 : true, /* isEliminatable. Not relevant for setters. */
471 : false, /* isAlwaysInSlot. Only relevant for getters. */
472 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
473 : false, /* isTypedMethod. Only relevant for methods. */
474 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
475 : };
476 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
477 : static_assert(0 < 2, "There is no slot for us");
478 :
479 : static bool
480 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
481 : {
482 0 : mozilla::dom::RTCTrackEvent* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::RTCTrackEvent>(obj);
483 : // We don't want to preserve if we don't have a wrapper, and we
484 : // obviously can't preserve if we're not initialized.
485 0 : if (self && self->GetWrapperPreserveColor()) {
486 0 : PreserveWrapper(self);
487 : }
488 0 : return true;
489 : }
490 :
491 : static void
492 0 : _finalize(js::FreeOp* fop, JSObject* obj)
493 : {
494 0 : mozilla::dom::RTCTrackEvent* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::RTCTrackEvent>(obj);
495 0 : if (self) {
496 0 : ClearWrapper(self, self, obj);
497 0 : AddForDeferredFinalization<mozilla::dom::RTCTrackEvent>(self);
498 : }
499 0 : }
500 :
501 : static void
502 0 : _objectMoved(JSObject* obj, const JSObject* old)
503 : {
504 0 : mozilla::dom::RTCTrackEvent* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::RTCTrackEvent>(obj);
505 0 : if (self) {
506 0 : UpdateWrapper(self, self, obj, old);
507 : }
508 0 : }
509 :
510 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
511 : #if defined(__clang__)
512 : #pragma clang diagnostic push
513 : #pragma clang diagnostic ignored "-Wmissing-braces"
514 : #endif
515 : static const JSPropertySpec sAttributes_specs[] = {
516 : { "receiver", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &receiver_getterinfo, nullptr, nullptr },
517 : { "track", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &track_getterinfo, nullptr, nullptr },
518 : { "streams", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &streams_getterinfo, nullptr, nullptr },
519 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
520 : };
521 : #if defined(__clang__)
522 : #pragma clang diagnostic pop
523 : #endif
524 :
525 :
526 : // Can't be const because the pref-enabled boolean needs to be writable
527 : static Prefable<const JSPropertySpec> sAttributes[] = {
528 : { nullptr, &sAttributes_specs[0] },
529 : { nullptr, nullptr }
530 : };
531 :
532 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
533 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
534 : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
535 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
536 :
537 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
538 : #if defined(__clang__)
539 : #pragma clang diagnostic push
540 : #pragma clang diagnostic ignored "-Wmissing-braces"
541 : #endif
542 : static const JSPropertySpec sUnforgeableAttributes_specs[] = {
543 : { "isTrusted", JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_PERMANENT, GenericBindingGetter, &isTrusted_getterinfo, nullptr, nullptr },
544 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
545 : };
546 : #if defined(__clang__)
547 : #pragma clang diagnostic pop
548 : #endif
549 :
550 :
551 : // Can't be const because the pref-enabled boolean needs to be writable
552 : static Prefable<const JSPropertySpec> sUnforgeableAttributes[] = {
553 : { nullptr, &sUnforgeableAttributes_specs[0] },
554 : { nullptr, nullptr }
555 : };
556 :
557 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
558 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
559 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
560 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
561 :
562 :
563 : static uint16_t sNativeProperties_sortedPropertyIndices[4];
564 : static PropertyInfo sNativeProperties_propertyInfos[4];
565 :
566 : static const NativePropertiesN<2> sNativeProperties = {
567 : false, 0,
568 : false, 0,
569 : false, 0,
570 : true, 0 /* sAttributes */,
571 : false, 0,
572 : true, 1 /* sUnforgeableAttributes */,
573 : false, 0,
574 : -1,
575 : 4,
576 : sNativeProperties_sortedPropertyIndices,
577 : {
578 : { sAttributes, &sNativeProperties_propertyInfos[0] },
579 : { sUnforgeableAttributes, &sNativeProperties_propertyInfos[3] }
580 : }
581 : };
582 : static_assert(4 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
583 : "We have a property info count that is oversized");
584 :
585 : static bool
586 0 : _constructor(JSContext* cx, unsigned argc, JS::Value* vp)
587 : {
588 0 : JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
589 0 : JS::Rooted<JSObject*> obj(cx, &args.callee());
590 0 : if (!args.isConstructing()) {
591 : // XXXbz wish I could get the name from the callee instead of
592 : // Adding more relocations
593 0 : return ThrowConstructorWithoutNew(cx, "RTCTrackEvent");
594 : }
595 :
596 0 : GlobalObject global(cx, obj);
597 0 : if (global.Failed()) {
598 0 : return false;
599 : }
600 :
601 0 : JS::Rooted<JSObject*> desiredProto(cx);
602 0 : if (!GetDesiredProto(cx, args, &desiredProto)) {
603 0 : return false;
604 : }
605 :
606 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
607 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "RTCTrackEvent");
608 : }
609 0 : bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
610 0 : binding_detail::FakeString arg0;
611 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
612 0 : return false;
613 : }
614 0 : binding_detail::FastRTCTrackEventInit arg1;
615 0 : if (!arg1.Init(cx, args[1], "Argument 2 of RTCTrackEvent.constructor", false)) {
616 0 : return false;
617 : }
618 0 : Maybe<JSAutoCompartment> ac;
619 0 : if (objIsXray) {
620 0 : obj = js::CheckedUnwrap(obj);
621 0 : if (!obj) {
622 0 : return false;
623 : }
624 0 : ac.emplace(cx, obj);
625 0 : if (!JS_WrapObject(cx, &desiredProto)) {
626 0 : return false;
627 : }
628 : }
629 0 : binding_detail::FastErrorResult rv;
630 0 : auto result(StrongOrRawPtr<mozilla::dom::RTCTrackEvent>(mozilla::dom::RTCTrackEvent::Constructor(global, NonNullHelper(Constify(arg0)), Constify(arg1), rv)));
631 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
632 0 : return false;
633 : }
634 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
635 : static_assert(!IsPointer<decltype(result)>::value,
636 : "NewObject implies that we need to keep the object alive with a strong reference.");
637 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) {
638 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
639 0 : return false;
640 : }
641 0 : return true;
642 : }
643 :
644 : static const js::ClassOps sInterfaceObjectClassOps = {
645 : nullptr, /* addProperty */
646 : nullptr, /* delProperty */
647 : nullptr, /* getProperty */
648 : nullptr, /* setProperty */
649 : nullptr, /* enumerate */
650 : nullptr, /* newEnumerate */
651 : nullptr, /* resolve */
652 : nullptr, /* mayResolve */
653 : nullptr, /* finalize */
654 : _constructor, /* call */
655 : nullptr, /* hasInstance */
656 : _constructor, /* construct */
657 : nullptr, /* trace */
658 : };
659 :
660 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
661 : {
662 : "Function",
663 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
664 : &sInterfaceObjectClassOps,
665 : JS_NULL_CLASS_SPEC,
666 : JS_NULL_CLASS_EXT,
667 : &sInterfaceObjectClassObjectOps
668 : },
669 : eInterface,
670 : true,
671 : prototypes::id::RTCTrackEvent,
672 : PrototypeTraits<prototypes::id::RTCTrackEvent>::Depth,
673 : sNativePropertyHooks,
674 : "function RTCTrackEvent() {\n [native code]\n}",
675 : EventBinding::GetConstructorObject
676 : };
677 :
678 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
679 : {
680 : "RTCTrackEventPrototype",
681 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE + 1 /* slot for the JSObject holding the unforgeable properties */),
682 : JS_NULL_CLASS_OPS,
683 : JS_NULL_CLASS_SPEC,
684 : JS_NULL_CLASS_EXT,
685 : JS_NULL_OBJECT_OPS
686 : },
687 : eInterfacePrototype,
688 : false,
689 : prototypes::id::RTCTrackEvent,
690 : PrototypeTraits<prototypes::id::RTCTrackEvent>::Depth,
691 : sNativePropertyHooks,
692 : "[object RTCTrackEventPrototype]",
693 : EventBinding::GetProtoObject
694 : };
695 :
696 : bool
697 0 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
698 : {
699 : static bool sPrefValue;
700 : static bool sPrefCacheSetUp = false;
701 0 : if (!sPrefCacheSetUp) {
702 0 : sPrefCacheSetUp = true;
703 0 : Preferences::AddBoolVarCache(&sPrefValue, "media.peerconnection.enabled");
704 : }
705 :
706 0 : return sPrefValue;
707 : }
708 :
709 : JSObject*
710 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
711 : {
712 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
713 : }
714 :
715 : static const js::ClassOps sClassOps = {
716 : _addProperty, /* addProperty */
717 : nullptr, /* delProperty */
718 : nullptr, /* getProperty */
719 : nullptr, /* setProperty */
720 : nullptr, /* enumerate */
721 : nullptr, /* newEnumerate */
722 : nullptr, /* resolve */
723 : nullptr, /* mayResolve */
724 : _finalize, /* finalize */
725 : nullptr, /* call */
726 : nullptr, /* hasInstance */
727 : nullptr, /* construct */
728 : nullptr, /* trace */
729 : };
730 :
731 : static const js::ClassExtension sClassExtension = {
732 : nullptr, /* weakmapKeyDelegateOp */
733 : _objectMoved /* objectMovedOp */
734 : };
735 :
736 : static const DOMJSClass sClass = {
737 : { "RTCTrackEvent",
738 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(2) | JSCLASS_SKIP_NURSERY_FINALIZE,
739 : &sClassOps,
740 : JS_NULL_CLASS_SPEC,
741 : &sClassExtension,
742 : JS_NULL_OBJECT_OPS
743 : },
744 : { prototypes::id::Event, prototypes::id::RTCTrackEvent, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
745 : IsBaseOf<nsISupports, mozilla::dom::RTCTrackEvent >::value,
746 : sNativePropertyHooks,
747 : FindAssociatedGlobalForNative<mozilla::dom::RTCTrackEvent>::Get,
748 : GetProtoObjectHandle,
749 : GetCCParticipant<mozilla::dom::RTCTrackEvent>::Get()
750 : };
751 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
752 : "Must have the right minimal number of reserved slots.");
753 : static_assert(2 >= 2,
754 : "Must have enough reserved slots.");
755 :
756 : const JSClass*
757 0 : GetJSClass()
758 : {
759 0 : return sClass.ToJSClass();
760 : }
761 :
762 : bool
763 0 : Wrap(JSContext* aCx, mozilla::dom::RTCTrackEvent* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
764 : {
765 : MOZ_ASSERT(static_cast<mozilla::dom::RTCTrackEvent*>(aObject) ==
766 : reinterpret_cast<mozilla::dom::RTCTrackEvent*>(aObject),
767 : "Multiple inheritance for mozilla::dom::RTCTrackEvent is broken.");
768 : MOZ_ASSERT(static_cast<mozilla::dom::Event*>(aObject) ==
769 : reinterpret_cast<mozilla::dom::Event*>(aObject),
770 : "Multiple inheritance for mozilla::dom::Event is broken.");
771 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
772 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
773 0 : MOZ_ASSERT(!aCache->GetWrapper(),
774 : "You should probably not be using Wrap() directly; use "
775 : "GetOrCreateDOMReflector instead");
776 :
777 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
778 : "nsISupports must be on our primary inheritance chain");
779 :
780 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
781 0 : if (!global) {
782 0 : return false;
783 : }
784 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
785 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
786 :
787 : // That might have ended up wrapping us already, due to the wonders
788 : // of XBL. Check for that, and bail out as needed.
789 0 : aReflector.set(aCache->GetWrapper());
790 0 : if (aReflector) {
791 : #ifdef DEBUG
792 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
793 : #endif // DEBUG
794 0 : return true;
795 : }
796 :
797 0 : JSAutoCompartment ac(aCx, global);
798 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
799 0 : if (!canonicalProto) {
800 0 : return false;
801 : }
802 0 : JS::Rooted<JSObject*> proto(aCx);
803 0 : if (aGivenProto) {
804 0 : proto = aGivenProto;
805 : // Unfortunately, while aGivenProto was in the compartment of aCx
806 : // coming in, we changed compartments to that of "parent" so may need
807 : // to wrap the proto here.
808 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
809 0 : if (!JS_WrapObject(aCx, &proto)) {
810 0 : return false;
811 : }
812 : }
813 : } else {
814 0 : proto = canonicalProto;
815 : }
816 :
817 0 : BindingJSObjectCreator<mozilla::dom::RTCTrackEvent> creator(aCx);
818 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
819 0 : if (!aReflector) {
820 0 : return false;
821 : }
822 :
823 0 : aCache->SetWrapper(aReflector);
824 :
825 : // Important: do unforgeable property setup after we have handed
826 : // over ownership of the C++ object to obj as needed, so that if
827 : // we fail and it ends up GCed it won't have problems in the
828 : // finalizer trying to drop its ownership of the C++ object.
829 : JS::Rooted<JSObject*> unforgeableHolder(aCx,
830 0 : &js::GetReservedSlot(canonicalProto, DOM_INTERFACE_PROTO_SLOTS_BASE).toObject());
831 0 : if (!JS_InitializePropertiesFromCompatibleNativeObject(aCx, aReflector, unforgeableHolder)) {
832 0 : aCache->ReleaseWrapper(aObject);
833 0 : aCache->ClearWrapper();
834 0 : return false;
835 : }
836 0 : creator.InitializationSucceeded();
837 :
838 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
839 : aCache->GetWrapperPreserveColor() == aReflector);
840 : // If proto != canonicalProto, we have to preserve our wrapper;
841 : // otherwise we won't be able to properly recreate it later, since
842 : // we won't know what proto to use. Note that we don't check
843 : // aGivenProto here, since it's entirely possible (and even
844 : // somewhat common) to have a non-null aGivenProto which is the
845 : // same as canonicalProto.
846 0 : if (proto != canonicalProto) {
847 0 : PreserveWrapper(aObject);
848 : }
849 :
850 0 : return true;
851 : }
852 :
853 : // This may allocate too many slots, because we only really need
854 : // slots for our non-interface-typed members that we cache. But
855 : // allocating slots only for those would make the slot index
856 : // computations much more complicated, so let's do this the simple
857 : // way for now.
858 : DEFINE_XRAY_EXPANDO_CLASS(static, sXrayExpandoObjectClass, 1);
859 :
860 : const NativePropertyHooks sNativePropertyHooks[] = { {
861 : nullptr,
862 : nullptr,
863 : nullptr,
864 : { sNativeProperties.Upcast(), nullptr },
865 : prototypes::id::RTCTrackEvent,
866 : constructors::id::RTCTrackEvent,
867 : EventBinding::sNativePropertyHooks,
868 : &sXrayExpandoObjectClass
869 : } };
870 :
871 : void
872 0 : ClearCachedStreamsValue(mozilla::dom::RTCTrackEvent* aObject)
873 : {
874 : JSObject* obj;
875 0 : obj = aObject->GetWrapper();
876 0 : if (!obj) {
877 0 : return;
878 : }
879 0 : js::SetReservedSlot(obj, (DOM_INSTANCE_RESERVED_SLOTS + 0), JS::UndefinedValue());
880 0 : xpc::ClearXrayExpandoSlots(obj, (xpc::JSSLOT_EXPANDO_COUNT + 0));
881 : }
882 :
883 : void
884 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
885 : {
886 0 : JS::Handle<JSObject*> parentProto(EventBinding::GetProtoObjectHandle(aCx));
887 0 : if (!parentProto) {
888 0 : return;
889 : }
890 :
891 0 : JS::Handle<JSObject*> constructorProto(EventBinding::GetConstructorObjectHandle(aCx));
892 0 : if (!constructorProto) {
893 0 : return;
894 : }
895 :
896 : static bool sIdsInited = false;
897 0 : if (!sIdsInited && NS_IsMainThread()) {
898 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
899 0 : return;
900 : }
901 0 : sIdsInited = true;
902 : }
903 :
904 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::RTCTrackEvent);
905 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::RTCTrackEvent);
906 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
907 : &sPrototypeClass.mBase, protoCache,
908 : constructorProto, &sInterfaceObjectClass.mBase, 2, nullptr,
909 : interfaceCache,
910 : sNativeProperties.Upcast(),
911 : nullptr,
912 : "RTCTrackEvent", aDefineOnGlobal,
913 : nullptr,
914 0 : false);
915 :
916 0 : JS::Rooted<JSObject*> unforgeableHolder(aCx);
917 : {
918 0 : JS::Rooted<JSObject*> holderProto(aCx, *protoCache);
919 0 : unforgeableHolder = JS_NewObjectWithoutMetadata(aCx, sClass.ToJSClass(), holderProto);
920 0 : if (!unforgeableHolder) {
921 0 : *protoCache = nullptr;
922 0 : if (interfaceCache) {
923 0 : *interfaceCache = nullptr;
924 : }
925 0 : return;
926 : }
927 : }
928 :
929 0 : if (!DefineUnforgeableAttributes(aCx, unforgeableHolder, sUnforgeableAttributes)) {
930 0 : *protoCache = nullptr;
931 0 : if (interfaceCache) {
932 0 : *interfaceCache = nullptr;
933 : }
934 0 : return;
935 : }
936 :
937 0 : if (*protoCache) {
938 0 : js::SetReservedSlot(*protoCache, DOM_INTERFACE_PROTO_SLOTS_BASE,
939 0 : JS::ObjectValue(*unforgeableHolder));
940 : }
941 : }
942 :
943 : JS::Handle<JSObject*>
944 0 : GetProtoObjectHandle(JSContext* aCx)
945 : {
946 : /* Get the interface prototype object for this class. This will create the
947 : object as needed. */
948 0 : bool aDefineOnGlobal = true;
949 :
950 : /* Make sure our global is sane. Hopefully we can remove this sometime */
951 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
952 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
953 0 : return nullptr;
954 : }
955 :
956 : /* Check to see whether the interface objects are already installed */
957 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
958 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::RTCTrackEvent)) {
959 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
960 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
961 : }
962 :
963 : /*
964 : * The object might _still_ be null, but that's OK.
965 : *
966 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
967 : * traced by TraceProtoAndIfaceCache() and its contents are never
968 : * changed after they have been set.
969 : *
970 : * Calling address() avoids the read read barrier that does gray
971 : * unmarking, but it's not possible for the object to be gray here.
972 : */
973 :
974 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::RTCTrackEvent);
975 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
976 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
977 : }
978 :
979 : JS::Handle<JSObject*>
980 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
981 : {
982 : /* Get the interface object for this class. This will create the object as
983 : needed. */
984 :
985 : /* Make sure our global is sane. Hopefully we can remove this sometime */
986 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
987 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
988 0 : return nullptr;
989 : }
990 :
991 : /* Check to see whether the interface objects are already installed */
992 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
993 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::RTCTrackEvent)) {
994 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
995 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
996 : }
997 :
998 : /*
999 : * The object might _still_ be null, but that's OK.
1000 : *
1001 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
1002 : * traced by TraceProtoAndIfaceCache() and its contents are never
1003 : * changed after they have been set.
1004 : *
1005 : * Calling address() avoids the read read barrier that does gray
1006 : * unmarking, but it's not possible for the object to be gray here.
1007 : */
1008 :
1009 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::RTCTrackEvent);
1010 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
1011 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
1012 : }
1013 :
1014 : JSObject*
1015 0 : GetConstructorObject(JSContext* aCx)
1016 : {
1017 0 : return GetConstructorObjectHandle(aCx);
1018 : }
1019 :
1020 : } // namespace RTCTrackEventBinding
1021 :
1022 :
1023 :
1024 : } // namespace dom
1025 : } // namespace mozilla
|