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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM ScrollBoxObject.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "BoxObjectBinding.h"
       4             : #include "ScrollBoxObjectBinding.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/Element.h"
      10             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      11             : #include "mozilla/dom/PrimitiveConversions.h"
      12             : #include "mozilla/dom/ScrollBoxObject.h"
      13             : #include "mozilla/dom/XrayExpandoClass.h"
      14             : 
      15             : namespace mozilla {
      16             : namespace dom {
      17             : 
      18             : namespace ScrollBoxObjectBinding {
      19             : 
      20             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<BoxObjectBinding::NativeType>::value,
      21             :               "Can't inherit from an interface with a different ownership model.");
      22             : 
      23             : static bool
      24           0 : scrollTo(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, const JSJitMethodCallArgs& args)
      25             : {
      26           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
      27           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ScrollBoxObject.scrollTo");
      28             :   }
      29             :   int32_t arg0;
      30           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
      31           0 :     return false;
      32             :   }
      33             :   int32_t arg1;
      34           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
      35           0 :     return false;
      36             :   }
      37           0 :   binding_detail::FastErrorResult rv;
      38           0 :   self->ScrollTo(arg0, arg1, rv);
      39           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
      40           0 :     return false;
      41             :   }
      42           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      43           0 :   args.rval().setUndefined();
      44           0 :   return true;
      45             : }
      46             : 
      47             : static const JSJitInfo scrollTo_methodinfo = {
      48             :   { (JSJitGetterOp)scrollTo },
      49             :   { prototypes::id::ScrollBoxObject },
      50             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
      51             :   JSJitInfo::Method,
      52             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      53             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
      54             :   false,  /* isInfallible. False in setters. */
      55             :   false,  /* isMovable.  Not relevant for setters. */
      56             :   false, /* isEliminatable.  Not relevant for setters. */
      57             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      58             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      59             :   false,  /* isTypedMethod.  Only relevant for methods. */
      60             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      61             : };
      62             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      63             : static_assert(0 < 1, "There is no slot for us");
      64             : 
      65             : static bool
      66           0 : scrollBy(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, const JSJitMethodCallArgs& args)
      67             : {
      68           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
      69           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ScrollBoxObject.scrollBy");
      70             :   }
      71             :   int32_t arg0;
      72           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
      73           0 :     return false;
      74             :   }
      75             :   int32_t arg1;
      76           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
      77           0 :     return false;
      78             :   }
      79           0 :   binding_detail::FastErrorResult rv;
      80           0 :   self->ScrollBy(arg0, arg1, rv);
      81           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
      82           0 :     return false;
      83             :   }
      84           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      85           0 :   args.rval().setUndefined();
      86           0 :   return true;
      87             : }
      88             : 
      89             : static const JSJitInfo scrollBy_methodinfo = {
      90             :   { (JSJitGetterOp)scrollBy },
      91             :   { prototypes::id::ScrollBoxObject },
      92             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
      93             :   JSJitInfo::Method,
      94             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      95             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
      96             :   false,  /* isInfallible. False in setters. */
      97             :   false,  /* isMovable.  Not relevant for setters. */
      98             :   false, /* isEliminatable.  Not relevant for setters. */
      99             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     100             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     101             :   false,  /* isTypedMethod.  Only relevant for methods. */
     102             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     103             : };
     104             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     105             : static_assert(0 < 1, "There is no slot for us");
     106             : 
     107             : static bool
     108           0 : scrollByLine(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, const JSJitMethodCallArgs& args)
     109             : {
     110           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     111           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ScrollBoxObject.scrollByLine");
     112             :   }
     113             :   int32_t arg0;
     114           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
     115           0 :     return false;
     116             :   }
     117           0 :   binding_detail::FastErrorResult rv;
     118           0 :   self->ScrollByLine(arg0, rv);
     119           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     120           0 :     return false;
     121             :   }
     122           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     123           0 :   args.rval().setUndefined();
     124           0 :   return true;
     125             : }
     126             : 
     127             : static const JSJitInfo scrollByLine_methodinfo = {
     128             :   { (JSJitGetterOp)scrollByLine },
     129             :   { prototypes::id::ScrollBoxObject },
     130             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
     131             :   JSJitInfo::Method,
     132             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     133             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     134             :   false,  /* isInfallible. False in setters. */
     135             :   false,  /* isMovable.  Not relevant for setters. */
     136             :   false, /* isEliminatable.  Not relevant for setters. */
     137             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     138             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     139             :   false,  /* isTypedMethod.  Only relevant for methods. */
     140             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     141             : };
     142             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     143             : static_assert(0 < 1, "There is no slot for us");
     144             : 
     145             : static bool
     146           0 : scrollByIndex(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, const JSJitMethodCallArgs& args)
     147             : {
     148           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     149           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ScrollBoxObject.scrollByIndex");
     150             :   }
     151             :   int32_t arg0;
     152           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
     153           0 :     return false;
     154             :   }
     155           0 :   binding_detail::FastErrorResult rv;
     156           0 :   self->ScrollByIndex(arg0, 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().setUndefined();
     162           0 :   return true;
     163             : }
     164             : 
     165             : static const JSJitInfo scrollByIndex_methodinfo = {
     166             :   { (JSJitGetterOp)scrollByIndex },
     167             :   { prototypes::id::ScrollBoxObject },
     168             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
     169             :   JSJitInfo::Method,
     170             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     171             :   JSVAL_TYPE_UNDEFINED,  /* 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 : scrollToLine(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, const JSJitMethodCallArgs& args)
     185             : {
     186           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     187           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ScrollBoxObject.scrollToLine");
     188             :   }
     189             :   int32_t arg0;
     190           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
     191           0 :     return false;
     192             :   }
     193           0 :   binding_detail::FastErrorResult rv;
     194           0 :   self->ScrollToLine(arg0, rv);
     195           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     196           0 :     return false;
     197             :   }
     198           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     199           0 :   args.rval().setUndefined();
     200           0 :   return true;
     201             : }
     202             : 
     203             : static const JSJitInfo scrollToLine_methodinfo = {
     204             :   { (JSJitGetterOp)scrollToLine },
     205             :   { prototypes::id::ScrollBoxObject },
     206             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
     207             :   JSJitInfo::Method,
     208             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     209             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     210             :   false,  /* isInfallible. False in setters. */
     211             :   false,  /* isMovable.  Not relevant for setters. */
     212             :   false, /* isEliminatable.  Not relevant for setters. */
     213             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     214             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     215             :   false,  /* isTypedMethod.  Only relevant for methods. */
     216             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     217             : };
     218             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     219             : static_assert(0 < 1, "There is no slot for us");
     220             : 
     221             : static bool
     222           0 : scrollToElement(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, const JSJitMethodCallArgs& args)
     223             : {
     224           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     225           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ScrollBoxObject.scrollToElement");
     226             :   }
     227           0 :   NonNull<mozilla::dom::Element> arg0;
     228           0 :   if (args[0].isObject()) {
     229             :     {
     230           0 :       nsresult rv = UnwrapObject<prototypes::id::Element, mozilla::dom::Element>(args[0], arg0);
     231           0 :       if (NS_FAILED(rv)) {
     232           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of ScrollBoxObject.scrollToElement", "Element");
     233           0 :         return false;
     234             :       }
     235             :     }
     236             :   } else {
     237           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of ScrollBoxObject.scrollToElement");
     238           0 :     return false;
     239             :   }
     240           0 :   binding_detail::FastErrorResult rv;
     241           0 :   self->ScrollToElement(NonNullHelper(arg0), rv);
     242           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     243           0 :     return false;
     244             :   }
     245           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     246           0 :   args.rval().setUndefined();
     247           0 :   return true;
     248             : }
     249             : 
     250             : static const JSJitInfo scrollToElement_methodinfo = {
     251             :   { (JSJitGetterOp)scrollToElement },
     252             :   { prototypes::id::ScrollBoxObject },
     253             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
     254             :   JSJitInfo::Method,
     255             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     256             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     257             :   false,  /* isInfallible. False in setters. */
     258             :   false,  /* isMovable.  Not relevant for setters. */
     259             :   false, /* isEliminatable.  Not relevant for setters. */
     260             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     261             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     262             :   false,  /* isTypedMethod.  Only relevant for methods. */
     263             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     264             : };
     265             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     266             : static_assert(0 < 1, "There is no slot for us");
     267             : 
     268             : static bool
     269           0 : scrollToIndex(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, const JSJitMethodCallArgs& args)
     270             : {
     271           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     272           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ScrollBoxObject.scrollToIndex");
     273             :   }
     274             :   int32_t arg0;
     275           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
     276           0 :     return false;
     277             :   }
     278           0 :   binding_detail::FastErrorResult rv;
     279           0 :   self->ScrollToIndex(arg0, rv);
     280           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     281           0 :     return false;
     282             :   }
     283           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     284           0 :   args.rval().setUndefined();
     285           0 :   return true;
     286             : }
     287             : 
     288             : static const JSJitInfo scrollToIndex_methodinfo = {
     289             :   { (JSJitGetterOp)scrollToIndex },
     290             :   { prototypes::id::ScrollBoxObject },
     291             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
     292             :   JSJitInfo::Method,
     293             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     294             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     295             :   false,  /* isInfallible. False in setters. */
     296             :   false,  /* isMovable.  Not relevant for setters. */
     297             :   false, /* isEliminatable.  Not relevant for setters. */
     298             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     299             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     300             :   false,  /* isTypedMethod.  Only relevant for methods. */
     301             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     302             : };
     303             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     304             : static_assert(0 < 1, "There is no slot for us");
     305             : 
     306             : static bool
     307           0 : get_positionX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, JSJitGetterCallArgs args)
     308             : {
     309           0 :   binding_detail::FastErrorResult rv;
     310           0 :   int32_t result(self->GetPositionX(rv));
     311           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     312           0 :     return false;
     313             :   }
     314           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     315           0 :   args.rval().setInt32(int32_t(result));
     316           0 :   return true;
     317             : }
     318             : 
     319             : static const JSJitInfo positionX_getterinfo = {
     320             :   { (JSJitGetterOp)get_positionX },
     321             :   { prototypes::id::ScrollBoxObject },
     322             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
     323             :   JSJitInfo::Getter,
     324             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     325             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
     326             :   false,  /* isInfallible. False in setters. */
     327             :   false,  /* isMovable.  Not relevant for setters. */
     328             :   false, /* isEliminatable.  Not relevant for setters. */
     329             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     330             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     331             :   false,  /* isTypedMethod.  Only relevant for methods. */
     332             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     333             : };
     334             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     335             : static_assert(0 < 1, "There is no slot for us");
     336             : 
     337             : static bool
     338           0 : get_positionY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, JSJitGetterCallArgs args)
     339             : {
     340           0 :   binding_detail::FastErrorResult rv;
     341           0 :   int32_t result(self->GetPositionY(rv));
     342           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     343           0 :     return false;
     344             :   }
     345           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     346           0 :   args.rval().setInt32(int32_t(result));
     347           0 :   return true;
     348             : }
     349             : 
     350             : static const JSJitInfo positionY_getterinfo = {
     351             :   { (JSJitGetterOp)get_positionY },
     352             :   { prototypes::id::ScrollBoxObject },
     353             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
     354             :   JSJitInfo::Getter,
     355             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     356             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
     357             :   false,  /* isInfallible. False in setters. */
     358             :   false,  /* isMovable.  Not relevant for setters. */
     359             :   false, /* isEliminatable.  Not relevant for setters. */
     360             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     361             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     362             :   false,  /* isTypedMethod.  Only relevant for methods. */
     363             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     364             : };
     365             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     366             : static_assert(0 < 1, "There is no slot for us");
     367             : 
     368             : static bool
     369           0 : get_scrolledWidth(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, JSJitGetterCallArgs args)
     370             : {
     371           0 :   binding_detail::FastErrorResult rv;
     372           0 :   int32_t result(self->GetScrolledWidth(rv));
     373           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     374           0 :     return false;
     375             :   }
     376           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     377           0 :   args.rval().setInt32(int32_t(result));
     378           0 :   return true;
     379             : }
     380             : 
     381             : static const JSJitInfo scrolledWidth_getterinfo = {
     382             :   { (JSJitGetterOp)get_scrolledWidth },
     383             :   { prototypes::id::ScrollBoxObject },
     384             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
     385             :   JSJitInfo::Getter,
     386             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     387             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
     388             :   false,  /* isInfallible. False in setters. */
     389             :   false,  /* isMovable.  Not relevant for setters. */
     390             :   false, /* isEliminatable.  Not relevant for setters. */
     391             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     392             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     393             :   false,  /* isTypedMethod.  Only relevant for methods. */
     394             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     395             : };
     396             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     397             : static_assert(0 < 1, "There is no slot for us");
     398             : 
     399             : static bool
     400           0 : get_scrolledHeight(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, JSJitGetterCallArgs args)
     401             : {
     402           0 :   binding_detail::FastErrorResult rv;
     403           0 :   int32_t result(self->GetScrolledHeight(rv));
     404           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     405           0 :     return false;
     406             :   }
     407           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     408           0 :   args.rval().setInt32(int32_t(result));
     409           0 :   return true;
     410             : }
     411             : 
     412             : static const JSJitInfo scrolledHeight_getterinfo = {
     413             :   { (JSJitGetterOp)get_scrolledHeight },
     414             :   { prototypes::id::ScrollBoxObject },
     415             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
     416             :   JSJitInfo::Getter,
     417             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     418             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
     419             :   false,  /* isInfallible. False in setters. */
     420             :   false,  /* isMovable.  Not relevant for setters. */
     421             :   false, /* isEliminatable.  Not relevant for setters. */
     422             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     423             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     424             :   false,  /* isTypedMethod.  Only relevant for methods. */
     425             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     426             : };
     427             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     428             : static_assert(0 < 1, "There is no slot for us");
     429             : 
     430             : static bool
     431           0 : getPosition(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, const JSJitMethodCallArgs& args)
     432             : {
     433           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     434           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ScrollBoxObject.getPosition");
     435             :   }
     436           0 :   JS::Rooted<JSObject*> arg0(cx);
     437           0 :   if (args[0].isObject()) {
     438           0 :     arg0 = &args[0].toObject();
     439             :   } else {
     440           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of ScrollBoxObject.getPosition");
     441           0 :     return false;
     442             :   }
     443           0 :   JS::Rooted<JSObject*> arg1(cx);
     444           0 :   if (args[1].isObject()) {
     445           0 :     arg1 = &args[1].toObject();
     446             :   } else {
     447           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of ScrollBoxObject.getPosition");
     448           0 :     return false;
     449             :   }
     450           0 :   binding_detail::FastErrorResult rv;
     451           0 :   self->GetPosition(cx, arg0, arg1, rv);
     452           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     453           0 :     return false;
     454             :   }
     455           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     456           0 :   args.rval().setUndefined();
     457           0 :   return true;
     458             : }
     459             : 
     460             : static const JSJitInfo getPosition_methodinfo = {
     461             :   { (JSJitGetterOp)getPosition },
     462             :   { prototypes::id::ScrollBoxObject },
     463             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
     464             :   JSJitInfo::Method,
     465             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     466             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     467             :   false,  /* isInfallible. False in setters. */
     468             :   false,  /* isMovable.  Not relevant for setters. */
     469             :   false, /* isEliminatable.  Not relevant for setters. */
     470             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     471             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     472             :   false,  /* isTypedMethod.  Only relevant for methods. */
     473             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     474             : };
     475             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     476             : static_assert(0 < 1, "There is no slot for us");
     477             : 
     478             : static bool
     479           0 : getScrolledSize(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, const JSJitMethodCallArgs& args)
     480             : {
     481           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     482           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ScrollBoxObject.getScrolledSize");
     483             :   }
     484           0 :   JS::Rooted<JSObject*> arg0(cx);
     485           0 :   if (args[0].isObject()) {
     486           0 :     arg0 = &args[0].toObject();
     487             :   } else {
     488           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of ScrollBoxObject.getScrolledSize");
     489           0 :     return false;
     490             :   }
     491           0 :   JS::Rooted<JSObject*> arg1(cx);
     492           0 :   if (args[1].isObject()) {
     493           0 :     arg1 = &args[1].toObject();
     494             :   } else {
     495           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of ScrollBoxObject.getScrolledSize");
     496           0 :     return false;
     497             :   }
     498           0 :   binding_detail::FastErrorResult rv;
     499           0 :   self->GetScrolledSize(cx, arg0, arg1, rv);
     500           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     501           0 :     return false;
     502             :   }
     503           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     504           0 :   args.rval().setUndefined();
     505           0 :   return true;
     506             : }
     507             : 
     508             : static const JSJitInfo getScrolledSize_methodinfo = {
     509             :   { (JSJitGetterOp)getScrolledSize },
     510             :   { prototypes::id::ScrollBoxObject },
     511             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
     512             :   JSJitInfo::Method,
     513             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     514             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     515             :   false,  /* isInfallible. False in setters. */
     516             :   false,  /* isMovable.  Not relevant for setters. */
     517             :   false, /* isEliminatable.  Not relevant for setters. */
     518             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     519             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     520             :   false,  /* isTypedMethod.  Only relevant for methods. */
     521             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     522             : };
     523             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     524             : static_assert(0 < 1, "There is no slot for us");
     525             : 
     526             : static bool
     527           0 : ensureElementIsVisible(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, const JSJitMethodCallArgs& args)
     528             : {
     529           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     530           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ScrollBoxObject.ensureElementIsVisible");
     531             :   }
     532           0 :   NonNull<mozilla::dom::Element> arg0;
     533           0 :   if (args[0].isObject()) {
     534             :     {
     535           0 :       nsresult rv = UnwrapObject<prototypes::id::Element, mozilla::dom::Element>(args[0], arg0);
     536           0 :       if (NS_FAILED(rv)) {
     537           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of ScrollBoxObject.ensureElementIsVisible", "Element");
     538           0 :         return false;
     539             :       }
     540             :     }
     541             :   } else {
     542           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of ScrollBoxObject.ensureElementIsVisible");
     543           0 :     return false;
     544             :   }
     545           0 :   binding_detail::FastErrorResult rv;
     546           0 :   self->EnsureElementIsVisible(NonNullHelper(arg0), rv);
     547           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     548           0 :     return false;
     549             :   }
     550           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     551           0 :   args.rval().setUndefined();
     552           0 :   return true;
     553             : }
     554             : 
     555             : static const JSJitInfo ensureElementIsVisible_methodinfo = {
     556             :   { (JSJitGetterOp)ensureElementIsVisible },
     557             :   { prototypes::id::ScrollBoxObject },
     558             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
     559             :   JSJitInfo::Method,
     560             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     561             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     562             :   false,  /* isInfallible. False in setters. */
     563             :   false,  /* isMovable.  Not relevant for setters. */
     564             :   false, /* isEliminatable.  Not relevant for setters. */
     565             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     566             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     567             :   false,  /* isTypedMethod.  Only relevant for methods. */
     568             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     569             : };
     570             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     571             : static_assert(0 < 1, "There is no slot for us");
     572             : 
     573             : static bool
     574           0 : ensureIndexIsVisible(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, const JSJitMethodCallArgs& args)
     575             : {
     576           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     577           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ScrollBoxObject.ensureIndexIsVisible");
     578             :   }
     579             :   int32_t arg0;
     580           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
     581           0 :     return false;
     582             :   }
     583           0 :   binding_detail::FastErrorResult rv;
     584           0 :   self->EnsureIndexIsVisible(arg0, rv);
     585           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     586           0 :     return false;
     587             :   }
     588           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     589           0 :   args.rval().setUndefined();
     590           0 :   return true;
     591             : }
     592             : 
     593             : static const JSJitInfo ensureIndexIsVisible_methodinfo = {
     594             :   { (JSJitGetterOp)ensureIndexIsVisible },
     595             :   { prototypes::id::ScrollBoxObject },
     596             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
     597             :   JSJitInfo::Method,
     598             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     599             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     600             :   false,  /* isInfallible. False in setters. */
     601             :   false,  /* isMovable.  Not relevant for setters. */
     602             :   false, /* isEliminatable.  Not relevant for setters. */
     603             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     604             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     605             :   false,  /* isTypedMethod.  Only relevant for methods. */
     606             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     607             : };
     608             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     609             : static_assert(0 < 1, "There is no slot for us");
     610             : 
     611             : static bool
     612           0 : ensureLineIsVisible(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollBoxObject* self, const JSJitMethodCallArgs& args)
     613             : {
     614           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     615           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ScrollBoxObject.ensureLineIsVisible");
     616             :   }
     617             :   int32_t arg0;
     618           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
     619           0 :     return false;
     620             :   }
     621           0 :   binding_detail::FastErrorResult rv;
     622           0 :   self->EnsureLineIsVisible(arg0, rv);
     623           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     624           0 :     return false;
     625             :   }
     626           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     627           0 :   args.rval().setUndefined();
     628           0 :   return true;
     629             : }
     630             : 
     631             : static const JSJitInfo ensureLineIsVisible_methodinfo = {
     632             :   { (JSJitGetterOp)ensureLineIsVisible },
     633             :   { prototypes::id::ScrollBoxObject },
     634             :   { PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth },
     635             :   JSJitInfo::Method,
     636             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     637             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     638             :   false,  /* isInfallible. False in setters. */
     639             :   false,  /* isMovable.  Not relevant for setters. */
     640             :   false, /* isEliminatable.  Not relevant for setters. */
     641             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     642             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     643             :   false,  /* isTypedMethod.  Only relevant for methods. */
     644             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     645             : };
     646             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     647             : static_assert(0 < 1, "There is no slot for us");
     648             : 
     649             : static bool
     650           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     651             : {
     652           0 :   mozilla::dom::ScrollBoxObject* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::ScrollBoxObject>(obj);
     653             :   // We don't want to preserve if we don't have a wrapper, and we
     654             :   // obviously can't preserve if we're not initialized.
     655           0 :   if (self && self->GetWrapperPreserveColor()) {
     656           0 :     PreserveWrapper(self);
     657             :   }
     658           0 :   return true;
     659             : }
     660             : 
     661             : static void
     662           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     663             : {
     664           0 :   mozilla::dom::ScrollBoxObject* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::ScrollBoxObject>(obj);
     665           0 :   if (self) {
     666           0 :     ClearWrapper(self, self, obj);
     667           0 :     AddForDeferredFinalization<mozilla::dom::ScrollBoxObject>(self);
     668             :   }
     669           0 : }
     670             : 
     671             : static void
     672           0 : _objectMoved(JSObject* obj, const JSObject* old)
     673             : {
     674           0 :   mozilla::dom::ScrollBoxObject* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::ScrollBoxObject>(obj);
     675           0 :   if (self) {
     676           0 :     UpdateWrapper(self, self, obj, old);
     677             :   }
     678           0 : }
     679             : 
     680             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     681             : #if defined(__clang__)
     682             : #pragma clang diagnostic push
     683             : #pragma clang diagnostic ignored "-Wmissing-braces"
     684             : #endif
     685             : static const JSFunctionSpec sMethods_specs[] = {
     686             :   JS_FNSPEC("scrollTo", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&scrollTo_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
     687             :   JS_FNSPEC("scrollBy", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&scrollBy_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
     688             :   JS_FNSPEC("scrollByLine", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&scrollByLine_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     689             :   JS_FNSPEC("scrollByIndex", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&scrollByIndex_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     690             :   JS_FNSPEC("scrollToLine", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&scrollToLine_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     691             :   JS_FNSPEC("scrollToElement", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&scrollToElement_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     692             :   JS_FNSPEC("scrollToIndex", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&scrollToIndex_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     693             :   JS_FNSPEC("getPosition", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getPosition_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
     694             :   JS_FNSPEC("getScrolledSize", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getScrolledSize_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
     695             :   JS_FNSPEC("ensureElementIsVisible", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&ensureElementIsVisible_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     696             :   JS_FNSPEC("ensureIndexIsVisible", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&ensureIndexIsVisible_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     697             :   JS_FNSPEC("ensureLineIsVisible", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&ensureLineIsVisible_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     698             :   JS_FS_END
     699             : };
     700             : #if defined(__clang__)
     701             : #pragma clang diagnostic pop
     702             : #endif
     703             : 
     704             : 
     705             : // Can't be const because the pref-enabled boolean needs to be writable
     706             : static Prefable<const JSFunctionSpec> sMethods[] = {
     707             :   { nullptr, &sMethods_specs[0] },
     708             :   { nullptr, nullptr }
     709             : };
     710             : 
     711             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     712             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     713             : static_assert(12 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     714             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     715             : 
     716             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     717             : #if defined(__clang__)
     718             : #pragma clang diagnostic push
     719             : #pragma clang diagnostic ignored "-Wmissing-braces"
     720             : #endif
     721             : static const JSPropertySpec sAttributes_specs[] = {
     722             :   { "positionX", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &positionX_getterinfo, nullptr, nullptr },
     723             :   { "positionY", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &positionY_getterinfo, nullptr, nullptr },
     724             :   { "scrolledWidth", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &scrolledWidth_getterinfo, nullptr, nullptr },
     725             :   { "scrolledHeight", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &scrolledHeight_getterinfo, nullptr, nullptr },
     726             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     727             : };
     728             : #if defined(__clang__)
     729             : #pragma clang diagnostic pop
     730             : #endif
     731             : 
     732             : 
     733             : // Can't be const because the pref-enabled boolean needs to be writable
     734             : static Prefable<const JSPropertySpec> sAttributes[] = {
     735             :   { nullptr, &sAttributes_specs[0] },
     736             :   { nullptr, nullptr }
     737             : };
     738             : 
     739             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     740             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     741             : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     742             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     743             : 
     744             : 
     745             : static uint16_t sNativeProperties_sortedPropertyIndices[16];
     746             : static PropertyInfo sNativeProperties_propertyInfos[16];
     747             : 
     748             : static const NativePropertiesN<2> sNativeProperties = {
     749             :   false, 0,
     750             :   false, 0,
     751             :   true,  0 /* sMethods */,
     752             :   true,  1 /* sAttributes */,
     753             :   false, 0,
     754             :   false, 0,
     755             :   false, 0,
     756             :   -1,
     757             :   16,
     758             :   sNativeProperties_sortedPropertyIndices,
     759             :   {
     760             :     { sMethods, &sNativeProperties_propertyInfos[0] },
     761             :     { sAttributes, &sNativeProperties_propertyInfos[12] }
     762             :   }
     763             : };
     764             : static_assert(16 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     765             :     "We have a property info count that is oversized");
     766             : 
     767             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     768             :   {
     769             :     "ScrollBoxObjectPrototype",
     770             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     771             :     JS_NULL_CLASS_OPS,
     772             :     JS_NULL_CLASS_SPEC,
     773             :     JS_NULL_CLASS_EXT,
     774             :     JS_NULL_OBJECT_OPS
     775             :   },
     776             :   eInterfacePrototype,
     777             :   false,
     778             :   prototypes::id::ScrollBoxObject,
     779             :   PrototypeTraits<prototypes::id::ScrollBoxObject>::Depth,
     780             :   sNativePropertyHooks,
     781             :   "[object ScrollBoxObjectPrototype]",
     782             :   BoxObjectBinding::GetProtoObject
     783             : };
     784             : 
     785             : static const js::ClassOps sClassOps = {
     786             :   _addProperty, /* addProperty */
     787             :   nullptr,               /* delProperty */
     788             :   nullptr,               /* getProperty */
     789             :   nullptr,               /* setProperty */
     790             :   nullptr,               /* enumerate */
     791             :   nullptr, /* newEnumerate */
     792             :   nullptr, /* resolve */
     793             :   nullptr, /* mayResolve */
     794             :   _finalize, /* finalize */
     795             :   nullptr, /* call */
     796             :   nullptr,               /* hasInstance */
     797             :   nullptr,               /* construct */
     798             :   nullptr, /* trace */
     799             : };
     800             : 
     801             : static const js::ClassExtension sClassExtension = {
     802             :   nullptr, /* weakmapKeyDelegateOp */
     803             :   _objectMoved /* objectMovedOp */
     804             : };
     805             : 
     806             : static const DOMJSClass sClass = {
     807             :   { "ScrollBoxObject",
     808             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
     809             :     &sClassOps,
     810             :     JS_NULL_CLASS_SPEC,
     811             :     &sClassExtension,
     812             :     JS_NULL_OBJECT_OPS
     813             :   },
     814             :   { prototypes::id::BoxObject, prototypes::id::ScrollBoxObject, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
     815             :   IsBaseOf<nsISupports, mozilla::dom::ScrollBoxObject >::value,
     816             :   sNativePropertyHooks,
     817             :   FindAssociatedGlobalForNative<mozilla::dom::ScrollBoxObject>::Get,
     818             :   GetProtoObjectHandle,
     819             :   GetCCParticipant<mozilla::dom::ScrollBoxObject>::Get()
     820             : };
     821             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     822             :               "Must have the right minimal number of reserved slots.");
     823             : static_assert(1 >= 1,
     824             :               "Must have enough reserved slots.");
     825             : 
     826             : const JSClass*
     827           0 : GetJSClass()
     828             : {
     829           0 :   return sClass.ToJSClass();
     830             : }
     831             : 
     832             : bool
     833           0 : Wrap(JSContext* aCx, mozilla::dom::ScrollBoxObject* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     834             : {
     835             :   MOZ_ASSERT(static_cast<mozilla::dom::ScrollBoxObject*>(aObject) ==
     836             :              reinterpret_cast<mozilla::dom::ScrollBoxObject*>(aObject),
     837             :              "Multiple inheritance for mozilla::dom::ScrollBoxObject is broken.");
     838             :   MOZ_ASSERT(static_cast<mozilla::dom::BoxObject*>(aObject) ==
     839             :              reinterpret_cast<mozilla::dom::BoxObject*>(aObject),
     840             :              "Multiple inheritance for mozilla::dom::BoxObject is broken.");
     841           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     842           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     843           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     844             :              "You should probably not be using Wrap() directly; use "
     845             :              "GetOrCreateDOMReflector instead");
     846             : 
     847           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     848             :              "nsISupports must be on our primary inheritance chain");
     849             : 
     850           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     851           0 :   if (!global) {
     852           0 :     return false;
     853             :   }
     854           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     855           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     856             : 
     857             :   // That might have ended up wrapping us already, due to the wonders
     858             :   // of XBL.  Check for that, and bail out as needed.
     859           0 :   aReflector.set(aCache->GetWrapper());
     860           0 :   if (aReflector) {
     861             : #ifdef DEBUG
     862           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     863             : #endif // DEBUG
     864           0 :     return true;
     865             :   }
     866             : 
     867           0 :   JSAutoCompartment ac(aCx, global);
     868           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     869           0 :   if (!canonicalProto) {
     870           0 :     return false;
     871             :   }
     872           0 :   JS::Rooted<JSObject*> proto(aCx);
     873           0 :   if (aGivenProto) {
     874           0 :     proto = aGivenProto;
     875             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     876             :     // coming in, we changed compartments to that of "parent" so may need
     877             :     // to wrap the proto here.
     878           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     879           0 :       if (!JS_WrapObject(aCx, &proto)) {
     880           0 :         return false;
     881             :       }
     882             :     }
     883             :   } else {
     884           0 :     proto = canonicalProto;
     885             :   }
     886             : 
     887           0 :   BindingJSObjectCreator<mozilla::dom::ScrollBoxObject> creator(aCx);
     888           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     889           0 :   if (!aReflector) {
     890           0 :     return false;
     891             :   }
     892             : 
     893           0 :   aCache->SetWrapper(aReflector);
     894           0 :   creator.InitializationSucceeded();
     895             : 
     896           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     897             :              aCache->GetWrapperPreserveColor() == aReflector);
     898             :   // If proto != canonicalProto, we have to preserve our wrapper;
     899             :   // otherwise we won't be able to properly recreate it later, since
     900             :   // we won't know what proto to use.  Note that we don't check
     901             :   // aGivenProto here, since it's entirely possible (and even
     902             :   // somewhat common) to have a non-null aGivenProto which is the
     903             :   // same as canonicalProto.
     904           0 :   if (proto != canonicalProto) {
     905           0 :     PreserveWrapper(aObject);
     906             :   }
     907             : 
     908           0 :   return true;
     909             : }
     910             : 
     911             : const NativePropertyHooks sNativePropertyHooks[] = { {
     912             :   nullptr,
     913             :   nullptr,
     914             :   nullptr,
     915             :   { sNativeProperties.Upcast(), nullptr },
     916             :   prototypes::id::ScrollBoxObject,
     917             :   constructors::id::_ID_Count,
     918             :   BoxObjectBinding::sNativePropertyHooks,
     919             :   &DefaultXrayExpandoObjectClass
     920             : } };
     921             : 
     922             : void
     923           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     924             : {
     925           0 :   JS::Handle<JSObject*> parentProto(BoxObjectBinding::GetProtoObjectHandle(aCx));
     926           0 :   if (!parentProto) {
     927           0 :     return;
     928             :   }
     929             : 
     930             :   static bool sIdsInited = false;
     931           0 :   if (!sIdsInited && NS_IsMainThread()) {
     932           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     933           0 :       return;
     934             :     }
     935           0 :     sIdsInited = true;
     936             :   }
     937             : 
     938           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::ScrollBoxObject);
     939           0 :   JS::Heap<JSObject*>* interfaceCache = nullptr;
     940           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     941             :                               &sPrototypeClass.mBase, protoCache,
     942             :                               nullptr, nullptr, 0, nullptr,
     943             :                               interfaceCache,
     944             :                               sNativeProperties.Upcast(),
     945             :                               nullptr,
     946             :                               nullptr, aDefineOnGlobal,
     947             :                               nullptr,
     948           0 :                               false);
     949             : }
     950             : 
     951             : JS::Handle<JSObject*>
     952           0 : GetProtoObjectHandle(JSContext* aCx)
     953             : {
     954             :   /* Get the interface prototype object for this class.  This will create the
     955             :      object as needed. */
     956           0 :   bool aDefineOnGlobal = true;
     957             : 
     958             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     959           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     960           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     961           0 :     return nullptr;
     962             :   }
     963             : 
     964             :   /* Check to see whether the interface objects are already installed */
     965           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     966           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::ScrollBoxObject)) {
     967           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     968           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     969             :   }
     970             : 
     971             :   /*
     972             :    * The object might _still_ be null, but that's OK.
     973             :    *
     974             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     975             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     976             :    * changed after they have been set.
     977             :    *
     978             :    * Calling address() avoids the read read barrier that does gray
     979             :    * unmarking, but it's not possible for the object to be gray here.
     980             :    */
     981             : 
     982           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::ScrollBoxObject);
     983           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     984           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     985             : }
     986             : 
     987             : } // namespace ScrollBoxObjectBinding
     988             : 
     989             : 
     990             : 
     991             : } // namespace dom
     992             : } // namespace mozilla

Generated by: LCOV version 1.13