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

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

Generated by: LCOV version 1.13