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

Generated by: LCOV version 1.13