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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM HTMLButtonElement.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "HTMLButtonElementBinding.h"
       4             : #include "HTMLElementBinding.h"
       5             : #include "WrapperFactory.h"
       6             : #include "mozilla/OwningNonNull.h"
       7             : #include "mozilla/dom/BindingUtils.h"
       8             : #include "mozilla/dom/CustomElementRegistry.h"
       9             : #include "mozilla/dom/DOMJSClass.h"
      10             : #include "mozilla/dom/HTMLButtonElement.h"
      11             : #include "mozilla/dom/HTMLFormElement.h"
      12             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      13             : #include "mozilla/dom/Nullable.h"
      14             : #include "mozilla/dom/PrimitiveConversions.h"
      15             : #include "mozilla/dom/ValidityState.h"
      16             : #include "mozilla/dom/XrayExpandoClass.h"
      17             : #include "nsINodeList.h"
      18             : 
      19             : namespace mozilla {
      20             : namespace dom {
      21             : 
      22             : namespace HTMLButtonElementBinding {
      23             : 
      24             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<HTMLElementBinding::NativeType>::value,
      25             :               "Can't inherit from an interface with a different ownership model.");
      26             : 
      27             : static bool
      28           0 : get_autofocus(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
      29             : {
      30           0 :   bool result(self->Autofocus());
      31           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      32           0 :   args.rval().setBoolean(result);
      33           0 :   return true;
      34             : }
      35             : 
      36             : static bool
      37           0 : set_autofocus(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
      38             : {
      39             :   bool arg0;
      40           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
      41           0 :     return false;
      42             :   }
      43           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
      44           0 :   Maybe<AutoCEReaction> ceReaction;
      45           0 :   if (reactionsStack) {
      46           0 :     ceReaction.emplace(reactionsStack);
      47             :   }
      48           0 :   binding_detail::FastErrorResult rv;
      49           0 :   self->SetAutofocus(arg0, rv);
      50           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
      51           0 :     return false;
      52             :   }
      53           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      54             : 
      55           0 :   return true;
      56             : }
      57             : 
      58             : static const JSJitInfo autofocus_getterinfo = {
      59             :   { (JSJitGetterOp)get_autofocus },
      60             :   { prototypes::id::HTMLButtonElement },
      61             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
      62             :   JSJitInfo::Getter,
      63             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
      64             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
      65             :   true,  /* isInfallible. False in setters. */
      66             :   true,  /* isMovable.  Not relevant for setters. */
      67             :   true, /* isEliminatable.  Not relevant for setters. */
      68             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      69             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      70             :   false,  /* isTypedMethod.  Only relevant for methods. */
      71             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      72             : };
      73             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      74             : static_assert(0 < 1, "There is no slot for us");
      75             : static const JSJitInfo autofocus_setterinfo = {
      76             :   { (JSJitGetterOp)set_autofocus },
      77             :   { prototypes::id::HTMLButtonElement },
      78             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
      79             :   JSJitInfo::Setter,
      80             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      81             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
      82             :   false,  /* isInfallible. False in setters. */
      83             :   false,  /* isMovable.  Not relevant for setters. */
      84             :   false, /* isEliminatable.  Not relevant for setters. */
      85             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      86             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      87             :   false,  /* isTypedMethod.  Only relevant for methods. */
      88             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      89             : };
      90             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      91             : static_assert(0 < 1, "There is no slot for us");
      92             : 
      93             : static bool
      94           0 : get_disabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
      95             : {
      96           0 :   bool result(self->Disabled());
      97           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      98           0 :   args.rval().setBoolean(result);
      99           0 :   return true;
     100             : }
     101             : 
     102             : static bool
     103           0 : set_disabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
     104             : {
     105             :   bool arg0;
     106           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
     107           0 :     return false;
     108             :   }
     109           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
     110           0 :   Maybe<AutoCEReaction> ceReaction;
     111           0 :   if (reactionsStack) {
     112           0 :     ceReaction.emplace(reactionsStack);
     113             :   }
     114           0 :   binding_detail::FastErrorResult rv;
     115           0 :   self->SetDisabled(arg0, rv);
     116           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     117           0 :     return false;
     118             :   }
     119           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     120             : 
     121           0 :   return true;
     122             : }
     123             : 
     124             : static const JSJitInfo disabled_getterinfo = {
     125             :   { (JSJitGetterOp)get_disabled },
     126             :   { prototypes::id::HTMLButtonElement },
     127             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     128             :   JSJitInfo::Getter,
     129             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     130             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     131             :   true,  /* isInfallible. False in setters. */
     132             :   true,  /* isMovable.  Not relevant for setters. */
     133             :   true, /* isEliminatable.  Not relevant for setters. */
     134             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     135             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     136             :   false,  /* isTypedMethod.  Only relevant for methods. */
     137             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     138             : };
     139             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     140             : static_assert(0 < 1, "There is no slot for us");
     141             : static const JSJitInfo disabled_setterinfo = {
     142             :   { (JSJitGetterOp)set_disabled },
     143             :   { prototypes::id::HTMLButtonElement },
     144             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     145             :   JSJitInfo::Setter,
     146             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     147             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     148             :   false,  /* isInfallible. False in setters. */
     149             :   false,  /* isMovable.  Not relevant for setters. */
     150             :   false, /* isEliminatable.  Not relevant for setters. */
     151             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     152             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     153             :   false,  /* isTypedMethod.  Only relevant for methods. */
     154             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     155             : };
     156             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     157             : static_assert(0 < 1, "There is no slot for us");
     158             : 
     159             : static bool
     160           0 : get_form(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
     161             : {
     162           0 :   auto result(StrongOrRawPtr<mozilla::dom::HTMLFormElement>(self->GetForm()));
     163           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     164           0 :   if (!result) {
     165           0 :     args.rval().setNull();
     166           0 :     return true;
     167             :   }
     168           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     169           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     170           0 :     return false;
     171             :   }
     172           0 :   return true;
     173             : }
     174             : 
     175             : static const JSJitInfo form_getterinfo = {
     176             :   { (JSJitGetterOp)get_form },
     177             :   { prototypes::id::HTMLButtonElement },
     178             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     179             :   JSJitInfo::Getter,
     180             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     181             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     182             :   false,  /* isInfallible. False in setters. */
     183             :   true,  /* isMovable.  Not relevant for setters. */
     184             :   true, /* isEliminatable.  Not relevant for setters. */
     185             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     186             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     187             :   false,  /* isTypedMethod.  Only relevant for methods. */
     188             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     189             : };
     190             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     191             : static_assert(0 < 1, "There is no slot for us");
     192             : 
     193             : static bool
     194           0 : get_formAction(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
     195             : {
     196           0 :   DOMString result;
     197           0 :   self->GetFormAction(result);
     198           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     199           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     200           0 :     return false;
     201             :   }
     202           0 :   return true;
     203             : }
     204             : 
     205             : static bool
     206           0 : set_formAction(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
     207             : {
     208           0 :   binding_detail::FakeString arg0;
     209           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     210           0 :     return false;
     211             :   }
     212           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
     213           0 :   Maybe<AutoCEReaction> ceReaction;
     214           0 :   if (reactionsStack) {
     215           0 :     ceReaction.emplace(reactionsStack);
     216             :   }
     217           0 :   binding_detail::FastErrorResult rv;
     218           0 :   self->SetFormAction(NonNullHelper(Constify(arg0)), rv);
     219           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     220           0 :     return false;
     221             :   }
     222           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     223             : 
     224           0 :   return true;
     225             : }
     226             : 
     227             : static const JSJitInfo formAction_getterinfo = {
     228             :   { (JSJitGetterOp)get_formAction },
     229             :   { prototypes::id::HTMLButtonElement },
     230             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     231             :   JSJitInfo::Getter,
     232             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     233             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     234             :   false,  /* isInfallible. False in setters. */
     235             :   true,  /* isMovable.  Not relevant for setters. */
     236             :   true, /* isEliminatable.  Not relevant for setters. */
     237             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     238             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     239             :   false,  /* isTypedMethod.  Only relevant for methods. */
     240             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     241             : };
     242             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     243             : static_assert(0 < 1, "There is no slot for us");
     244             : static const JSJitInfo formAction_setterinfo = {
     245             :   { (JSJitGetterOp)set_formAction },
     246             :   { prototypes::id::HTMLButtonElement },
     247             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     248             :   JSJitInfo::Setter,
     249             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     250             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     251             :   false,  /* isInfallible. False in setters. */
     252             :   false,  /* isMovable.  Not relevant for setters. */
     253             :   false, /* isEliminatable.  Not relevant for setters. */
     254             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     255             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     256             :   false,  /* isTypedMethod.  Only relevant for methods. */
     257             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     258             : };
     259             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     260             : static_assert(0 < 1, "There is no slot for us");
     261             : 
     262             : static bool
     263           0 : get_formEnctype(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
     264             : {
     265           0 :   DOMString result;
     266           0 :   self->GetFormEnctype(result);
     267           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     268           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     269           0 :     return false;
     270             :   }
     271           0 :   return true;
     272             : }
     273             : 
     274             : static bool
     275           0 : set_formEnctype(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
     276             : {
     277           0 :   binding_detail::FakeString arg0;
     278           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     279           0 :     return false;
     280             :   }
     281           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
     282           0 :   Maybe<AutoCEReaction> ceReaction;
     283           0 :   if (reactionsStack) {
     284           0 :     ceReaction.emplace(reactionsStack);
     285             :   }
     286           0 :   binding_detail::FastErrorResult rv;
     287           0 :   self->SetFormEnctype(NonNullHelper(Constify(arg0)), rv);
     288           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     289           0 :     return false;
     290             :   }
     291           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     292             : 
     293           0 :   return true;
     294             : }
     295             : 
     296             : static const JSJitInfo formEnctype_getterinfo = {
     297             :   { (JSJitGetterOp)get_formEnctype },
     298             :   { prototypes::id::HTMLButtonElement },
     299             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     300             :   JSJitInfo::Getter,
     301             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     302             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     303             :   false,  /* isInfallible. False in setters. */
     304             :   true,  /* isMovable.  Not relevant for setters. */
     305             :   true, /* isEliminatable.  Not relevant for setters. */
     306             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     307             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     308             :   false,  /* isTypedMethod.  Only relevant for methods. */
     309             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     310             : };
     311             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     312             : static_assert(0 < 1, "There is no slot for us");
     313             : static const JSJitInfo formEnctype_setterinfo = {
     314             :   { (JSJitGetterOp)set_formEnctype },
     315             :   { prototypes::id::HTMLButtonElement },
     316             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     317             :   JSJitInfo::Setter,
     318             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     319             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     320             :   false,  /* isInfallible. False in setters. */
     321             :   false,  /* isMovable.  Not relevant for setters. */
     322             :   false, /* isEliminatable.  Not relevant for setters. */
     323             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     324             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     325             :   false,  /* isTypedMethod.  Only relevant for methods. */
     326             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     327             : };
     328             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     329             : static_assert(0 < 1, "There is no slot for us");
     330             : 
     331             : static bool
     332           0 : get_formMethod(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
     333             : {
     334           0 :   DOMString result;
     335           0 :   self->GetFormMethod(result);
     336           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     337           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     338           0 :     return false;
     339             :   }
     340           0 :   return true;
     341             : }
     342             : 
     343             : static bool
     344           0 : set_formMethod(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
     345             : {
     346           0 :   binding_detail::FakeString arg0;
     347           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     348           0 :     return false;
     349             :   }
     350           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
     351           0 :   Maybe<AutoCEReaction> ceReaction;
     352           0 :   if (reactionsStack) {
     353           0 :     ceReaction.emplace(reactionsStack);
     354             :   }
     355           0 :   binding_detail::FastErrorResult rv;
     356           0 :   self->SetFormMethod(NonNullHelper(Constify(arg0)), rv);
     357           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     358           0 :     return false;
     359             :   }
     360           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     361             : 
     362           0 :   return true;
     363             : }
     364             : 
     365             : static const JSJitInfo formMethod_getterinfo = {
     366             :   { (JSJitGetterOp)get_formMethod },
     367             :   { prototypes::id::HTMLButtonElement },
     368             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     369             :   JSJitInfo::Getter,
     370             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     371             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     372             :   false,  /* isInfallible. False in setters. */
     373             :   true,  /* isMovable.  Not relevant for setters. */
     374             :   true, /* isEliminatable.  Not relevant for setters. */
     375             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     376             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     377             :   false,  /* isTypedMethod.  Only relevant for methods. */
     378             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     379             : };
     380             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     381             : static_assert(0 < 1, "There is no slot for us");
     382             : static const JSJitInfo formMethod_setterinfo = {
     383             :   { (JSJitGetterOp)set_formMethod },
     384             :   { prototypes::id::HTMLButtonElement },
     385             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     386             :   JSJitInfo::Setter,
     387             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     388             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     389             :   false,  /* isInfallible. False in setters. */
     390             :   false,  /* isMovable.  Not relevant for setters. */
     391             :   false, /* isEliminatable.  Not relevant for setters. */
     392             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     393             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     394             :   false,  /* isTypedMethod.  Only relevant for methods. */
     395             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     396             : };
     397             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     398             : static_assert(0 < 1, "There is no slot for us");
     399             : 
     400             : static bool
     401           0 : get_formNoValidate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
     402             : {
     403           0 :   bool result(self->FormNoValidate());
     404           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     405           0 :   args.rval().setBoolean(result);
     406           0 :   return true;
     407             : }
     408             : 
     409             : static bool
     410           0 : set_formNoValidate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
     411             : {
     412             :   bool arg0;
     413           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
     414           0 :     return false;
     415             :   }
     416           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
     417           0 :   Maybe<AutoCEReaction> ceReaction;
     418           0 :   if (reactionsStack) {
     419           0 :     ceReaction.emplace(reactionsStack);
     420             :   }
     421           0 :   binding_detail::FastErrorResult rv;
     422           0 :   self->SetFormNoValidate(arg0, rv);
     423           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     424           0 :     return false;
     425             :   }
     426           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     427             : 
     428           0 :   return true;
     429             : }
     430             : 
     431             : static const JSJitInfo formNoValidate_getterinfo = {
     432             :   { (JSJitGetterOp)get_formNoValidate },
     433             :   { prototypes::id::HTMLButtonElement },
     434             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     435             :   JSJitInfo::Getter,
     436             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     437             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     438             :   true,  /* isInfallible. False in setters. */
     439             :   true,  /* isMovable.  Not relevant for setters. */
     440             :   true, /* isEliminatable.  Not relevant for setters. */
     441             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     442             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     443             :   false,  /* isTypedMethod.  Only relevant for methods. */
     444             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     445             : };
     446             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     447             : static_assert(0 < 1, "There is no slot for us");
     448             : static const JSJitInfo formNoValidate_setterinfo = {
     449             :   { (JSJitGetterOp)set_formNoValidate },
     450             :   { prototypes::id::HTMLButtonElement },
     451             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     452             :   JSJitInfo::Setter,
     453             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     454             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     455             :   false,  /* isInfallible. False in setters. */
     456             :   false,  /* isMovable.  Not relevant for setters. */
     457             :   false, /* isEliminatable.  Not relevant for setters. */
     458             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     459             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     460             :   false,  /* isTypedMethod.  Only relevant for methods. */
     461             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     462             : };
     463             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     464             : static_assert(0 < 1, "There is no slot for us");
     465             : 
     466             : static bool
     467           0 : get_formTarget(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
     468             : {
     469           0 :   DOMString result;
     470           0 :   self->GetFormTarget(result);
     471           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     472           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     473           0 :     return false;
     474             :   }
     475           0 :   return true;
     476             : }
     477             : 
     478             : static bool
     479           0 : set_formTarget(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
     480             : {
     481           0 :   binding_detail::FakeString arg0;
     482           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     483           0 :     return false;
     484             :   }
     485           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
     486           0 :   Maybe<AutoCEReaction> ceReaction;
     487           0 :   if (reactionsStack) {
     488           0 :     ceReaction.emplace(reactionsStack);
     489             :   }
     490           0 :   binding_detail::FastErrorResult rv;
     491           0 :   self->SetFormTarget(NonNullHelper(Constify(arg0)), rv);
     492           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     493           0 :     return false;
     494             :   }
     495           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     496             : 
     497           0 :   return true;
     498             : }
     499             : 
     500             : static const JSJitInfo formTarget_getterinfo = {
     501             :   { (JSJitGetterOp)get_formTarget },
     502             :   { prototypes::id::HTMLButtonElement },
     503             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     504             :   JSJitInfo::Getter,
     505             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     506             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     507             :   false,  /* isInfallible. False in setters. */
     508             :   true,  /* isMovable.  Not relevant for setters. */
     509             :   true, /* isEliminatable.  Not relevant for setters. */
     510             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     511             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     512             :   false,  /* isTypedMethod.  Only relevant for methods. */
     513             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     514             : };
     515             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     516             : static_assert(0 < 1, "There is no slot for us");
     517             : static const JSJitInfo formTarget_setterinfo = {
     518             :   { (JSJitGetterOp)set_formTarget },
     519             :   { prototypes::id::HTMLButtonElement },
     520             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     521             :   JSJitInfo::Setter,
     522             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     523             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     524             :   false,  /* isInfallible. False in setters. */
     525             :   false,  /* isMovable.  Not relevant for setters. */
     526             :   false, /* isEliminatable.  Not relevant for setters. */
     527             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     528             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     529             :   false,  /* isTypedMethod.  Only relevant for methods. */
     530             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     531             : };
     532             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     533             : static_assert(0 < 1, "There is no slot for us");
     534             : 
     535             : static bool
     536           0 : get_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
     537             : {
     538           0 :   DOMString result;
     539           0 :   self->GetName(result);
     540           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     541           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     542           0 :     return false;
     543             :   }
     544           0 :   return true;
     545             : }
     546             : 
     547             : static bool
     548           0 : set_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
     549             : {
     550           0 :   binding_detail::FakeString arg0;
     551           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     552           0 :     return false;
     553             :   }
     554           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
     555           0 :   Maybe<AutoCEReaction> ceReaction;
     556           0 :   if (reactionsStack) {
     557           0 :     ceReaction.emplace(reactionsStack);
     558             :   }
     559           0 :   binding_detail::FastErrorResult rv;
     560           0 :   self->SetName(NonNullHelper(Constify(arg0)), rv);
     561           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     562           0 :     return false;
     563             :   }
     564           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     565             : 
     566           0 :   return true;
     567             : }
     568             : 
     569             : static const JSJitInfo name_getterinfo = {
     570             :   { (JSJitGetterOp)get_name },
     571             :   { prototypes::id::HTMLButtonElement },
     572             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     573             :   JSJitInfo::Getter,
     574             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     575             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     576             :   false,  /* isInfallible. False in setters. */
     577             :   true,  /* isMovable.  Not relevant for setters. */
     578             :   true, /* isEliminatable.  Not relevant for setters. */
     579             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     580             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     581             :   false,  /* isTypedMethod.  Only relevant for methods. */
     582             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     583             : };
     584             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     585             : static_assert(0 < 1, "There is no slot for us");
     586             : static const JSJitInfo name_setterinfo = {
     587             :   { (JSJitGetterOp)set_name },
     588             :   { prototypes::id::HTMLButtonElement },
     589             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     590             :   JSJitInfo::Setter,
     591             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     592             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     593             :   false,  /* isInfallible. False in setters. */
     594             :   false,  /* isMovable.  Not relevant for setters. */
     595             :   false, /* isEliminatable.  Not relevant for setters. */
     596             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     597             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     598             :   false,  /* isTypedMethod.  Only relevant for methods. */
     599             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     600             : };
     601             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     602             : static_assert(0 < 1, "There is no slot for us");
     603             : 
     604             : static bool
     605           0 : get_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
     606             : {
     607           0 :   DOMString result;
     608           0 :   self->GetType(result);
     609           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     610           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     611           0 :     return false;
     612             :   }
     613           0 :   return true;
     614             : }
     615             : 
     616             : static bool
     617           0 : set_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
     618             : {
     619           0 :   binding_detail::FakeString arg0;
     620           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     621           0 :     return false;
     622             :   }
     623           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
     624           0 :   Maybe<AutoCEReaction> ceReaction;
     625           0 :   if (reactionsStack) {
     626           0 :     ceReaction.emplace(reactionsStack);
     627             :   }
     628           0 :   binding_detail::FastErrorResult rv;
     629           0 :   self->SetType(NonNullHelper(Constify(arg0)), rv);
     630           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     631           0 :     return false;
     632             :   }
     633           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     634             : 
     635           0 :   return true;
     636             : }
     637             : 
     638             : static const JSJitInfo type_getterinfo = {
     639             :   { (JSJitGetterOp)get_type },
     640             :   { prototypes::id::HTMLButtonElement },
     641             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     642             :   JSJitInfo::Getter,
     643             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     644             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     645             :   false,  /* isInfallible. False in setters. */
     646             :   true,  /* isMovable.  Not relevant for setters. */
     647             :   true, /* isEliminatable.  Not relevant for setters. */
     648             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     649             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     650             :   false,  /* isTypedMethod.  Only relevant for methods. */
     651             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     652             : };
     653             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     654             : static_assert(0 < 1, "There is no slot for us");
     655             : static const JSJitInfo type_setterinfo = {
     656             :   { (JSJitGetterOp)set_type },
     657             :   { prototypes::id::HTMLButtonElement },
     658             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     659             :   JSJitInfo::Setter,
     660             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     661             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     662             :   false,  /* isInfallible. False in setters. */
     663             :   false,  /* isMovable.  Not relevant for setters. */
     664             :   false, /* isEliminatable.  Not relevant for setters. */
     665             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     666             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     667             :   false,  /* isTypedMethod.  Only relevant for methods. */
     668             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     669             : };
     670             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     671             : static_assert(0 < 1, "There is no slot for us");
     672             : 
     673             : static bool
     674           0 : get_value(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
     675             : {
     676           0 :   DOMString result;
     677           0 :   self->GetValue(result);
     678           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     679           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     680           0 :     return false;
     681             :   }
     682           0 :   return true;
     683             : }
     684             : 
     685             : static bool
     686           0 : set_value(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitSetterCallArgs args)
     687             : {
     688           0 :   binding_detail::FakeString arg0;
     689           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     690           0 :     return false;
     691             :   }
     692           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
     693           0 :   Maybe<AutoCEReaction> ceReaction;
     694           0 :   if (reactionsStack) {
     695           0 :     ceReaction.emplace(reactionsStack);
     696             :   }
     697           0 :   binding_detail::FastErrorResult rv;
     698           0 :   self->SetValue(NonNullHelper(Constify(arg0)), rv);
     699           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     700           0 :     return false;
     701             :   }
     702           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     703             : 
     704           0 :   return true;
     705             : }
     706             : 
     707             : static const JSJitInfo value_getterinfo = {
     708             :   { (JSJitGetterOp)get_value },
     709             :   { prototypes::id::HTMLButtonElement },
     710             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     711             :   JSJitInfo::Getter,
     712             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     713             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     714             :   false,  /* isInfallible. False in setters. */
     715             :   true,  /* isMovable.  Not relevant for setters. */
     716             :   true, /* isEliminatable.  Not relevant for setters. */
     717             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     718             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     719             :   false,  /* isTypedMethod.  Only relevant for methods. */
     720             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     721             : };
     722             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     723             : static_assert(0 < 1, "There is no slot for us");
     724             : static const JSJitInfo value_setterinfo = {
     725             :   { (JSJitGetterOp)set_value },
     726             :   { prototypes::id::HTMLButtonElement },
     727             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     728             :   JSJitInfo::Setter,
     729             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     730             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     731             :   false,  /* isInfallible. False in setters. */
     732             :   false,  /* isMovable.  Not relevant for setters. */
     733             :   false, /* isEliminatable.  Not relevant for setters. */
     734             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     735             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     736             :   false,  /* isTypedMethod.  Only relevant for methods. */
     737             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     738             : };
     739             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     740             : static_assert(0 < 1, "There is no slot for us");
     741             : 
     742             : static bool
     743           0 : get_willValidate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
     744             : {
     745           0 :   bool result(self->WillValidate());
     746           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     747           0 :   args.rval().setBoolean(result);
     748           0 :   return true;
     749             : }
     750             : 
     751             : static const JSJitInfo willValidate_getterinfo = {
     752             :   { (JSJitGetterOp)get_willValidate },
     753             :   { prototypes::id::HTMLButtonElement },
     754             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     755             :   JSJitInfo::Getter,
     756             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     757             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     758             :   true,  /* isInfallible. False in setters. */
     759             :   false,  /* isMovable.  Not relevant for setters. */
     760             :   false, /* isEliminatable.  Not relevant for setters. */
     761             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     762             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     763             :   false,  /* isTypedMethod.  Only relevant for methods. */
     764             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     765             : };
     766             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     767             : static_assert(0 < 1, "There is no slot for us");
     768             : 
     769             : static bool
     770           0 : get_validity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
     771             : {
     772           0 :   auto result(StrongOrRawPtr<mozilla::dom::ValidityState>(self->Validity()));
     773           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     774           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     775           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     776           0 :     return false;
     777             :   }
     778           0 :   return true;
     779             : }
     780             : 
     781             : static const JSJitInfo validity_getterinfo = {
     782             :   { (JSJitGetterOp)get_validity },
     783             :   { prototypes::id::HTMLButtonElement },
     784             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     785             :   JSJitInfo::Getter,
     786             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     787             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     788             :   false,  /* isInfallible. False in setters. */
     789             :   false,  /* isMovable.  Not relevant for setters. */
     790             :   false, /* isEliminatable.  Not relevant for setters. */
     791             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     792             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     793             :   false,  /* isTypedMethod.  Only relevant for methods. */
     794             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     795             : };
     796             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     797             : static_assert(0 < 1, "There is no slot for us");
     798             : 
     799             : static bool
     800           0 : get_validationMessage(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
     801             : {
     802           0 :   DOMString result;
     803           0 :   self->GetValidationMessage(result);
     804           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     805           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     806           0 :     return false;
     807             :   }
     808           0 :   return true;
     809             : }
     810             : 
     811             : static const JSJitInfo validationMessage_getterinfo = {
     812             :   { (JSJitGetterOp)get_validationMessage },
     813             :   { prototypes::id::HTMLButtonElement },
     814             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     815             :   JSJitInfo::Getter,
     816             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     817             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     818             :   false,  /* isInfallible. False in setters. */
     819             :   false,  /* isMovable.  Not relevant for setters. */
     820             :   false, /* isEliminatable.  Not relevant for setters. */
     821             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     822             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     823             :   false,  /* isTypedMethod.  Only relevant for methods. */
     824             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     825             : };
     826             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     827             : static_assert(0 < 1, "There is no slot for us");
     828             : 
     829             : static bool
     830           0 : checkValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, const JSJitMethodCallArgs& args)
     831             : {
     832           0 :   bool result(self->CheckValidity());
     833           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     834           0 :   args.rval().setBoolean(result);
     835           0 :   return true;
     836             : }
     837             : 
     838             : static const JSJitInfo checkValidity_methodinfo = {
     839             :   { (JSJitGetterOp)checkValidity },
     840             :   { prototypes::id::HTMLButtonElement },
     841             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     842             :   JSJitInfo::Method,
     843             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     844             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     845             :   true,  /* isInfallible. False in setters. */
     846             :   false,  /* isMovable.  Not relevant for setters. */
     847             :   false, /* isEliminatable.  Not relevant for setters. */
     848             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     849             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     850             :   false,  /* isTypedMethod.  Only relevant for methods. */
     851             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     852             : };
     853             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     854             : static_assert(0 < 1, "There is no slot for us");
     855             : 
     856             : static bool
     857           0 : reportValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, const JSJitMethodCallArgs& args)
     858             : {
     859           0 :   bool result(self->ReportValidity());
     860           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     861           0 :   args.rval().setBoolean(result);
     862           0 :   return true;
     863             : }
     864             : 
     865             : static const JSJitInfo reportValidity_methodinfo = {
     866             :   { (JSJitGetterOp)reportValidity },
     867             :   { prototypes::id::HTMLButtonElement },
     868             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     869             :   JSJitInfo::Method,
     870             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     871             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     872             :   true,  /* isInfallible. False in setters. */
     873             :   false,  /* isMovable.  Not relevant for setters. */
     874             :   false, /* isEliminatable.  Not relevant for setters. */
     875             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     876             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     877             :   false,  /* isTypedMethod.  Only relevant for methods. */
     878             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     879             : };
     880             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     881             : static_assert(0 < 1, "There is no slot for us");
     882             : 
     883             : static bool
     884           0 : setCustomValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, const JSJitMethodCallArgs& args)
     885             : {
     886           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     887           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLButtonElement.setCustomValidity");
     888             :   }
     889           0 :   binding_detail::FakeString arg0;
     890           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     891           0 :     return false;
     892             :   }
     893           0 :   self->SetCustomValidity(NonNullHelper(Constify(arg0)));
     894           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     895           0 :   args.rval().setUndefined();
     896           0 :   return true;
     897             : }
     898             : 
     899             : static const JSJitInfo setCustomValidity_methodinfo = {
     900             :   { (JSJitGetterOp)setCustomValidity },
     901             :   { prototypes::id::HTMLButtonElement },
     902             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     903             :   JSJitInfo::Method,
     904             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     905             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     906             :   false,  /* isInfallible. False in setters. */
     907             :   false,  /* isMovable.  Not relevant for setters. */
     908             :   false, /* isEliminatable.  Not relevant for setters. */
     909             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     910             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     911             :   false,  /* isTypedMethod.  Only relevant for methods. */
     912             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     913             : };
     914             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     915             : static_assert(0 < 1, "There is no slot for us");
     916             : 
     917             : static bool
     918           0 : get_labels(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLButtonElement* self, JSJitGetterCallArgs args)
     919             : {
     920           0 :   auto result(StrongOrRawPtr<nsINodeList>(self->Labels()));
     921           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     922           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     923           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     924           0 :     return false;
     925             :   }
     926           0 :   return true;
     927             : }
     928             : 
     929             : static const JSJitInfo labels_getterinfo = {
     930             :   { (JSJitGetterOp)get_labels },
     931             :   { prototypes::id::HTMLButtonElement },
     932             :   { PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth },
     933             :   JSJitInfo::Getter,
     934             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     935             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     936             :   false,  /* isInfallible. False in setters. */
     937             :   false,  /* isMovable.  Not relevant for setters. */
     938             :   false, /* isEliminatable.  Not relevant for setters. */
     939             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     940             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     941             :   false,  /* isTypedMethod.  Only relevant for methods. */
     942             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     943             : };
     944             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     945             : static_assert(0 < 1, "There is no slot for us");
     946             : 
     947             : static bool
     948           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     949             : {
     950           0 :   mozilla::dom::HTMLButtonElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLButtonElement>(obj);
     951             :   // We don't want to preserve if we don't have a wrapper, and we
     952             :   // obviously can't preserve if we're not initialized.
     953           0 :   if (self && self->GetWrapperPreserveColor()) {
     954           0 :     PreserveWrapper(self);
     955             :   }
     956           0 :   return true;
     957             : }
     958             : 
     959             : static void
     960           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     961             : {
     962           0 :   mozilla::dom::HTMLButtonElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLButtonElement>(obj);
     963           0 :   if (self) {
     964           0 :     ClearWrapper(self, self, obj);
     965           0 :     AddForDeferredFinalization<mozilla::dom::HTMLButtonElement>(self);
     966             :   }
     967           0 : }
     968             : 
     969             : static void
     970           0 : _objectMoved(JSObject* obj, const JSObject* old)
     971             : {
     972           0 :   mozilla::dom::HTMLButtonElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLButtonElement>(obj);
     973           0 :   if (self) {
     974           0 :     UpdateWrapper(self, self, obj, old);
     975             :   }
     976           0 : }
     977             : 
     978             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     979             : #if defined(__clang__)
     980             : #pragma clang diagnostic push
     981             : #pragma clang diagnostic ignored "-Wmissing-braces"
     982             : #endif
     983             : static const JSFunctionSpec sMethods_specs[] = {
     984             :   JS_FNSPEC("checkValidity", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&checkValidity_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
     985             :   JS_FNSPEC("reportValidity", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&reportValidity_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
     986             :   JS_FNSPEC("setCustomValidity", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setCustomValidity_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     987             :   JS_FS_END
     988             : };
     989             : #if defined(__clang__)
     990             : #pragma clang diagnostic pop
     991             : #endif
     992             : 
     993             : 
     994             : // Can't be const because the pref-enabled boolean needs to be writable
     995             : static Prefable<const JSFunctionSpec> sMethods[] = {
     996             :   { nullptr, &sMethods_specs[0] },
     997             :   { nullptr, nullptr }
     998             : };
     999             : 
    1000             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
    1001             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
    1002             : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    1003             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
    1004             : 
    1005             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
    1006             : #if defined(__clang__)
    1007             : #pragma clang diagnostic push
    1008             : #pragma clang diagnostic ignored "-Wmissing-braces"
    1009             : #endif
    1010             : static const JSPropertySpec sAttributes_specs[] = {
    1011             :   { "autofocus", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &autofocus_getterinfo, GenericBindingSetter, &autofocus_setterinfo },
    1012             :   { "disabled", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &disabled_getterinfo, GenericBindingSetter, &disabled_setterinfo },
    1013             :   { "form", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &form_getterinfo, nullptr, nullptr },
    1014             :   { "formAction", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &formAction_getterinfo, GenericBindingSetter, &formAction_setterinfo },
    1015             :   { "formEnctype", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &formEnctype_getterinfo, GenericBindingSetter, &formEnctype_setterinfo },
    1016             :   { "formMethod", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &formMethod_getterinfo, GenericBindingSetter, &formMethod_setterinfo },
    1017             :   { "formNoValidate", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &formNoValidate_getterinfo, GenericBindingSetter, &formNoValidate_setterinfo },
    1018             :   { "formTarget", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &formTarget_getterinfo, GenericBindingSetter, &formTarget_setterinfo },
    1019             :   { "name", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &name_getterinfo, GenericBindingSetter, &name_setterinfo },
    1020             :   { "type", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &type_getterinfo, GenericBindingSetter, &type_setterinfo },
    1021             :   { "value", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &value_getterinfo, GenericBindingSetter, &value_setterinfo },
    1022             :   { "willValidate", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &willValidate_getterinfo, nullptr, nullptr },
    1023             :   { "validity", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &validity_getterinfo, nullptr, nullptr },
    1024             :   { "validationMessage", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &validationMessage_getterinfo, nullptr, nullptr },
    1025             :   { "labels", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &labels_getterinfo, nullptr, nullptr },
    1026             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
    1027             : };
    1028             : #if defined(__clang__)
    1029             : #pragma clang diagnostic pop
    1030             : #endif
    1031             : 
    1032             : 
    1033             : // Can't be const because the pref-enabled boolean needs to be writable
    1034             : static Prefable<const JSPropertySpec> sAttributes[] = {
    1035             :   { nullptr, &sAttributes_specs[0] },
    1036             :   { nullptr, nullptr }
    1037             : };
    1038             : 
    1039             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
    1040             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
    1041             : static_assert(15 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    1042             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
    1043             : 
    1044             : 
    1045             : static uint16_t sNativeProperties_sortedPropertyIndices[18];
    1046             : static PropertyInfo sNativeProperties_propertyInfos[18];
    1047             : 
    1048             : static const NativePropertiesN<2> sNativeProperties = {
    1049             :   false, 0,
    1050             :   false, 0,
    1051             :   true,  0 /* sMethods */,
    1052             :   true,  1 /* sAttributes */,
    1053             :   false, 0,
    1054             :   false, 0,
    1055             :   false, 0,
    1056             :   -1,
    1057             :   18,
    1058             :   sNativeProperties_sortedPropertyIndices,
    1059             :   {
    1060             :     { sMethods, &sNativeProperties_propertyInfos[0] },
    1061             :     { sAttributes, &sNativeProperties_propertyInfos[3] }
    1062             :   }
    1063             : };
    1064             : static_assert(18 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
    1065             :     "We have a property info count that is oversized");
    1066             : 
    1067             : static bool
    1068           0 : _constructor(JSContext* cx, unsigned argc, JS::Value* vp)
    1069             : {
    1070           0 :   JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
    1071           0 :   JS::Rooted<JSObject*> obj(cx, &args.callee());
    1072           0 :   if (!args.isConstructing()) {
    1073             :     // XXXbz wish I could get the name from the callee instead of
    1074             :     // Adding more relocations
    1075           0 :     return ThrowConstructorWithoutNew(cx, "HTMLButtonElement");
    1076             :   }
    1077             : 
    1078           0 :   GlobalObject global(cx, obj);
    1079           0 :   if (global.Failed()) {
    1080           0 :     return false;
    1081             :   }
    1082             : 
    1083             :   // The newTarget might be a cross-compartment wrapper. Get the underlying object
    1084             :   // so we can do the spec's object-identity checks.
    1085           0 :   JS::Rooted<JSObject*> newTarget(cx, js::CheckedUnwrap(&args.newTarget().toObject()));
    1086           0 :   if (!newTarget) {
    1087           0 :     return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
    1088             :   }
    1089             : 
    1090             :   // Step 2 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
    1091             :   // Enter the compartment of our underlying newTarget object, so we end
    1092             :   // up comparing to the constructor object for our interface from that global.
    1093             :   {
    1094           0 :     JSAutoCompartment ac(cx, newTarget);
    1095           0 :     JS::Handle<JSObject*> constructor(GetConstructorObjectHandle(cx));
    1096           0 :     if (!constructor) {
    1097           0 :       return false;
    1098             :     }
    1099           0 :     if (newTarget == constructor) {
    1100           0 :       return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
    1101             :     }
    1102             :   }
    1103             : 
    1104           0 :   JS::Rooted<JSObject*> desiredProto(cx);
    1105           0 :   if (!GetDesiredProto(cx, args, &desiredProto)) {
    1106           0 :     return false;
    1107             :   }
    1108           0 :   if (!desiredProto) {
    1109             :     // Step 7 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
    1110             :     // This fallback behavior is designed to match analogous behavior for the
    1111             :     // JavaScript built-ins. So we enter the compartment of our underlying
    1112             :     // newTarget object and fall back to the prototype object from that global.
    1113             :     // XXX The spec says to use GetFunctionRealm(), which is not actually
    1114             :     // the same thing as what we have here (e.g. in the case of scripted callable proxies
    1115             :     // whose target is not same-compartment with the proxy, or bound functions, etc).
    1116             :     // https://bugzilla.mozilla.org/show_bug.cgi?id=1317658
    1117             :     {
    1118           0 :       JSAutoCompartment ac(cx, newTarget);
    1119           0 :       desiredProto = GetProtoObjectHandle(cx);
    1120           0 :       if (!desiredProto) {
    1121           0 :           return false;
    1122             :       }
    1123             :     }
    1124             : 
    1125             :     // desiredProto is in the compartment of the underlying newTarget object.
    1126             :     // Wrap it into the context compartment.
    1127           0 :     if (!JS_WrapObject(cx, &desiredProto)) {
    1128           0 :       return false;
    1129             :     }
    1130             :   }
    1131             : 
    1132           0 :   bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
    1133           0 :   Maybe<JSAutoCompartment> ac;
    1134           0 :   if (objIsXray) {
    1135           0 :     obj = js::CheckedUnwrap(obj);
    1136           0 :     if (!obj) {
    1137           0 :       return false;
    1138             :     }
    1139           0 :     ac.emplace(cx, obj);
    1140           0 :     if (!JS_WrapObject(cx, &desiredProto)) {
    1141           0 :       return false;
    1142             :     }
    1143             :   }
    1144           0 :   binding_detail::FastErrorResult rv;
    1145           0 :   auto result(StrongOrRawPtr<mozilla::dom::HTMLButtonElement>(CreateHTMLElement(global, args, rv)));
    1146           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1147           0 :     return false;
    1148             :   }
    1149           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1150             :   static_assert(!IsPointer<decltype(result)>::value,
    1151             :                 "NewObject implies that we need to keep the object alive with a strong reference.");
    1152           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) {
    1153           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1154           0 :     return false;
    1155             :   }
    1156           0 :   return true;
    1157             : }
    1158             : 
    1159             : static const js::ClassOps sInterfaceObjectClassOps = {
    1160             :     nullptr,               /* addProperty */
    1161             :     nullptr,               /* delProperty */
    1162             :     nullptr,               /* getProperty */
    1163             :     nullptr,               /* setProperty */
    1164             :     nullptr,               /* enumerate */
    1165             :     nullptr,               /* newEnumerate */
    1166             :     nullptr,               /* resolve */
    1167             :     nullptr,               /* mayResolve */
    1168             :     nullptr,               /* finalize */
    1169             :     _constructor, /* call */
    1170             :     nullptr,               /* hasInstance */
    1171             :     _constructor, /* construct */
    1172             :     nullptr,               /* trace */
    1173             : };
    1174             : 
    1175             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
    1176             :   {
    1177             :     "Function",
    1178             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
    1179             :     &sInterfaceObjectClassOps,
    1180             :     JS_NULL_CLASS_SPEC,
    1181             :     JS_NULL_CLASS_EXT,
    1182             :     &sInterfaceObjectClassObjectOps
    1183             :   },
    1184             :   eInterface,
    1185             :   true,
    1186             :   prototypes::id::HTMLButtonElement,
    1187             :   PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth,
    1188             :   sNativePropertyHooks,
    1189             :   "function HTMLButtonElement() {\n    [native code]\n}",
    1190             :   HTMLElementBinding::GetConstructorObject
    1191             : };
    1192             : 
    1193             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
    1194             :   {
    1195             :     "HTMLButtonElementPrototype",
    1196             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
    1197             :     JS_NULL_CLASS_OPS,
    1198             :     JS_NULL_CLASS_SPEC,
    1199             :     JS_NULL_CLASS_EXT,
    1200             :     JS_NULL_OBJECT_OPS
    1201             :   },
    1202             :   eInterfacePrototype,
    1203             :   false,
    1204             :   prototypes::id::HTMLButtonElement,
    1205             :   PrototypeTraits<prototypes::id::HTMLButtonElement>::Depth,
    1206             :   sNativePropertyHooks,
    1207             :   "[object HTMLButtonElementPrototype]",
    1208             :   HTMLElementBinding::GetProtoObject
    1209             : };
    1210             : 
    1211             : JSObject*
    1212           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
    1213             : {
    1214           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
    1215             : }
    1216             : 
    1217             : static const js::ClassOps sClassOps = {
    1218             :   _addProperty, /* addProperty */
    1219             :   nullptr,               /* delProperty */
    1220             :   nullptr,               /* getProperty */
    1221             :   nullptr,               /* setProperty */
    1222             :   nullptr,               /* enumerate */
    1223             :   nullptr, /* newEnumerate */
    1224             :   nullptr, /* resolve */
    1225             :   nullptr, /* mayResolve */
    1226             :   _finalize, /* finalize */
    1227             :   nullptr, /* call */
    1228             :   nullptr,               /* hasInstance */
    1229             :   nullptr,               /* construct */
    1230             :   nullptr, /* trace */
    1231             : };
    1232             : 
    1233             : static const js::ClassExtension sClassExtension = {
    1234             :   nullptr, /* weakmapKeyDelegateOp */
    1235             :   _objectMoved /* objectMovedOp */
    1236             : };
    1237             : 
    1238             : static const DOMJSClass sClass = {
    1239             :   { "HTMLButtonElement",
    1240             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
    1241             :     &sClassOps,
    1242             :     JS_NULL_CLASS_SPEC,
    1243             :     &sClassExtension,
    1244             :     JS_NULL_OBJECT_OPS
    1245             :   },
    1246             :   { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::HTMLElement, prototypes::id::HTMLButtonElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
    1247             :   IsBaseOf<nsISupports, mozilla::dom::HTMLButtonElement >::value,
    1248             :   sNativePropertyHooks,
    1249             :   FindAssociatedGlobalForNative<mozilla::dom::HTMLButtonElement>::Get,
    1250             :   GetProtoObjectHandle,
    1251             :   GetCCParticipant<mozilla::dom::HTMLButtonElement>::Get()
    1252             : };
    1253             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
    1254             :               "Must have the right minimal number of reserved slots.");
    1255             : static_assert(1 >= 1,
    1256             :               "Must have enough reserved slots.");
    1257             : 
    1258             : const JSClass*
    1259           0 : GetJSClass()
    1260             : {
    1261           0 :   return sClass.ToJSClass();
    1262             : }
    1263             : 
    1264             : bool
    1265           0 : Wrap(JSContext* aCx, mozilla::dom::HTMLButtonElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
    1266             : {
    1267             :   MOZ_ASSERT(static_cast<mozilla::dom::HTMLButtonElement*>(aObject) ==
    1268             :              reinterpret_cast<mozilla::dom::HTMLButtonElement*>(aObject),
    1269             :              "Multiple inheritance for mozilla::dom::HTMLButtonElement is broken.");
    1270             :   MOZ_ASSERT(static_cast<nsGenericHTMLElement*>(aObject) ==
    1271             :              reinterpret_cast<nsGenericHTMLElement*>(aObject),
    1272             :              "Multiple inheritance for nsGenericHTMLElement is broken.");
    1273             :   MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
    1274             :              reinterpret_cast<mozilla::dom::Element*>(aObject),
    1275             :              "Multiple inheritance for mozilla::dom::Element is broken.");
    1276             :   MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
    1277             :              reinterpret_cast<nsINode*>(aObject),
    1278             :              "Multiple inheritance for nsINode is broken.");
    1279             :   MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
    1280             :              reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
    1281             :              "Multiple inheritance for mozilla::dom::EventTarget is broken.");
    1282           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
    1283           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
    1284           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
    1285             :              "You should probably not be using Wrap() directly; use "
    1286             :              "GetOrCreateDOMReflector instead");
    1287             : 
    1288           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
    1289             :              "nsISupports must be on our primary inheritance chain");
    1290             : 
    1291           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
    1292           0 :   if (!global) {
    1293           0 :     return false;
    1294             :   }
    1295           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
    1296           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
    1297             : 
    1298             :   // That might have ended up wrapping us already, due to the wonders
    1299             :   // of XBL.  Check for that, and bail out as needed.
    1300           0 :   aReflector.set(aCache->GetWrapper());
    1301           0 :   if (aReflector) {
    1302             : #ifdef DEBUG
    1303           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
    1304             : #endif // DEBUG
    1305           0 :     return true;
    1306             :   }
    1307             : 
    1308           0 :   JSAutoCompartment ac(aCx, global);
    1309           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
    1310           0 :   if (!canonicalProto) {
    1311           0 :     return false;
    1312             :   }
    1313           0 :   JS::Rooted<JSObject*> proto(aCx);
    1314           0 :   if (aGivenProto) {
    1315           0 :     proto = aGivenProto;
    1316             :     // Unfortunately, while aGivenProto was in the compartment of aCx
    1317             :     // coming in, we changed compartments to that of "parent" so may need
    1318             :     // to wrap the proto here.
    1319           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
    1320           0 :       if (!JS_WrapObject(aCx, &proto)) {
    1321           0 :         return false;
    1322             :       }
    1323             :     }
    1324             :   } else {
    1325           0 :     proto = canonicalProto;
    1326             :   }
    1327             : 
    1328           0 :   BindingJSObjectCreator<mozilla::dom::HTMLButtonElement> creator(aCx);
    1329           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
    1330           0 :   if (!aReflector) {
    1331           0 :     return false;
    1332             :   }
    1333             : 
    1334           0 :   aCache->SetWrapper(aReflector);
    1335           0 :   creator.InitializationSucceeded();
    1336             : 
    1337           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
    1338             :              aCache->GetWrapperPreserveColor() == aReflector);
    1339             :   // If proto != canonicalProto, we have to preserve our wrapper;
    1340             :   // otherwise we won't be able to properly recreate it later, since
    1341             :   // we won't know what proto to use.  Note that we don't check
    1342             :   // aGivenProto here, since it's entirely possible (and even
    1343             :   // somewhat common) to have a non-null aGivenProto which is the
    1344             :   // same as canonicalProto.
    1345           0 :   if (proto != canonicalProto) {
    1346           0 :     PreserveWrapper(aObject);
    1347             :   }
    1348             : 
    1349           0 :   return true;
    1350             : }
    1351             : 
    1352             : const NativePropertyHooks sNativePropertyHooks[] = { {
    1353             :   nullptr,
    1354             :   nullptr,
    1355             :   nullptr,
    1356             :   { sNativeProperties.Upcast(), nullptr },
    1357             :   prototypes::id::HTMLButtonElement,
    1358             :   constructors::id::HTMLButtonElement,
    1359             :   HTMLElementBinding::sNativePropertyHooks,
    1360             :   &DefaultXrayExpandoObjectClass
    1361             : } };
    1362             : 
    1363             : void
    1364           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
    1365             : {
    1366           0 :   JS::Handle<JSObject*> parentProto(HTMLElementBinding::GetProtoObjectHandle(aCx));
    1367           0 :   if (!parentProto) {
    1368           0 :     return;
    1369             :   }
    1370             : 
    1371           0 :   JS::Handle<JSObject*> constructorProto(HTMLElementBinding::GetConstructorObjectHandle(aCx));
    1372           0 :   if (!constructorProto) {
    1373           0 :     return;
    1374             :   }
    1375             : 
    1376             :   static bool sIdsInited = false;
    1377           0 :   if (!sIdsInited && NS_IsMainThread()) {
    1378           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
    1379           0 :       return;
    1380             :     }
    1381           0 :     sIdsInited = true;
    1382             :   }
    1383             : 
    1384           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLButtonElement);
    1385           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLButtonElement);
    1386           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
    1387             :                               &sPrototypeClass.mBase, protoCache,
    1388             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
    1389             :                               interfaceCache,
    1390             :                               sNativeProperties.Upcast(),
    1391             :                               nullptr,
    1392             :                               "HTMLButtonElement", aDefineOnGlobal,
    1393             :                               nullptr,
    1394           0 :                               false);
    1395             : }
    1396             : 
    1397             : JS::Handle<JSObject*>
    1398           0 : GetProtoObjectHandle(JSContext* aCx)
    1399             : {
    1400             :   /* Get the interface prototype object for this class.  This will create the
    1401             :      object as needed. */
    1402           0 :   bool aDefineOnGlobal = true;
    1403             : 
    1404             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    1405           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    1406           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    1407           0 :     return nullptr;
    1408             :   }
    1409             : 
    1410             :   /* Check to see whether the interface objects are already installed */
    1411           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    1412           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::HTMLButtonElement)) {
    1413           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    1414           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    1415             :   }
    1416             : 
    1417             :   /*
    1418             :    * The object might _still_ be null, but that's OK.
    1419             :    *
    1420             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    1421             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    1422             :    * changed after they have been set.
    1423             :    *
    1424             :    * Calling address() avoids the read read barrier that does gray
    1425             :    * unmarking, but it's not possible for the object to be gray here.
    1426             :    */
    1427             : 
    1428           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::HTMLButtonElement);
    1429           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    1430           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    1431             : }
    1432             : 
    1433             : JS::Handle<JSObject*>
    1434           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
    1435             : {
    1436             :   /* Get the interface object for this class.  This will create the object as
    1437             :      needed. */
    1438             : 
    1439             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    1440           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    1441           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    1442           0 :     return nullptr;
    1443             :   }
    1444             : 
    1445             :   /* Check to see whether the interface objects are already installed */
    1446           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    1447           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::HTMLButtonElement)) {
    1448           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    1449           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    1450             :   }
    1451             : 
    1452             :   /*
    1453             :    * The object might _still_ be null, but that's OK.
    1454             :    *
    1455             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    1456             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    1457             :    * changed after they have been set.
    1458             :    *
    1459             :    * Calling address() avoids the read read barrier that does gray
    1460             :    * unmarking, but it's not possible for the object to be gray here.
    1461             :    */
    1462             : 
    1463           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::HTMLButtonElement);
    1464           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    1465           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    1466             : }
    1467             : 
    1468             : JSObject*
    1469           0 : GetConstructorObject(JSContext* aCx)
    1470             : {
    1471           0 :   return GetConstructorObjectHandle(aCx);
    1472             : }
    1473             : 
    1474             : } // namespace HTMLButtonElementBinding
    1475             : 
    1476             : 
    1477             : 
    1478             : } // namespace dom
    1479             : } // namespace mozilla

Generated by: LCOV version 1.13