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

Generated by: LCOV version 1.13