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

Generated by: LCOV version 1.13