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

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

Generated by: LCOV version 1.13