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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM SVGTextContentElement.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "SVGGraphicsElementBinding.h"
       4             : #include "SVGTextContentElementBinding.h"
       5             : #include "WrapperFactory.h"
       6             : #include "mozilla/FloatingPoint.h"
       7             : #include "mozilla/OwningNonNull.h"
       8             : #include "mozilla/dom/BindingUtils.h"
       9             : #include "mozilla/dom/DOMJSClass.h"
      10             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      11             : #include "mozilla/dom/PrimitiveConversions.h"
      12             : #include "mozilla/dom/SVGAnimatedEnumeration.h"
      13             : #include "mozilla/dom/SVGAnimatedLength.h"
      14             : #include "mozilla/dom/SVGIRect.h"
      15             : #include "mozilla/dom/SVGTextContentElement.h"
      16             : #include "mozilla/dom/XrayExpandoClass.h"
      17             : #include "nsISVGPoint.h"
      18             : 
      19             : namespace mozilla {
      20             : namespace dom {
      21             : 
      22             : namespace SVGTextContentElementBinding {
      23             : 
      24             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGGraphicsElementBinding::NativeType>::value,
      25             :               "Can't inherit from an interface with a different ownership model.");
      26             : 
      27             : static bool
      28           0 : get_textLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, JSJitGetterCallArgs args)
      29             : {
      30           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->TextLength()));
      31           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      32           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      33           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      34           0 :     return false;
      35             :   }
      36           0 :   return true;
      37             : }
      38             : 
      39             : static const JSJitInfo textLength_getterinfo = {
      40             :   { (JSJitGetterOp)get_textLength },
      41             :   { prototypes::id::SVGTextContentElement },
      42             :   { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
      43             :   JSJitInfo::Getter,
      44             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
      45             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
      46             :   false,  /* isInfallible. False in setters. */
      47             :   true,  /* isMovable.  Not relevant for setters. */
      48             :   true, /* isEliminatable.  Not relevant for setters. */
      49             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      50             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      51             :   false,  /* isTypedMethod.  Only relevant for methods. */
      52             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      53             : };
      54             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      55             : static_assert(0 < 1, "There is no slot for us");
      56             : 
      57             : static bool
      58           0 : get_lengthAdjust(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, JSJitGetterCallArgs args)
      59             : {
      60           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->LengthAdjust()));
      61           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      62           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      63           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      64           0 :     return false;
      65             :   }
      66           0 :   return true;
      67             : }
      68             : 
      69             : static const JSJitInfo lengthAdjust_getterinfo = {
      70             :   { (JSJitGetterOp)get_lengthAdjust },
      71             :   { prototypes::id::SVGTextContentElement },
      72             :   { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
      73             :   JSJitInfo::Getter,
      74             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
      75             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
      76             :   false,  /* isInfallible. False in setters. */
      77             :   true,  /* isMovable.  Not relevant for setters. */
      78             :   true, /* isEliminatable.  Not relevant for setters. */
      79             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      80             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      81             :   false,  /* isTypedMethod.  Only relevant for methods. */
      82             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      83             : };
      84             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      85             : static_assert(0 < 1, "There is no slot for us");
      86             : 
      87             : static bool
      88           0 : getNumberOfChars(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
      89             : {
      90           0 :   int32_t result(self->GetNumberOfChars());
      91           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      92           0 :   args.rval().setInt32(int32_t(result));
      93           0 :   return true;
      94             : }
      95             : 
      96             : static const JSJitInfo getNumberOfChars_methodinfo = {
      97             :   { (JSJitGetterOp)getNumberOfChars },
      98             :   { prototypes::id::SVGTextContentElement },
      99             :   { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
     100             :   JSJitInfo::Method,
     101             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     102             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
     103             :   true,  /* isInfallible. False in setters. */
     104             :   false,  /* isMovable.  Not relevant for setters. */
     105             :   false, /* 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 : getComputedTextLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
     116             : {
     117           0 :   float result(self->GetComputedTextLength());
     118           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     119           0 :   args.rval().set(JS_NumberValue(double(result)));
     120           0 :   return true;
     121             : }
     122             : 
     123             : static const JSJitInfo getComputedTextLength_methodinfo = {
     124             :   { (JSJitGetterOp)getComputedTextLength },
     125             :   { prototypes::id::SVGTextContentElement },
     126             :   { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
     127             :   JSJitInfo::Method,
     128             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     129             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
     130             :   true,  /* isInfallible. False in setters. */
     131             :   false,  /* isMovable.  Not relevant for setters. */
     132             :   false, /* isEliminatable.  Not relevant for setters. */
     133             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     134             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     135             :   false,  /* isTypedMethod.  Only relevant for methods. */
     136             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     137             : };
     138             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     139             : static_assert(0 < 1, "There is no slot for us");
     140             : 
     141             : static bool
     142           0 : getSubStringLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
     143             : {
     144           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     145           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGTextContentElement.getSubStringLength");
     146             :   }
     147             :   uint32_t arg0;
     148           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
     149           0 :     return false;
     150             :   }
     151             :   uint32_t arg1;
     152           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
     153           0 :     return false;
     154             :   }
     155           0 :   binding_detail::FastErrorResult rv;
     156           0 :   float result(self->GetSubStringLength(arg0, arg1, rv));
     157           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     158           0 :     return false;
     159             :   }
     160           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     161           0 :   args.rval().set(JS_NumberValue(double(result)));
     162           0 :   return true;
     163             : }
     164             : 
     165             : static const JSJitInfo getSubStringLength_methodinfo = {
     166             :   { (JSJitGetterOp)getSubStringLength },
     167             :   { prototypes::id::SVGTextContentElement },
     168             :   { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
     169             :   JSJitInfo::Method,
     170             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     171             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
     172             :   false,  /* isInfallible. False in setters. */
     173             :   false,  /* isMovable.  Not relevant for setters. */
     174             :   false, /* isEliminatable.  Not relevant for setters. */
     175             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     176             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     177             :   false,  /* isTypedMethod.  Only relevant for methods. */
     178             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     179             : };
     180             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     181             : static_assert(0 < 1, "There is no slot for us");
     182             : 
     183             : static bool
     184           0 : getStartPositionOfChar(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
     185             : {
     186           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     187           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGTextContentElement.getStartPositionOfChar");
     188             :   }
     189             :   uint32_t arg0;
     190           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
     191           0 :     return false;
     192             :   }
     193           0 :   binding_detail::FastErrorResult rv;
     194           0 :   auto result(StrongOrRawPtr<mozilla::nsISVGPoint>(self->GetStartPositionOfChar(arg0, rv)));
     195           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     196           0 :     return false;
     197             :   }
     198           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     199           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     200           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     201           0 :     return false;
     202             :   }
     203           0 :   return true;
     204             : }
     205             : 
     206             : static const JSJitInfo getStartPositionOfChar_methodinfo = {
     207             :   { (JSJitGetterOp)getStartPositionOfChar },
     208             :   { prototypes::id::SVGTextContentElement },
     209             :   { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
     210             :   JSJitInfo::Method,
     211             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     212             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     213             :   false,  /* isInfallible. False in setters. */
     214             :   false,  /* isMovable.  Not relevant for setters. */
     215             :   false, /* isEliminatable.  Not relevant for setters. */
     216             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     217             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     218             :   false,  /* isTypedMethod.  Only relevant for methods. */
     219             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     220             : };
     221             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     222             : static_assert(0 < 1, "There is no slot for us");
     223             : 
     224             : static bool
     225           0 : getEndPositionOfChar(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
     226             : {
     227           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     228           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGTextContentElement.getEndPositionOfChar");
     229             :   }
     230             :   uint32_t arg0;
     231           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
     232           0 :     return false;
     233             :   }
     234           0 :   binding_detail::FastErrorResult rv;
     235           0 :   auto result(StrongOrRawPtr<mozilla::nsISVGPoint>(self->GetEndPositionOfChar(arg0, rv)));
     236           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     237           0 :     return false;
     238             :   }
     239           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     240           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     241           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     242           0 :     return false;
     243             :   }
     244           0 :   return true;
     245             : }
     246             : 
     247             : static const JSJitInfo getEndPositionOfChar_methodinfo = {
     248             :   { (JSJitGetterOp)getEndPositionOfChar },
     249             :   { prototypes::id::SVGTextContentElement },
     250             :   { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
     251             :   JSJitInfo::Method,
     252             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     253             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     254             :   false,  /* isInfallible. False in setters. */
     255             :   false,  /* isMovable.  Not relevant for setters. */
     256             :   false, /* isEliminatable.  Not relevant for setters. */
     257             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     258             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     259             :   false,  /* isTypedMethod.  Only relevant for methods. */
     260             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     261             : };
     262             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     263             : static_assert(0 < 1, "There is no slot for us");
     264             : 
     265             : static bool
     266           0 : getExtentOfChar(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
     267             : {
     268           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     269           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGTextContentElement.getExtentOfChar");
     270             :   }
     271             :   uint32_t arg0;
     272           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
     273           0 :     return false;
     274             :   }
     275           0 :   binding_detail::FastErrorResult rv;
     276           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGIRect>(self->GetExtentOfChar(arg0, rv)));
     277           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     278           0 :     return false;
     279             :   }
     280           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     281             :   static_assert(!IsPointer<decltype(result)>::value,
     282             :                 "NewObject implies that we need to keep the object alive with a strong reference.");
     283           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     284           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     285           0 :     return false;
     286             :   }
     287           0 :   return true;
     288             : }
     289             : 
     290             : static const JSJitInfo getExtentOfChar_methodinfo = {
     291             :   { (JSJitGetterOp)getExtentOfChar },
     292             :   { prototypes::id::SVGTextContentElement },
     293             :   { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
     294             :   JSJitInfo::Method,
     295             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     296             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     297             :   false,  /* isInfallible. False in setters. */
     298             :   false,  /* isMovable.  Not relevant for setters. */
     299             :   false, /* isEliminatable.  Not relevant for setters. */
     300             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     301             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     302             :   false,  /* isTypedMethod.  Only relevant for methods. */
     303             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     304             : };
     305             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     306             : static_assert(0 < 1, "There is no slot for us");
     307             : 
     308             : static bool
     309           0 : getRotationOfChar(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
     310             : {
     311           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     312           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGTextContentElement.getRotationOfChar");
     313             :   }
     314             :   uint32_t arg0;
     315           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
     316           0 :     return false;
     317             :   }
     318           0 :   binding_detail::FastErrorResult rv;
     319           0 :   float result(self->GetRotationOfChar(arg0, rv));
     320           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     321           0 :     return false;
     322             :   }
     323           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     324           0 :   args.rval().set(JS_NumberValue(double(result)));
     325           0 :   return true;
     326             : }
     327             : 
     328             : static const JSJitInfo getRotationOfChar_methodinfo = {
     329             :   { (JSJitGetterOp)getRotationOfChar },
     330             :   { prototypes::id::SVGTextContentElement },
     331             :   { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
     332             :   JSJitInfo::Method,
     333             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     334             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
     335             :   false,  /* isInfallible. False in setters. */
     336             :   false,  /* isMovable.  Not relevant for setters. */
     337             :   false, /* isEliminatable.  Not relevant for setters. */
     338             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     339             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     340             :   false,  /* isTypedMethod.  Only relevant for methods. */
     341             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     342             : };
     343             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     344             : static_assert(0 < 1, "There is no slot for us");
     345             : 
     346             : static bool
     347           0 : getCharNumAtPosition(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
     348             : {
     349           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     350           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGTextContentElement.getCharNumAtPosition");
     351             :   }
     352           0 :   NonNull<mozilla::nsISVGPoint> arg0;
     353           0 :   if (args[0].isObject()) {
     354             :     {
     355           0 :       nsresult rv = UnwrapObject<prototypes::id::SVGPoint, mozilla::nsISVGPoint>(args[0], arg0);
     356           0 :       if (NS_FAILED(rv)) {
     357           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of SVGTextContentElement.getCharNumAtPosition", "SVGPoint");
     358           0 :         return false;
     359             :       }
     360             :     }
     361             :   } else {
     362           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of SVGTextContentElement.getCharNumAtPosition");
     363           0 :     return false;
     364             :   }
     365           0 :   int32_t result(self->GetCharNumAtPosition(NonNullHelper(arg0)));
     366           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     367           0 :   args.rval().setInt32(int32_t(result));
     368           0 :   return true;
     369             : }
     370             : 
     371             : static const JSJitInfo getCharNumAtPosition_methodinfo = {
     372             :   { (JSJitGetterOp)getCharNumAtPosition },
     373             :   { prototypes::id::SVGTextContentElement },
     374             :   { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
     375             :   JSJitInfo::Method,
     376             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     377             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
     378             :   false,  /* isInfallible. False in setters. */
     379             :   false,  /* isMovable.  Not relevant for setters. */
     380             :   false, /* isEliminatable.  Not relevant for setters. */
     381             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     382             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     383             :   false,  /* isTypedMethod.  Only relevant for methods. */
     384             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     385             : };
     386             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     387             : static_assert(0 < 1, "There is no slot for us");
     388             : 
     389             : static bool
     390           0 : selectSubString(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGTextContentElement* self, const JSJitMethodCallArgs& args)
     391             : {
     392           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     393           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGTextContentElement.selectSubString");
     394             :   }
     395             :   uint32_t arg0;
     396           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
     397           0 :     return false;
     398             :   }
     399             :   uint32_t arg1;
     400           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
     401           0 :     return false;
     402             :   }
     403           0 :   binding_detail::FastErrorResult rv;
     404           0 :   self->SelectSubString(arg0, arg1, rv);
     405           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     406           0 :     return false;
     407             :   }
     408           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     409           0 :   args.rval().setUndefined();
     410           0 :   return true;
     411             : }
     412             : 
     413             : static const JSJitInfo selectSubString_methodinfo = {
     414             :   { (JSJitGetterOp)selectSubString },
     415             :   { prototypes::id::SVGTextContentElement },
     416             :   { PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth },
     417             :   JSJitInfo::Method,
     418             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     419             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     420             :   false,  /* isInfallible. False in setters. */
     421             :   false,  /* isMovable.  Not relevant for setters. */
     422             :   false, /* isEliminatable.  Not relevant for setters. */
     423             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     424             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     425             :   false,  /* isTypedMethod.  Only relevant for methods. */
     426             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     427             : };
     428             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     429             : static_assert(0 < 1, "There is no slot for us");
     430             : 
     431             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     432             : #if defined(__clang__)
     433             : #pragma clang diagnostic push
     434             : #pragma clang diagnostic ignored "-Wmissing-braces"
     435             : #endif
     436             : static const JSFunctionSpec sMethods_specs[] = {
     437             :   JS_FNSPEC("getNumberOfChars", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getNumberOfChars_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
     438             :   JS_FNSPEC("getComputedTextLength", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getComputedTextLength_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
     439             :   JS_FNSPEC("getSubStringLength", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getSubStringLength_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
     440             :   JS_FNSPEC("getStartPositionOfChar", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getStartPositionOfChar_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     441             :   JS_FNSPEC("getEndPositionOfChar", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getEndPositionOfChar_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     442             :   JS_FNSPEC("getExtentOfChar", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getExtentOfChar_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     443             :   JS_FNSPEC("getRotationOfChar", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getRotationOfChar_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     444             :   JS_FNSPEC("getCharNumAtPosition", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getCharNumAtPosition_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     445             :   JS_FNSPEC("selectSubString", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&selectSubString_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
     446             :   JS_FS_END
     447             : };
     448             : #if defined(__clang__)
     449             : #pragma clang diagnostic pop
     450             : #endif
     451             : 
     452             : 
     453             : // Can't be const because the pref-enabled boolean needs to be writable
     454             : static Prefable<const JSFunctionSpec> sMethods[] = {
     455             :   { nullptr, &sMethods_specs[0] },
     456             :   { nullptr, nullptr }
     457             : };
     458             : 
     459             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     460             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     461             : static_assert(9 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     462             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     463             : 
     464             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     465             : #if defined(__clang__)
     466             : #pragma clang diagnostic push
     467             : #pragma clang diagnostic ignored "-Wmissing-braces"
     468             : #endif
     469             : static const JSPropertySpec sAttributes_specs[] = {
     470             :   { "textLength", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &textLength_getterinfo, nullptr, nullptr },
     471             :   { "lengthAdjust", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &lengthAdjust_getterinfo, nullptr, nullptr },
     472             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     473             : };
     474             : #if defined(__clang__)
     475             : #pragma clang diagnostic pop
     476             : #endif
     477             : 
     478             : 
     479             : // Can't be const because the pref-enabled boolean needs to be writable
     480             : static Prefable<const JSPropertySpec> sAttributes[] = {
     481             :   { nullptr, &sAttributes_specs[0] },
     482             :   { nullptr, nullptr }
     483             : };
     484             : 
     485             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     486             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     487             : static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     488             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     489             : 
     490             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     491             : #if defined(__clang__)
     492             : #pragma clang diagnostic push
     493             : #pragma clang diagnostic ignored "-Wmissing-braces"
     494             : #endif
     495             : static const ConstantSpec sConstants_specs[] = {
     496             :   { "LENGTHADJUST_UNKNOWN", JS::Int32Value(0) },
     497             :   { "LENGTHADJUST_SPACING", JS::Int32Value(1) },
     498             :   { "LENGTHADJUST_SPACINGANDGLYPHS", JS::Int32Value(2) },
     499             :   { 0, JS::UndefinedValue() }
     500             : };
     501             : #if defined(__clang__)
     502             : #pragma clang diagnostic pop
     503             : #endif
     504             : 
     505             : 
     506             : // Can't be const because the pref-enabled boolean needs to be writable
     507             : static Prefable<const ConstantSpec> sConstants[] = {
     508             :   { nullptr, &sConstants_specs[0] },
     509             :   { nullptr, nullptr }
     510             : };
     511             : 
     512             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     513             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     514             : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     515             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     516             : 
     517             : 
     518             : static uint16_t sNativeProperties_sortedPropertyIndices[14];
     519             : static PropertyInfo sNativeProperties_propertyInfos[14];
     520             : 
     521             : static const NativePropertiesN<3> sNativeProperties = {
     522             :   false, 0,
     523             :   false, 0,
     524             :   true,  0 /* sMethods */,
     525             :   true,  1 /* sAttributes */,
     526             :   false, 0,
     527             :   false, 0,
     528             :   true,  2 /* sConstants */,
     529             :   -1,
     530             :   14,
     531             :   sNativeProperties_sortedPropertyIndices,
     532             :   {
     533             :     { sMethods, &sNativeProperties_propertyInfos[0] },
     534             :     { sAttributes, &sNativeProperties_propertyInfos[9] },
     535             :     { sConstants, &sNativeProperties_propertyInfos[11] }
     536             :   }
     537             : };
     538             : static_assert(14 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     539             :     "We have a property info count that is oversized");
     540             : 
     541             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     542             :   {
     543             :     "Function",
     544             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     545             :     &sBoringInterfaceObjectClassClassOps,
     546             :     JS_NULL_CLASS_SPEC,
     547             :     JS_NULL_CLASS_EXT,
     548             :     &sInterfaceObjectClassObjectOps
     549             :   },
     550             :   eInterface,
     551             :   true,
     552             :   prototypes::id::SVGTextContentElement,
     553             :   PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth,
     554             :   sNativePropertyHooks,
     555             :   "function SVGTextContentElement() {\n    [native code]\n}",
     556             :   SVGGraphicsElementBinding::GetConstructorObject
     557             : };
     558             : 
     559             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     560             :   {
     561             :     "SVGTextContentElementPrototype",
     562             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     563             :     JS_NULL_CLASS_OPS,
     564             :     JS_NULL_CLASS_SPEC,
     565             :     JS_NULL_CLASS_EXT,
     566             :     JS_NULL_OBJECT_OPS
     567             :   },
     568             :   eInterfacePrototype,
     569             :   false,
     570             :   prototypes::id::SVGTextContentElement,
     571             :   PrototypeTraits<prototypes::id::SVGTextContentElement>::Depth,
     572             :   sNativePropertyHooks,
     573             :   "[object SVGTextContentElementPrototype]",
     574             :   SVGGraphicsElementBinding::GetProtoObject
     575             : };
     576             : 
     577             : JSObject*
     578           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     579             : {
     580           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     581             : }
     582             : 
     583             : const NativePropertyHooks sNativePropertyHooks[] = { {
     584             :   nullptr,
     585             :   nullptr,
     586             :   nullptr,
     587             :   { sNativeProperties.Upcast(), nullptr },
     588             :   prototypes::id::SVGTextContentElement,
     589             :   constructors::id::SVGTextContentElement,
     590             :   SVGGraphicsElementBinding::sNativePropertyHooks,
     591             :   &DefaultXrayExpandoObjectClass
     592             : } };
     593             : 
     594             : void
     595           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     596             : {
     597           0 :   JS::Handle<JSObject*> parentProto(SVGGraphicsElementBinding::GetProtoObjectHandle(aCx));
     598           0 :   if (!parentProto) {
     599           0 :     return;
     600             :   }
     601             : 
     602           0 :   JS::Handle<JSObject*> constructorProto(SVGGraphicsElementBinding::GetConstructorObjectHandle(aCx));
     603           0 :   if (!constructorProto) {
     604           0 :     return;
     605             :   }
     606             : 
     607             :   static bool sIdsInited = false;
     608           0 :   if (!sIdsInited && NS_IsMainThread()) {
     609           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     610           0 :       return;
     611             :     }
     612           0 :     sIdsInited = true;
     613             :   }
     614             : 
     615           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGTextContentElement);
     616           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGTextContentElement);
     617           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     618             :                               &sPrototypeClass.mBase, protoCache,
     619             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     620             :                               interfaceCache,
     621             :                               sNativeProperties.Upcast(),
     622             :                               nullptr,
     623             :                               "SVGTextContentElement", aDefineOnGlobal,
     624             :                               nullptr,
     625           0 :                               false);
     626             : }
     627             : 
     628             : JS::Handle<JSObject*>
     629           0 : GetProtoObjectHandle(JSContext* aCx)
     630             : {
     631             :   /* Get the interface prototype object for this class.  This will create the
     632             :      object as needed. */
     633           0 :   bool aDefineOnGlobal = true;
     634             : 
     635             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     636           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     637           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     638           0 :     return nullptr;
     639             :   }
     640             : 
     641             :   /* Check to see whether the interface objects are already installed */
     642           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     643           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGTextContentElement)) {
     644           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     645           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     646             :   }
     647             : 
     648             :   /*
     649             :    * The object might _still_ be null, but that's OK.
     650             :    *
     651             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     652             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     653             :    * changed after they have been set.
     654             :    *
     655             :    * Calling address() avoids the read read barrier that does gray
     656             :    * unmarking, but it's not possible for the object to be gray here.
     657             :    */
     658             : 
     659           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGTextContentElement);
     660           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     661           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     662             : }
     663             : 
     664             : JSObject*
     665           0 : GetProtoObject(JSContext* aCx)
     666             : {
     667           0 :   return GetProtoObjectHandle(aCx);
     668             : }
     669             : 
     670             : JS::Handle<JSObject*>
     671           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     672             : {
     673             :   /* Get the interface object for this class.  This will create the object as
     674             :      needed. */
     675             : 
     676             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     677           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     678           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     679           0 :     return nullptr;
     680             :   }
     681             : 
     682             :   /* Check to see whether the interface objects are already installed */
     683           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     684           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGTextContentElement)) {
     685           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     686           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     687             :   }
     688             : 
     689             :   /*
     690             :    * The object might _still_ be null, but that's OK.
     691             :    *
     692             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     693             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     694             :    * changed after they have been set.
     695             :    *
     696             :    * Calling address() avoids the read read barrier that does gray
     697             :    * unmarking, but it's not possible for the object to be gray here.
     698             :    */
     699             : 
     700           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGTextContentElement);
     701           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     702           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     703             : }
     704             : 
     705             : JSObject*
     706           0 : GetConstructorObject(JSContext* aCx)
     707             : {
     708           0 :   return GetConstructorObjectHandle(aCx);
     709             : }
     710             : 
     711             : } // namespace SVGTextContentElementBinding
     712             : 
     713             : 
     714             : 
     715             : } // namespace dom
     716             : } // namespace mozilla

Generated by: LCOV version 1.13