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

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

Generated by: LCOV version 1.13