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

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

Generated by: LCOV version 1.13