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

Generated by: LCOV version 1.13