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

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

Generated by: LCOV version 1.13