LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dom/bindings - AudioTrackListBinding.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 308 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 31 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM AudioTrackList.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "AudioTrackListBinding.h"
       4             : #include "EventHandlerBinding.h"
       5             : #include "EventTargetBinding.h"
       6             : #include "WrapperFactory.h"
       7             : #include "mozilla/OwningNonNull.h"
       8             : #include "mozilla/Preferences.h"
       9             : #include "mozilla/dom/AudioTrack.h"
      10             : #include "mozilla/dom/AudioTrackList.h"
      11             : #include "mozilla/dom/BindingUtils.h"
      12             : #include "mozilla/dom/DOMJSClass.h"
      13             : #include "mozilla/dom/DOMJSProxyHandler.h"
      14             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      15             : #include "mozilla/dom/Nullable.h"
      16             : #include "mozilla/dom/PrimitiveConversions.h"
      17             : #include "mozilla/dom/XrayExpandoClass.h"
      18             : 
      19             : namespace mozilla {
      20             : namespace dom {
      21             : 
      22             : namespace AudioTrackListBinding {
      23             : 
      24             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<EventTargetBinding::NativeType>::value,
      25             :               "Can't inherit from an interface with a different ownership model.");
      26             : 
      27             : static bool
      28           0 : get_length(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioTrackList* self, JSJitGetterCallArgs args)
      29             : {
      30           0 :   uint32_t result(self->Length());
      31           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      32           0 :   args.rval().setNumber(result);
      33           0 :   return true;
      34             : }
      35             : 
      36             : static const JSJitInfo length_getterinfo = {
      37             :   { (JSJitGetterOp)get_length },
      38             :   { prototypes::id::AudioTrackList },
      39             :   { PrototypeTraits<prototypes::id::AudioTrackList>::Depth },
      40             :   JSJitInfo::Getter,
      41             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      42             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
      43             :   true,  /* isInfallible. False in setters. */
      44             :   false,  /* isMovable.  Not relevant for setters. */
      45             :   false, /* isEliminatable.  Not relevant for setters. */
      46             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      47             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      48             :   false,  /* isTypedMethod.  Only relevant for methods. */
      49             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      50             : };
      51             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      52             : static_assert(0 < 1, "There is no slot for us");
      53             : 
      54             : static bool
      55           0 : getTrackById(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioTrackList* self, const JSJitMethodCallArgs& args)
      56             : {
      57           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
      58           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "AudioTrackList.getTrackById");
      59             :   }
      60           0 :   binding_detail::FakeString arg0;
      61           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
      62           0 :     return false;
      63             :   }
      64           0 :   auto result(StrongOrRawPtr<mozilla::dom::AudioTrack>(self->GetTrackById(NonNullHelper(Constify(arg0)))));
      65           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      66           0 :   if (!result) {
      67           0 :     args.rval().setNull();
      68           0 :     return true;
      69             :   }
      70           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      71           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      72           0 :     return false;
      73             :   }
      74           0 :   return true;
      75             : }
      76             : 
      77             : static const JSJitInfo getTrackById_methodinfo = {
      78             :   { (JSJitGetterOp)getTrackById },
      79             :   { prototypes::id::AudioTrackList },
      80             :   { PrototypeTraits<prototypes::id::AudioTrackList>::Depth },
      81             :   JSJitInfo::Method,
      82             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      83             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
      84             :   false,  /* isInfallible. False in setters. */
      85             :   false,  /* isMovable.  Not relevant for setters. */
      86             :   false, /* isEliminatable.  Not relevant for setters. */
      87             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      88             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      89             :   false,  /* isTypedMethod.  Only relevant for methods. */
      90             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      91             : };
      92             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      93             : static_assert(0 < 1, "There is no slot for us");
      94             : 
      95             : static bool
      96           0 : get_onchange(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioTrackList* self, JSJitGetterCallArgs args)
      97             : {
      98           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnchange());
      99           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     100           0 :   if (result) {
     101           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
     102           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
     103           0 :       return false;
     104             :     }
     105           0 :     return true;
     106             :   } else {
     107           0 :     args.rval().setNull();
     108           0 :     return true;
     109             :   }
     110             : }
     111             : 
     112             : static bool
     113           0 : set_onchange(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioTrackList* self, JSJitSetterCallArgs args)
     114             : {
     115           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
     116           0 :   if (args[0].isObject()) {
     117             :     { // scope for tempRoot
     118           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
     119           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
     120             :     }
     121             :   } else {
     122           0 :     arg0 = nullptr;
     123             :   }
     124           0 :   self->SetOnchange(Constify(arg0));
     125           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     126             : 
     127           0 :   return true;
     128             : }
     129             : 
     130             : static const JSJitInfo onchange_getterinfo = {
     131             :   { (JSJitGetterOp)get_onchange },
     132             :   { prototypes::id::AudioTrackList },
     133             :   { PrototypeTraits<prototypes::id::AudioTrackList>::Depth },
     134             :   JSJitInfo::Getter,
     135             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     136             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     137             :   false,  /* isInfallible. False in setters. */
     138             :   false,  /* isMovable.  Not relevant for setters. */
     139             :   false, /* isEliminatable.  Not relevant for setters. */
     140             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     141             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     142             :   false,  /* isTypedMethod.  Only relevant for methods. */
     143             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     144             : };
     145             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     146             : static_assert(0 < 1, "There is no slot for us");
     147             : static const JSJitInfo onchange_setterinfo = {
     148             :   { (JSJitGetterOp)set_onchange },
     149             :   { prototypes::id::AudioTrackList },
     150             :   { PrototypeTraits<prototypes::id::AudioTrackList>::Depth },
     151             :   JSJitInfo::Setter,
     152             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     153             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     154             :   false,  /* isInfallible. False in setters. */
     155             :   false,  /* isMovable.  Not relevant for setters. */
     156             :   false, /* isEliminatable.  Not relevant for setters. */
     157             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     158             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     159             :   false,  /* isTypedMethod.  Only relevant for methods. */
     160             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     161             : };
     162             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     163             : static_assert(0 < 1, "There is no slot for us");
     164             : 
     165             : static bool
     166           0 : get_onaddtrack(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioTrackList* self, JSJitGetterCallArgs args)
     167             : {
     168           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnaddtrack());
     169           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     170           0 :   if (result) {
     171           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
     172           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
     173           0 :       return false;
     174             :     }
     175           0 :     return true;
     176             :   } else {
     177           0 :     args.rval().setNull();
     178           0 :     return true;
     179             :   }
     180             : }
     181             : 
     182             : static bool
     183           0 : set_onaddtrack(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioTrackList* self, JSJitSetterCallArgs args)
     184             : {
     185           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
     186           0 :   if (args[0].isObject()) {
     187             :     { // scope for tempRoot
     188           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
     189           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
     190             :     }
     191             :   } else {
     192           0 :     arg0 = nullptr;
     193             :   }
     194           0 :   self->SetOnaddtrack(Constify(arg0));
     195           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     196             : 
     197           0 :   return true;
     198             : }
     199             : 
     200             : static const JSJitInfo onaddtrack_getterinfo = {
     201             :   { (JSJitGetterOp)get_onaddtrack },
     202             :   { prototypes::id::AudioTrackList },
     203             :   { PrototypeTraits<prototypes::id::AudioTrackList>::Depth },
     204             :   JSJitInfo::Getter,
     205             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     206             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     207             :   false,  /* isInfallible. False in setters. */
     208             :   false,  /* isMovable.  Not relevant for setters. */
     209             :   false, /* isEliminatable.  Not relevant for setters. */
     210             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     211             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     212             :   false,  /* isTypedMethod.  Only relevant for methods. */
     213             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     214             : };
     215             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     216             : static_assert(0 < 1, "There is no slot for us");
     217             : static const JSJitInfo onaddtrack_setterinfo = {
     218             :   { (JSJitGetterOp)set_onaddtrack },
     219             :   { prototypes::id::AudioTrackList },
     220             :   { PrototypeTraits<prototypes::id::AudioTrackList>::Depth },
     221             :   JSJitInfo::Setter,
     222             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     223             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     224             :   false,  /* isInfallible. False in setters. */
     225             :   false,  /* isMovable.  Not relevant for setters. */
     226             :   false, /* isEliminatable.  Not relevant for setters. */
     227             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     228             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     229             :   false,  /* isTypedMethod.  Only relevant for methods. */
     230             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     231             : };
     232             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     233             : static_assert(0 < 1, "There is no slot for us");
     234             : 
     235             : static bool
     236           0 : get_onremovetrack(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioTrackList* self, JSJitGetterCallArgs args)
     237             : {
     238           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnremovetrack());
     239           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     240           0 :   if (result) {
     241           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
     242           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
     243           0 :       return false;
     244             :     }
     245           0 :     return true;
     246             :   } else {
     247           0 :     args.rval().setNull();
     248           0 :     return true;
     249             :   }
     250             : }
     251             : 
     252             : static bool
     253           0 : set_onremovetrack(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioTrackList* self, JSJitSetterCallArgs args)
     254             : {
     255           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
     256           0 :   if (args[0].isObject()) {
     257             :     { // scope for tempRoot
     258           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
     259           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
     260             :     }
     261             :   } else {
     262           0 :     arg0 = nullptr;
     263             :   }
     264           0 :   self->SetOnremovetrack(Constify(arg0));
     265           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     266             : 
     267           0 :   return true;
     268             : }
     269             : 
     270             : static const JSJitInfo onremovetrack_getterinfo = {
     271             :   { (JSJitGetterOp)get_onremovetrack },
     272             :   { prototypes::id::AudioTrackList },
     273             :   { PrototypeTraits<prototypes::id::AudioTrackList>::Depth },
     274             :   JSJitInfo::Getter,
     275             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     276             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     277             :   false,  /* isInfallible. False in setters. */
     278             :   false,  /* isMovable.  Not relevant for setters. */
     279             :   false, /* isEliminatable.  Not relevant for setters. */
     280             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     281             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     282             :   false,  /* isTypedMethod.  Only relevant for methods. */
     283             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     284             : };
     285             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     286             : static_assert(0 < 1, "There is no slot for us");
     287             : static const JSJitInfo onremovetrack_setterinfo = {
     288             :   { (JSJitGetterOp)set_onremovetrack },
     289             :   { prototypes::id::AudioTrackList },
     290             :   { PrototypeTraits<prototypes::id::AudioTrackList>::Depth },
     291             :   JSJitInfo::Setter,
     292             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     293             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     294             :   false,  /* isInfallible. False in setters. */
     295             :   false,  /* isMovable.  Not relevant for setters. */
     296             :   false, /* isEliminatable.  Not relevant for setters. */
     297             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     298             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     299             :   false,  /* isTypedMethod.  Only relevant for methods. */
     300             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     301             : };
     302             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     303             : static_assert(0 < 1, "There is no slot for us");
     304             : 
     305             : static void
     306           0 : _objectMoved(JSObject* obj, const JSObject* old)
     307             : {
     308           0 :   mozilla::dom::AudioTrackList* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::AudioTrackList>(obj);
     309           0 :   if (self) {
     310           0 :     UpdateWrapper(self, self, obj, old);
     311             :   }
     312           0 : }
     313             : 
     314             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     315             : #if defined(__clang__)
     316             : #pragma clang diagnostic push
     317             : #pragma clang diagnostic ignored "-Wmissing-braces"
     318             : #endif
     319             : static const JSFunctionSpec sMethods_specs[] = {
     320             :   JS_FNSPEC("getTrackById", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getTrackById_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     321             :   JS_SYM_FNSPEC(iterator, nullptr, nullptr, 0, 0, "ArrayValues"),
     322             :   JS_FS_END
     323             : };
     324             : #if defined(__clang__)
     325             : #pragma clang diagnostic pop
     326             : #endif
     327             : 
     328             : 
     329             : // Can't be const because the pref-enabled boolean needs to be writable
     330             : static Prefable<const JSFunctionSpec> sMethods[] = {
     331             :   { nullptr, &sMethods_specs[0] },
     332             :   { nullptr, nullptr }
     333             : };
     334             : 
     335             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     336             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     337             : static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     338             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     339             : 
     340             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     341             : #if defined(__clang__)
     342             : #pragma clang diagnostic push
     343             : #pragma clang diagnostic ignored "-Wmissing-braces"
     344             : #endif
     345             : static const JSPropertySpec sAttributes_specs[] = {
     346             :   { "length", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &length_getterinfo, nullptr, nullptr },
     347             :   { "onchange", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onchange_getterinfo, GenericBindingSetter, &onchange_setterinfo },
     348             :   { "onaddtrack", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onaddtrack_getterinfo, GenericBindingSetter, &onaddtrack_setterinfo },
     349             :   { "onremovetrack", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onremovetrack_getterinfo, GenericBindingSetter, &onremovetrack_setterinfo },
     350             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     351             : };
     352             : #if defined(__clang__)
     353             : #pragma clang diagnostic pop
     354             : #endif
     355             : 
     356             : 
     357             : // Can't be const because the pref-enabled boolean needs to be writable
     358             : static Prefable<const JSPropertySpec> sAttributes[] = {
     359             :   { nullptr, &sAttributes_specs[0] },
     360             :   { nullptr, nullptr }
     361             : };
     362             : 
     363             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     364             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     365             : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     366             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     367             : 
     368             : 
     369             : static uint16_t sNativeProperties_sortedPropertyIndices[6];
     370             : static PropertyInfo sNativeProperties_propertyInfos[6];
     371             : 
     372             : static const NativePropertiesN<2> sNativeProperties = {
     373             :   false, 0,
     374             :   false, 0,
     375             :   true,  0 /* sMethods */,
     376             :   true,  1 /* sAttributes */,
     377             :   false, 0,
     378             :   false, 0,
     379             :   false, 0,
     380             :   -1,
     381             :   6,
     382             :   sNativeProperties_sortedPropertyIndices,
     383             :   {
     384             :     { sMethods, &sNativeProperties_propertyInfos[0] },
     385             :     { sAttributes, &sNativeProperties_propertyInfos[2] }
     386             :   }
     387             : };
     388             : static_assert(6 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     389             :     "We have a property info count that is oversized");
     390             : 
     391             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     392             :   {
     393             :     "Function",
     394             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     395             :     &sBoringInterfaceObjectClassClassOps,
     396             :     JS_NULL_CLASS_SPEC,
     397             :     JS_NULL_CLASS_EXT,
     398             :     &sInterfaceObjectClassObjectOps
     399             :   },
     400             :   eInterface,
     401             :   true,
     402             :   prototypes::id::AudioTrackList,
     403             :   PrototypeTraits<prototypes::id::AudioTrackList>::Depth,
     404             :   sNativePropertyHooks,
     405             :   "function AudioTrackList() {\n    [native code]\n}",
     406             :   EventTargetBinding::GetConstructorObject
     407             : };
     408             : 
     409             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     410             :   {
     411             :     "AudioTrackListPrototype",
     412             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     413             :     JS_NULL_CLASS_OPS,
     414             :     JS_NULL_CLASS_SPEC,
     415             :     JS_NULL_CLASS_EXT,
     416             :     JS_NULL_OBJECT_OPS
     417             :   },
     418             :   eInterfacePrototype,
     419             :   false,
     420             :   prototypes::id::AudioTrackList,
     421             :   PrototypeTraits<prototypes::id::AudioTrackList>::Depth,
     422             :   sNativePropertyHooks,
     423             :   "[object AudioTrackListPrototype]",
     424             :   EventTargetBinding::GetProtoObject
     425             : };
     426             : 
     427             : bool
     428           0 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
     429             : {
     430             :   static bool sPrefValue;
     431             :   static bool sPrefCacheSetUp = false;
     432           0 :   if (!sPrefCacheSetUp) {
     433           0 :     sPrefCacheSetUp = true;
     434           0 :     Preferences::AddBoolVarCache(&sPrefValue, "media.track.enabled");
     435             :   }
     436             : 
     437           0 :   return sPrefValue;
     438             : }
     439             : 
     440             : JSObject*
     441           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     442             : {
     443           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     444             : }
     445             : 
     446             : static_assert(IsBaseOf<nsISupports, mozilla::dom::AudioTrackList >::value,
     447             :                   "We don't support non-nsISupports native classes for "
     448             :                   "proxy-based bindings yet");
     449             : 
     450             : 
     451             : class DOMProxyHandler : public mozilla::dom::DOMProxyHandler
     452             : {
     453             : public:
     454             :   explicit constexpr DOMProxyHandler()
     455             :   {
     456             :   }
     457             : 
     458             :   virtual bool
     459             :   getOwnPropDescriptor(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool ignoreNamedProps, JS::MutableHandle<JS::PropertyDescriptor> desc) const override;
     460             : 
     461             :   virtual bool
     462             :   defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, JS::Handle<JS::PropertyDescriptor> desc, JS::ObjectOpResult& opresult, bool* defined) const override;
     463             : 
     464             :   using mozilla::dom::DOMProxyHandler::defineProperty;
     465             : 
     466             :   virtual bool
     467             :   ownPropNames(JSContext* cx, JS::Handle<JSObject*> proxy, unsigned flags, JS::AutoIdVector& props) const override;
     468             : 
     469             :   virtual bool
     470             :   hasOwn(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool* bp) const override;
     471             : 
     472             :   virtual bool
     473             :   get(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<JS::Value> receiver, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) const override;
     474             : 
     475             :   virtual const char*
     476             :   className(JSContext* cx, JS::Handle<JSObject*> proxy) const override;
     477             : 
     478             :   virtual bool
     479             :   finalizeInBackground(const JS::Value& priv) const override;
     480             : 
     481             :   virtual void
     482             :   finalize(JSFreeOp* fop, JSObject* proxy) const override;
     483             : 
     484             :   static const DOMProxyHandler*
     485             :   getInstance();
     486             : 
     487             :   virtual bool
     488             :   delete_(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, JS::ObjectOpResult& opresult) const override;
     489             : 
     490             :   virtual bool
     491             :   getElements(JSContext* cx, JS::Handle<JSObject*> proxy, uint32_t begin, uint32_t end, js::ElementAdder* adder) const override;
     492             : };
     493             : 
     494             : MOZ_ALWAYS_INLINE bool
     495           0 : IsProxy(JSObject* obj)
     496             : {
     497           0 :   return js::IsProxy(obj) && js::GetProxyHandler(obj) == DOMProxyHandler::getInstance();
     498             : }
     499             : 
     500             : MOZ_ALWAYS_INLINE mozilla::dom::AudioTrackList*
     501           0 : UnwrapProxy(JSObject* obj)
     502             : {
     503           0 :   MOZ_ASSERT(js::IsProxy(obj));
     504           0 :   if (js::GetProxyHandler(obj) != DOMProxyHandler::getInstance()) {
     505           0 :     MOZ_ASSERT(xpc::WrapperFactory::IsXrayWrapper(obj));
     506           0 :     obj = js::UncheckedUnwrap(obj);
     507             :   }
     508           0 :   MOZ_ASSERT(IsProxy(obj));
     509           0 :   return static_cast<mozilla::dom::AudioTrackList*>(js::GetProxyReservedSlot(obj, DOM_OBJECT_SLOT).toPrivate());
     510             : }
     511             : 
     512             : bool
     513           0 : DOMProxyHandler::getOwnPropDescriptor(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool ignoreNamedProps, JS::MutableHandle<JS::PropertyDescriptor> desc) const
     514             : {
     515           0 :   bool isXray = xpc::WrapperFactory::IsXrayWrapper(proxy);
     516           0 :   uint32_t index = GetArrayIndexFromId(cx, id);
     517           0 :   if (IsArrayIndex(index)) {
     518           0 :     mozilla::dom::AudioTrackList* self = UnwrapProxy(proxy);
     519           0 :     bool found = false;
     520           0 :     auto result(StrongOrRawPtr<mozilla::dom::AudioTrack>(self->IndexedGetter(index, found)));
     521           0 :     MOZ_ASSERT(!JS_IsExceptionPending(cx));
     522             : 
     523           0 :     if (found) {
     524           0 :       if (!GetOrCreateDOMReflector(cx, result, desc.value())) {
     525           0 :         MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     526           0 :         return false;
     527             :       }
     528           0 :       FillPropertyDescriptor(desc, proxy, true);
     529           0 :       return true;
     530             :     }
     531             :   }
     532             : 
     533           0 :   JS::Rooted<JSObject*> expando(cx);
     534           0 :   if (!isXray && (expando = GetExpandoObject(proxy))) {
     535           0 :     if (!JS_GetOwnPropertyDescriptorById(cx, expando, id, desc)) {
     536           0 :       return false;
     537             :     }
     538           0 :     if (desc.object()) {
     539             :       // Pretend the property lives on the wrapper.
     540           0 :       desc.object().set(proxy);
     541           0 :       return true;
     542             :     }
     543             :   }
     544             : 
     545           0 :   desc.object().set(nullptr);
     546           0 :   return true;
     547             : }
     548             : 
     549             : bool
     550           0 : DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, JS::Handle<JS::PropertyDescriptor> desc, JS::ObjectOpResult& opresult, bool* defined) const
     551             : {
     552           0 :   if (IsArrayIndex(GetArrayIndexFromId(cx, id))) {
     553           0 :     *defined = true;
     554           0 :     return opresult.failNoIndexedSetter();
     555             :   }
     556           0 :   return mozilla::dom::DOMProxyHandler::defineProperty(cx, proxy, id, desc, opresult, defined);
     557             : }
     558             : 
     559             : 
     560             : bool
     561           0 : DOMProxyHandler::ownPropNames(JSContext* cx, JS::Handle<JSObject*> proxy, unsigned flags, JS::AutoIdVector& props) const
     562             : {
     563           0 :   bool isXray = xpc::WrapperFactory::IsXrayWrapper(proxy);
     564             : 
     565           0 :   uint32_t length = UnwrapProxy(proxy)->Length();
     566           0 :   MOZ_ASSERT(int32_t(length) >= 0);
     567           0 :   for (int32_t i = 0; i < int32_t(length); ++i) {
     568           0 :     if (!props.append(INT_TO_JSID(i))) {
     569           0 :       return false;
     570             :     }
     571             :   }
     572             : 
     573           0 :   JS::Rooted<JSObject*> expando(cx);
     574           0 :   if (!isXray && (expando = DOMProxyHandler::GetExpandoObject(proxy)) &&
     575           0 :       !js::GetPropertyKeys(cx, expando, flags, &props)) {
     576           0 :     return false;
     577             :   }
     578             : 
     579           0 :   return true;
     580             : }
     581             : 
     582             : bool
     583           0 : DOMProxyHandler::hasOwn(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool* bp) const
     584             : {
     585           0 :   MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
     586             :             "Should not have a XrayWrapper here");
     587             : 
     588           0 :   uint32_t index = GetArrayIndexFromId(cx, id);
     589           0 :   if (IsArrayIndex(index)) {
     590           0 :     bool found = false;
     591           0 :     mozilla::dom::AudioTrackList* self = UnwrapProxy(proxy);
     592           0 :     auto result(StrongOrRawPtr<mozilla::dom::AudioTrack>(self->IndexedGetter(index, found)));
     593           0 :     MOZ_ASSERT(!JS_IsExceptionPending(cx));
     594             :     (void)result;
     595             : 
     596           0 :     *bp = found;
     597           0 :     return true;
     598             :   }
     599             : 
     600             : 
     601           0 :   JS::Rooted<JSObject*> expando(cx, GetExpandoObject(proxy));
     602           0 :   if (expando) {
     603           0 :     bool b = true;
     604           0 :     bool ok = JS_HasPropertyById(cx, expando, id, &b);
     605           0 :     *bp = !!b;
     606           0 :     if (!ok || *bp) {
     607           0 :       return ok;
     608             :     }
     609             :   }
     610             : 
     611           0 :   *bp = false;
     612           0 :   return true;
     613             : }
     614             : 
     615             : bool
     616           0 : DOMProxyHandler::get(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<JS::Value> receiver, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) const
     617             : {
     618           0 :   MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
     619             :               "Should not have a XrayWrapper here");
     620             : 
     621           0 :   uint32_t index = GetArrayIndexFromId(cx, id);
     622           0 :   if (IsArrayIndex(index)) {
     623           0 :     mozilla::dom::AudioTrackList* self = UnwrapProxy(proxy);
     624           0 :     bool found = false;
     625           0 :     auto result(StrongOrRawPtr<mozilla::dom::AudioTrack>(self->IndexedGetter(index, found)));
     626           0 :     MOZ_ASSERT(!JS_IsExceptionPending(cx));
     627             : 
     628           0 :     if (found) {
     629           0 :       if (!GetOrCreateDOMReflector(cx, result, vp)) {
     630           0 :         MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     631           0 :         return false;
     632             :       }
     633           0 :       return true;
     634             :     }
     635             :     // Even if we don't have this index, we don't forward the
     636             :     // get on to our expando object.
     637             :   } else {
     638             :     { // Scope for expando
     639           0 :       JS::Rooted<JSObject*> expando(cx, DOMProxyHandler::GetExpandoObject(proxy));
     640           0 :       if (expando) {
     641             :         bool hasProp;
     642           0 :         if (!JS_HasPropertyById(cx, expando, id, &hasProp)) {
     643           0 :           return false;
     644             :         }
     645             : 
     646           0 :         if (hasProp) {
     647             :           // Forward the get to the expando object, but our receiver is whatever our
     648             :           // receiver is.
     649           0 :           return JS_ForwardGetPropertyTo(cx, expando, id, receiver, vp);
     650             :         }
     651             :       }
     652             :     }
     653             :   }
     654             : 
     655             :   bool foundOnPrototype;
     656           0 :   if (!GetPropertyOnPrototype(cx, proxy, receiver, id, &foundOnPrototype, vp)) {
     657           0 :     return false;
     658             :   }
     659             : 
     660           0 :   if (foundOnPrototype) {
     661           0 :     return true;
     662             :   }
     663             : 
     664           0 :   vp.setUndefined();
     665           0 :   return true;
     666             : }
     667             : 
     668             : const char*
     669           0 : DOMProxyHandler::className(JSContext* cx, JS::Handle<JSObject*> proxy) const
     670             : {
     671           0 :   return "AudioTrackList";
     672             : }
     673             : 
     674             : bool
     675           0 : DOMProxyHandler::finalizeInBackground(const JS::Value& priv) const
     676             : {
     677           0 :   return false;
     678             : }
     679             : 
     680             : void
     681           0 : DOMProxyHandler::finalize(JSFreeOp* fop, JSObject* proxy) const
     682             : {
     683           0 :   mozilla::dom::AudioTrackList* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::AudioTrackList>(proxy);
     684           0 :   if (self) {
     685           0 :     ClearWrapper(self, self, proxy);
     686           0 :     AddForDeferredFinalization<mozilla::dom::AudioTrackList>(self);
     687             :   }
     688           0 : }
     689             : 
     690             : const DOMProxyHandler*
     691           0 : DOMProxyHandler::getInstance()
     692             : {
     693             :   static const DOMProxyHandler instance;
     694           0 :   return &instance;
     695             : }
     696             : 
     697             : bool
     698           0 : DOMProxyHandler::delete_(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, JS::ObjectOpResult& opresult) const
     699             : {
     700           0 :   MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
     701             :             "Should not have a XrayWrapper here");
     702             : 
     703           0 :   uint32_t index = GetArrayIndexFromId(cx, id);
     704           0 :   if (IsArrayIndex(index)) {
     705             :     bool deleteSucceeded;
     706           0 :     bool found = false;
     707           0 :     mozilla::dom::AudioTrackList* self = UnwrapProxy(proxy);
     708           0 :     auto result(StrongOrRawPtr<mozilla::dom::AudioTrack>(self->IndexedGetter(index, found)));
     709           0 :     MOZ_ASSERT(!JS_IsExceptionPending(cx));
     710             :     (void)result;
     711           0 :     deleteSucceeded = !found;
     712           0 :     return deleteSucceeded ? opresult.succeed() : opresult.failCantDelete();
     713             :   }
     714             : 
     715           0 :   return dom::DOMProxyHandler::delete_(cx, proxy, id, opresult);
     716             : }
     717             : 
     718             : bool
     719           0 : DOMProxyHandler::getElements(JSContext* cx, JS::Handle<JSObject*> proxy, uint32_t begin, uint32_t end, js::ElementAdder* adder) const
     720             : {
     721           0 :   JS::Rooted<JS::Value> temp(cx);
     722           0 :   MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
     723             :              "Should not have a XrayWrapper here");
     724             : 
     725           0 :   mozilla::dom::AudioTrackList* self = UnwrapProxy(proxy);
     726           0 :   uint32_t length = self->Length();
     727             :   // Compute the end of the indices we'll get ourselves
     728           0 :   uint32_t ourEnd = std::max(begin, std::min(end, length));
     729             : 
     730           0 :   for (uint32_t index = begin; index < ourEnd; ++index) {
     731           0 :     bool found = false;
     732           0 :     auto result(StrongOrRawPtr<mozilla::dom::AudioTrack>(self->IndexedGetter(index, found)));
     733           0 :     MOZ_ASSERT(!JS_IsExceptionPending(cx));
     734             : 
     735           0 :     MOZ_ASSERT(found);
     736           0 :     if (!GetOrCreateDOMReflector(cx, result, &temp)) {
     737           0 :       MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     738           0 :       return false;
     739             :     }
     740           0 :     if (!adder->append(cx, temp)) return false;
     741           0 :     continue;
     742             :   }
     743             : 
     744           0 :   if (end > ourEnd) {
     745           0 :     JS::Rooted<JSObject*> proto(cx);
     746           0 :     if (!js::GetObjectProto(cx, proxy, &proto)) {
     747           0 :       return false;
     748             :     }
     749           0 :     return js::GetElementsWithAdder(cx, proto, proxy, ourEnd, end, adder);
     750             :   }
     751             : 
     752           0 :   return true;
     753             : }
     754             : 
     755             : static const js::ClassExtension sClassExtension = PROXY_MAKE_EXT(
     756             :     _objectMoved
     757             : );
     758             : 
     759             : static const DOMJSClass sClass = {
     760             :   PROXY_CLASS_WITH_EXT("AudioTrackList",
     761             :                        JSCLASS_IS_DOMJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(1),
     762             :                        &sClassExtension),
     763             :   { prototypes::id::EventTarget, prototypes::id::AudioTrackList, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
     764             :   IsBaseOf<nsISupports, mozilla::dom::AudioTrackList >::value,
     765             :   sNativePropertyHooks,
     766             :   FindAssociatedGlobalForNative<mozilla::dom::AudioTrackList>::Get,
     767             :   GetProtoObjectHandle,
     768             :   GetCCParticipant<mozilla::dom::AudioTrackList>::Get()
     769             : };
     770             : 
     771             : bool
     772           0 : Wrap(JSContext* aCx, mozilla::dom::AudioTrackList* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     773             : {
     774             :   MOZ_ASSERT(static_cast<mozilla::dom::AudioTrackList*>(aObject) ==
     775             :              reinterpret_cast<mozilla::dom::AudioTrackList*>(aObject),
     776             :              "Multiple inheritance for mozilla::dom::AudioTrackList is broken.");
     777             :   MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
     778             :              reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
     779             :              "Multiple inheritance for mozilla::dom::EventTarget is broken.");
     780           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     781           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     782           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     783             :              "You should probably not be using Wrap() directly; use "
     784             :              "GetOrCreateDOMReflector instead");
     785             : 
     786           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     787             :              "nsISupports must be on our primary inheritance chain");
     788             : 
     789           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     790           0 :   if (!global) {
     791           0 :     return false;
     792             :   }
     793           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     794           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     795             : 
     796             :   // That might have ended up wrapping us already, due to the wonders
     797             :   // of XBL.  Check for that, and bail out as needed.
     798           0 :   aReflector.set(aCache->GetWrapper());
     799           0 :   if (aReflector) {
     800             : #ifdef DEBUG
     801           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     802             : #endif // DEBUG
     803           0 :     return true;
     804             :   }
     805             : 
     806           0 :   JSAutoCompartment ac(aCx, global);
     807           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     808           0 :   if (!canonicalProto) {
     809           0 :     return false;
     810             :   }
     811           0 :   JS::Rooted<JSObject*> proto(aCx);
     812           0 :   if (aGivenProto) {
     813           0 :     proto = aGivenProto;
     814             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     815             :     // coming in, we changed compartments to that of "parent" so may need
     816             :     // to wrap the proto here.
     817           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     818           0 :       if (!JS_WrapObject(aCx, &proto)) {
     819           0 :         return false;
     820             :       }
     821             :     }
     822             :   } else {
     823           0 :     proto = canonicalProto;
     824             :   }
     825             : 
     826           0 :   BindingJSObjectCreator<mozilla::dom::AudioTrackList> creator(aCx);
     827           0 :   JS::Rooted<JS::Value> expandoValue(aCx, JS::UndefinedValue());
     828           0 :   creator.CreateProxyObject(aCx, &sClass.mBase, DOMProxyHandler::getInstance(),
     829           0 :                             proto, aObject, expandoValue, aReflector);
     830           0 :   if (!aReflector) {
     831           0 :     return false;
     832             :   }
     833             : 
     834             : 
     835           0 :   aCache->SetWrapper(aReflector);
     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             : static bool
     854           0 : ResolveOwnProperty(JSContext* cx, JS::Handle<JSObject*> wrapper, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::PropertyDescriptor> desc)
     855             : {
     856           0 :   return js::GetProxyHandler(obj)->getOwnPropertyDescriptor(cx, wrapper, id, desc);
     857             : }
     858             : 
     859             : static bool
     860           0 : EnumerateOwnProperties(JSContext* cx, JS::Handle<JSObject*> wrapper, JS::Handle<JSObject*> obj, JS::AutoIdVector& props)
     861             : {
     862           0 :   return js::GetProxyHandler(obj)->ownPropertyKeys(cx, wrapper, props);
     863             : }
     864             : 
     865             : const NativePropertyHooks sNativePropertyHooks[] = { {
     866             :   ResolveOwnProperty,
     867             :   EnumerateOwnProperties,
     868             :   nullptr,
     869             :   { sNativeProperties.Upcast(), nullptr },
     870             :   prototypes::id::AudioTrackList,
     871             :   constructors::id::AudioTrackList,
     872             :   EventTargetBinding::sNativePropertyHooks,
     873             :   &DefaultXrayExpandoObjectClass
     874             : } };
     875             : 
     876             : void
     877           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     878             : {
     879           0 :   JS::Handle<JSObject*> parentProto(EventTargetBinding::GetProtoObjectHandle(aCx));
     880           0 :   if (!parentProto) {
     881           0 :     return;
     882             :   }
     883             : 
     884           0 :   JS::Handle<JSObject*> constructorProto(EventTargetBinding::GetConstructorObjectHandle(aCx));
     885           0 :   if (!constructorProto) {
     886           0 :     return;
     887             :   }
     888             : 
     889             :   static bool sIdsInited = false;
     890           0 :   if (!sIdsInited && NS_IsMainThread()) {
     891           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     892           0 :       return;
     893             :     }
     894           0 :     sIdsInited = true;
     895             :   }
     896             : 
     897           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::AudioTrackList);
     898           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::AudioTrackList);
     899           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     900             :                               &sPrototypeClass.mBase, protoCache,
     901             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     902             :                               interfaceCache,
     903             :                               sNativeProperties.Upcast(),
     904             :                               nullptr,
     905             :                               "AudioTrackList", aDefineOnGlobal,
     906             :                               nullptr,
     907           0 :                               false);
     908             : }
     909             : 
     910             : JS::Handle<JSObject*>
     911           0 : GetProtoObjectHandle(JSContext* aCx)
     912             : {
     913             :   /* Get the interface prototype object for this class.  This will create the
     914             :      object as needed. */
     915           0 :   bool aDefineOnGlobal = true;
     916             : 
     917             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     918           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     919           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     920           0 :     return nullptr;
     921             :   }
     922             : 
     923             :   /* Check to see whether the interface objects are already installed */
     924           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     925           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::AudioTrackList)) {
     926           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     927           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     928             :   }
     929             : 
     930             :   /*
     931             :    * The object might _still_ be null, but that's OK.
     932             :    *
     933             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     934             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     935             :    * changed after they have been set.
     936             :    *
     937             :    * Calling address() avoids the read read barrier that does gray
     938             :    * unmarking, but it's not possible for the object to be gray here.
     939             :    */
     940             : 
     941           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::AudioTrackList);
     942           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     943           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     944             : }
     945             : 
     946             : JS::Handle<JSObject*>
     947           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     948             : {
     949             :   /* Get the interface object for this class.  This will create the object as
     950             :      needed. */
     951             : 
     952             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     953           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     954           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     955           0 :     return nullptr;
     956             :   }
     957             : 
     958             :   /* Check to see whether the interface objects are already installed */
     959           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     960           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::AudioTrackList)) {
     961           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     962           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     963             :   }
     964             : 
     965             :   /*
     966             :    * The object might _still_ be null, but that's OK.
     967             :    *
     968             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     969             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     970             :    * changed after they have been set.
     971             :    *
     972             :    * Calling address() avoids the read read barrier that does gray
     973             :    * unmarking, but it's not possible for the object to be gray here.
     974             :    */
     975             : 
     976           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::AudioTrackList);
     977           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     978           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     979             : }
     980             : 
     981             : JSObject*
     982           0 : GetConstructorObject(JSContext* aCx)
     983             : {
     984           0 :   return GetConstructorObjectHandle(aCx);
     985             : }
     986             : 
     987             : } // namespace AudioTrackListBinding
     988             : 
     989             : 
     990             : 
     991             : } // namespace dom
     992             : } // namespace mozilla

Generated by: LCOV version 1.13