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

Generated by: LCOV version 1.13