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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM ScrollAreaEvent.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "ScrollAreaEventBinding.h"
       4             : #include "UIEventBinding.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/Nullable.h"
      12             : #include "mozilla/dom/PrimitiveConversions.h"
      13             : #include "mozilla/dom/ScrollAreaEvent.h"
      14             : #include "mozilla/dom/XrayExpandoClass.h"
      15             : #include "nsGlobalWindow.h"
      16             : 
      17             : namespace mozilla {
      18             : namespace dom {
      19             : 
      20             : namespace ScrollAreaEventBinding {
      21             : 
      22             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<UIEventBinding::NativeType>::value,
      23             :               "Can't inherit from an interface with a different ownership model.");
      24             : 
      25             : static bool
      26           0 : get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollAreaEvent* self, JSJitGetterCallArgs args)
      27             : {
      28           0 :   float result(self->X());
      29           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      30           0 :   args.rval().set(JS_NumberValue(double(result)));
      31           0 :   return true;
      32             : }
      33             : 
      34             : static const JSJitInfo x_getterinfo = {
      35             :   { (JSJitGetterOp)get_x },
      36             :   { prototypes::id::ScrollAreaEvent },
      37             :   { PrototypeTraits<prototypes::id::ScrollAreaEvent>::Depth },
      38             :   JSJitInfo::Getter,
      39             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      40             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
      41             :   true,  /* isInfallible. False in setters. */
      42             :   false,  /* isMovable.  Not relevant for setters. */
      43             :   false, /* isEliminatable.  Not relevant for setters. */
      44             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      45             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      46             :   false,  /* isTypedMethod.  Only relevant for methods. */
      47             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      48             : };
      49             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      50             : static_assert(0 < 1, "There is no slot for us");
      51             : 
      52             : static bool
      53           0 : get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollAreaEvent* self, JSJitGetterCallArgs args)
      54             : {
      55           0 :   float result(self->Y());
      56           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      57           0 :   args.rval().set(JS_NumberValue(double(result)));
      58           0 :   return true;
      59             : }
      60             : 
      61             : static const JSJitInfo y_getterinfo = {
      62             :   { (JSJitGetterOp)get_y },
      63             :   { prototypes::id::ScrollAreaEvent },
      64             :   { PrototypeTraits<prototypes::id::ScrollAreaEvent>::Depth },
      65             :   JSJitInfo::Getter,
      66             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      67             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
      68             :   true,  /* isInfallible. False in setters. */
      69             :   false,  /* isMovable.  Not relevant for setters. */
      70             :   false, /* isEliminatable.  Not relevant for setters. */
      71             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      72             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      73             :   false,  /* isTypedMethod.  Only relevant for methods. */
      74             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      75             : };
      76             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      77             : static_assert(0 < 1, "There is no slot for us");
      78             : 
      79             : static bool
      80           0 : get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollAreaEvent* self, JSJitGetterCallArgs args)
      81             : {
      82           0 :   float result(self->Width());
      83           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      84           0 :   args.rval().set(JS_NumberValue(double(result)));
      85           0 :   return true;
      86             : }
      87             : 
      88             : static const JSJitInfo width_getterinfo = {
      89             :   { (JSJitGetterOp)get_width },
      90             :   { prototypes::id::ScrollAreaEvent },
      91             :   { PrototypeTraits<prototypes::id::ScrollAreaEvent>::Depth },
      92             :   JSJitInfo::Getter,
      93             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      94             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
      95             :   true,  /* isInfallible. False in setters. */
      96             :   false,  /* isMovable.  Not relevant for setters. */
      97             :   false, /* isEliminatable.  Not relevant for setters. */
      98             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      99             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     100             :   false,  /* isTypedMethod.  Only relevant for methods. */
     101             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     102             : };
     103             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     104             : static_assert(0 < 1, "There is no slot for us");
     105             : 
     106             : static bool
     107           0 : get_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollAreaEvent* self, JSJitGetterCallArgs args)
     108             : {
     109           0 :   float result(self->Height());
     110           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     111           0 :   args.rval().set(JS_NumberValue(double(result)));
     112           0 :   return true;
     113             : }
     114             : 
     115             : static const JSJitInfo height_getterinfo = {
     116             :   { (JSJitGetterOp)get_height },
     117             :   { prototypes::id::ScrollAreaEvent },
     118             :   { PrototypeTraits<prototypes::id::ScrollAreaEvent>::Depth },
     119             :   JSJitInfo::Getter,
     120             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     121             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
     122             :   true,  /* isInfallible. False in setters. */
     123             :   false,  /* isMovable.  Not relevant for setters. */
     124             :   false, /* isEliminatable.  Not relevant for setters. */
     125             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     126             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     127             :   false,  /* isTypedMethod.  Only relevant for methods. */
     128             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     129             : };
     130             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     131             : static_assert(0 < 1, "There is no slot for us");
     132             : 
     133             : static bool
     134           0 : initScrollAreaEvent(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollAreaEvent* self, const JSJitMethodCallArgs& args)
     135             : {
     136           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     137           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "ScrollAreaEvent.initScrollAreaEvent");
     138             :   }
     139           0 :   binding_detail::FakeString arg0;
     140           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     141           0 :     return false;
     142             :   }
     143             :   bool arg1;
     144           0 :   if (args.hasDefined(1)) {
     145           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, args[1], &arg1)) {
     146           0 :       return false;
     147             :     }
     148             :   } else {
     149           0 :     arg1 = false;
     150             :   }
     151             :   bool arg2;
     152           0 :   if (args.hasDefined(2)) {
     153           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, args[2], &arg2)) {
     154           0 :       return false;
     155             :     }
     156             :   } else {
     157           0 :     arg2 = false;
     158             :   }
     159             :   nsGlobalWindow* arg3;
     160           0 :   if (args.hasDefined(3)) {
     161           0 :     if (args[3].isObject()) {
     162             :       {
     163           0 :         nsresult rv = UnwrapObject<prototypes::id::Window, nsGlobalWindow>(args[3], arg3);
     164           0 :         if (NS_FAILED(rv)) {
     165           0 :           ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 4 of ScrollAreaEvent.initScrollAreaEvent", "Window");
     166           0 :           return false;
     167             :         }
     168             :       }
     169           0 :     } else if (args[3].isNullOrUndefined()) {
     170           0 :       arg3 = nullptr;
     171             :     } else {
     172           0 :       ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 4 of ScrollAreaEvent.initScrollAreaEvent");
     173           0 :       return false;
     174             :     }
     175             :   } else {
     176           0 :     arg3 = nullptr;
     177             :   }
     178             :   int32_t arg4;
     179           0 :   if (args.hasDefined(4)) {
     180           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, args[4], &arg4)) {
     181           0 :       return false;
     182             :     }
     183             :   } else {
     184           0 :     arg4 = 0;
     185             :   }
     186             :   float arg5;
     187           0 :   if (args.hasDefined(5)) {
     188           0 :     if (!ValueToPrimitive<float, eDefault>(cx, args[5], &arg5)) {
     189           0 :       return false;
     190           0 :     } else if (!mozilla::IsFinite(arg5)) {
     191           0 :       ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 6 of ScrollAreaEvent.initScrollAreaEvent");
     192           0 :       return false;
     193             :     }
     194             :   } else {
     195           0 :     arg5 = 0.0F;
     196             :   }
     197             :   float arg6;
     198           0 :   if (args.hasDefined(6)) {
     199           0 :     if (!ValueToPrimitive<float, eDefault>(cx, args[6], &arg6)) {
     200           0 :       return false;
     201           0 :     } else if (!mozilla::IsFinite(arg6)) {
     202           0 :       ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 7 of ScrollAreaEvent.initScrollAreaEvent");
     203           0 :       return false;
     204             :     }
     205             :   } else {
     206           0 :     arg6 = 0.0F;
     207             :   }
     208             :   float arg7;
     209           0 :   if (args.hasDefined(7)) {
     210           0 :     if (!ValueToPrimitive<float, eDefault>(cx, args[7], &arg7)) {
     211           0 :       return false;
     212           0 :     } else if (!mozilla::IsFinite(arg7)) {
     213           0 :       ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 8 of ScrollAreaEvent.initScrollAreaEvent");
     214           0 :       return false;
     215             :     }
     216             :   } else {
     217           0 :     arg7 = 0.0F;
     218             :   }
     219             :   float arg8;
     220           0 :   if (args.hasDefined(8)) {
     221           0 :     if (!ValueToPrimitive<float, eDefault>(cx, args[8], &arg8)) {
     222           0 :       return false;
     223           0 :     } else if (!mozilla::IsFinite(arg8)) {
     224           0 :       ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 9 of ScrollAreaEvent.initScrollAreaEvent");
     225           0 :       return false;
     226             :     }
     227             :   } else {
     228           0 :     arg8 = 0.0F;
     229             :   }
     230           0 :   self->InitScrollAreaEvent(NonNullHelper(Constify(arg0)), arg1, arg2, Constify(arg3), arg4, arg5, arg6, arg7, arg8);
     231           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     232           0 :   args.rval().setUndefined();
     233           0 :   return true;
     234             : }
     235             : 
     236             : static const JSJitInfo initScrollAreaEvent_methodinfo = {
     237             :   { (JSJitGetterOp)initScrollAreaEvent },
     238             :   { prototypes::id::ScrollAreaEvent },
     239             :   { PrototypeTraits<prototypes::id::ScrollAreaEvent>::Depth },
     240             :   JSJitInfo::Method,
     241             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     242             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     243             :   false,  /* isInfallible. False in setters. */
     244             :   false,  /* isMovable.  Not relevant for setters. */
     245             :   false, /* isEliminatable.  Not relevant for setters. */
     246             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     247             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     248             :   false,  /* isTypedMethod.  Only relevant for methods. */
     249             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     250             : };
     251             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     252             : static_assert(0 < 1, "There is no slot for us");
     253             : 
     254             : static bool
     255           0 : get_isTrusted(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::ScrollAreaEvent* self, JSJitGetterCallArgs args)
     256             : {
     257           0 :   bool result(self->IsTrusted());
     258           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     259           0 :   args.rval().setBoolean(result);
     260           0 :   return true;
     261             : }
     262             : 
     263             : static const JSJitInfo isTrusted_getterinfo = {
     264             :   { (JSJitGetterOp)get_isTrusted },
     265             :   { prototypes::id::ScrollAreaEvent },
     266             :   { PrototypeTraits<prototypes::id::ScrollAreaEvent>::Depth },
     267             :   JSJitInfo::Getter,
     268             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     269             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     270             :   true,  /* isInfallible. False in setters. */
     271             :   true,  /* isMovable.  Not relevant for setters. */
     272             :   true, /* isEliminatable.  Not relevant for setters. */
     273             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     274             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     275             :   false,  /* isTypedMethod.  Only relevant for methods. */
     276             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     277             : };
     278             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     279             : static_assert(0 < 1, "There is no slot for us");
     280             : 
     281             : static bool
     282           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     283             : {
     284           0 :   mozilla::dom::ScrollAreaEvent* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::ScrollAreaEvent>(obj);
     285             :   // We don't want to preserve if we don't have a wrapper, and we
     286             :   // obviously can't preserve if we're not initialized.
     287           0 :   if (self && self->GetWrapperPreserveColor()) {
     288           0 :     PreserveWrapper(self);
     289             :   }
     290           0 :   return true;
     291             : }
     292             : 
     293             : static void
     294           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     295             : {
     296           0 :   mozilla::dom::ScrollAreaEvent* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::ScrollAreaEvent>(obj);
     297           0 :   if (self) {
     298           0 :     ClearWrapper(self, self, obj);
     299           0 :     AddForDeferredFinalization<mozilla::dom::ScrollAreaEvent>(self);
     300             :   }
     301           0 : }
     302             : 
     303             : static void
     304           0 : _objectMoved(JSObject* obj, const JSObject* old)
     305             : {
     306           0 :   mozilla::dom::ScrollAreaEvent* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::ScrollAreaEvent>(obj);
     307           0 :   if (self) {
     308           0 :     UpdateWrapper(self, self, obj, old);
     309             :   }
     310           0 : }
     311             : 
     312             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     313             : #if defined(__clang__)
     314             : #pragma clang diagnostic push
     315             : #pragma clang diagnostic ignored "-Wmissing-braces"
     316             : #endif
     317             : static const JSFunctionSpec sMethods_specs[] = {
     318             :   JS_FNSPEC("initScrollAreaEvent", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&initScrollAreaEvent_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     319             :   JS_FS_END
     320             : };
     321             : #if defined(__clang__)
     322             : #pragma clang diagnostic pop
     323             : #endif
     324             : 
     325             : 
     326             : // Can't be const because the pref-enabled boolean needs to be writable
     327             : static Prefable<const JSFunctionSpec> sMethods[] = {
     328             :   { nullptr, &sMethods_specs[0] },
     329             :   { nullptr, nullptr }
     330             : };
     331             : 
     332             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     333             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     334             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     335             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     336             : 
     337             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     338             : #if defined(__clang__)
     339             : #pragma clang diagnostic push
     340             : #pragma clang diagnostic ignored "-Wmissing-braces"
     341             : #endif
     342             : static const JSPropertySpec sAttributes_specs[] = {
     343             :   { "x", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &x_getterinfo, nullptr, nullptr },
     344             :   { "y", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &y_getterinfo, nullptr, nullptr },
     345             :   { "width", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &width_getterinfo, nullptr, nullptr },
     346             :   { "height", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &height_getterinfo, nullptr, nullptr },
     347             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     348             : };
     349             : #if defined(__clang__)
     350             : #pragma clang diagnostic pop
     351             : #endif
     352             : 
     353             : 
     354             : // Can't be const because the pref-enabled boolean needs to be writable
     355             : static Prefable<const JSPropertySpec> sAttributes[] = {
     356             :   { nullptr, &sAttributes_specs[0] },
     357             :   { nullptr, nullptr }
     358             : };
     359             : 
     360             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     361             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     362             : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     363             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     364             : 
     365             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     366             : #if defined(__clang__)
     367             : #pragma clang diagnostic push
     368             : #pragma clang diagnostic ignored "-Wmissing-braces"
     369             : #endif
     370             : static const JSPropertySpec sUnforgeableAttributes_specs[] = {
     371             :   { "isTrusted", JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_PERMANENT, GenericBindingGetter, &isTrusted_getterinfo, nullptr, nullptr },
     372             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     373             : };
     374             : #if defined(__clang__)
     375             : #pragma clang diagnostic pop
     376             : #endif
     377             : 
     378             : 
     379             : // Can't be const because the pref-enabled boolean needs to be writable
     380             : static Prefable<const JSPropertySpec> sUnforgeableAttributes[] = {
     381             :   { nullptr, &sUnforgeableAttributes_specs[0] },
     382             :   { nullptr, nullptr }
     383             : };
     384             : 
     385             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     386             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     387             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     388             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     389             : 
     390             : 
     391             : static uint16_t sNativeProperties_sortedPropertyIndices[6];
     392             : static PropertyInfo sNativeProperties_propertyInfos[6];
     393             : 
     394             : static const NativePropertiesN<3> sNativeProperties = {
     395             :   false, 0,
     396             :   false, 0,
     397             :   true,  0 /* sMethods */,
     398             :   true,  1 /* sAttributes */,
     399             :   false, 0,
     400             :   true,  2 /* sUnforgeableAttributes */,
     401             :   false, 0,
     402             :   -1,
     403             :   6,
     404             :   sNativeProperties_sortedPropertyIndices,
     405             :   {
     406             :     { sMethods, &sNativeProperties_propertyInfos[0] },
     407             :     { sAttributes, &sNativeProperties_propertyInfos[1] },
     408             :     { sUnforgeableAttributes, &sNativeProperties_propertyInfos[5] }
     409             :   }
     410             : };
     411             : static_assert(6 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     412             :     "We have a property info count that is oversized");
     413             : 
     414             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     415             :   {
     416             :     "Function",
     417             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     418             :     &sBoringInterfaceObjectClassClassOps,
     419             :     JS_NULL_CLASS_SPEC,
     420             :     JS_NULL_CLASS_EXT,
     421             :     &sInterfaceObjectClassObjectOps
     422             :   },
     423             :   eInterface,
     424             :   true,
     425             :   prototypes::id::ScrollAreaEvent,
     426             :   PrototypeTraits<prototypes::id::ScrollAreaEvent>::Depth,
     427             :   sNativePropertyHooks,
     428             :   "function ScrollAreaEvent() {\n    [native code]\n}",
     429             :   UIEventBinding::GetConstructorObject
     430             : };
     431             : 
     432             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     433             :   {
     434             :     "ScrollAreaEventPrototype",
     435             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE + 1 /* slot for the JSObject holding the unforgeable properties */),
     436             :     JS_NULL_CLASS_OPS,
     437             :     JS_NULL_CLASS_SPEC,
     438             :     JS_NULL_CLASS_EXT,
     439             :     JS_NULL_OBJECT_OPS
     440             :   },
     441             :   eInterfacePrototype,
     442             :   false,
     443             :   prototypes::id::ScrollAreaEvent,
     444             :   PrototypeTraits<prototypes::id::ScrollAreaEvent>::Depth,
     445             :   sNativePropertyHooks,
     446             :   "[object ScrollAreaEventPrototype]",
     447             :   UIEventBinding::GetProtoObject
     448             : };
     449             : 
     450             : JSObject*
     451           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     452             : {
     453           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     454             : }
     455             : 
     456             : static const js::ClassOps sClassOps = {
     457             :   _addProperty, /* addProperty */
     458             :   nullptr,               /* delProperty */
     459             :   nullptr,               /* getProperty */
     460             :   nullptr,               /* setProperty */
     461             :   nullptr,               /* enumerate */
     462             :   nullptr, /* newEnumerate */
     463             :   nullptr, /* resolve */
     464             :   nullptr, /* mayResolve */
     465             :   _finalize, /* finalize */
     466             :   nullptr, /* call */
     467             :   nullptr,               /* hasInstance */
     468             :   nullptr,               /* construct */
     469             :   nullptr, /* trace */
     470             : };
     471             : 
     472             : static const js::ClassExtension sClassExtension = {
     473             :   nullptr, /* weakmapKeyDelegateOp */
     474             :   _objectMoved /* objectMovedOp */
     475             : };
     476             : 
     477             : static const DOMJSClass sClass = {
     478             :   { "ScrollAreaEvent",
     479             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_SKIP_NURSERY_FINALIZE,
     480             :     &sClassOps,
     481             :     JS_NULL_CLASS_SPEC,
     482             :     &sClassExtension,
     483             :     JS_NULL_OBJECT_OPS
     484             :   },
     485             :   { prototypes::id::Event, prototypes::id::UIEvent, prototypes::id::ScrollAreaEvent, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
     486             :   IsBaseOf<nsISupports, mozilla::dom::ScrollAreaEvent >::value,
     487             :   sNativePropertyHooks,
     488             :   FindAssociatedGlobalForNative<mozilla::dom::ScrollAreaEvent>::Get,
     489             :   GetProtoObjectHandle,
     490             :   GetCCParticipant<mozilla::dom::ScrollAreaEvent>::Get()
     491             : };
     492             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     493             :               "Must have the right minimal number of reserved slots.");
     494             : static_assert(1 >= 1,
     495             :               "Must have enough reserved slots.");
     496             : 
     497             : const JSClass*
     498           0 : GetJSClass()
     499             : {
     500           0 :   return sClass.ToJSClass();
     501             : }
     502             : 
     503             : bool
     504           0 : Wrap(JSContext* aCx, mozilla::dom::ScrollAreaEvent* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     505             : {
     506             :   MOZ_ASSERT(static_cast<mozilla::dom::ScrollAreaEvent*>(aObject) ==
     507             :              reinterpret_cast<mozilla::dom::ScrollAreaEvent*>(aObject),
     508             :              "Multiple inheritance for mozilla::dom::ScrollAreaEvent is broken.");
     509             :   MOZ_ASSERT(static_cast<mozilla::dom::UIEvent*>(aObject) ==
     510             :              reinterpret_cast<mozilla::dom::UIEvent*>(aObject),
     511             :              "Multiple inheritance for mozilla::dom::UIEvent is broken.");
     512             :   MOZ_ASSERT(static_cast<mozilla::dom::Event*>(aObject) ==
     513             :              reinterpret_cast<mozilla::dom::Event*>(aObject),
     514             :              "Multiple inheritance for mozilla::dom::Event is broken.");
     515           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     516           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     517           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     518             :              "You should probably not be using Wrap() directly; use "
     519             :              "GetOrCreateDOMReflector instead");
     520             : 
     521           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     522             :              "nsISupports must be on our primary inheritance chain");
     523             : 
     524           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     525           0 :   if (!global) {
     526           0 :     return false;
     527             :   }
     528           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     529           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     530             : 
     531             :   // That might have ended up wrapping us already, due to the wonders
     532             :   // of XBL.  Check for that, and bail out as needed.
     533           0 :   aReflector.set(aCache->GetWrapper());
     534           0 :   if (aReflector) {
     535             : #ifdef DEBUG
     536           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     537             : #endif // DEBUG
     538           0 :     return true;
     539             :   }
     540             : 
     541           0 :   JSAutoCompartment ac(aCx, global);
     542           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     543           0 :   if (!canonicalProto) {
     544           0 :     return false;
     545             :   }
     546           0 :   JS::Rooted<JSObject*> proto(aCx);
     547           0 :   if (aGivenProto) {
     548           0 :     proto = aGivenProto;
     549             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     550             :     // coming in, we changed compartments to that of "parent" so may need
     551             :     // to wrap the proto here.
     552           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     553           0 :       if (!JS_WrapObject(aCx, &proto)) {
     554           0 :         return false;
     555             :       }
     556             :     }
     557             :   } else {
     558           0 :     proto = canonicalProto;
     559             :   }
     560             : 
     561           0 :   BindingJSObjectCreator<mozilla::dom::ScrollAreaEvent> creator(aCx);
     562           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     563           0 :   if (!aReflector) {
     564           0 :     return false;
     565             :   }
     566             : 
     567           0 :   aCache->SetWrapper(aReflector);
     568             : 
     569             :   // Important: do unforgeable property setup after we have handed
     570             :   // over ownership of the C++ object to obj as needed, so that if
     571             :   // we fail and it ends up GCed it won't have problems in the
     572             :   // finalizer trying to drop its ownership of the C++ object.
     573             :   JS::Rooted<JSObject*> unforgeableHolder(aCx,
     574           0 :     &js::GetReservedSlot(canonicalProto, DOM_INTERFACE_PROTO_SLOTS_BASE).toObject());
     575           0 :   if (!JS_InitializePropertiesFromCompatibleNativeObject(aCx, aReflector, unforgeableHolder)) {
     576           0 :     aCache->ReleaseWrapper(aObject);
     577           0 :     aCache->ClearWrapper();
     578           0 :     return false;
     579             :   }
     580           0 :   creator.InitializationSucceeded();
     581             : 
     582           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     583             :              aCache->GetWrapperPreserveColor() == aReflector);
     584             :   // If proto != canonicalProto, we have to preserve our wrapper;
     585             :   // otherwise we won't be able to properly recreate it later, since
     586             :   // we won't know what proto to use.  Note that we don't check
     587             :   // aGivenProto here, since it's entirely possible (and even
     588             :   // somewhat common) to have a non-null aGivenProto which is the
     589             :   // same as canonicalProto.
     590           0 :   if (proto != canonicalProto) {
     591           0 :     PreserveWrapper(aObject);
     592             :   }
     593             : 
     594           0 :   return true;
     595             : }
     596             : 
     597             : const NativePropertyHooks sNativePropertyHooks[] = { {
     598             :   nullptr,
     599             :   nullptr,
     600             :   nullptr,
     601             :   { sNativeProperties.Upcast(), nullptr },
     602             :   prototypes::id::ScrollAreaEvent,
     603             :   constructors::id::ScrollAreaEvent,
     604             :   UIEventBinding::sNativePropertyHooks,
     605             :   &DefaultXrayExpandoObjectClass
     606             : } };
     607             : 
     608             : void
     609           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     610             : {
     611           0 :   JS::Handle<JSObject*> parentProto(UIEventBinding::GetProtoObjectHandle(aCx));
     612           0 :   if (!parentProto) {
     613           0 :     return;
     614             :   }
     615             : 
     616           0 :   JS::Handle<JSObject*> constructorProto(UIEventBinding::GetConstructorObjectHandle(aCx));
     617           0 :   if (!constructorProto) {
     618           0 :     return;
     619             :   }
     620             : 
     621             :   static bool sIdsInited = false;
     622           0 :   if (!sIdsInited && NS_IsMainThread()) {
     623           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     624           0 :       return;
     625             :     }
     626           0 :     sIdsInited = true;
     627             :   }
     628             : 
     629           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::ScrollAreaEvent);
     630           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::ScrollAreaEvent);
     631           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     632             :                               &sPrototypeClass.mBase, protoCache,
     633             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     634             :                               interfaceCache,
     635             :                               sNativeProperties.Upcast(),
     636             :                               nullptr,
     637             :                               "ScrollAreaEvent", aDefineOnGlobal,
     638             :                               nullptr,
     639           0 :                               false);
     640             : 
     641           0 :   JS::Rooted<JSObject*> unforgeableHolder(aCx);
     642             :   {
     643           0 :     JS::Rooted<JSObject*> holderProto(aCx, *protoCache);
     644           0 :     unforgeableHolder = JS_NewObjectWithoutMetadata(aCx, sClass.ToJSClass(), holderProto);
     645           0 :     if (!unforgeableHolder) {
     646           0 :       *protoCache = nullptr;
     647           0 :       if (interfaceCache) {
     648           0 :         *interfaceCache = nullptr;
     649             :       }
     650           0 :       return;
     651             :     }
     652             :   }
     653             : 
     654           0 :   if (!DefineUnforgeableAttributes(aCx, unforgeableHolder, sUnforgeableAttributes)) {
     655           0 :     *protoCache = nullptr;
     656           0 :     if (interfaceCache) {
     657           0 :       *interfaceCache = nullptr;
     658             :     }
     659           0 :     return;
     660             :   }
     661             : 
     662           0 :   if (*protoCache) {
     663           0 :     js::SetReservedSlot(*protoCache, DOM_INTERFACE_PROTO_SLOTS_BASE,
     664           0 :                         JS::ObjectValue(*unforgeableHolder));
     665             :   }
     666             : }
     667             : 
     668             : JS::Handle<JSObject*>
     669           0 : GetProtoObjectHandle(JSContext* aCx)
     670             : {
     671             :   /* Get the interface prototype object for this class.  This will create the
     672             :      object as needed. */
     673           0 :   bool aDefineOnGlobal = true;
     674             : 
     675             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     676           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     677           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     678           0 :     return nullptr;
     679             :   }
     680             : 
     681             :   /* Check to see whether the interface objects are already installed */
     682           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     683           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::ScrollAreaEvent)) {
     684           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     685           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     686             :   }
     687             : 
     688             :   /*
     689             :    * The object might _still_ be null, but that's OK.
     690             :    *
     691             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     692             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     693             :    * changed after they have been set.
     694             :    *
     695             :    * Calling address() avoids the read read barrier that does gray
     696             :    * unmarking, but it's not possible for the object to be gray here.
     697             :    */
     698             : 
     699           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::ScrollAreaEvent);
     700           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     701           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     702             : }
     703             : 
     704             : JS::Handle<JSObject*>
     705           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     706             : {
     707             :   /* Get the interface object for this class.  This will create the object as
     708             :      needed. */
     709             : 
     710             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     711           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     712           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     713           0 :     return nullptr;
     714             :   }
     715             : 
     716             :   /* Check to see whether the interface objects are already installed */
     717           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     718           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::ScrollAreaEvent)) {
     719           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     720           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     721             :   }
     722             : 
     723             :   /*
     724             :    * The object might _still_ be null, but that's OK.
     725             :    *
     726             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     727             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     728             :    * changed after they have been set.
     729             :    *
     730             :    * Calling address() avoids the read read barrier that does gray
     731             :    * unmarking, but it's not possible for the object to be gray here.
     732             :    */
     733             : 
     734           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::ScrollAreaEvent);
     735           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     736           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     737             : }
     738             : 
     739             : JSObject*
     740           0 : GetConstructorObject(JSContext* aCx)
     741             : {
     742           0 :   return GetConstructorObjectHandle(aCx);
     743             : }
     744             : 
     745             : } // namespace ScrollAreaEventBinding
     746             : 
     747             : 
     748             : 
     749             : } // namespace dom
     750             : } // namespace mozilla

Generated by: LCOV version 1.13