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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM TimeRanges.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "TimeRangesBinding.h"
       4             : #include "WrapperFactory.h"
       5             : #include "mozilla/FloatingPoint.h"
       6             : #include "mozilla/OwningNonNull.h"
       7             : #include "mozilla/dom/BindingUtils.h"
       8             : #include "mozilla/dom/DOMJSClass.h"
       9             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      10             : #include "mozilla/dom/PrimitiveConversions.h"
      11             : #include "mozilla/dom/TimeRanges.h"
      12             : #include "mozilla/dom/XrayExpandoClass.h"
      13             : 
      14             : namespace mozilla {
      15             : namespace dom {
      16             : 
      17             : namespace TimeRangesBinding {
      18             : 
      19             : static bool
      20           0 : get_length(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TimeRanges* self, JSJitGetterCallArgs args)
      21             : {
      22           0 :   uint32_t result(self->Length());
      23           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      24           0 :   args.rval().setNumber(result);
      25           0 :   return true;
      26             : }
      27             : 
      28             : static const JSJitInfo length_getterinfo = {
      29             :   { (JSJitGetterOp)get_length },
      30             :   { prototypes::id::TimeRanges },
      31             :   { PrototypeTraits<prototypes::id::TimeRanges>::Depth },
      32             :   JSJitInfo::Getter,
      33             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      34             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
      35             :   true,  /* isInfallible. False in setters. */
      36             :   false,  /* isMovable.  Not relevant for setters. */
      37             :   false, /* isEliminatable.  Not relevant for setters. */
      38             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      39             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      40             :   false,  /* isTypedMethod.  Only relevant for methods. */
      41             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      42             : };
      43             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      44             : static_assert(0 < 1, "There is no slot for us");
      45             : 
      46             : static bool
      47           0 : start(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TimeRanges* self, const JSJitMethodCallArgs& args)
      48             : {
      49           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
      50           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TimeRanges.start");
      51             :   }
      52             :   uint32_t arg0;
      53           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
      54           0 :     return false;
      55             :   }
      56           0 :   binding_detail::FastErrorResult rv;
      57           0 :   double result(self->Start(arg0, rv));
      58           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
      59           0 :     return false;
      60             :   }
      61           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      62           0 :   args.rval().set(JS_NumberValue(double(result)));
      63           0 :   return true;
      64             : }
      65             : 
      66             : static const JSJitInfo start_methodinfo = {
      67             :   { (JSJitGetterOp)start },
      68             :   { prototypes::id::TimeRanges },
      69             :   { PrototypeTraits<prototypes::id::TimeRanges>::Depth },
      70             :   JSJitInfo::Method,
      71             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      72             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
      73             :   false,  /* isInfallible. False in setters. */
      74             :   false,  /* isMovable.  Not relevant for setters. */
      75             :   false, /* isEliminatable.  Not relevant for setters. */
      76             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      77             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      78             :   false,  /* isTypedMethod.  Only relevant for methods. */
      79             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      80             : };
      81             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      82             : static_assert(0 < 1, "There is no slot for us");
      83             : 
      84             : static bool
      85           0 : end(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TimeRanges* self, const JSJitMethodCallArgs& args)
      86             : {
      87           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
      88           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TimeRanges.end");
      89             :   }
      90             :   uint32_t arg0;
      91           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
      92           0 :     return false;
      93             :   }
      94           0 :   binding_detail::FastErrorResult rv;
      95           0 :   double result(self->End(arg0, rv));
      96           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
      97           0 :     return false;
      98             :   }
      99           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     100           0 :   args.rval().set(JS_NumberValue(double(result)));
     101           0 :   return true;
     102             : }
     103             : 
     104             : static const JSJitInfo end_methodinfo = {
     105             :   { (JSJitGetterOp)end },
     106             :   { prototypes::id::TimeRanges },
     107             :   { PrototypeTraits<prototypes::id::TimeRanges>::Depth },
     108             :   JSJitInfo::Method,
     109             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     110             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
     111             :   false,  /* isInfallible. False in setters. */
     112             :   false,  /* isMovable.  Not relevant for setters. */
     113             :   false, /* isEliminatable.  Not relevant for setters. */
     114             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     115             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     116             :   false,  /* isTypedMethod.  Only relevant for methods. */
     117             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     118             : };
     119             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     120             : static_assert(0 < 1, "There is no slot for us");
     121             : 
     122             : static bool
     123           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     124             : {
     125           0 :   mozilla::dom::TimeRanges* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::TimeRanges>(obj);
     126             :   // We don't want to preserve if we don't have a wrapper, and we
     127             :   // obviously can't preserve if we're not initialized.
     128           0 :   if (self && self->GetWrapperPreserveColor()) {
     129           0 :     PreserveWrapper(self);
     130             :   }
     131           0 :   return true;
     132             : }
     133             : 
     134             : static void
     135           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     136             : {
     137           0 :   mozilla::dom::TimeRanges* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::TimeRanges>(obj);
     138           0 :   if (self) {
     139           0 :     ClearWrapper(self, self, obj);
     140           0 :     AddForDeferredFinalization<mozilla::dom::TimeRanges>(self);
     141             :   }
     142           0 : }
     143             : 
     144             : static void
     145           0 : _objectMoved(JSObject* obj, const JSObject* old)
     146             : {
     147           0 :   mozilla::dom::TimeRanges* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::TimeRanges>(obj);
     148           0 :   if (self) {
     149           0 :     UpdateWrapper(self, self, obj, old);
     150             :   }
     151           0 : }
     152             : 
     153             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     154             : #if defined(__clang__)
     155             : #pragma clang diagnostic push
     156             : #pragma clang diagnostic ignored "-Wmissing-braces"
     157             : #endif
     158             : static const JSFunctionSpec sMethods_specs[] = {
     159             :   JS_FNSPEC("start", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&start_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     160             :   JS_FNSPEC("end", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&end_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     161             :   JS_FS_END
     162             : };
     163             : #if defined(__clang__)
     164             : #pragma clang diagnostic pop
     165             : #endif
     166             : 
     167             : 
     168             : // Can't be const because the pref-enabled boolean needs to be writable
     169             : static Prefable<const JSFunctionSpec> sMethods[] = {
     170             :   { nullptr, &sMethods_specs[0] },
     171             :   { nullptr, nullptr }
     172             : };
     173             : 
     174             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     175             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     176             : static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     177             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     178             : 
     179             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     180             : #if defined(__clang__)
     181             : #pragma clang diagnostic push
     182             : #pragma clang diagnostic ignored "-Wmissing-braces"
     183             : #endif
     184             : static const JSPropertySpec sAttributes_specs[] = {
     185             :   { "length", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &length_getterinfo, nullptr, nullptr },
     186             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     187             : };
     188             : #if defined(__clang__)
     189             : #pragma clang diagnostic pop
     190             : #endif
     191             : 
     192             : 
     193             : // Can't be const because the pref-enabled boolean needs to be writable
     194             : static Prefable<const JSPropertySpec> sAttributes[] = {
     195             :   { nullptr, &sAttributes_specs[0] },
     196             :   { nullptr, nullptr }
     197             : };
     198             : 
     199             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     200             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     201             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     202             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     203             : 
     204             : 
     205             : static uint16_t sNativeProperties_sortedPropertyIndices[3];
     206             : static PropertyInfo sNativeProperties_propertyInfos[3];
     207             : 
     208             : static const NativePropertiesN<2> sNativeProperties = {
     209             :   false, 0,
     210             :   false, 0,
     211             :   true,  0 /* sMethods */,
     212             :   true,  1 /* sAttributes */,
     213             :   false, 0,
     214             :   false, 0,
     215             :   false, 0,
     216             :   -1,
     217             :   3,
     218             :   sNativeProperties_sortedPropertyIndices,
     219             :   {
     220             :     { sMethods, &sNativeProperties_propertyInfos[0] },
     221             :     { sAttributes, &sNativeProperties_propertyInfos[2] }
     222             :   }
     223             : };
     224             : static_assert(3 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     225             :     "We have a property info count that is oversized");
     226             : 
     227             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     228             :   {
     229             :     "Function",
     230             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     231             :     &sBoringInterfaceObjectClassClassOps,
     232             :     JS_NULL_CLASS_SPEC,
     233             :     JS_NULL_CLASS_EXT,
     234             :     &sInterfaceObjectClassObjectOps
     235             :   },
     236             :   eInterface,
     237             :   true,
     238             :   prototypes::id::TimeRanges,
     239             :   PrototypeTraits<prototypes::id::TimeRanges>::Depth,
     240             :   sNativePropertyHooks,
     241             :   "function TimeRanges() {\n    [native code]\n}",
     242             :   JS::GetRealmFunctionPrototype
     243             : };
     244             : 
     245             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     246             :   {
     247             :     "TimeRangesPrototype",
     248             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     249             :     JS_NULL_CLASS_OPS,
     250             :     JS_NULL_CLASS_SPEC,
     251             :     JS_NULL_CLASS_EXT,
     252             :     JS_NULL_OBJECT_OPS
     253             :   },
     254             :   eInterfacePrototype,
     255             :   false,
     256             :   prototypes::id::TimeRanges,
     257             :   PrototypeTraits<prototypes::id::TimeRanges>::Depth,
     258             :   sNativePropertyHooks,
     259             :   "[object TimeRangesPrototype]",
     260             :   JS::GetRealmObjectPrototype
     261             : };
     262             : 
     263             : JSObject*
     264           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     265             : {
     266           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     267             : }
     268             : 
     269             : static const js::ClassOps sClassOps = {
     270             :   _addProperty, /* addProperty */
     271             :   nullptr,               /* delProperty */
     272             :   nullptr,               /* getProperty */
     273             :   nullptr,               /* setProperty */
     274             :   nullptr,               /* enumerate */
     275             :   nullptr, /* newEnumerate */
     276             :   nullptr, /* resolve */
     277             :   nullptr, /* mayResolve */
     278             :   _finalize, /* finalize */
     279             :   nullptr, /* call */
     280             :   nullptr,               /* hasInstance */
     281             :   nullptr,               /* construct */
     282             :   nullptr, /* trace */
     283             : };
     284             : 
     285             : static const js::ClassExtension sClassExtension = {
     286             :   nullptr, /* weakmapKeyDelegateOp */
     287             :   _objectMoved /* objectMovedOp */
     288             : };
     289             : 
     290             : static const DOMJSClass sClass = {
     291             :   { "TimeRanges",
     292             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
     293             :     &sClassOps,
     294             :     JS_NULL_CLASS_SPEC,
     295             :     &sClassExtension,
     296             :     JS_NULL_OBJECT_OPS
     297             :   },
     298             :   { prototypes::id::TimeRanges, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
     299             :   IsBaseOf<nsISupports, mozilla::dom::TimeRanges >::value,
     300             :   sNativePropertyHooks,
     301             :   FindAssociatedGlobalForNative<mozilla::dom::TimeRanges>::Get,
     302             :   GetProtoObjectHandle,
     303             :   GetCCParticipant<mozilla::dom::TimeRanges>::Get()
     304             : };
     305             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     306             :               "Must have the right minimal number of reserved slots.");
     307             : static_assert(1 >= 1,
     308             :               "Must have enough reserved slots.");
     309             : 
     310             : const JSClass*
     311           0 : GetJSClass()
     312             : {
     313           0 :   return sClass.ToJSClass();
     314             : }
     315             : 
     316             : bool
     317           0 : Wrap(JSContext* aCx, mozilla::dom::TimeRanges* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     318             : {
     319             :   MOZ_ASSERT(static_cast<mozilla::dom::TimeRanges*>(aObject) ==
     320             :              reinterpret_cast<mozilla::dom::TimeRanges*>(aObject),
     321             :              "Multiple inheritance for mozilla::dom::TimeRanges is broken.");
     322           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     323           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     324           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     325             :              "You should probably not be using Wrap() directly; use "
     326             :              "GetOrCreateDOMReflector instead");
     327             : 
     328           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     329             :              "nsISupports must be on our primary inheritance chain");
     330             : 
     331           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     332           0 :   if (!global) {
     333           0 :     return false;
     334             :   }
     335           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     336           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     337             : 
     338             :   // That might have ended up wrapping us already, due to the wonders
     339             :   // of XBL.  Check for that, and bail out as needed.
     340           0 :   aReflector.set(aCache->GetWrapper());
     341           0 :   if (aReflector) {
     342             : #ifdef DEBUG
     343           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     344             : #endif // DEBUG
     345           0 :     return true;
     346             :   }
     347             : 
     348           0 :   JSAutoCompartment ac(aCx, global);
     349           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     350           0 :   if (!canonicalProto) {
     351           0 :     return false;
     352             :   }
     353           0 :   JS::Rooted<JSObject*> proto(aCx);
     354           0 :   if (aGivenProto) {
     355           0 :     proto = aGivenProto;
     356             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     357             :     // coming in, we changed compartments to that of "parent" so may need
     358             :     // to wrap the proto here.
     359           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     360           0 :       if (!JS_WrapObject(aCx, &proto)) {
     361           0 :         return false;
     362             :       }
     363             :     }
     364             :   } else {
     365           0 :     proto = canonicalProto;
     366             :   }
     367             : 
     368           0 :   BindingJSObjectCreator<mozilla::dom::TimeRanges> creator(aCx);
     369           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     370           0 :   if (!aReflector) {
     371           0 :     return false;
     372             :   }
     373             : 
     374           0 :   aCache->SetWrapper(aReflector);
     375           0 :   creator.InitializationSucceeded();
     376             : 
     377           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     378             :              aCache->GetWrapperPreserveColor() == aReflector);
     379             :   // If proto != canonicalProto, we have to preserve our wrapper;
     380             :   // otherwise we won't be able to properly recreate it later, since
     381             :   // we won't know what proto to use.  Note that we don't check
     382             :   // aGivenProto here, since it's entirely possible (and even
     383             :   // somewhat common) to have a non-null aGivenProto which is the
     384             :   // same as canonicalProto.
     385           0 :   if (proto != canonicalProto) {
     386           0 :     PreserveWrapper(aObject);
     387             :   }
     388             : 
     389           0 :   return true;
     390             : }
     391             : 
     392             : const NativePropertyHooks sNativePropertyHooks[] = { {
     393             :   nullptr,
     394             :   nullptr,
     395             :   nullptr,
     396             :   { sNativeProperties.Upcast(), nullptr },
     397             :   prototypes::id::TimeRanges,
     398             :   constructors::id::TimeRanges,
     399             :   nullptr,
     400             :   &DefaultXrayExpandoObjectClass
     401             : } };
     402             : 
     403             : void
     404           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     405             : {
     406           0 :   JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
     407           0 :   if (!parentProto) {
     408           0 :     return;
     409             :   }
     410             : 
     411           0 :   JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
     412           0 :   if (!constructorProto) {
     413           0 :     return;
     414             :   }
     415             : 
     416             :   static bool sIdsInited = false;
     417           0 :   if (!sIdsInited && NS_IsMainThread()) {
     418           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     419           0 :       return;
     420             :     }
     421           0 :     sIdsInited = true;
     422             :   }
     423             : 
     424           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::TimeRanges);
     425           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::TimeRanges);
     426           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     427             :                               &sPrototypeClass.mBase, protoCache,
     428             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     429             :                               interfaceCache,
     430             :                               sNativeProperties.Upcast(),
     431             :                               nullptr,
     432             :                               "TimeRanges", aDefineOnGlobal,
     433             :                               nullptr,
     434           0 :                               false);
     435             : }
     436             : 
     437             : JS::Handle<JSObject*>
     438           0 : GetProtoObjectHandle(JSContext* aCx)
     439             : {
     440             :   /* Get the interface prototype object for this class.  This will create the
     441             :      object as needed. */
     442           0 :   bool aDefineOnGlobal = true;
     443             : 
     444             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     445           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     446           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     447           0 :     return nullptr;
     448             :   }
     449             : 
     450             :   /* Check to see whether the interface objects are already installed */
     451           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     452           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::TimeRanges)) {
     453           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     454           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     455             :   }
     456             : 
     457             :   /*
     458             :    * The object might _still_ be null, but that's OK.
     459             :    *
     460             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     461             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     462             :    * changed after they have been set.
     463             :    *
     464             :    * Calling address() avoids the read read barrier that does gray
     465             :    * unmarking, but it's not possible for the object to be gray here.
     466             :    */
     467             : 
     468           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::TimeRanges);
     469           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     470           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     471             : }
     472             : 
     473             : JS::Handle<JSObject*>
     474           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     475             : {
     476             :   /* Get the interface object for this class.  This will create the object as
     477             :      needed. */
     478             : 
     479             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     480           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     481           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     482           0 :     return nullptr;
     483             :   }
     484             : 
     485             :   /* Check to see whether the interface objects are already installed */
     486           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     487           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::TimeRanges)) {
     488           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     489           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     490             :   }
     491             : 
     492             :   /*
     493             :    * The object might _still_ be null, but that's OK.
     494             :    *
     495             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     496             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     497             :    * changed after they have been set.
     498             :    *
     499             :    * Calling address() avoids the read read barrier that does gray
     500             :    * unmarking, but it's not possible for the object to be gray here.
     501             :    */
     502             : 
     503           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::TimeRanges);
     504           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     505           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     506             : }
     507             : 
     508             : JSObject*
     509           0 : GetConstructorObject(JSContext* aCx)
     510             : {
     511           0 :   return GetConstructorObjectHandle(aCx);
     512             : }
     513             : 
     514             : } // namespace TimeRangesBinding
     515             : 
     516             : 
     517             : 
     518             : } // namespace dom
     519             : } // namespace mozilla

Generated by: LCOV version 1.13