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

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

Generated by: LCOV version 1.13