LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dom/bindings - ElementBinding.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 177 1537 11.5 %
Date: 2017-07-14 16:53:18 Functions: 20 119 16.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM Element.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "AnimatableBinding.h"
       4             : #include "AtomList.h"
       5             : #include "DOMPointBinding.h"
       6             : #include "ElementBinding.h"
       7             : #include "GeometryUtilsBinding.h"
       8             : #include "KeyframeAnimationOptionsBinding.h"
       9             : #include "NodeBinding.h"
      10             : #include "WindowBinding.h"
      11             : #include "WrapperFactory.h"
      12             : #include "jsapi.h"
      13             : #include "mozilla/FloatingPoint.h"
      14             : #include "mozilla/OwningNonNull.h"
      15             : #include "mozilla/Preferences.h"
      16             : #include "mozilla/dom/Animation.h"
      17             : #include "mozilla/dom/Attr.h"
      18             : #include "mozilla/dom/BindingUtils.h"
      19             : #include "mozilla/dom/CustomElementRegistry.h"
      20             : #include "mozilla/dom/DOMJSClass.h"
      21             : #include "mozilla/dom/DOMMatrix.h"
      22             : #include "mozilla/dom/DOMPoint.h"
      23             : #include "mozilla/dom/DOMQuad.h"
      24             : #include "mozilla/dom/DOMRect.h"
      25             : #include "mozilla/dom/Element.h"
      26             : #include "mozilla/dom/Grid.h"
      27             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      28             : #include "mozilla/dom/Nullable.h"
      29             : #include "mozilla/dom/PrimitiveConversions.h"
      30             : #include "mozilla/dom/ScriptSettings.h"
      31             : #include "mozilla/dom/ShadowRoot.h"
      32             : #include "mozilla/dom/SimpleGlobalObject.h"
      33             : #include "mozilla/dom/UnionConversions.h"
      34             : #include "mozilla/dom/UnionTypes.h"
      35             : #include "mozilla/dom/XrayExpandoClass.h"
      36             : #include "nsContentList.h"
      37             : #include "nsContentUtils.h"
      38             : #include "nsDOMAttributeMap.h"
      39             : #include "nsDOMTokenList.h"
      40             : #include "nsDocument.h"
      41             : #include "nsINode.h"
      42             : #include "nsINodeList.h"
      43             : #include "nsISupports.h"
      44             : #include "xpcjsid.h"
      45             : 
      46             : namespace mozilla {
      47             : namespace dom {
      48             : 
      49             : namespace ScrollLogicalPositionValues {
      50             : extern const EnumEntry strings[3] = {
      51             :   {"start", 5},
      52             :   {"end", 3},
      53             :   { nullptr, 0 }
      54             : };
      55             : } // namespace ScrollLogicalPositionValues
      56             : 
      57             : bool
      58           0 : ToJSValue(JSContext* aCx, ScrollLogicalPosition aArgument, JS::MutableHandle<JS::Value> aValue)
      59             : {
      60           0 :   MOZ_ASSERT(uint32_t(aArgument) < ArrayLength(ScrollLogicalPositionValues::strings));
      61             :   JSString* resultStr =
      62           0 :     JS_NewStringCopyN(aCx, ScrollLogicalPositionValues::strings[uint32_t(aArgument)].value,
      63           0 :                       ScrollLogicalPositionValues::strings[uint32_t(aArgument)].length);
      64           0 :   if (!resultStr) {
      65           0 :     return false;
      66             :   }
      67           0 :   aValue.setString(resultStr);
      68           0 :   return true;
      69             : }
      70             : 
      71             : 
      72             : 
      73           0 : ScrollIntoViewOptions::ScrollIntoViewOptions()
      74           0 :   : ScrollOptions(FastDictionaryInitializer())
      75             : {
      76             :   // Safe to pass a null context if we pass a null value
      77           0 :   Init(nullptr, JS::NullHandleValue);
      78           0 : }
      79             : 
      80             : 
      81             : 
      82             : bool
      83           0 : ScrollIntoViewOptions::InitIds(JSContext* cx, ScrollIntoViewOptionsAtoms* atomsCache)
      84             : {
      85           0 :   MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache));
      86             : 
      87             :   // Initialize these in reverse order so that any failure leaves the first one
      88             :   // uninitialized.
      89           0 :   if (!atomsCache->block_id.init(cx, "block")) {
      90           0 :     return false;
      91             :   }
      92           0 :   return true;
      93             : }
      94             : 
      95             : bool
      96           0 : ScrollIntoViewOptions::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
      97             : {
      98             :   // Passing a null JSContext is OK only if we're initing from null,
      99             :   // Since in that case we will not have to do any property gets
     100             :   // Also evaluate isNullOrUndefined in order to avoid false-positive
     101             :   // checkers by static analysis tools
     102           0 :   MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
     103           0 :   ScrollIntoViewOptionsAtoms* atomsCache = nullptr;
     104           0 :   if (cx) {
     105           0 :     atomsCache = GetAtomCache<ScrollIntoViewOptionsAtoms>(cx);
     106           0 :     if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
     107           0 :       return false;
     108             :     }
     109             :   }
     110             : 
     111             :   // Per spec, we init the parent's members first
     112           0 :   if (!ScrollOptions::Init(cx, val)) {
     113           0 :     return false;
     114             :   }
     115             : 
     116           0 :   bool isNull = val.isNullOrUndefined();
     117             :   // We only need these if !isNull, in which case we have |cx|.
     118           0 :   Maybe<JS::Rooted<JSObject *> > object;
     119           0 :   Maybe<JS::Rooted<JS::Value> > temp;
     120           0 :   if (!isNull) {
     121           0 :     MOZ_ASSERT(cx);
     122           0 :     object.emplace(cx, &val.toObject());
     123           0 :     temp.emplace(cx);
     124             :   }
     125           0 :   if (!isNull) {
     126           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->block_id, temp.ptr())) {
     127           0 :       return false;
     128             :     }
     129             :   }
     130           0 :   if (!isNull && !temp->isUndefined()) {
     131             :     {
     132             :       int index;
     133           0 :       if (!FindEnumStringIndex<true>(cx, temp.ref(), ScrollLogicalPositionValues::strings, "ScrollLogicalPosition", "'block' member of ScrollIntoViewOptions", &index)) {
     134           0 :         return false;
     135             :       }
     136           0 :       MOZ_ASSERT(index >= 0);
     137           0 :       mBlock = static_cast<ScrollLogicalPosition>(index);
     138             :     }
     139             :   } else {
     140           0 :     mBlock = ScrollLogicalPosition::Start;
     141             :   }
     142           0 :   mIsAnyMemberPresent = true;
     143           0 :   return true;
     144             : }
     145             : 
     146             : bool
     147           0 : ScrollIntoViewOptions::Init(const nsAString& aJSON)
     148             : {
     149           0 :   AutoJSAPI jsapi;
     150           0 :   JSObject* cleanGlobal = SimpleGlobalObject::Create(SimpleGlobalObject::GlobalType::BindingDetail);
     151           0 :   if (!cleanGlobal) {
     152           0 :     return false;
     153             :   }
     154           0 :   if (!jsapi.Init(cleanGlobal)) {
     155           0 :     return false;
     156             :   }
     157           0 :   JSContext* cx = jsapi.cx();
     158           0 :   JS::Rooted<JS::Value> json(cx);
     159           0 :   bool ok = ParseJSON(cx, aJSON, &json);
     160           0 :   NS_ENSURE_TRUE(ok, false);
     161           0 :   return Init(cx, json);
     162             : }
     163             : 
     164             : bool
     165           0 : ScrollIntoViewOptions::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
     166             : {
     167           0 :   ScrollIntoViewOptionsAtoms* atomsCache = GetAtomCache<ScrollIntoViewOptionsAtoms>(cx);
     168           0 :   if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
     169           0 :     return false;
     170             :   }
     171             : 
     172             :   // Per spec, we define the parent's members first
     173           0 :   if (!ScrollOptions::ToObjectInternal(cx, rval)) {
     174           0 :     return false;
     175             :   }
     176           0 :   JS::Rooted<JSObject*> obj(cx, &rval.toObject());
     177             : 
     178             :   do {
     179             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     180           0 :     JS::Rooted<JS::Value> temp(cx);
     181           0 :     ScrollLogicalPosition const & currentValue = mBlock;
     182           0 :     if (!ToJSValue(cx, currentValue, &temp)) {
     183           0 :       return false;
     184             :     }
     185           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->block_id, temp, JSPROP_ENUMERATE)) {
     186           0 :       return false;
     187             :     }
     188           0 :     break;
     189             :   } while(0);
     190             : 
     191           0 :   return true;
     192             : }
     193             : 
     194             : bool
     195           0 : ScrollIntoViewOptions::ToJSON(nsAString& aJSON) const
     196             : {
     197           0 :   AutoJSAPI jsapi;
     198           0 :   jsapi.Init();
     199           0 :   JSContext *cx = jsapi.cx();
     200             :   // It's safe to use UnprivilegedJunkScopeOrWorkerGlobal here
     201             :   // because we'll only be creating objects, in ways that have no
     202             :   // side-effects, followed by a call to JS::ToJSONMaybeSafely,
     203             :   // which likewise guarantees no side-effects for the sorts of
     204             :   // things we will pass it.
     205           0 :   JSAutoCompartment ac(cx, binding_detail::UnprivilegedJunkScopeOrWorkerGlobal());
     206           0 :   JS::Rooted<JS::Value> val(cx);
     207           0 :   if (!ToObjectInternal(cx, &val)) {
     208           0 :     return false;
     209             :   }
     210           0 :   JS::Rooted<JSObject*> obj(cx, &val.toObject());
     211           0 :   return StringifyToJSON(cx, obj, aJSON);
     212             : }
     213             : 
     214             : void
     215           0 : ScrollIntoViewOptions::TraceDictionary(JSTracer* trc)
     216             : {
     217           0 :   ScrollOptions::TraceDictionary(trc);
     218           0 : }
     219             : 
     220             : ScrollIntoViewOptions&
     221           0 : ScrollIntoViewOptions::operator=(const ScrollIntoViewOptions& aOther)
     222             : {
     223           0 :   ScrollOptions::operator=(aOther);
     224           0 :   mBlock = aOther.mBlock;
     225           0 :   return *this;
     226             : }
     227             : 
     228             : namespace binding_detail {
     229             : } // namespace binding_detail
     230             : 
     231             : 
     232             : namespace ElementBinding {
     233             : 
     234             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<NodeBinding::NativeType>::value,
     235             :               "Can't inherit from an interface with a different ownership model.");
     236             : 
     237             : static bool
     238           1 : get_namespaceURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
     239             : {
     240           2 :   DOMString result;
     241           1 :   self->GetNamespaceURI(result);
     242           1 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     243           1 :   if (!xpc::StringToJsval(cx, result, args.rval())) {
     244           0 :     return false;
     245             :   }
     246           1 :   return true;
     247             : }
     248             : 
     249             : static const JSJitInfo namespaceURI_getterinfo = {
     250             :   { (JSJitGetterOp)get_namespaceURI },
     251             :   { prototypes::id::Element },
     252             :   { PrototypeTraits<prototypes::id::Element>::Depth },
     253             :   JSJitInfo::Getter,
     254             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     255             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     256             :   false,  /* isInfallible. False in setters. */
     257             :   true,  /* isMovable.  Not relevant for setters. */
     258             :   true, /* isEliminatable.  Not relevant for setters. */
     259             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     260             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     261             :   false,  /* isTypedMethod.  Only relevant for methods. */
     262             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     263             : };
     264             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     265             : static_assert(0 < 1, "There is no slot for us");
     266             : 
     267             : static bool
     268           0 : get_prefix(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
     269             : {
     270           0 :   DOMString result;
     271           0 :   self->GetPrefix(result);
     272           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     273           0 :   if (!xpc::StringToJsval(cx, result, args.rval())) {
     274           0 :     return false;
     275             :   }
     276           0 :   return true;
     277             : }
     278             : 
     279             : static const JSJitInfo prefix_getterinfo = {
     280             :   { (JSJitGetterOp)get_prefix },
     281             :   { prototypes::id::Element },
     282             :   { PrototypeTraits<prototypes::id::Element>::Depth },
     283             :   JSJitInfo::Getter,
     284             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     285             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     286             :   false,  /* isInfallible. False in setters. */
     287             :   true,  /* isMovable.  Not relevant for setters. */
     288             :   true, /* isEliminatable.  Not relevant for setters. */
     289             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     290             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     291             :   false,  /* isTypedMethod.  Only relevant for methods. */
     292             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     293             : };
     294             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     295             : static_assert(0 < 1, "There is no slot for us");
     296             : 
     297             : static bool
     298          35 : get_localName(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
     299             : {
     300          70 :   DOMString result;
     301          35 :   self->GetLocalName(result);
     302          35 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     303          35 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     304           0 :     return false;
     305             :   }
     306          35 :   return true;
     307             : }
     308             : 
     309             : static const JSJitInfo localName_getterinfo = {
     310             :   { (JSJitGetterOp)get_localName },
     311             :   { prototypes::id::Element },
     312             :   { PrototypeTraits<prototypes::id::Element>::Depth },
     313             :   JSJitInfo::Getter,
     314             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     315             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     316             :   false,  /* isInfallible. False in setters. */
     317             :   true,  /* isMovable.  Not relevant for setters. */
     318             :   true, /* isEliminatable.  Not relevant for setters. */
     319             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     320             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     321             :   false,  /* isTypedMethod.  Only relevant for methods. */
     322             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     323             : };
     324             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     325             : static_assert(0 < 1, "There is no slot for us");
     326             : 
     327             : static bool
     328           0 : get_tagName(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
     329             : {
     330           0 :   DOMString result;
     331           0 :   self->GetTagName(result);
     332           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     333           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     334           0 :     return false;
     335             :   }
     336           0 :   return true;
     337             : }
     338             : 
     339             : static const JSJitInfo tagName_getterinfo = {
     340             :   { (JSJitGetterOp)get_tagName },
     341             :   { prototypes::id::Element },
     342             :   { PrototypeTraits<prototypes::id::Element>::Depth },
     343             :   JSJitInfo::Getter,
     344             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     345             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     346             :   false,  /* isInfallible. False in setters. */
     347             :   true,  /* isMovable.  Not relevant for setters. */
     348             :   true, /* isEliminatable.  Not relevant for setters. */
     349             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     350             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     351             :   false,  /* isTypedMethod.  Only relevant for methods. */
     352             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     353             : };
     354             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     355             : static_assert(0 < 1, "There is no slot for us");
     356             : 
     357             : static bool
     358          74 : get_id(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
     359             : {
     360         148 :   DOMString result;
     361          74 :   self->GetId(result);
     362          74 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     363          74 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     364           0 :     return false;
     365             :   }
     366          74 :   return true;
     367             : }
     368             : 
     369             : static bool
     370          41 : set_id(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitSetterCallArgs args)
     371             : {
     372          82 :   binding_detail::FakeString arg0;
     373          41 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     374           0 :     return false;
     375             :   }
     376          41 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
     377          82 :   Maybe<AutoCEReaction> ceReaction;
     378          41 :   if (reactionsStack) {
     379          41 :     ceReaction.emplace(reactionsStack);
     380             :   }
     381          41 :   self->SetId(NonNullHelper(Constify(arg0)));
     382          41 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     383             : 
     384          41 :   return true;
     385             : }
     386             : 
     387             : static const JSJitInfo id_getterinfo = {
     388             :   { (JSJitGetterOp)get_id },
     389             :   { prototypes::id::Element },
     390             :   { PrototypeTraits<prototypes::id::Element>::Depth },
     391             :   JSJitInfo::Getter,
     392             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     393             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     394             :   false,  /* isInfallible. False in setters. */
     395             :   true,  /* isMovable.  Not relevant for setters. */
     396             :   true, /* isEliminatable.  Not relevant for setters. */
     397             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     398             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     399             :   false,  /* isTypedMethod.  Only relevant for methods. */
     400             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     401             : };
     402             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     403             : static_assert(0 < 1, "There is no slot for us");
     404             : static const JSJitInfo id_setterinfo = {
     405             :   { (JSJitGetterOp)set_id },
     406             :   { prototypes::id::Element },
     407             :   { PrototypeTraits<prototypes::id::Element>::Depth },
     408             :   JSJitInfo::Setter,
     409             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     410             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     411             :   false,  /* isInfallible. False in setters. */
     412             :   false,  /* isMovable.  Not relevant for setters. */
     413             :   false, /* isEliminatable.  Not relevant for setters. */
     414             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     415             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     416             :   false,  /* isTypedMethod.  Only relevant for methods. */
     417             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     418             : };
     419             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     420             : static_assert(0 < 1, "There is no slot for us");
     421             : 
     422             : static bool
     423           0 : get_className(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
     424             : {
     425           0 :   DOMString result;
     426           0 :   self->GetClassName(result);
     427           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     428           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     429           0 :     return false;
     430             :   }
     431           0 :   return true;
     432             : }
     433             : 
     434             : static bool
     435           8 : set_className(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitSetterCallArgs args)
     436             : {
     437          16 :   binding_detail::FakeString arg0;
     438           8 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     439           0 :     return false;
     440             :   }
     441           8 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
     442          16 :   Maybe<AutoCEReaction> ceReaction;
     443           8 :   if (reactionsStack) {
     444           8 :     ceReaction.emplace(reactionsStack);
     445             :   }
     446           8 :   self->SetClassName(NonNullHelper(Constify(arg0)));
     447           8 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     448             : 
     449           8 :   return true;
     450             : }
     451             : 
     452             : static const JSJitInfo className_getterinfo = {
     453             :   { (JSJitGetterOp)get_className },
     454             :   { prototypes::id::Element },
     455             :   { PrototypeTraits<prototypes::id::Element>::Depth },
     456             :   JSJitInfo::Getter,
     457             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     458             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     459             :   false,  /* isInfallible. False in setters. */
     460             :   true,  /* isMovable.  Not relevant for setters. */
     461             :   true, /* isEliminatable.  Not relevant for setters. */
     462             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     463             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     464             :   false,  /* isTypedMethod.  Only relevant for methods. */
     465             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     466             : };
     467             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     468             : static_assert(0 < 1, "There is no slot for us");
     469             : static const JSJitInfo className_setterinfo = {
     470             :   { (JSJitGetterOp)set_className },
     471             :   { prototypes::id::Element },
     472             :   { PrototypeTraits<prototypes::id::Element>::Depth },
     473             :   JSJitInfo::Setter,
     474             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     475             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     476             :   false,  /* isInfallible. False in setters. */
     477             :   false,  /* isMovable.  Not relevant for setters. */
     478             :   false, /* isEliminatable.  Not relevant for setters. */
     479             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     480             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     481             :   false,  /* isTypedMethod.  Only relevant for methods. */
     482             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     483             : };
     484             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     485             : static_assert(0 < 1, "There is no slot for us");
     486             : 
     487             : static bool
     488           8 : get_classList(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
     489             : {
     490           8 :   auto result(StrongOrRawPtr<nsDOMTokenList>(self->ClassList()));
     491           8 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     492           8 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     493           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     494           0 :     return false;
     495             :   }
     496           8 :   return true;
     497             : }
     498             : 
     499             : static bool
     500           0 : set_classList(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitSetterCallArgs args)
     501             : {
     502           0 :   JS::Rooted<JS::Value> v(cx);
     503           0 :   if (!JS_GetProperty(cx, obj, "classList", &v)) {
     504           0 :     return false;
     505             :   }
     506             : 
     507           0 :   if (!v.isObject()) {
     508           0 :     return ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Element.classList");
     509             :   }
     510             : 
     511           0 :   JS::Rooted<JSObject*> targetObj(cx, &v.toObject());
     512           0 :   return JS_SetProperty(cx, targetObj, "value", args[0]);
     513             : }
     514             : 
     515             : static const JSJitInfo classList_getterinfo = {
     516             :   { (JSJitGetterOp)get_classList },
     517             :   { prototypes::id::Element },
     518             :   { PrototypeTraits<prototypes::id::Element>::Depth },
     519             :   JSJitInfo::Getter,
     520             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     521             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     522             :   false,  /* isInfallible. False in setters. */
     523             :   true,  /* isMovable.  Not relevant for setters. */
     524             :   true, /* isEliminatable.  Not relevant for setters. */
     525             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     526             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     527             :   false,  /* isTypedMethod.  Only relevant for methods. */
     528             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     529             : };
     530             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     531             : static_assert(0 < 1, "There is no slot for us");
     532             : static const JSJitInfo classList_setterinfo = {
     533             :   { (JSJitGetterOp)set_classList },
     534             :   { prototypes::id::Element },
     535             :   { PrototypeTraits<prototypes::id::Element>::Depth },
     536             :   JSJitInfo::Setter,
     537             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     538             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     539             :   false,  /* isInfallible. False in setters. */
     540             :   false,  /* isMovable.  Not relevant for setters. */
     541             :   false, /* isEliminatable.  Not relevant for setters. */
     542             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     543             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     544             :   false,  /* isTypedMethod.  Only relevant for methods. */
     545             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     546             : };
     547             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     548             : static_assert(0 < 1, "There is no slot for us");
     549             : 
     550             : static bool
     551           0 : get_attributes(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
     552             : {
     553           0 :   auto result(StrongOrRawPtr<nsDOMAttributeMap>(self->Attributes()));
     554           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     555           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     556           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     557           0 :     return false;
     558             :   }
     559           0 :   return true;
     560             : }
     561             : 
     562             : static const JSJitInfo attributes_getterinfo = {
     563             :   { (JSJitGetterOp)get_attributes },
     564             :   { prototypes::id::Element },
     565             :   { PrototypeTraits<prototypes::id::Element>::Depth },
     566             :   JSJitInfo::Getter,
     567             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     568             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     569             :   false,  /* isInfallible. False in setters. */
     570             :   true,  /* isMovable.  Not relevant for setters. */
     571             :   true, /* isEliminatable.  Not relevant for setters. */
     572             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     573             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     574             :   false,  /* isTypedMethod.  Only relevant for methods. */
     575             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     576             : };
     577             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     578             : static_assert(0 < 1, "There is no slot for us");
     579             : 
     580             : static bool
     581           0 : getAttributeNames(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
     582             : {
     583           0 :   nsTArray<nsString> result;
     584           0 :   self->GetAttributeNames(result);
     585           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     586             : 
     587           0 :   uint32_t length = result.Length();
     588           0 :   JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
     589           0 :   if (!returnArray) {
     590           0 :     return false;
     591             :   }
     592             :   // Scope for 'tmp'
     593             :   {
     594           0 :     JS::Rooted<JS::Value> tmp(cx);
     595           0 :     for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
     596             :       // Control block to let us common up the JS_DefineElement calls when there
     597             :       // are different ways to succeed at wrapping the object.
     598             :       do {
     599           0 :         if (!xpc::NonVoidStringToJsval(cx, result[sequenceIdx0], &tmp)) {
     600           0 :           return false;
     601             :         }
     602           0 :         break;
     603             :       } while (0);
     604           0 :       if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
     605             :                             JSPROP_ENUMERATE)) {
     606           0 :         return false;
     607             :       }
     608             :     }
     609             :   }
     610           0 :   args.rval().setObject(*returnArray);
     611           0 :   return true;
     612             : }
     613             : 
     614             : static const JSJitInfo::ArgType getAttributeNames_methodinfo_argTypes[] = { JSJitInfo::ArgTypeListEnd };
     615             : static const JSTypedMethodJitInfo getAttributeNames_methodinfo = {
     616             :   {
     617             :     { (JSJitGetterOp)getAttributeNames },
     618             :     { prototypes::id::Element },
     619             :     { PrototypeTraits<prototypes::id::Element>::Depth },
     620             :     JSJitInfo::Method,
     621             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     622             :     JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     623             :     false,  /* isInfallible. False in setters. */
     624             :     true,  /* isMovable.  Not relevant for setters. */
     625             :     true, /* isEliminatable.  Not relevant for setters. */
     626             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
     627             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     628             :     true,  /* isTypedMethod.  Only relevant for methods. */
     629             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
     630             :   },
     631             :   getAttributeNames_methodinfo_argTypes
     632             : };
     633             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     634             : static_assert(0 < 1, "There is no slot for us");
     635             : 
     636             : static bool
     637         224 : getAttribute(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
     638             : {
     639         224 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     640           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.getAttribute");
     641             :   }
     642         448 :   binding_detail::FakeString arg0;
     643         224 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     644           0 :     return false;
     645             :   }
     646         448 :   DOMString result;
     647         224 :   self->GetAttribute(NonNullHelper(Constify(arg0)), result);
     648         224 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     649         224 :   if (!xpc::StringToJsval(cx, result, args.rval())) {
     650           0 :     return false;
     651             :   }
     652         224 :   return true;
     653             : }
     654             : 
     655             : static const JSJitInfo::ArgType getAttribute_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd };
     656             : static const JSTypedMethodJitInfo getAttribute_methodinfo = {
     657             :   {
     658             :     { (JSJitGetterOp)getAttribute },
     659             :     { prototypes::id::Element },
     660             :     { PrototypeTraits<prototypes::id::Element>::Depth },
     661             :     JSJitInfo::Method,
     662             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     663             :     JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     664             :     false,  /* isInfallible. False in setters. */
     665             :     true,  /* isMovable.  Not relevant for setters. */
     666             :     true, /* isEliminatable.  Not relevant for setters. */
     667             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
     668             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     669             :     true,  /* isTypedMethod.  Only relevant for methods. */
     670             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
     671             :   },
     672             :   getAttribute_methodinfo_argTypes
     673             : };
     674             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     675             : static_assert(0 < 1, "There is no slot for us");
     676             : 
     677             : static bool
     678           0 : getAttributeNS(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
     679             : {
     680           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     681           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.getAttributeNS");
     682             :   }
     683           0 :   binding_detail::FakeString arg0;
     684           0 :   if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) {
     685           0 :     return false;
     686             :   }
     687           0 :   binding_detail::FakeString arg1;
     688           0 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
     689           0 :     return false;
     690             :   }
     691           0 :   DOMString result;
     692           0 :   self->GetAttributeNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), result);
     693           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     694           0 :   if (!xpc::StringToJsval(cx, result, args.rval())) {
     695           0 :     return false;
     696             :   }
     697           0 :   return true;
     698             : }
     699             : 
     700             : static const JSJitInfo::ArgType getAttributeNS_methodinfo_argTypes[] = { JSJitInfo::ArgType(JSJitInfo::Null | JSJitInfo::String), JSJitInfo::String, JSJitInfo::ArgTypeListEnd };
     701             : static const JSTypedMethodJitInfo getAttributeNS_methodinfo = {
     702             :   {
     703             :     { (JSJitGetterOp)getAttributeNS },
     704             :     { prototypes::id::Element },
     705             :     { PrototypeTraits<prototypes::id::Element>::Depth },
     706             :     JSJitInfo::Method,
     707             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     708             :     JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     709             :     false,  /* isInfallible. False in setters. */
     710             :     true,  /* isMovable.  Not relevant for setters. */
     711             :     true, /* isEliminatable.  Not relevant for setters. */
     712             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
     713             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     714             :     true,  /* isTypedMethod.  Only relevant for methods. */
     715             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
     716             :   },
     717             :   getAttributeNS_methodinfo_argTypes
     718             : };
     719             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     720             : static_assert(0 < 1, "There is no slot for us");
     721             : 
     722             : static bool
     723         361 : setAttribute(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
     724             : {
     725         361 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     726           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.setAttribute");
     727             :   }
     728         722 :   binding_detail::FakeString arg0;
     729         361 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     730           0 :     return false;
     731             :   }
     732         722 :   binding_detail::FakeString arg1;
     733         361 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
     734           0 :     return false;
     735             :   }
     736         361 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
     737         722 :   Maybe<AutoCEReaction> ceReaction;
     738         361 :   if (reactionsStack) {
     739         361 :     ceReaction.emplace(reactionsStack);
     740             :   }
     741         722 :   binding_detail::FastErrorResult rv;
     742         361 :   self->SetAttribute(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), rv);
     743         361 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     744           0 :     return false;
     745             :   }
     746         361 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     747         361 :   args.rval().setUndefined();
     748         361 :   return true;
     749             : }
     750             : 
     751             : static const JSJitInfo setAttribute_methodinfo = {
     752             :   { (JSJitGetterOp)setAttribute },
     753             :   { prototypes::id::Element },
     754             :   { PrototypeTraits<prototypes::id::Element>::Depth },
     755             :   JSJitInfo::Method,
     756             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     757             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     758             :   false,  /* 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 : setAttributeNS(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
     771             : {
     772           0 :   if (MOZ_UNLIKELY(args.length() < 3)) {
     773           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.setAttributeNS");
     774             :   }
     775           0 :   binding_detail::FakeString arg0;
     776           0 :   if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) {
     777           0 :     return false;
     778             :   }
     779           0 :   binding_detail::FakeString arg1;
     780           0 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
     781           0 :     return false;
     782             :   }
     783           0 :   binding_detail::FakeString arg2;
     784           0 :   if (!ConvertJSValueToString(cx, args[2], eStringify, eStringify, arg2)) {
     785           0 :     return false;
     786             :   }
     787           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
     788           0 :   Maybe<AutoCEReaction> ceReaction;
     789           0 :   if (reactionsStack) {
     790           0 :     ceReaction.emplace(reactionsStack);
     791             :   }
     792           0 :   binding_detail::FastErrorResult rv;
     793           0 :   self->SetAttributeNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), NonNullHelper(Constify(arg2)), rv);
     794           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     795           0 :     return false;
     796             :   }
     797           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     798           0 :   args.rval().setUndefined();
     799           0 :   return true;
     800             : }
     801             : 
     802             : static const JSJitInfo setAttributeNS_methodinfo = {
     803             :   { (JSJitGetterOp)setAttributeNS },
     804             :   { prototypes::id::Element },
     805             :   { PrototypeTraits<prototypes::id::Element>::Depth },
     806             :   JSJitInfo::Method,
     807             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     808             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     809             :   false,  /* isInfallible. False in setters. */
     810             :   false,  /* isMovable.  Not relevant for setters. */
     811             :   false, /* isEliminatable.  Not relevant for setters. */
     812             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     813             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     814             :   false,  /* isTypedMethod.  Only relevant for methods. */
     815             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     816             : };
     817             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     818             : static_assert(0 < 1, "There is no slot for us");
     819             : 
     820             : static bool
     821         101 : removeAttribute(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
     822             : {
     823         101 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     824           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.removeAttribute");
     825             :   }
     826         202 :   binding_detail::FakeString arg0;
     827         101 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     828           0 :     return false;
     829             :   }
     830         101 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
     831         202 :   Maybe<AutoCEReaction> ceReaction;
     832         101 :   if (reactionsStack) {
     833         101 :     ceReaction.emplace(reactionsStack);
     834             :   }
     835         202 :   binding_detail::FastErrorResult rv;
     836         101 :   self->RemoveAttribute(NonNullHelper(Constify(arg0)), rv);
     837         101 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     838           0 :     return false;
     839             :   }
     840         101 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     841         101 :   args.rval().setUndefined();
     842         101 :   return true;
     843             : }
     844             : 
     845             : static const JSJitInfo removeAttribute_methodinfo = {
     846             :   { (JSJitGetterOp)removeAttribute },
     847             :   { prototypes::id::Element },
     848             :   { PrototypeTraits<prototypes::id::Element>::Depth },
     849             :   JSJitInfo::Method,
     850             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     851             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     852             :   false,  /* isInfallible. False in setters. */
     853             :   false,  /* isMovable.  Not relevant for setters. */
     854             :   false, /* isEliminatable.  Not relevant for setters. */
     855             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     856             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     857             :   false,  /* isTypedMethod.  Only relevant for methods. */
     858             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     859             : };
     860             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     861             : static_assert(0 < 1, "There is no slot for us");
     862             : 
     863             : static bool
     864           0 : removeAttributeNS(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
     865             : {
     866           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     867           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.removeAttributeNS");
     868             :   }
     869           0 :   binding_detail::FakeString arg0;
     870           0 :   if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) {
     871           0 :     return false;
     872             :   }
     873           0 :   binding_detail::FakeString arg1;
     874           0 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
     875           0 :     return false;
     876             :   }
     877           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
     878           0 :   Maybe<AutoCEReaction> ceReaction;
     879           0 :   if (reactionsStack) {
     880           0 :     ceReaction.emplace(reactionsStack);
     881             :   }
     882           0 :   binding_detail::FastErrorResult rv;
     883           0 :   self->RemoveAttributeNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), rv);
     884           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     885           0 :     return false;
     886             :   }
     887           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     888           0 :   args.rval().setUndefined();
     889           0 :   return true;
     890             : }
     891             : 
     892             : static const JSJitInfo removeAttributeNS_methodinfo = {
     893             :   { (JSJitGetterOp)removeAttributeNS },
     894             :   { prototypes::id::Element },
     895             :   { PrototypeTraits<prototypes::id::Element>::Depth },
     896             :   JSJitInfo::Method,
     897             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     898             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     899             :   false,  /* isInfallible. False in setters. */
     900             :   false,  /* isMovable.  Not relevant for setters. */
     901             :   false, /* isEliminatable.  Not relevant for setters. */
     902             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     903             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     904             :   false,  /* isTypedMethod.  Only relevant for methods. */
     905             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     906             : };
     907             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     908             : static_assert(0 < 1, "There is no slot for us");
     909             : 
     910             : static bool
     911          33 : hasAttribute(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
     912             : {
     913          33 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     914           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.hasAttribute");
     915             :   }
     916          66 :   binding_detail::FakeString arg0;
     917          33 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     918           0 :     return false;
     919             :   }
     920          33 :   bool result(self->HasAttribute(NonNullHelper(Constify(arg0))));
     921          33 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     922          33 :   args.rval().setBoolean(result);
     923          33 :   return true;
     924             : }
     925             : 
     926             : static const JSJitInfo::ArgType hasAttribute_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd };
     927             : static const JSTypedMethodJitInfo hasAttribute_methodinfo = {
     928             :   {
     929             :     { (JSJitGetterOp)hasAttribute },
     930             :     { prototypes::id::Element },
     931             :     { PrototypeTraits<prototypes::id::Element>::Depth },
     932             :     JSJitInfo::Method,
     933             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     934             :     JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     935             :     false,  /* isInfallible. False in setters. */
     936             :     true,  /* isMovable.  Not relevant for setters. */
     937             :     true, /* isEliminatable.  Not relevant for setters. */
     938             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
     939             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     940             :     true,  /* isTypedMethod.  Only relevant for methods. */
     941             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
     942             :   },
     943             :   hasAttribute_methodinfo_argTypes
     944             : };
     945             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     946             : static_assert(0 < 1, "There is no slot for us");
     947             : 
     948             : static bool
     949           0 : hasAttributeNS(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
     950             : {
     951           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     952           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.hasAttributeNS");
     953             :   }
     954           0 :   binding_detail::FakeString arg0;
     955           0 :   if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) {
     956           0 :     return false;
     957             :   }
     958           0 :   binding_detail::FakeString arg1;
     959           0 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
     960           0 :     return false;
     961             :   }
     962           0 :   bool result(self->HasAttributeNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1))));
     963           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     964           0 :   args.rval().setBoolean(result);
     965           0 :   return true;
     966             : }
     967             : 
     968             : static const JSJitInfo::ArgType hasAttributeNS_methodinfo_argTypes[] = { JSJitInfo::ArgType(JSJitInfo::Null | JSJitInfo::String), JSJitInfo::String, JSJitInfo::ArgTypeListEnd };
     969             : static const JSTypedMethodJitInfo hasAttributeNS_methodinfo = {
     970             :   {
     971             :     { (JSJitGetterOp)hasAttributeNS },
     972             :     { prototypes::id::Element },
     973             :     { PrototypeTraits<prototypes::id::Element>::Depth },
     974             :     JSJitInfo::Method,
     975             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
     976             :     JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     977             :     false,  /* isInfallible. False in setters. */
     978             :     true,  /* isMovable.  Not relevant for setters. */
     979             :     true, /* isEliminatable.  Not relevant for setters. */
     980             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
     981             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     982             :     true,  /* isTypedMethod.  Only relevant for methods. */
     983             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
     984             :   },
     985             :   hasAttributeNS_methodinfo_argTypes
     986             : };
     987             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     988             : static_assert(0 < 1, "There is no slot for us");
     989             : 
     990             : static bool
     991           0 : hasAttributes(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
     992             : {
     993           0 :   bool result(self->HasAttributes());
     994           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     995           0 :   args.rval().setBoolean(result);
     996           0 :   return true;
     997             : }
     998             : 
     999             : static const JSJitInfo::ArgType hasAttributes_methodinfo_argTypes[] = { JSJitInfo::ArgTypeListEnd };
    1000             : static const JSTypedMethodJitInfo hasAttributes_methodinfo = {
    1001             :   {
    1002             :     { (JSJitGetterOp)hasAttributes },
    1003             :     { prototypes::id::Element },
    1004             :     { PrototypeTraits<prototypes::id::Element>::Depth },
    1005             :     JSJitInfo::Method,
    1006             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    1007             :     JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
    1008             :     true,  /* isInfallible. False in setters. */
    1009             :     true,  /* isMovable.  Not relevant for setters. */
    1010             :     true, /* isEliminatable.  Not relevant for setters. */
    1011             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
    1012             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1013             :     true,  /* isTypedMethod.  Only relevant for methods. */
    1014             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1015             :   },
    1016             :   hasAttributes_methodinfo_argTypes
    1017             : };
    1018             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1019             : static_assert(0 < 1, "There is no slot for us");
    1020             : 
    1021             : static bool
    1022           0 : closest(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1023             : {
    1024           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    1025           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.closest");
    1026             :   }
    1027           0 :   binding_detail::FakeString arg0;
    1028           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
    1029           0 :     return false;
    1030             :   }
    1031           0 :   binding_detail::FastErrorResult rv;
    1032           0 :   auto result(StrongOrRawPtr<mozilla::dom::Element>(self->Closest(NonNullHelper(Constify(arg0)), rv)));
    1033           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1034           0 :     return false;
    1035             :   }
    1036           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1037           0 :   if (!result) {
    1038           0 :     args.rval().setNull();
    1039           0 :     return true;
    1040             :   }
    1041           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    1042           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1043           0 :     return false;
    1044             :   }
    1045           0 :   return true;
    1046             : }
    1047             : 
    1048             : static const JSJitInfo::ArgType closest_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd };
    1049             : static const JSTypedMethodJitInfo closest_methodinfo = {
    1050             :   {
    1051             :     { (JSJitGetterOp)closest },
    1052             :     { prototypes::id::Element },
    1053             :     { PrototypeTraits<prototypes::id::Element>::Depth },
    1054             :     JSJitInfo::Method,
    1055             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    1056             :     JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    1057             :     false,  /* isInfallible. False in setters. */
    1058             :     false,  /* isMovable.  Not relevant for setters. */
    1059             :     false, /* isEliminatable.  Not relevant for setters. */
    1060             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
    1061             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1062             :     true,  /* isTypedMethod.  Only relevant for methods. */
    1063             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1064             :   },
    1065             :   closest_methodinfo_argTypes
    1066             : };
    1067             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1068             : static_assert(0 < 1, "There is no slot for us");
    1069             : 
    1070             : static bool
    1071           0 : matches(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1072             : {
    1073           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    1074           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.matches");
    1075             :   }
    1076           0 :   binding_detail::FakeString arg0;
    1077           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
    1078           0 :     return false;
    1079             :   }
    1080           0 :   binding_detail::FastErrorResult rv;
    1081           0 :   bool result(self->Matches(NonNullHelper(Constify(arg0)), rv));
    1082           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1083           0 :     return false;
    1084             :   }
    1085           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1086           0 :   args.rval().setBoolean(result);
    1087           0 :   return true;
    1088             : }
    1089             : 
    1090             : static const JSJitInfo::ArgType matches_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd };
    1091             : static const JSTypedMethodJitInfo matches_methodinfo = {
    1092             :   {
    1093             :     { (JSJitGetterOp)matches },
    1094             :     { prototypes::id::Element },
    1095             :     { PrototypeTraits<prototypes::id::Element>::Depth },
    1096             :     JSJitInfo::Method,
    1097             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    1098             :     JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
    1099             :     false,  /* isInfallible. False in setters. */
    1100             :     false,  /* isMovable.  Not relevant for setters. */
    1101             :     false, /* isEliminatable.  Not relevant for setters. */
    1102             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
    1103             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1104             :     true,  /* isTypedMethod.  Only relevant for methods. */
    1105             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1106             :   },
    1107             :   matches_methodinfo_argTypes
    1108             : };
    1109             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1110             : static_assert(0 < 1, "There is no slot for us");
    1111             : 
    1112             : static bool
    1113           0 : webkitMatchesSelector(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1114             : {
    1115           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    1116           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.webkitMatchesSelector");
    1117             :   }
    1118           0 :   binding_detail::FakeString arg0;
    1119           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
    1120           0 :     return false;
    1121             :   }
    1122           0 :   binding_detail::FastErrorResult rv;
    1123           0 :   bool result(self->Matches(NonNullHelper(Constify(arg0)), rv));
    1124           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1125           0 :     return false;
    1126             :   }
    1127           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1128           0 :   args.rval().setBoolean(result);
    1129           0 :   return true;
    1130             : }
    1131             : 
    1132             : static const JSJitInfo::ArgType webkitMatchesSelector_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd };
    1133             : static const JSTypedMethodJitInfo webkitMatchesSelector_methodinfo = {
    1134             :   {
    1135             :     { (JSJitGetterOp)webkitMatchesSelector },
    1136             :     { prototypes::id::Element },
    1137             :     { PrototypeTraits<prototypes::id::Element>::Depth },
    1138             :     JSJitInfo::Method,
    1139             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    1140             :     JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
    1141             :     false,  /* isInfallible. False in setters. */
    1142             :     false,  /* isMovable.  Not relevant for setters. */
    1143             :     false, /* isEliminatable.  Not relevant for setters. */
    1144             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
    1145             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1146             :     true,  /* isTypedMethod.  Only relevant for methods. */
    1147             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1148             :   },
    1149             :   webkitMatchesSelector_methodinfo_argTypes
    1150             : };
    1151             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1152             : static_assert(0 < 1, "There is no slot for us");
    1153             : 
    1154             : static bool
    1155           1 : getElementsByTagName(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1156             : {
    1157           1 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    1158           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.getElementsByTagName");
    1159             :   }
    1160           2 :   binding_detail::FakeString arg0;
    1161           1 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
    1162           0 :     return false;
    1163             :   }
    1164           2 :   auto result(StrongOrRawPtr<nsIHTMLCollection>(self->GetElementsByTagName(NonNullHelper(Constify(arg0)))));
    1165           1 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1166           1 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    1167           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1168           0 :     return false;
    1169             :   }
    1170           1 :   return true;
    1171             : }
    1172             : 
    1173             : static const JSJitInfo::ArgType getElementsByTagName_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd };
    1174             : static const JSTypedMethodJitInfo getElementsByTagName_methodinfo = {
    1175             :   {
    1176             :     { (JSJitGetterOp)getElementsByTagName },
    1177             :     { prototypes::id::Element },
    1178             :     { PrototypeTraits<prototypes::id::Element>::Depth },
    1179             :     JSJitInfo::Method,
    1180             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    1181             :     JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    1182             :     false,  /* isInfallible. False in setters. */
    1183             :     true,  /* isMovable.  Not relevant for setters. */
    1184             :     true, /* isEliminatable.  Not relevant for setters. */
    1185             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
    1186             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1187             :     true,  /* isTypedMethod.  Only relevant for methods. */
    1188             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1189             :   },
    1190             :   getElementsByTagName_methodinfo_argTypes
    1191             : };
    1192             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1193             : static_assert(0 < 1, "There is no slot for us");
    1194             : 
    1195             : static bool
    1196           1 : getElementsByTagNameNS(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1197             : {
    1198           1 :   if (MOZ_UNLIKELY(args.length() < 2)) {
    1199           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.getElementsByTagNameNS");
    1200             :   }
    1201           2 :   binding_detail::FakeString arg0;
    1202           1 :   if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) {
    1203           0 :     return false;
    1204             :   }
    1205           2 :   binding_detail::FakeString arg1;
    1206           1 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
    1207           0 :     return false;
    1208             :   }
    1209           2 :   binding_detail::FastErrorResult rv;
    1210           2 :   auto result(StrongOrRawPtr<nsIHTMLCollection>(self->GetElementsByTagNameNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), rv)));
    1211           1 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1212           0 :     return false;
    1213             :   }
    1214           1 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1215           1 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    1216           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1217           0 :     return false;
    1218             :   }
    1219           1 :   return true;
    1220             : }
    1221             : 
    1222             : static const JSJitInfo::ArgType getElementsByTagNameNS_methodinfo_argTypes[] = { JSJitInfo::ArgType(JSJitInfo::Null | JSJitInfo::String), JSJitInfo::String, JSJitInfo::ArgTypeListEnd };
    1223             : static const JSTypedMethodJitInfo getElementsByTagNameNS_methodinfo = {
    1224             :   {
    1225             :     { (JSJitGetterOp)getElementsByTagNameNS },
    1226             :     { prototypes::id::Element },
    1227             :     { PrototypeTraits<prototypes::id::Element>::Depth },
    1228             :     JSJitInfo::Method,
    1229             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    1230             :     JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    1231             :     false,  /* isInfallible. False in setters. */
    1232             :     false,  /* isMovable.  Not relevant for setters. */
    1233             :     false, /* isEliminatable.  Not relevant for setters. */
    1234             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
    1235             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1236             :     true,  /* isTypedMethod.  Only relevant for methods. */
    1237             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1238             :   },
    1239             :   getElementsByTagNameNS_methodinfo_argTypes
    1240             : };
    1241             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1242             : static_assert(0 < 1, "There is no slot for us");
    1243             : 
    1244             : static bool
    1245           0 : getElementsByClassName(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1246             : {
    1247           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    1248           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.getElementsByClassName");
    1249             :   }
    1250           0 :   binding_detail::FakeString arg0;
    1251           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
    1252           0 :     return false;
    1253             :   }
    1254           0 :   auto result(StrongOrRawPtr<nsIHTMLCollection>(self->GetElementsByClassName(NonNullHelper(Constify(arg0)))));
    1255           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1256           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    1257           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1258           0 :     return false;
    1259             :   }
    1260           0 :   return true;
    1261             : }
    1262             : 
    1263             : static const JSJitInfo::ArgType getElementsByClassName_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd };
    1264             : static const JSTypedMethodJitInfo getElementsByClassName_methodinfo = {
    1265             :   {
    1266             :     { (JSJitGetterOp)getElementsByClassName },
    1267             :     { prototypes::id::Element },
    1268             :     { PrototypeTraits<prototypes::id::Element>::Depth },
    1269             :     JSJitInfo::Method,
    1270             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    1271             :     JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    1272             :     false,  /* isInfallible. False in setters. */
    1273             :     true,  /* isMovable.  Not relevant for setters. */
    1274             :     true, /* isEliminatable.  Not relevant for setters. */
    1275             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
    1276             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1277             :     true,  /* isTypedMethod.  Only relevant for methods. */
    1278             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1279             :   },
    1280             :   getElementsByClassName_methodinfo_argTypes
    1281             : };
    1282             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1283             : static_assert(0 < 1, "There is no slot for us");
    1284             : 
    1285             : static bool
    1286           0 : insertAdjacentElement(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1287             : {
    1288           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
    1289           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.insertAdjacentElement");
    1290             :   }
    1291           0 :   binding_detail::FakeString arg0;
    1292           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
    1293           0 :     return false;
    1294             :   }
    1295           0 :   NonNull<mozilla::dom::Element> arg1;
    1296           0 :   if (args[1].isObject()) {
    1297             :     {
    1298           0 :       nsresult rv = UnwrapObject<prototypes::id::Element, mozilla::dom::Element>(args[1], arg1);
    1299           0 :       if (NS_FAILED(rv)) {
    1300           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of Element.insertAdjacentElement", "Element");
    1301           0 :         return false;
    1302             :       }
    1303             :     }
    1304             :   } else {
    1305           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of Element.insertAdjacentElement");
    1306           0 :     return false;
    1307             :   }
    1308           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
    1309           0 :   Maybe<AutoCEReaction> ceReaction;
    1310           0 :   if (reactionsStack) {
    1311           0 :     ceReaction.emplace(reactionsStack);
    1312             :   }
    1313           0 :   binding_detail::FastErrorResult rv;
    1314           0 :   auto result(StrongOrRawPtr<mozilla::dom::Element>(self->InsertAdjacentElement(NonNullHelper(Constify(arg0)), NonNullHelper(arg1), rv)));
    1315           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1316           0 :     return false;
    1317             :   }
    1318           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1319           0 :   if (!result) {
    1320           0 :     args.rval().setNull();
    1321           0 :     return true;
    1322             :   }
    1323           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    1324           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1325           0 :     return false;
    1326             :   }
    1327           0 :   return true;
    1328             : }
    1329             : 
    1330             : static const JSJitInfo::ArgType insertAdjacentElement_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::Object, JSJitInfo::ArgTypeListEnd };
    1331             : static const JSTypedMethodJitInfo insertAdjacentElement_methodinfo = {
    1332             :   {
    1333             :     { (JSJitGetterOp)insertAdjacentElement },
    1334             :     { prototypes::id::Element },
    1335             :     { PrototypeTraits<prototypes::id::Element>::Depth },
    1336             :     JSJitInfo::Method,
    1337             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    1338             :     JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    1339             :     false,  /* isInfallible. False in setters. */
    1340             :     false,  /* isMovable.  Not relevant for setters. */
    1341             :     false, /* isEliminatable.  Not relevant for setters. */
    1342             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
    1343             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1344             :     true,  /* isTypedMethod.  Only relevant for methods. */
    1345             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1346             :   },
    1347             :   insertAdjacentElement_methodinfo_argTypes
    1348             : };
    1349             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1350             : static_assert(0 < 1, "There is no slot for us");
    1351             : 
    1352             : static bool
    1353           0 : insertAdjacentText(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1354             : {
    1355           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
    1356           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.insertAdjacentText");
    1357             :   }
    1358           0 :   binding_detail::FakeString arg0;
    1359           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
    1360           0 :     return false;
    1361             :   }
    1362           0 :   binding_detail::FakeString arg1;
    1363           0 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
    1364           0 :     return false;
    1365             :   }
    1366           0 :   binding_detail::FastErrorResult rv;
    1367           0 :   self->InsertAdjacentText(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), rv);
    1368           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1369           0 :     return false;
    1370             :   }
    1371           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1372           0 :   args.rval().setUndefined();
    1373           0 :   return true;
    1374             : }
    1375             : 
    1376             : static const JSJitInfo insertAdjacentText_methodinfo = {
    1377             :   { (JSJitGetterOp)insertAdjacentText },
    1378             :   { prototypes::id::Element },
    1379             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    1380             :   JSJitInfo::Method,
    1381             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1382             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    1383             :   false,  /* isInfallible. False in setters. */
    1384             :   false,  /* isMovable.  Not relevant for setters. */
    1385             :   false, /* isEliminatable.  Not relevant for setters. */
    1386             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1387             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1388             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1389             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1390             : };
    1391             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1392             : static_assert(0 < 1, "There is no slot for us");
    1393             : 
    1394             : static bool
    1395           0 : get_fontSizeInflation(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    1396             : {
    1397           0 :   float result(self->FontSizeInflation());
    1398           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1399           0 :   args.rval().set(JS_NumberValue(double(result)));
    1400           0 :   return true;
    1401             : }
    1402             : 
    1403             : static const JSJitInfo fontSizeInflation_getterinfo = {
    1404             :   { (JSJitGetterOp)get_fontSizeInflation },
    1405             :   { prototypes::id::Element },
    1406             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    1407             :   JSJitInfo::Getter,
    1408             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1409             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
    1410             :   true,  /* isInfallible. False in setters. */
    1411             :   false,  /* isMovable.  Not relevant for setters. */
    1412             :   false, /* isEliminatable.  Not relevant for setters. */
    1413             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1414             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1415             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1416             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1417             : };
    1418             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1419             : static_assert(0 < 1, "There is no slot for us");
    1420             : 
    1421             : static bool
    1422           0 : mozMatchesSelector(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1423             : {
    1424           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    1425           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.mozMatchesSelector");
    1426             :   }
    1427           0 :   binding_detail::FakeString arg0;
    1428           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
    1429           0 :     return false;
    1430             :   }
    1431           0 :   binding_detail::FastErrorResult rv;
    1432           0 :   bool result(self->Matches(NonNullHelper(Constify(arg0)), rv));
    1433           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1434           0 :     return false;
    1435             :   }
    1436           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1437           0 :   args.rval().setBoolean(result);
    1438           0 :   return true;
    1439             : }
    1440             : 
    1441             : static const JSJitInfo::ArgType mozMatchesSelector_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd };
    1442             : static const JSTypedMethodJitInfo mozMatchesSelector_methodinfo = {
    1443             :   {
    1444             :     { (JSJitGetterOp)mozMatchesSelector },
    1445             :     { prototypes::id::Element },
    1446             :     { PrototypeTraits<prototypes::id::Element>::Depth },
    1447             :     JSJitInfo::Method,
    1448             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    1449             :     JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
    1450             :     false,  /* isInfallible. False in setters. */
    1451             :     false,  /* isMovable.  Not relevant for setters. */
    1452             :     false, /* isEliminatable.  Not relevant for setters. */
    1453             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
    1454             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1455             :     true,  /* isTypedMethod.  Only relevant for methods. */
    1456             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1457             :   },
    1458             :   mozMatchesSelector_methodinfo_argTypes
    1459             : };
    1460             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1461             : static_assert(0 < 1, "There is no slot for us");
    1462             : 
    1463             : static bool
    1464           0 : setPointerCapture(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1465             : {
    1466           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    1467           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.setPointerCapture");
    1468             :   }
    1469           0 :   if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
    1470             :       // Return false from the JSNative in order to trigger
    1471             :       // an uncatchable exception.
    1472           0 :       MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1473           0 :       return false;
    1474             :   }
    1475             :   int32_t arg0;
    1476           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
    1477           0 :     return false;
    1478             :   }
    1479           0 :   binding_detail::FastErrorResult rv;
    1480           0 :   self->SetPointerCapture(arg0, rv);
    1481           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1482           0 :     return false;
    1483             :   }
    1484           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1485           0 :   args.rval().setUndefined();
    1486           0 :   return true;
    1487             : }
    1488             : 
    1489             : static const JSJitInfo setPointerCapture_methodinfo = {
    1490             :   { (JSJitGetterOp)setPointerCapture },
    1491             :   { prototypes::id::Element },
    1492             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    1493             :   JSJitInfo::Method,
    1494             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1495             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    1496             :   false,  /* isInfallible. False in setters. */
    1497             :   false,  /* isMovable.  Not relevant for setters. */
    1498             :   false, /* isEliminatable.  Not relevant for setters. */
    1499             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1500             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1501             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1502             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1503             : };
    1504             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1505             : static_assert(0 < 1, "There is no slot for us");
    1506             : 
    1507             : static bool
    1508           0 : releasePointerCapture(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1509             : {
    1510           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    1511           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.releasePointerCapture");
    1512             :   }
    1513             :   int32_t arg0;
    1514           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
    1515           0 :     return false;
    1516             :   }
    1517           0 :   binding_detail::FastErrorResult rv;
    1518           0 :   self->ReleasePointerCapture(arg0, rv);
    1519           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1520           0 :     return false;
    1521             :   }
    1522           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1523           0 :   args.rval().setUndefined();
    1524           0 :   return true;
    1525             : }
    1526             : 
    1527             : static const JSJitInfo releasePointerCapture_methodinfo = {
    1528             :   { (JSJitGetterOp)releasePointerCapture },
    1529             :   { prototypes::id::Element },
    1530             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    1531             :   JSJitInfo::Method,
    1532             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1533             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    1534             :   false,  /* isInfallible. False in setters. */
    1535             :   false,  /* isMovable.  Not relevant for setters. */
    1536             :   false, /* isEliminatable.  Not relevant for setters. */
    1537             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1538             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1539             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1540             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1541             : };
    1542             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1543             : static_assert(0 < 1, "There is no slot for us");
    1544             : 
    1545             : static bool
    1546           0 : hasPointerCapture(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1547             : {
    1548           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    1549           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.hasPointerCapture");
    1550             :   }
    1551             :   int32_t arg0;
    1552           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
    1553           0 :     return false;
    1554             :   }
    1555           0 :   bool result(self->HasPointerCapture(arg0));
    1556           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1557           0 :   args.rval().setBoolean(result);
    1558           0 :   return true;
    1559             : }
    1560             : 
    1561             : static const JSJitInfo hasPointerCapture_methodinfo = {
    1562             :   { (JSJitGetterOp)hasPointerCapture },
    1563             :   { prototypes::id::Element },
    1564             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    1565             :   JSJitInfo::Method,
    1566             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1567             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
    1568             :   false,  /* isInfallible. False in setters. */
    1569             :   false,  /* isMovable.  Not relevant for setters. */
    1570             :   false, /* isEliminatable.  Not relevant for setters. */
    1571             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1572             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1573             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1574             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1575             : };
    1576             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1577             : static_assert(0 < 1, "There is no slot for us");
    1578             : 
    1579             : static bool
    1580           0 : setCapture(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1581             : {
    1582             :   bool arg0;
    1583           0 :   if (args.hasDefined(0)) {
    1584           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
    1585           0 :       return false;
    1586             :     }
    1587             :   } else {
    1588           0 :     arg0 = false;
    1589             :   }
    1590           0 :   self->SetCapture(arg0);
    1591           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1592           0 :   args.rval().setUndefined();
    1593           0 :   return true;
    1594             : }
    1595             : 
    1596             : static const JSJitInfo setCapture_methodinfo = {
    1597             :   { (JSJitGetterOp)setCapture },
    1598             :   { prototypes::id::Element },
    1599             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    1600             :   JSJitInfo::Method,
    1601             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1602             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    1603             :   false,  /* isInfallible. False in setters. */
    1604             :   false,  /* isMovable.  Not relevant for setters. */
    1605             :   false, /* isEliminatable.  Not relevant for setters. */
    1606             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1607             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1608             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1609             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1610             : };
    1611             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1612             : static_assert(0 < 1, "There is no slot for us");
    1613             : 
    1614             : static bool
    1615           0 : releaseCapture(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1616             : {
    1617           0 :   self->ReleaseCapture();
    1618           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1619           0 :   args.rval().setUndefined();
    1620           0 :   return true;
    1621             : }
    1622             : 
    1623             : static const JSJitInfo releaseCapture_methodinfo = {
    1624             :   { (JSJitGetterOp)releaseCapture },
    1625             :   { prototypes::id::Element },
    1626             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    1627             :   JSJitInfo::Method,
    1628             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1629             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    1630             :   true,  /* isInfallible. False in setters. */
    1631             :   false,  /* isMovable.  Not relevant for setters. */
    1632             :   false, /* isEliminatable.  Not relevant for setters. */
    1633             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1634             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1635             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1636             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1637             : };
    1638             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1639             : static_assert(0 < 1, "There is no slot for us");
    1640             : 
    1641             : static bool
    1642           0 : setCaptureAlways(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1643             : {
    1644             :   bool arg0;
    1645           0 :   if (args.hasDefined(0)) {
    1646           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
    1647           0 :       return false;
    1648             :     }
    1649             :   } else {
    1650           0 :     arg0 = false;
    1651             :   }
    1652           0 :   self->SetCaptureAlways(arg0);
    1653           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1654           0 :   args.rval().setUndefined();
    1655           0 :   return true;
    1656             : }
    1657             : 
    1658             : static const JSJitInfo setCaptureAlways_methodinfo = {
    1659             :   { (JSJitGetterOp)setCaptureAlways },
    1660             :   { prototypes::id::Element },
    1661             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    1662             :   JSJitInfo::Method,
    1663             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1664             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    1665             :   false,  /* isInfallible. False in setters. */
    1666             :   false,  /* isMovable.  Not relevant for setters. */
    1667             :   false, /* isEliminatable.  Not relevant for setters. */
    1668             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1669             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1670             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1671             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1672             : };
    1673             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1674             : static_assert(0 < 1, "There is no slot for us");
    1675             : 
    1676             : static bool
    1677           0 : getAttributeNode(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1678             : {
    1679           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    1680           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.getAttributeNode");
    1681             :   }
    1682           0 :   binding_detail::FakeString arg0;
    1683           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
    1684           0 :     return false;
    1685             :   }
    1686           0 :   auto result(StrongOrRawPtr<mozilla::dom::Attr>(self->GetAttributeNode(NonNullHelper(Constify(arg0)))));
    1687           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1688           0 :   if (!result) {
    1689           0 :     args.rval().setNull();
    1690           0 :     return true;
    1691             :   }
    1692           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    1693           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1694           0 :     return false;
    1695             :   }
    1696           0 :   return true;
    1697             : }
    1698             : 
    1699             : static const JSJitInfo getAttributeNode_methodinfo = {
    1700             :   { (JSJitGetterOp)getAttributeNode },
    1701             :   { prototypes::id::Element },
    1702             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    1703             :   JSJitInfo::Method,
    1704             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1705             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    1706             :   false,  /* isInfallible. False in setters. */
    1707             :   false,  /* isMovable.  Not relevant for setters. */
    1708             :   false, /* isEliminatable.  Not relevant for setters. */
    1709             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1710             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1711             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1712             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1713             : };
    1714             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1715             : static_assert(0 < 1, "There is no slot for us");
    1716             : 
    1717             : static bool
    1718           0 : setAttributeNode(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1719             : {
    1720           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    1721           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.setAttributeNode");
    1722             :   }
    1723           0 :   NonNull<mozilla::dom::Attr> arg0;
    1724           0 :   if (args[0].isObject()) {
    1725             :     {
    1726           0 :       nsresult rv = UnwrapObject<prototypes::id::Attr, mozilla::dom::Attr>(args[0], arg0);
    1727           0 :       if (NS_FAILED(rv)) {
    1728           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of Element.setAttributeNode", "Attr");
    1729           0 :         return false;
    1730             :       }
    1731             :     }
    1732             :   } else {
    1733           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of Element.setAttributeNode");
    1734           0 :     return false;
    1735             :   }
    1736           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
    1737           0 :   Maybe<AutoCEReaction> ceReaction;
    1738           0 :   if (reactionsStack) {
    1739           0 :     ceReaction.emplace(reactionsStack);
    1740             :   }
    1741           0 :   binding_detail::FastErrorResult rv;
    1742           0 :   auto result(StrongOrRawPtr<mozilla::dom::Attr>(self->SetAttributeNode(NonNullHelper(arg0), rv)));
    1743           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1744           0 :     return false;
    1745             :   }
    1746           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1747           0 :   if (!result) {
    1748           0 :     args.rval().setNull();
    1749           0 :     return true;
    1750             :   }
    1751           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    1752           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1753           0 :     return false;
    1754             :   }
    1755           0 :   return true;
    1756             : }
    1757             : 
    1758             : static const JSJitInfo setAttributeNode_methodinfo = {
    1759             :   { (JSJitGetterOp)setAttributeNode },
    1760             :   { prototypes::id::Element },
    1761             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    1762             :   JSJitInfo::Method,
    1763             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1764             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    1765             :   false,  /* isInfallible. False in setters. */
    1766             :   false,  /* isMovable.  Not relevant for setters. */
    1767             :   false, /* isEliminatable.  Not relevant for setters. */
    1768             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1769             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1770             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1771             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1772             : };
    1773             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1774             : static_assert(0 < 1, "There is no slot for us");
    1775             : 
    1776             : static bool
    1777           0 : removeAttributeNode(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1778             : {
    1779           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    1780           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.removeAttributeNode");
    1781             :   }
    1782           0 :   NonNull<mozilla::dom::Attr> arg0;
    1783           0 :   if (args[0].isObject()) {
    1784             :     {
    1785           0 :       nsresult rv = UnwrapObject<prototypes::id::Attr, mozilla::dom::Attr>(args[0], arg0);
    1786           0 :       if (NS_FAILED(rv)) {
    1787           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of Element.removeAttributeNode", "Attr");
    1788           0 :         return false;
    1789             :       }
    1790             :     }
    1791             :   } else {
    1792           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of Element.removeAttributeNode");
    1793           0 :     return false;
    1794             :   }
    1795           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
    1796           0 :   Maybe<AutoCEReaction> ceReaction;
    1797           0 :   if (reactionsStack) {
    1798           0 :     ceReaction.emplace(reactionsStack);
    1799             :   }
    1800           0 :   binding_detail::FastErrorResult rv;
    1801           0 :   auto result(StrongOrRawPtr<mozilla::dom::Attr>(self->RemoveAttributeNode(NonNullHelper(arg0), rv)));
    1802           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1803           0 :     return false;
    1804             :   }
    1805           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1806           0 :   if (!result) {
    1807           0 :     args.rval().setNull();
    1808           0 :     return true;
    1809             :   }
    1810           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    1811           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1812           0 :     return false;
    1813             :   }
    1814           0 :   return true;
    1815             : }
    1816             : 
    1817             : static const JSJitInfo removeAttributeNode_methodinfo = {
    1818             :   { (JSJitGetterOp)removeAttributeNode },
    1819             :   { prototypes::id::Element },
    1820             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    1821             :   JSJitInfo::Method,
    1822             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1823             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    1824             :   false,  /* isInfallible. False in setters. */
    1825             :   false,  /* isMovable.  Not relevant for setters. */
    1826             :   false, /* isEliminatable.  Not relevant for setters. */
    1827             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1828             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1829             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1830             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1831             : };
    1832             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1833             : static_assert(0 < 1, "There is no slot for us");
    1834             : 
    1835             : static bool
    1836           0 : getAttributeNodeNS(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1837             : {
    1838           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
    1839           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.getAttributeNodeNS");
    1840             :   }
    1841           0 :   binding_detail::FakeString arg0;
    1842           0 :   if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) {
    1843           0 :     return false;
    1844             :   }
    1845           0 :   binding_detail::FakeString arg1;
    1846           0 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
    1847           0 :     return false;
    1848             :   }
    1849           0 :   auto result(StrongOrRawPtr<mozilla::dom::Attr>(self->GetAttributeNodeNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)))));
    1850           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1851           0 :   if (!result) {
    1852           0 :     args.rval().setNull();
    1853           0 :     return true;
    1854             :   }
    1855           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    1856           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1857           0 :     return false;
    1858             :   }
    1859           0 :   return true;
    1860             : }
    1861             : 
    1862             : static const JSJitInfo getAttributeNodeNS_methodinfo = {
    1863             :   { (JSJitGetterOp)getAttributeNodeNS },
    1864             :   { prototypes::id::Element },
    1865             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    1866             :   JSJitInfo::Method,
    1867             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1868             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    1869             :   false,  /* isInfallible. False in setters. */
    1870             :   false,  /* isMovable.  Not relevant for setters. */
    1871             :   false, /* isEliminatable.  Not relevant for setters. */
    1872             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1873             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1874             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1875             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1876             : };
    1877             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1878             : static_assert(0 < 1, "There is no slot for us");
    1879             : 
    1880             : static bool
    1881           0 : setAttributeNodeNS(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1882             : {
    1883           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    1884           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.setAttributeNodeNS");
    1885             :   }
    1886           0 :   NonNull<mozilla::dom::Attr> arg0;
    1887           0 :   if (args[0].isObject()) {
    1888             :     {
    1889           0 :       nsresult rv = UnwrapObject<prototypes::id::Attr, mozilla::dom::Attr>(args[0], arg0);
    1890           0 :       if (NS_FAILED(rv)) {
    1891           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of Element.setAttributeNodeNS", "Attr");
    1892           0 :         return false;
    1893             :       }
    1894             :     }
    1895             :   } else {
    1896           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of Element.setAttributeNodeNS");
    1897           0 :     return false;
    1898             :   }
    1899           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
    1900           0 :   Maybe<AutoCEReaction> ceReaction;
    1901           0 :   if (reactionsStack) {
    1902           0 :     ceReaction.emplace(reactionsStack);
    1903             :   }
    1904           0 :   binding_detail::FastErrorResult rv;
    1905           0 :   auto result(StrongOrRawPtr<mozilla::dom::Attr>(self->SetAttributeNodeNS(NonNullHelper(arg0), rv)));
    1906           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1907           0 :     return false;
    1908             :   }
    1909           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1910           0 :   if (!result) {
    1911           0 :     args.rval().setNull();
    1912           0 :     return true;
    1913             :   }
    1914           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    1915           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1916           0 :     return false;
    1917             :   }
    1918           0 :   return true;
    1919             : }
    1920             : 
    1921             : static const JSJitInfo setAttributeNodeNS_methodinfo = {
    1922             :   { (JSJitGetterOp)setAttributeNodeNS },
    1923             :   { prototypes::id::Element },
    1924             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    1925             :   JSJitInfo::Method,
    1926             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1927             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    1928             :   false,  /* isInfallible. False in setters. */
    1929             :   false,  /* isMovable.  Not relevant for setters. */
    1930             :   false, /* isEliminatable.  Not relevant for setters. */
    1931             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1932             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1933             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1934             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1935             : };
    1936             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1937             : static_assert(0 < 1, "There is no slot for us");
    1938             : 
    1939             : static bool
    1940           0 : scrollByNoFlush(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1941             : {
    1942           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
    1943           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.scrollByNoFlush");
    1944             :   }
    1945             :   int32_t arg0;
    1946           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
    1947           0 :     return false;
    1948             :   }
    1949             :   int32_t arg1;
    1950           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
    1951           0 :     return false;
    1952             :   }
    1953           0 :   bool result(self->ScrollByNoFlush(arg0, arg1));
    1954           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1955           0 :   args.rval().setBoolean(result);
    1956           0 :   return true;
    1957             : }
    1958             : 
    1959             : static const JSJitInfo scrollByNoFlush_methodinfo = {
    1960             :   { (JSJitGetterOp)scrollByNoFlush },
    1961             :   { prototypes::id::Element },
    1962             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    1963             :   JSJitInfo::Method,
    1964             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1965             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
    1966             :   false,  /* isInfallible. False in setters. */
    1967             :   false,  /* isMovable.  Not relevant for setters. */
    1968             :   false, /* isEliminatable.  Not relevant for setters. */
    1969             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1970             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1971             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1972             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1973             : };
    1974             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1975             : static_assert(0 < 1, "There is no slot for us");
    1976             : 
    1977             : static bool
    1978           0 : getGridFragments(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    1979             : {
    1980           0 :   nsTArray<StrongPtrForMember<mozilla::dom::Grid>::Type> result;
    1981           0 :   self->GetGridFragments(result);
    1982           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1983             : 
    1984           0 :   uint32_t length = result.Length();
    1985           0 :   JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
    1986           0 :   if (!returnArray) {
    1987           0 :     return false;
    1988             :   }
    1989             :   // Scope for 'tmp'
    1990             :   {
    1991           0 :     JS::Rooted<JS::Value> tmp(cx);
    1992           0 :     for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
    1993             :       // Control block to let us common up the JS_DefineElement calls when there
    1994             :       // are different ways to succeed at wrapping the object.
    1995             :       do {
    1996           0 :         if (!GetOrCreateDOMReflector(cx, result[sequenceIdx0], &tmp)) {
    1997           0 :           MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1998           0 :           return false;
    1999             :         }
    2000           0 :         break;
    2001             :       } while (0);
    2002           0 :       if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
    2003             :                             JSPROP_ENUMERATE)) {
    2004           0 :         return false;
    2005             :       }
    2006             :     }
    2007             :   }
    2008           0 :   args.rval().setObject(*returnArray);
    2009           0 :   return true;
    2010             : }
    2011             : 
    2012             : static const JSJitInfo::ArgType getGridFragments_methodinfo_argTypes[] = { JSJitInfo::ArgTypeListEnd };
    2013             : static const JSTypedMethodJitInfo getGridFragments_methodinfo = {
    2014             :   {
    2015             :     { (JSJitGetterOp)getGridFragments },
    2016             :     { prototypes::id::Element },
    2017             :     { PrototypeTraits<prototypes::id::Element>::Depth },
    2018             :     JSJitInfo::Method,
    2019             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    2020             :     JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    2021             :     false,  /* isInfallible. False in setters. */
    2022             :     true,  /* isMovable.  Not relevant for setters. */
    2023             :     true, /* isEliminatable.  Not relevant for setters. */
    2024             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
    2025             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2026             :     true,  /* isTypedMethod.  Only relevant for methods. */
    2027             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2028             :   },
    2029             :   getGridFragments_methodinfo_argTypes
    2030             : };
    2031             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2032             : static_assert(0 < 1, "There is no slot for us");
    2033             : 
    2034             : static bool
    2035           0 : getTransformToAncestor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    2036             : {
    2037           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    2038           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.getTransformToAncestor");
    2039             :   }
    2040           0 :   NonNull<mozilla::dom::Element> arg0;
    2041           0 :   if (args[0].isObject()) {
    2042             :     {
    2043           0 :       nsresult rv = UnwrapObject<prototypes::id::Element, mozilla::dom::Element>(args[0], arg0);
    2044           0 :       if (NS_FAILED(rv)) {
    2045           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of Element.getTransformToAncestor", "Element");
    2046           0 :         return false;
    2047             :       }
    2048             :     }
    2049             :   } else {
    2050           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of Element.getTransformToAncestor");
    2051           0 :     return false;
    2052             :   }
    2053           0 :   auto result(StrongOrRawPtr<mozilla::dom::DOMMatrixReadOnly>(self->GetTransformToAncestor(NonNullHelper(arg0))));
    2054           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2055           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    2056           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    2057           0 :     return false;
    2058             :   }
    2059           0 :   return true;
    2060             : }
    2061             : 
    2062             : static const JSJitInfo getTransformToAncestor_methodinfo = {
    2063             :   { (JSJitGetterOp)getTransformToAncestor },
    2064             :   { prototypes::id::Element },
    2065             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2066             :   JSJitInfo::Method,
    2067             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2068             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    2069             :   false,  /* isInfallible. False in setters. */
    2070             :   false,  /* isMovable.  Not relevant for setters. */
    2071             :   false, /* isEliminatable.  Not relevant for setters. */
    2072             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2073             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2074             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2075             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2076             : };
    2077             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2078             : static_assert(0 < 1, "There is no slot for us");
    2079             : 
    2080             : static bool
    2081           0 : getTransformToParent(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    2082             : {
    2083           0 :   auto result(StrongOrRawPtr<mozilla::dom::DOMMatrixReadOnly>(self->GetTransformToParent()));
    2084           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2085           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    2086           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    2087           0 :     return false;
    2088             :   }
    2089           0 :   return true;
    2090             : }
    2091             : 
    2092             : static const JSJitInfo getTransformToParent_methodinfo = {
    2093             :   { (JSJitGetterOp)getTransformToParent },
    2094             :   { prototypes::id::Element },
    2095             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2096             :   JSJitInfo::Method,
    2097             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2098             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    2099             :   false,  /* isInfallible. False in setters. */
    2100             :   false,  /* isMovable.  Not relevant for setters. */
    2101             :   false, /* isEliminatable.  Not relevant for setters. */
    2102             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2103             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2104             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2105             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2106             : };
    2107             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2108             : static_assert(0 < 1, "There is no slot for us");
    2109             : 
    2110             : static bool
    2111           0 : getTransformToViewport(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    2112             : {
    2113           0 :   auto result(StrongOrRawPtr<mozilla::dom::DOMMatrixReadOnly>(self->GetTransformToViewport()));
    2114           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2115           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    2116           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    2117           0 :     return false;
    2118             :   }
    2119           0 :   return true;
    2120             : }
    2121             : 
    2122             : static const JSJitInfo getTransformToViewport_methodinfo = {
    2123             :   { (JSJitGetterOp)getTransformToViewport },
    2124             :   { prototypes::id::Element },
    2125             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2126             :   JSJitInfo::Method,
    2127             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2128             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    2129             :   false,  /* isInfallible. False in setters. */
    2130             :   false,  /* isMovable.  Not relevant for setters. */
    2131             :   false, /* isEliminatable.  Not relevant for setters. */
    2132             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2133             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2134             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2135             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2136             : };
    2137             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2138             : static_assert(0 < 1, "There is no slot for us");
    2139             : 
    2140             : static bool
    2141           0 : getClientRects(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    2142             : {
    2143           0 :   auto result(StrongOrRawPtr<mozilla::dom::DOMRectList>(self->GetClientRects()));
    2144           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2145           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    2146           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    2147           0 :     return false;
    2148             :   }
    2149           0 :   return true;
    2150             : }
    2151             : 
    2152             : static const JSJitInfo getClientRects_methodinfo = {
    2153             :   { (JSJitGetterOp)getClientRects },
    2154             :   { prototypes::id::Element },
    2155             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2156             :   JSJitInfo::Method,
    2157             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2158             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    2159             :   false,  /* isInfallible. False in setters. */
    2160             :   false,  /* isMovable.  Not relevant for setters. */
    2161             :   false, /* isEliminatable.  Not relevant for setters. */
    2162             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2163             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2164             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2165             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2166             : };
    2167             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2168             : static_assert(0 < 1, "There is no slot for us");
    2169             : 
    2170             : static bool
    2171           2 : getBoundingClientRect(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    2172             : {
    2173           4 :   auto result(StrongOrRawPtr<mozilla::dom::DOMRect>(self->GetBoundingClientRect()));
    2174           2 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2175           2 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    2176           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    2177           0 :     return false;
    2178             :   }
    2179           2 :   return true;
    2180             : }
    2181             : 
    2182             : static const JSJitInfo getBoundingClientRect_methodinfo = {
    2183             :   { (JSJitGetterOp)getBoundingClientRect },
    2184             :   { prototypes::id::Element },
    2185             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2186             :   JSJitInfo::Method,
    2187             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2188             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    2189             :   false,  /* isInfallible. False in setters. */
    2190             :   false,  /* isMovable.  Not relevant for setters. */
    2191             :   false, /* isEliminatable.  Not relevant for setters. */
    2192             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2193             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2194             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2195             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2196             : };
    2197             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2198             : static_assert(0 < 1, "There is no slot for us");
    2199             : 
    2200             : static bool
    2201           0 : scrollIntoView(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    2202             : {
    2203           0 :   unsigned argcount = std::min(args.length(), 1u);
    2204           0 :   switch (argcount) {
    2205             :     case 0: {
    2206           0 :       binding_detail::FastScrollIntoViewOptions arg0;
    2207           0 :       if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue,  "Argument 1 of Element.scrollIntoView", false)) {
    2208           0 :         return false;
    2209             :       }
    2210           0 :       self->ScrollIntoView(Constify(arg0));
    2211           0 :       MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2212           0 :       args.rval().setUndefined();
    2213           0 :       return true;
    2214             :       break;
    2215             :     }
    2216             :     case 1: {
    2217           0 :       if (args[0].isNullOrUndefined()) {
    2218           0 :         binding_detail::FastScrollIntoViewOptions arg0;
    2219           0 :         if (!arg0.Init(cx, args[0],  "Argument 1 of Element.scrollIntoView", false)) {
    2220           0 :           return false;
    2221             :         }
    2222           0 :         self->ScrollIntoView(Constify(arg0));
    2223           0 :         MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2224           0 :         args.rval().setUndefined();
    2225           0 :         return true;
    2226             :       }
    2227           0 :       if (args[0].isObject()) {
    2228             :         do {
    2229           0 :           binding_detail::FastScrollIntoViewOptions arg0;
    2230           0 :           if (!arg0.Init(cx, args[0],  "Argument 1 of Element.scrollIntoView", false)) {
    2231           0 :             return false;
    2232             :           }
    2233           0 :           self->ScrollIntoView(Constify(arg0));
    2234           0 :           MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2235           0 :           args.rval().setUndefined();
    2236           0 :           return true;
    2237             :         } while (0);
    2238             :       }
    2239             :       bool arg0;
    2240           0 :       if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
    2241           0 :         return false;
    2242             :       }
    2243           0 :       self->ScrollIntoView(arg0);
    2244           0 :       MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2245           0 :       args.rval().setUndefined();
    2246           0 :       return true;
    2247             :       break;
    2248             :     }
    2249             :     default: {
    2250           0 :       return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.scrollIntoView");
    2251             :       break;
    2252             :     }
    2253             :   }
    2254             :   MOZ_CRASH("We have an always-returning default case");
    2255             :   return false;
    2256             : }
    2257             : 
    2258             : static const JSJitInfo scrollIntoView_methodinfo = {
    2259             :   { (JSJitGetterOp)scrollIntoView },
    2260             :   { prototypes::id::Element },
    2261             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2262             :   JSJitInfo::Method,
    2263             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2264             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    2265             :   false,  /* isInfallible. False in setters. */
    2266             :   false,  /* isMovable.  Not relevant for setters. */
    2267             :   false, /* isEliminatable.  Not relevant for setters. */
    2268             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2269             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2270             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2271             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2272             : };
    2273             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2274             : static_assert(0 < 1, "There is no slot for us");
    2275             : 
    2276             : static bool
    2277           0 : get_scrollTop(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    2278             : {
    2279           0 :   int32_t result(self->ScrollTop());
    2280           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2281           0 :   args.rval().setInt32(int32_t(result));
    2282           0 :   return true;
    2283             : }
    2284             : 
    2285             : static bool
    2286           0 : set_scrollTop(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitSetterCallArgs args)
    2287             : {
    2288             :   int32_t arg0;
    2289           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
    2290           0 :     return false;
    2291             :   }
    2292           0 :   self->SetScrollTop(arg0);
    2293           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2294             : 
    2295           0 :   return true;
    2296             : }
    2297             : 
    2298             : static const JSJitInfo scrollTop_getterinfo = {
    2299             :   { (JSJitGetterOp)get_scrollTop },
    2300             :   { prototypes::id::Element },
    2301             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2302             :   JSJitInfo::Getter,
    2303             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2304             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
    2305             :   true,  /* isInfallible. False in setters. */
    2306             :   false,  /* isMovable.  Not relevant for setters. */
    2307             :   false, /* isEliminatable.  Not relevant for setters. */
    2308             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2309             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2310             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2311             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2312             : };
    2313             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2314             : static_assert(0 < 1, "There is no slot for us");
    2315             : static const JSJitInfo scrollTop_setterinfo = {
    2316             :   { (JSJitGetterOp)set_scrollTop },
    2317             :   { prototypes::id::Element },
    2318             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2319             :   JSJitInfo::Setter,
    2320             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2321             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    2322             :   false,  /* isInfallible. False in setters. */
    2323             :   false,  /* isMovable.  Not relevant for setters. */
    2324             :   false, /* isEliminatable.  Not relevant for setters. */
    2325             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2326             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2327             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2328             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2329             : };
    2330             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2331             : static_assert(0 < 1, "There is no slot for us");
    2332             : 
    2333             : static bool
    2334           0 : get_scrollLeft(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    2335             : {
    2336           0 :   int32_t result(self->ScrollLeft());
    2337           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2338           0 :   args.rval().setInt32(int32_t(result));
    2339           0 :   return true;
    2340             : }
    2341             : 
    2342             : static bool
    2343           0 : set_scrollLeft(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitSetterCallArgs args)
    2344             : {
    2345             :   int32_t arg0;
    2346           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
    2347           0 :     return false;
    2348             :   }
    2349           0 :   self->SetScrollLeft(arg0);
    2350           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2351             : 
    2352           0 :   return true;
    2353             : }
    2354             : 
    2355             : static const JSJitInfo scrollLeft_getterinfo = {
    2356             :   { (JSJitGetterOp)get_scrollLeft },
    2357             :   { prototypes::id::Element },
    2358             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2359             :   JSJitInfo::Getter,
    2360             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2361             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
    2362             :   true,  /* isInfallible. False in setters. */
    2363             :   false,  /* isMovable.  Not relevant for setters. */
    2364             :   false, /* isEliminatable.  Not relevant for setters. */
    2365             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2366             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2367             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2368             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2369             : };
    2370             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2371             : static_assert(0 < 1, "There is no slot for us");
    2372             : static const JSJitInfo scrollLeft_setterinfo = {
    2373             :   { (JSJitGetterOp)set_scrollLeft },
    2374             :   { prototypes::id::Element },
    2375             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2376             :   JSJitInfo::Setter,
    2377             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2378             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    2379             :   false,  /* isInfallible. False in setters. */
    2380             :   false,  /* isMovable.  Not relevant for setters. */
    2381             :   false, /* isEliminatable.  Not relevant for setters. */
    2382             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2383             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2384             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2385             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2386             : };
    2387             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2388             : static_assert(0 < 1, "There is no slot for us");
    2389             : 
    2390             : static bool
    2391           0 : get_scrollWidth(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    2392             : {
    2393           0 :   int32_t result(self->ScrollWidth());
    2394           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2395           0 :   args.rval().setInt32(int32_t(result));
    2396           0 :   return true;
    2397             : }
    2398             : 
    2399             : static const JSJitInfo scrollWidth_getterinfo = {
    2400             :   { (JSJitGetterOp)get_scrollWidth },
    2401             :   { prototypes::id::Element },
    2402             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2403             :   JSJitInfo::Getter,
    2404             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2405             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
    2406             :   true,  /* isInfallible. False in setters. */
    2407             :   false,  /* isMovable.  Not relevant for setters. */
    2408             :   false, /* isEliminatable.  Not relevant for setters. */
    2409             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2410             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2411             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2412             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2413             : };
    2414             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2415             : static_assert(0 < 1, "There is no slot for us");
    2416             : 
    2417             : static bool
    2418           0 : get_scrollHeight(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    2419             : {
    2420           0 :   int32_t result(self->ScrollHeight());
    2421           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2422           0 :   args.rval().setInt32(int32_t(result));
    2423           0 :   return true;
    2424             : }
    2425             : 
    2426             : static const JSJitInfo scrollHeight_getterinfo = {
    2427             :   { (JSJitGetterOp)get_scrollHeight },
    2428             :   { prototypes::id::Element },
    2429             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2430             :   JSJitInfo::Getter,
    2431             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2432             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
    2433             :   true,  /* isInfallible. False in setters. */
    2434             :   false,  /* isMovable.  Not relevant for setters. */
    2435             :   false, /* isEliminatable.  Not relevant for setters. */
    2436             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2437             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2438             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2439             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2440             : };
    2441             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2442             : static_assert(0 < 1, "There is no slot for us");
    2443             : 
    2444             : static bool
    2445           0 : scroll(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    2446             : {
    2447           0 :   unsigned argcount = std::min(args.length(), 2u);
    2448           0 :   switch (argcount) {
    2449             :     case 0: {
    2450             :       MOZ_FALLTHROUGH;
    2451             :     }
    2452             :     case 1: {
    2453           0 :       binding_detail::FastScrollToOptions arg0;
    2454           0 :       if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue,  "Argument 1 of Element.scroll", false)) {
    2455           0 :         return false;
    2456             :       }
    2457           0 :       self->Scroll(Constify(arg0));
    2458           0 :       MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2459           0 :       args.rval().setUndefined();
    2460           0 :       return true;
    2461             :       break;
    2462             :     }
    2463             :     case 2: {
    2464             :       double arg0;
    2465           0 :       if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
    2466           0 :         return false;
    2467             :       }
    2468             :       double arg1;
    2469           0 :       if (!ValueToPrimitive<double, eDefault>(cx, args[1], &arg1)) {
    2470           0 :         return false;
    2471             :       }
    2472           0 :       self->Scroll(arg0, arg1);
    2473           0 :       MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2474           0 :       args.rval().setUndefined();
    2475           0 :       return true;
    2476             :       break;
    2477             :     }
    2478             :     default: {
    2479           0 :       return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.scroll");
    2480             :       break;
    2481             :     }
    2482             :   }
    2483             :   MOZ_CRASH("We have an always-returning default case");
    2484             :   return false;
    2485             : }
    2486             : 
    2487             : static const JSJitInfo scroll_methodinfo = {
    2488             :   { (JSJitGetterOp)scroll },
    2489             :   { prototypes::id::Element },
    2490             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2491             :   JSJitInfo::Method,
    2492             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2493             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    2494             :   false,  /* isInfallible. False in setters. */
    2495             :   false,  /* isMovable.  Not relevant for setters. */
    2496             :   false, /* isEliminatable.  Not relevant for setters. */
    2497             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2498             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2499             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2500             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2501             : };
    2502             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2503             : static_assert(0 < 1, "There is no slot for us");
    2504             : 
    2505             : static bool
    2506           0 : scrollTo(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    2507             : {
    2508           0 :   unsigned argcount = std::min(args.length(), 2u);
    2509           0 :   switch (argcount) {
    2510             :     case 0: {
    2511             :       MOZ_FALLTHROUGH;
    2512             :     }
    2513             :     case 1: {
    2514           0 :       binding_detail::FastScrollToOptions arg0;
    2515           0 :       if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue,  "Argument 1 of Element.scrollTo", false)) {
    2516           0 :         return false;
    2517             :       }
    2518           0 :       self->ScrollTo(Constify(arg0));
    2519           0 :       MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2520           0 :       args.rval().setUndefined();
    2521           0 :       return true;
    2522             :       break;
    2523             :     }
    2524             :     case 2: {
    2525             :       double arg0;
    2526           0 :       if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
    2527           0 :         return false;
    2528             :       }
    2529             :       double arg1;
    2530           0 :       if (!ValueToPrimitive<double, eDefault>(cx, args[1], &arg1)) {
    2531           0 :         return false;
    2532             :       }
    2533           0 :       self->ScrollTo(arg0, arg1);
    2534           0 :       MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2535           0 :       args.rval().setUndefined();
    2536           0 :       return true;
    2537             :       break;
    2538             :     }
    2539             :     default: {
    2540           0 :       return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.scrollTo");
    2541             :       break;
    2542             :     }
    2543             :   }
    2544             :   MOZ_CRASH("We have an always-returning default case");
    2545             :   return false;
    2546             : }
    2547             : 
    2548             : static const JSJitInfo scrollTo_methodinfo = {
    2549             :   { (JSJitGetterOp)scrollTo },
    2550             :   { prototypes::id::Element },
    2551             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2552             :   JSJitInfo::Method,
    2553             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2554             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    2555             :   false,  /* isInfallible. False in setters. */
    2556             :   false,  /* isMovable.  Not relevant for setters. */
    2557             :   false, /* isEliminatable.  Not relevant for setters. */
    2558             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2559             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2560             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2561             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2562             : };
    2563             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2564             : static_assert(0 < 1, "There is no slot for us");
    2565             : 
    2566             : static bool
    2567           0 : scrollBy(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    2568             : {
    2569           0 :   unsigned argcount = std::min(args.length(), 2u);
    2570           0 :   switch (argcount) {
    2571             :     case 0: {
    2572             :       MOZ_FALLTHROUGH;
    2573             :     }
    2574             :     case 1: {
    2575           0 :       binding_detail::FastScrollToOptions arg0;
    2576           0 :       if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue,  "Argument 1 of Element.scrollBy", false)) {
    2577           0 :         return false;
    2578             :       }
    2579           0 :       self->ScrollBy(Constify(arg0));
    2580           0 :       MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2581           0 :       args.rval().setUndefined();
    2582           0 :       return true;
    2583             :       break;
    2584             :     }
    2585             :     case 2: {
    2586             :       double arg0;
    2587           0 :       if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
    2588           0 :         return false;
    2589             :       }
    2590             :       double arg1;
    2591           0 :       if (!ValueToPrimitive<double, eDefault>(cx, args[1], &arg1)) {
    2592           0 :         return false;
    2593             :       }
    2594           0 :       self->ScrollBy(arg0, arg1);
    2595           0 :       MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2596           0 :       args.rval().setUndefined();
    2597           0 :       return true;
    2598             :       break;
    2599             :     }
    2600             :     default: {
    2601           0 :       return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.scrollBy");
    2602             :       break;
    2603             :     }
    2604             :   }
    2605             :   MOZ_CRASH("We have an always-returning default case");
    2606             :   return false;
    2607             : }
    2608             : 
    2609             : static const JSJitInfo scrollBy_methodinfo = {
    2610             :   { (JSJitGetterOp)scrollBy },
    2611             :   { prototypes::id::Element },
    2612             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2613             :   JSJitInfo::Method,
    2614             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2615             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    2616             :   false,  /* isInfallible. False in setters. */
    2617             :   false,  /* isMovable.  Not relevant for setters. */
    2618             :   false, /* isEliminatable.  Not relevant for setters. */
    2619             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2620             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2621             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2622             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2623             : };
    2624             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2625             : static_assert(0 < 1, "There is no slot for us");
    2626             : 
    2627             : static bool
    2628           0 : mozScrollSnap(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    2629             : {
    2630           0 :   self->MozScrollSnap();
    2631           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2632           0 :   args.rval().setUndefined();
    2633           0 :   return true;
    2634             : }
    2635             : 
    2636             : static const JSJitInfo mozScrollSnap_methodinfo = {
    2637             :   { (JSJitGetterOp)mozScrollSnap },
    2638             :   { prototypes::id::Element },
    2639             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2640             :   JSJitInfo::Method,
    2641             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2642             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    2643             :   true,  /* isInfallible. False in setters. */
    2644             :   false,  /* isMovable.  Not relevant for setters. */
    2645             :   false, /* isEliminatable.  Not relevant for setters. */
    2646             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2647             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2648             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2649             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2650             : };
    2651             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2652             : static_assert(0 < 1, "There is no slot for us");
    2653             : 
    2654             : static bool
    2655           0 : get_clientTop(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    2656             : {
    2657           0 :   int32_t result(self->ClientTop());
    2658           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2659           0 :   args.rval().setInt32(int32_t(result));
    2660           0 :   return true;
    2661             : }
    2662             : 
    2663             : static const JSJitInfo clientTop_getterinfo = {
    2664             :   { (JSJitGetterOp)get_clientTop },
    2665             :   { prototypes::id::Element },
    2666             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2667             :   JSJitInfo::Getter,
    2668             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2669             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
    2670             :   true,  /* isInfallible. False in setters. */
    2671             :   false,  /* isMovable.  Not relevant for setters. */
    2672             :   false, /* isEliminatable.  Not relevant for setters. */
    2673             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2674             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2675             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2676             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2677             : };
    2678             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2679             : static_assert(0 < 1, "There is no slot for us");
    2680             : 
    2681             : static bool
    2682           0 : get_clientLeft(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    2683             : {
    2684           0 :   int32_t result(self->ClientLeft());
    2685           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2686           0 :   args.rval().setInt32(int32_t(result));
    2687           0 :   return true;
    2688             : }
    2689             : 
    2690             : static const JSJitInfo clientLeft_getterinfo = {
    2691             :   { (JSJitGetterOp)get_clientLeft },
    2692             :   { prototypes::id::Element },
    2693             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2694             :   JSJitInfo::Getter,
    2695             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2696             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
    2697             :   true,  /* isInfallible. False in setters. */
    2698             :   false,  /* isMovable.  Not relevant for setters. */
    2699             :   false, /* isEliminatable.  Not relevant for setters. */
    2700             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2701             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2702             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2703             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2704             : };
    2705             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2706             : static_assert(0 < 1, "There is no slot for us");
    2707             : 
    2708             : static bool
    2709           0 : get_clientWidth(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    2710             : {
    2711           0 :   int32_t result(self->ClientWidth());
    2712           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2713           0 :   args.rval().setInt32(int32_t(result));
    2714           0 :   return true;
    2715             : }
    2716             : 
    2717             : static const JSJitInfo clientWidth_getterinfo = {
    2718             :   { (JSJitGetterOp)get_clientWidth },
    2719             :   { prototypes::id::Element },
    2720             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2721             :   JSJitInfo::Getter,
    2722             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2723             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
    2724             :   true,  /* isInfallible. False in setters. */
    2725             :   false,  /* isMovable.  Not relevant for setters. */
    2726             :   false, /* isEliminatable.  Not relevant for setters. */
    2727             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2728             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2729             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2730             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2731             : };
    2732             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2733             : static_assert(0 < 1, "There is no slot for us");
    2734             : 
    2735             : static bool
    2736           0 : get_clientHeight(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    2737             : {
    2738           0 :   int32_t result(self->ClientHeight());
    2739           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2740           0 :   args.rval().setInt32(int32_t(result));
    2741           0 :   return true;
    2742             : }
    2743             : 
    2744             : static const JSJitInfo clientHeight_getterinfo = {
    2745             :   { (JSJitGetterOp)get_clientHeight },
    2746             :   { prototypes::id::Element },
    2747             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2748             :   JSJitInfo::Getter,
    2749             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2750             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
    2751             :   true,  /* isInfallible. False in setters. */
    2752             :   false,  /* isMovable.  Not relevant for setters. */
    2753             :   false, /* isEliminatable.  Not relevant for setters. */
    2754             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2755             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2756             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2757             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2758             : };
    2759             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2760             : static_assert(0 < 1, "There is no slot for us");
    2761             : 
    2762             : static bool
    2763           0 : get_scrollTopMin(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    2764             : {
    2765           0 :   int32_t result(self->ScrollTopMin());
    2766           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2767           0 :   args.rval().setInt32(int32_t(result));
    2768           0 :   return true;
    2769             : }
    2770             : 
    2771             : static const JSJitInfo scrollTopMin_getterinfo = {
    2772             :   { (JSJitGetterOp)get_scrollTopMin },
    2773             :   { prototypes::id::Element },
    2774             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2775             :   JSJitInfo::Getter,
    2776             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2777             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
    2778             :   true,  /* isInfallible. False in setters. */
    2779             :   false,  /* isMovable.  Not relevant for setters. */
    2780             :   false, /* isEliminatable.  Not relevant for setters. */
    2781             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2782             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2783             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2784             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2785             : };
    2786             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2787             : static_assert(0 < 1, "There is no slot for us");
    2788             : 
    2789             : static bool
    2790           0 : get_scrollTopMax(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    2791             : {
    2792           0 :   int32_t result(self->ScrollTopMax());
    2793           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2794           0 :   args.rval().setInt32(int32_t(result));
    2795           0 :   return true;
    2796             : }
    2797             : 
    2798             : static const JSJitInfo scrollTopMax_getterinfo = {
    2799             :   { (JSJitGetterOp)get_scrollTopMax },
    2800             :   { prototypes::id::Element },
    2801             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2802             :   JSJitInfo::Getter,
    2803             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2804             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
    2805             :   true,  /* isInfallible. False in setters. */
    2806             :   false,  /* isMovable.  Not relevant for setters. */
    2807             :   false, /* isEliminatable.  Not relevant for setters. */
    2808             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2809             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2810             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2811             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2812             : };
    2813             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2814             : static_assert(0 < 1, "There is no slot for us");
    2815             : 
    2816             : static bool
    2817           1 : get_scrollLeftMin(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    2818             : {
    2819           1 :   int32_t result(self->ScrollLeftMin());
    2820           1 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2821           1 :   args.rval().setInt32(int32_t(result));
    2822           1 :   return true;
    2823             : }
    2824             : 
    2825             : static const JSJitInfo scrollLeftMin_getterinfo = {
    2826             :   { (JSJitGetterOp)get_scrollLeftMin },
    2827             :   { prototypes::id::Element },
    2828             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2829             :   JSJitInfo::Getter,
    2830             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2831             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
    2832             :   true,  /* isInfallible. False in setters. */
    2833             :   false,  /* isMovable.  Not relevant for setters. */
    2834             :   false, /* isEliminatable.  Not relevant for setters. */
    2835             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2836             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2837             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2838             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2839             : };
    2840             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2841             : static_assert(0 < 1, "There is no slot for us");
    2842             : 
    2843             : static bool
    2844           1 : get_scrollLeftMax(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    2845             : {
    2846           1 :   int32_t result(self->ScrollLeftMax());
    2847           1 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2848           1 :   args.rval().setInt32(int32_t(result));
    2849           1 :   return true;
    2850             : }
    2851             : 
    2852             : static const JSJitInfo scrollLeftMax_getterinfo = {
    2853             :   { (JSJitGetterOp)get_scrollLeftMax },
    2854             :   { prototypes::id::Element },
    2855             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2856             :   JSJitInfo::Getter,
    2857             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2858             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
    2859             :   true,  /* isInfallible. False in setters. */
    2860             :   false,  /* isMovable.  Not relevant for setters. */
    2861             :   false, /* isEliminatable.  Not relevant for setters. */
    2862             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2863             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2864             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2865             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2866             : };
    2867             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2868             : static_assert(0 < 1, "There is no slot for us");
    2869             : 
    2870             : static bool
    2871           0 : get_innerHTML(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    2872             : {
    2873           0 :   DOMString result;
    2874           0 :   self->GetInnerHTML(result);
    2875           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2876           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
    2877           0 :     return false;
    2878             :   }
    2879           0 :   return true;
    2880             : }
    2881             : 
    2882             : static bool
    2883           0 : set_innerHTML(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitSetterCallArgs args)
    2884             : {
    2885           0 :   binding_detail::FakeString arg0;
    2886           0 :   if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) {
    2887           0 :     return false;
    2888             :   }
    2889           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
    2890           0 :   Maybe<AutoCEReaction> ceReaction;
    2891           0 :   if (reactionsStack) {
    2892           0 :     ceReaction.emplace(reactionsStack);
    2893             :   }
    2894           0 :   binding_detail::FastErrorResult rv;
    2895           0 :   self->SetInnerHTML(NonNullHelper(Constify(arg0)), rv);
    2896           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    2897           0 :     return false;
    2898             :   }
    2899           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2900             : 
    2901           0 :   return true;
    2902             : }
    2903             : 
    2904             : static const JSJitInfo innerHTML_getterinfo = {
    2905             :   { (JSJitGetterOp)get_innerHTML },
    2906             :   { prototypes::id::Element },
    2907             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2908             :   JSJitInfo::Getter,
    2909             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    2910             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
    2911             :   false,  /* isInfallible. False in setters. */
    2912             :   true,  /* isMovable.  Not relevant for setters. */
    2913             :   true, /* isEliminatable.  Not relevant for setters. */
    2914             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2915             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2916             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2917             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2918             : };
    2919             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2920             : static_assert(0 < 1, "There is no slot for us");
    2921             : static const JSJitInfo innerHTML_setterinfo = {
    2922             :   { (JSJitGetterOp)set_innerHTML },
    2923             :   { prototypes::id::Element },
    2924             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2925             :   JSJitInfo::Setter,
    2926             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2927             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    2928             :   false,  /* isInfallible. False in setters. */
    2929             :   false,  /* isMovable.  Not relevant for setters. */
    2930             :   false, /* isEliminatable.  Not relevant for setters. */
    2931             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2932             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2933             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2934             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2935             : };
    2936             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2937             : static_assert(0 < 1, "There is no slot for us");
    2938             : 
    2939             : static bool
    2940           0 : get_outerHTML(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    2941             : {
    2942           0 :   DOMString result;
    2943           0 :   self->GetOuterHTML(result);
    2944           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2945           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
    2946           0 :     return false;
    2947             :   }
    2948           0 :   return true;
    2949             : }
    2950             : 
    2951             : static bool
    2952           0 : set_outerHTML(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitSetterCallArgs args)
    2953             : {
    2954           0 :   binding_detail::FakeString arg0;
    2955           0 :   if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) {
    2956           0 :     return false;
    2957             :   }
    2958           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
    2959           0 :   Maybe<AutoCEReaction> ceReaction;
    2960           0 :   if (reactionsStack) {
    2961           0 :     ceReaction.emplace(reactionsStack);
    2962             :   }
    2963           0 :   binding_detail::FastErrorResult rv;
    2964           0 :   self->SetOuterHTML(NonNullHelper(Constify(arg0)), rv);
    2965           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    2966           0 :     return false;
    2967             :   }
    2968           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    2969             : 
    2970           0 :   return true;
    2971             : }
    2972             : 
    2973             : static const JSJitInfo outerHTML_getterinfo = {
    2974             :   { (JSJitGetterOp)get_outerHTML },
    2975             :   { prototypes::id::Element },
    2976             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2977             :   JSJitInfo::Getter,
    2978             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    2979             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
    2980             :   false,  /* isInfallible. False in setters. */
    2981             :   true,  /* isMovable.  Not relevant for setters. */
    2982             :   true, /* isEliminatable.  Not relevant for setters. */
    2983             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    2984             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    2985             :   false,  /* isTypedMethod.  Only relevant for methods. */
    2986             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    2987             : };
    2988             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    2989             : static_assert(0 < 1, "There is no slot for us");
    2990             : static const JSJitInfo outerHTML_setterinfo = {
    2991             :   { (JSJitGetterOp)set_outerHTML },
    2992             :   { prototypes::id::Element },
    2993             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    2994             :   JSJitInfo::Setter,
    2995             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    2996             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    2997             :   false,  /* isInfallible. False in setters. */
    2998             :   false,  /* isMovable.  Not relevant for setters. */
    2999             :   false, /* isEliminatable.  Not relevant for setters. */
    3000             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3001             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3002             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3003             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3004             : };
    3005             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3006             : static_assert(0 < 1, "There is no slot for us");
    3007             : 
    3008             : static bool
    3009           0 : insertAdjacentHTML(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3010             : {
    3011           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
    3012           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.insertAdjacentHTML");
    3013             :   }
    3014           0 :   binding_detail::FakeString arg0;
    3015           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
    3016           0 :     return false;
    3017             :   }
    3018           0 :   binding_detail::FakeString arg1;
    3019           0 :   if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
    3020           0 :     return false;
    3021             :   }
    3022           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
    3023           0 :   Maybe<AutoCEReaction> ceReaction;
    3024           0 :   if (reactionsStack) {
    3025           0 :     ceReaction.emplace(reactionsStack);
    3026             :   }
    3027           0 :   binding_detail::FastErrorResult rv;
    3028           0 :   self->InsertAdjacentHTML(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), rv);
    3029           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    3030           0 :     return false;
    3031             :   }
    3032           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3033           0 :   args.rval().setUndefined();
    3034           0 :   return true;
    3035             : }
    3036             : 
    3037             : static const JSJitInfo insertAdjacentHTML_methodinfo = {
    3038             :   { (JSJitGetterOp)insertAdjacentHTML },
    3039             :   { prototypes::id::Element },
    3040             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3041             :   JSJitInfo::Method,
    3042             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3043             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    3044             :   false,  /* isInfallible. False in setters. */
    3045             :   false,  /* isMovable.  Not relevant for setters. */
    3046             :   false, /* isEliminatable.  Not relevant for setters. */
    3047             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3048             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3049             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3050             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3051             : };
    3052             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3053             : static_assert(0 < 1, "There is no slot for us");
    3054             : 
    3055             : static bool
    3056           0 : querySelector(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3057             : {
    3058           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    3059           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.querySelector");
    3060             :   }
    3061           0 :   binding_detail::FakeString arg0;
    3062           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
    3063           0 :     return false;
    3064             :   }
    3065           0 :   binding_detail::FastErrorResult rv;
    3066           0 :   auto result(StrongOrRawPtr<mozilla::dom::Element>(self->QuerySelector(NonNullHelper(Constify(arg0)), rv)));
    3067           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    3068           0 :     return false;
    3069             :   }
    3070           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3071           0 :   if (!result) {
    3072           0 :     args.rval().setNull();
    3073           0 :     return true;
    3074             :   }
    3075           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    3076           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    3077           0 :     return false;
    3078             :   }
    3079           0 :   return true;
    3080             : }
    3081             : 
    3082             : static const JSJitInfo::ArgType querySelector_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd };
    3083             : static const JSTypedMethodJitInfo querySelector_methodinfo = {
    3084             :   {
    3085             :     { (JSJitGetterOp)querySelector },
    3086             :     { prototypes::id::Element },
    3087             :     { PrototypeTraits<prototypes::id::Element>::Depth },
    3088             :     JSJitInfo::Method,
    3089             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    3090             :     JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    3091             :     false,  /* isInfallible. False in setters. */
    3092             :     false,  /* isMovable.  Not relevant for setters. */
    3093             :     false, /* isEliminatable.  Not relevant for setters. */
    3094             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
    3095             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3096             :     true,  /* isTypedMethod.  Only relevant for methods. */
    3097             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3098             :   },
    3099             :   querySelector_methodinfo_argTypes
    3100             : };
    3101             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3102             : static_assert(0 < 1, "There is no slot for us");
    3103             : 
    3104             : static bool
    3105           3 : querySelectorAll(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3106             : {
    3107           3 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    3108           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.querySelectorAll");
    3109             :   }
    3110           6 :   binding_detail::FakeString arg0;
    3111           3 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
    3112           0 :     return false;
    3113             :   }
    3114           6 :   binding_detail::FastErrorResult rv;
    3115           6 :   auto result(StrongOrRawPtr<nsINodeList>(self->QuerySelectorAll(NonNullHelper(Constify(arg0)), rv)));
    3116           3 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    3117           0 :     return false;
    3118             :   }
    3119           3 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3120           3 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    3121           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    3122           0 :     return false;
    3123             :   }
    3124           3 :   return true;
    3125             : }
    3126             : 
    3127             : static const JSJitInfo::ArgType querySelectorAll_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd };
    3128             : static const JSTypedMethodJitInfo querySelectorAll_methodinfo = {
    3129             :   {
    3130             :     { (JSJitGetterOp)querySelectorAll },
    3131             :     { prototypes::id::Element },
    3132             :     { PrototypeTraits<prototypes::id::Element>::Depth },
    3133             :     JSJitInfo::Method,
    3134             :     JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    3135             :     JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    3136             :     false,  /* isInfallible. False in setters. */
    3137             :     false,  /* isMovable.  Not relevant for setters. */
    3138             :     false, /* isEliminatable.  Not relevant for setters. */
    3139             :     false, /* isAlwaysInSlot.  Only relevant for getters. */
    3140             :     false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3141             :     true,  /* isTypedMethod.  Only relevant for methods. */
    3142             :     0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3143             :   },
    3144             :   querySelectorAll_methodinfo_argTypes
    3145             : };
    3146             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3147             : static_assert(0 < 1, "There is no slot for us");
    3148             : 
    3149             : static bool
    3150           0 : createShadowRoot(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3151             : {
    3152           0 :   binding_detail::FastErrorResult rv;
    3153           0 :   auto result(StrongOrRawPtr<mozilla::dom::ShadowRoot>(self->CreateShadowRoot(rv)));
    3154           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    3155           0 :     return false;
    3156             :   }
    3157           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3158           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    3159           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    3160           0 :     return false;
    3161             :   }
    3162           0 :   return true;
    3163             : }
    3164             : 
    3165             : static const JSJitInfo createShadowRoot_methodinfo = {
    3166             :   { (JSJitGetterOp)createShadowRoot },
    3167             :   { prototypes::id::Element },
    3168             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3169             :   JSJitInfo::Method,
    3170             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3171             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    3172             :   false,  /* isInfallible. False in setters. */
    3173             :   false,  /* isMovable.  Not relevant for setters. */
    3174             :   false, /* isEliminatable.  Not relevant for setters. */
    3175             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3176             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3177             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3178             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3179             : };
    3180             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3181             : static_assert(0 < 1, "There is no slot for us");
    3182             : 
    3183             : static bool
    3184           0 : getDestinationInsertionPoints(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3185             : {
    3186           0 :   auto result(StrongOrRawPtr<nsINodeList>(self->GetDestinationInsertionPoints()));
    3187           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3188           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    3189           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    3190           0 :     return false;
    3191             :   }
    3192           0 :   return true;
    3193             : }
    3194             : 
    3195             : static const JSJitInfo getDestinationInsertionPoints_methodinfo = {
    3196             :   { (JSJitGetterOp)getDestinationInsertionPoints },
    3197             :   { prototypes::id::Element },
    3198             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3199             :   JSJitInfo::Method,
    3200             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3201             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    3202             :   false,  /* isInfallible. False in setters. */
    3203             :   false,  /* isMovable.  Not relevant for setters. */
    3204             :   false, /* isEliminatable.  Not relevant for setters. */
    3205             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3206             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3207             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3208             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3209             : };
    3210             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3211             : static_assert(0 < 1, "There is no slot for us");
    3212             : 
    3213             : static bool
    3214           0 : get_shadowRoot(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    3215             : {
    3216           0 :   auto result(StrongOrRawPtr<mozilla::dom::ShadowRoot>(self->GetShadowRoot()));
    3217           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3218           0 :   if (!result) {
    3219           0 :     args.rval().setNull();
    3220           0 :     return true;
    3221             :   }
    3222           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    3223           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    3224           0 :     return false;
    3225             :   }
    3226           0 :   return true;
    3227             : }
    3228             : 
    3229             : static const JSJitInfo shadowRoot_getterinfo = {
    3230             :   { (JSJitGetterOp)get_shadowRoot },
    3231             :   { prototypes::id::Element },
    3232             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3233             :   JSJitInfo::Getter,
    3234             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3235             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    3236             :   false,  /* isInfallible. False in setters. */
    3237             :   false,  /* isMovable.  Not relevant for setters. */
    3238             :   false, /* isEliminatable.  Not relevant for setters. */
    3239             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3240             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3241             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3242             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3243             : };
    3244             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3245             : static_assert(0 < 1, "There is no slot for us");
    3246             : 
    3247             : static bool
    3248           0 : requestFullscreen(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3249             : {
    3250           0 :   if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
    3251             :       // Return false from the JSNative in order to trigger
    3252             :       // an uncatchable exception.
    3253           0 :       MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3254           0 :       return false;
    3255             :   }
    3256           0 :   binding_detail::FastErrorResult rv;
    3257           0 :   self->RequestFullscreen(nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv);
    3258           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    3259           0 :     return false;
    3260             :   }
    3261           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3262           0 :   args.rval().setUndefined();
    3263           0 :   return true;
    3264             : }
    3265             : 
    3266             : static const JSJitInfo requestFullscreen_methodinfo = {
    3267             :   { (JSJitGetterOp)requestFullscreen },
    3268             :   { prototypes::id::Element },
    3269             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3270             :   JSJitInfo::Method,
    3271             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3272             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    3273             :   false,  /* isInfallible. False in setters. */
    3274             :   false,  /* isMovable.  Not relevant for setters. */
    3275             :   false, /* isEliminatable.  Not relevant for setters. */
    3276             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3277             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3278             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3279             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3280             : };
    3281             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3282             : static_assert(0 < 1, "There is no slot for us");
    3283             : 
    3284             : static bool
    3285           0 : mozRequestFullScreen(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3286             : {
    3287           0 :   if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
    3288             :       // Return false from the JSNative in order to trigger
    3289             :       // an uncatchable exception.
    3290           0 :       MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3291           0 :       return false;
    3292             :   }
    3293           0 :   binding_detail::FastErrorResult rv;
    3294           0 :   self->RequestFullscreen(nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv);
    3295           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    3296           0 :     return false;
    3297             :   }
    3298           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3299           0 :   args.rval().setUndefined();
    3300           0 :   return true;
    3301             : }
    3302             : 
    3303             : static const JSJitInfo mozRequestFullScreen_methodinfo = {
    3304             :   { (JSJitGetterOp)mozRequestFullScreen },
    3305             :   { prototypes::id::Element },
    3306             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3307             :   JSJitInfo::Method,
    3308             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3309             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    3310             :   false,  /* isInfallible. False in setters. */
    3311             :   false,  /* isMovable.  Not relevant for setters. */
    3312             :   false, /* isEliminatable.  Not relevant for setters. */
    3313             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3314             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3315             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3316             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3317             : };
    3318             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3319             : static_assert(0 < 1, "There is no slot for us");
    3320             : 
    3321             : static bool
    3322           0 : requestPointerLock(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3323             : {
    3324           0 :   if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
    3325             :       // Return false from the JSNative in order to trigger
    3326             :       // an uncatchable exception.
    3327           0 :       MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3328           0 :       return false;
    3329             :   }
    3330           0 :   self->RequestPointerLock(nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem);
    3331           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3332           0 :   args.rval().setUndefined();
    3333           0 :   return true;
    3334             : }
    3335             : 
    3336             : static const JSJitInfo requestPointerLock_methodinfo = {
    3337             :   { (JSJitGetterOp)requestPointerLock },
    3338             :   { prototypes::id::Element },
    3339             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3340             :   JSJitInfo::Method,
    3341             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3342             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    3343             :   true,  /* isInfallible. False in setters. */
    3344             :   false,  /* isMovable.  Not relevant for setters. */
    3345             :   false, /* isEliminatable.  Not relevant for setters. */
    3346             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3347             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3348             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3349             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3350             : };
    3351             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3352             : static_assert(0 < 1, "There is no slot for us");
    3353             : 
    3354             : static bool
    3355           0 : animate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3356             : {
    3357           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
    3358           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.animate");
    3359             :   }
    3360           0 :   JS::Rooted<JSObject*> arg0(cx);
    3361           0 :   if (args[0].isObject()) {
    3362           0 :     arg0 = &args[0].toObject();
    3363           0 :   } else if (args[0].isNullOrUndefined()) {
    3364           0 :     arg0 = nullptr;
    3365             :   } else {
    3366           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of Element.animate");
    3367           0 :     return false;
    3368             :   }
    3369           0 :   UnrestrictedDoubleOrKeyframeAnimationOptions arg1;
    3370           0 :   UnrestrictedDoubleOrKeyframeAnimationOptionsArgument arg1_holder(arg1);
    3371           0 :   if (!(args.hasDefined(1))) {
    3372           0 :     if (!arg1.RawSetAsKeyframeAnimationOptions().Init(cx, JS::NullHandleValue, "Member of UnrestrictedDoubleOrKeyframeAnimationOptions")) {
    3373           0 :       return false;
    3374             :     }
    3375             :   } else {
    3376             :     {
    3377           0 :       bool done = false, failed = false, tryNext;
    3378           0 :       if (!done) {
    3379           0 :         done = (failed = !arg1_holder.TrySetToKeyframeAnimationOptions(cx, args[1], tryNext, false)) || !tryNext;
    3380             :       }
    3381           0 :       if (!done) {
    3382             :         do {
    3383           0 :           done = (failed = !arg1_holder.TrySetToUnrestrictedDouble(cx, args[1], tryNext)) || !tryNext;
    3384           0 :           break;
    3385             :         } while (0);
    3386             :       }
    3387           0 :       if (failed) {
    3388           0 :         return false;
    3389             :       }
    3390           0 :       if (!done) {
    3391           0 :         ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of Element.animate", "KeyframeAnimationOptions");
    3392           0 :         return false;
    3393             :       }
    3394             :     }
    3395             :   }
    3396           0 :   binding_detail::FastErrorResult rv;
    3397           0 :   auto result(StrongOrRawPtr<mozilla::dom::Animation>(self->Animate(cx, arg0, Constify(arg1), rv)));
    3398           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    3399           0 :     return false;
    3400             :   }
    3401           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3402           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    3403           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    3404           0 :     return false;
    3405             :   }
    3406           0 :   return true;
    3407             : }
    3408             : 
    3409             : static const JSJitInfo animate_methodinfo = {
    3410             :   { (JSJitGetterOp)animate },
    3411             :   { prototypes::id::Element },
    3412             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3413             :   JSJitInfo::Method,
    3414             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3415             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    3416             :   false,  /* isInfallible. False in setters. */
    3417             :   false,  /* isMovable.  Not relevant for setters. */
    3418             :   false, /* isEliminatable.  Not relevant for setters. */
    3419             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3420             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3421             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3422             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3423             : };
    3424             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3425             : static_assert(0 < 1, "There is no slot for us");
    3426             : 
    3427             : static bool
    3428           0 : getAnimations(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3429             : {
    3430           0 :   binding_detail::FastAnimationFilter arg0;
    3431           0 :   if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue,  "Argument 1 of Element.getAnimations", false)) {
    3432           0 :     return false;
    3433             :   }
    3434           0 :   nsTArray<StrongPtrForMember<mozilla::dom::Animation>::Type> result;
    3435           0 :   self->GetAnimations(Constify(arg0), result);
    3436           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3437             : 
    3438           0 :   uint32_t length = result.Length();
    3439           0 :   JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
    3440           0 :   if (!returnArray) {
    3441           0 :     return false;
    3442             :   }
    3443             :   // Scope for 'tmp'
    3444             :   {
    3445           0 :     JS::Rooted<JS::Value> tmp(cx);
    3446           0 :     for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
    3447             :       // Control block to let us common up the JS_DefineElement calls when there
    3448             :       // are different ways to succeed at wrapping the object.
    3449             :       do {
    3450           0 :         if (!GetOrCreateDOMReflector(cx, result[sequenceIdx0], &tmp)) {
    3451           0 :           MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    3452           0 :           return false;
    3453             :         }
    3454           0 :         break;
    3455             :       } while (0);
    3456           0 :       if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
    3457             :                             JSPROP_ENUMERATE)) {
    3458           0 :         return false;
    3459             :       }
    3460             :     }
    3461             :   }
    3462           0 :   args.rval().setObject(*returnArray);
    3463           0 :   return true;
    3464             : }
    3465             : 
    3466             : static const JSJitInfo getAnimations_methodinfo = {
    3467             :   { (JSJitGetterOp)getAnimations },
    3468             :   { prototypes::id::Element },
    3469             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3470             :   JSJitInfo::Method,
    3471             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3472             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    3473             :   false,  /* isInfallible. False in setters. */
    3474             :   false,  /* isMovable.  Not relevant for setters. */
    3475             :   false, /* isEliminatable.  Not relevant for setters. */
    3476             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3477             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3478             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3479             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3480             : };
    3481             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3482             : static_assert(0 < 1, "There is no slot for us");
    3483             : 
    3484             : static bool
    3485           0 : before(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3486             : {
    3487           0 :   binding_detail::AutoSequence<OwningNodeOrString> arg0;
    3488           0 :   if (args.length() > 0) {
    3489           0 :     if (!arg0.SetCapacity(args.length() - 0, mozilla::fallible)) {
    3490           0 :       JS_ReportOutOfMemory(cx);
    3491           0 :       return false;
    3492             :     }
    3493           0 :     for (uint32_t variadicArg = 0; variadicArg < args.length(); ++variadicArg) {
    3494           0 :       OwningNodeOrString& slot = *arg0.AppendElement(mozilla::fallible);
    3495             :       {
    3496           0 :         bool done = false, failed = false, tryNext;
    3497           0 :         if (args[variadicArg].isObject()) {
    3498           0 :           done = (failed = !slot.TrySetToNode(cx, args[variadicArg], tryNext, false)) || !tryNext;
    3499             : 
    3500             :         }
    3501           0 :         if (!done) {
    3502             :           do {
    3503           0 :             done = (failed = !slot.TrySetToString(cx, args[variadicArg], tryNext)) || !tryNext;
    3504           0 :             break;
    3505             :           } while (0);
    3506             :         }
    3507           0 :         if (failed) {
    3508           0 :           return false;
    3509             :         }
    3510           0 :         if (!done) {
    3511           0 :           ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 1 of Element.before", "Node");
    3512           0 :           return false;
    3513             :         }
    3514             :       }
    3515             :     }
    3516             :   }
    3517           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
    3518           0 :   Maybe<AutoCEReaction> ceReaction;
    3519           0 :   if (reactionsStack) {
    3520           0 :     ceReaction.emplace(reactionsStack);
    3521             :   }
    3522           0 :   binding_detail::FastErrorResult rv;
    3523           0 :   self->Before(Constify(arg0), rv);
    3524           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    3525           0 :     return false;
    3526             :   }
    3527           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3528           0 :   args.rval().setUndefined();
    3529           0 :   return true;
    3530             : }
    3531             : 
    3532             : static const JSJitInfo before_methodinfo = {
    3533             :   { (JSJitGetterOp)before },
    3534             :   { prototypes::id::Element },
    3535             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3536             :   JSJitInfo::Method,
    3537             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3538             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    3539             :   false,  /* isInfallible. False in setters. */
    3540             :   false,  /* isMovable.  Not relevant for setters. */
    3541             :   false, /* isEliminatable.  Not relevant for setters. */
    3542             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3543             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3544             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3545             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3546             : };
    3547             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3548             : static_assert(0 < 1, "There is no slot for us");
    3549             : 
    3550             : static bool
    3551           0 : after(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3552             : {
    3553           0 :   binding_detail::AutoSequence<OwningNodeOrString> arg0;
    3554           0 :   if (args.length() > 0) {
    3555           0 :     if (!arg0.SetCapacity(args.length() - 0, mozilla::fallible)) {
    3556           0 :       JS_ReportOutOfMemory(cx);
    3557           0 :       return false;
    3558             :     }
    3559           0 :     for (uint32_t variadicArg = 0; variadicArg < args.length(); ++variadicArg) {
    3560           0 :       OwningNodeOrString& slot = *arg0.AppendElement(mozilla::fallible);
    3561             :       {
    3562           0 :         bool done = false, failed = false, tryNext;
    3563           0 :         if (args[variadicArg].isObject()) {
    3564           0 :           done = (failed = !slot.TrySetToNode(cx, args[variadicArg], tryNext, false)) || !tryNext;
    3565             : 
    3566             :         }
    3567           0 :         if (!done) {
    3568             :           do {
    3569           0 :             done = (failed = !slot.TrySetToString(cx, args[variadicArg], tryNext)) || !tryNext;
    3570           0 :             break;
    3571             :           } while (0);
    3572             :         }
    3573           0 :         if (failed) {
    3574           0 :           return false;
    3575             :         }
    3576           0 :         if (!done) {
    3577           0 :           ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 1 of Element.after", "Node");
    3578           0 :           return false;
    3579             :         }
    3580             :       }
    3581             :     }
    3582             :   }
    3583           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
    3584           0 :   Maybe<AutoCEReaction> ceReaction;
    3585           0 :   if (reactionsStack) {
    3586           0 :     ceReaction.emplace(reactionsStack);
    3587             :   }
    3588           0 :   binding_detail::FastErrorResult rv;
    3589           0 :   self->After(Constify(arg0), rv);
    3590           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    3591           0 :     return false;
    3592             :   }
    3593           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3594           0 :   args.rval().setUndefined();
    3595           0 :   return true;
    3596             : }
    3597             : 
    3598             : static const JSJitInfo after_methodinfo = {
    3599             :   { (JSJitGetterOp)after },
    3600             :   { prototypes::id::Element },
    3601             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3602             :   JSJitInfo::Method,
    3603             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3604             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    3605             :   false,  /* isInfallible. False in setters. */
    3606             :   false,  /* isMovable.  Not relevant for setters. */
    3607             :   false, /* isEliminatable.  Not relevant for setters. */
    3608             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3609             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3610             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3611             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3612             : };
    3613             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3614             : static_assert(0 < 1, "There is no slot for us");
    3615             : 
    3616             : static bool
    3617           0 : replaceWith(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3618             : {
    3619           0 :   binding_detail::AutoSequence<OwningNodeOrString> arg0;
    3620           0 :   if (args.length() > 0) {
    3621           0 :     if (!arg0.SetCapacity(args.length() - 0, mozilla::fallible)) {
    3622           0 :       JS_ReportOutOfMemory(cx);
    3623           0 :       return false;
    3624             :     }
    3625           0 :     for (uint32_t variadicArg = 0; variadicArg < args.length(); ++variadicArg) {
    3626           0 :       OwningNodeOrString& slot = *arg0.AppendElement(mozilla::fallible);
    3627             :       {
    3628           0 :         bool done = false, failed = false, tryNext;
    3629           0 :         if (args[variadicArg].isObject()) {
    3630           0 :           done = (failed = !slot.TrySetToNode(cx, args[variadicArg], tryNext, false)) || !tryNext;
    3631             : 
    3632             :         }
    3633           0 :         if (!done) {
    3634             :           do {
    3635           0 :             done = (failed = !slot.TrySetToString(cx, args[variadicArg], tryNext)) || !tryNext;
    3636           0 :             break;
    3637             :           } while (0);
    3638             :         }
    3639           0 :         if (failed) {
    3640           0 :           return false;
    3641             :         }
    3642           0 :         if (!done) {
    3643           0 :           ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 1 of Element.replaceWith", "Node");
    3644           0 :           return false;
    3645             :         }
    3646             :       }
    3647             :     }
    3648             :   }
    3649           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
    3650           0 :   Maybe<AutoCEReaction> ceReaction;
    3651           0 :   if (reactionsStack) {
    3652           0 :     ceReaction.emplace(reactionsStack);
    3653             :   }
    3654           0 :   binding_detail::FastErrorResult rv;
    3655           0 :   self->ReplaceWith(Constify(arg0), rv);
    3656           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    3657           0 :     return false;
    3658             :   }
    3659           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3660           0 :   args.rval().setUndefined();
    3661           0 :   return true;
    3662             : }
    3663             : 
    3664             : static const JSJitInfo replaceWith_methodinfo = {
    3665             :   { (JSJitGetterOp)replaceWith },
    3666             :   { prototypes::id::Element },
    3667             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3668             :   JSJitInfo::Method,
    3669             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3670             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    3671             :   false,  /* isInfallible. False in setters. */
    3672             :   false,  /* isMovable.  Not relevant for setters. */
    3673             :   false, /* isEliminatable.  Not relevant for setters. */
    3674             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3675             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3676             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3677             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3678             : };
    3679             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3680             : static_assert(0 < 1, "There is no slot for us");
    3681             : 
    3682             : static bool
    3683           0 : remove(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3684             : {
    3685           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
    3686           0 :   Maybe<AutoCEReaction> ceReaction;
    3687           0 :   if (reactionsStack) {
    3688           0 :     ceReaction.emplace(reactionsStack);
    3689             :   }
    3690           0 :   self->Remove();
    3691           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3692           0 :   args.rval().setUndefined();
    3693           0 :   return true;
    3694             : }
    3695             : 
    3696             : static const JSJitInfo remove_methodinfo = {
    3697             :   { (JSJitGetterOp)remove },
    3698             :   { prototypes::id::Element },
    3699             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3700             :   JSJitInfo::Method,
    3701             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3702             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    3703             :   true,  /* isInfallible. False in setters. */
    3704             :   false,  /* isMovable.  Not relevant for setters. */
    3705             :   false, /* isEliminatable.  Not relevant for setters. */
    3706             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3707             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3708             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3709             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3710             : };
    3711             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3712             : static_assert(0 < 1, "There is no slot for us");
    3713             : 
    3714             : static bool
    3715           0 : getBoxQuads(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3716             : {
    3717           0 :   binding_detail::FastBoxQuadOptions arg0;
    3718           0 :   if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue,  "Argument 1 of Element.getBoxQuads", false)) {
    3719           0 :     return false;
    3720             :   }
    3721           0 :   binding_detail::FastErrorResult rv;
    3722           0 :   nsTArray<StrongPtrForMember<mozilla::dom::DOMQuad>::Type> result;
    3723           0 :   self->GetBoxQuads(Constify(arg0), result, nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv);
    3724           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    3725           0 :     return false;
    3726             :   }
    3727           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3728             : 
    3729           0 :   uint32_t length = result.Length();
    3730           0 :   JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
    3731           0 :   if (!returnArray) {
    3732           0 :     return false;
    3733             :   }
    3734             :   // Scope for 'tmp'
    3735             :   {
    3736           0 :     JS::Rooted<JS::Value> tmp(cx);
    3737           0 :     for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
    3738             :       // Control block to let us common up the JS_DefineElement calls when there
    3739             :       // are different ways to succeed at wrapping the object.
    3740             :       do {
    3741           0 :         if (!GetOrCreateDOMReflector(cx, result[sequenceIdx0], &tmp)) {
    3742           0 :           MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    3743           0 :           return false;
    3744             :         }
    3745           0 :         break;
    3746             :       } while (0);
    3747           0 :       if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
    3748             :                             JSPROP_ENUMERATE)) {
    3749           0 :         return false;
    3750             :       }
    3751             :     }
    3752             :   }
    3753           0 :   args.rval().setObject(*returnArray);
    3754           0 :   return true;
    3755             : }
    3756             : 
    3757             : static const JSJitInfo getBoxQuads_methodinfo = {
    3758             :   { (JSJitGetterOp)getBoxQuads },
    3759             :   { prototypes::id::Element },
    3760             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3761             :   JSJitInfo::Method,
    3762             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3763             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    3764             :   false,  /* isInfallible. False in setters. */
    3765             :   false,  /* isMovable.  Not relevant for setters. */
    3766             :   false, /* isEliminatable.  Not relevant for setters. */
    3767             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3768             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3769             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3770             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3771             : };
    3772             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3773             : static_assert(0 < 1, "There is no slot for us");
    3774             : 
    3775             : static bool
    3776           0 : convertQuadFromNode(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3777             : {
    3778           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
    3779           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.convertQuadFromNode");
    3780             :   }
    3781           0 :   NonNull<mozilla::dom::DOMQuad> arg0;
    3782           0 :   if (args[0].isObject()) {
    3783             :     {
    3784           0 :       nsresult rv = UnwrapObject<prototypes::id::DOMQuad, mozilla::dom::DOMQuad>(args[0], arg0);
    3785           0 :       if (NS_FAILED(rv)) {
    3786           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of Element.convertQuadFromNode", "DOMQuad");
    3787           0 :         return false;
    3788             :       }
    3789             :     }
    3790             :   } else {
    3791           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of Element.convertQuadFromNode");
    3792           0 :     return false;
    3793             :   }
    3794           0 :   TextOrElementOrDocument arg1;
    3795           0 :   TextOrElementOrDocumentArgument arg1_holder(arg1);
    3796             :   {
    3797           0 :     bool done = false, failed = false, tryNext;
    3798           0 :     if (args[1].isObject()) {
    3799           0 :       done = (failed = !arg1_holder.TrySetToText(cx, args[1], tryNext, false)) || !tryNext ||
    3800           0 :              (failed = !arg1_holder.TrySetToElement(cx, args[1], tryNext, false)) || !tryNext ||
    3801           0 :              (failed = !arg1_holder.TrySetToDocument(cx, args[1], tryNext, false)) || !tryNext;
    3802             : 
    3803             :     }
    3804           0 :     if (failed) {
    3805           0 :       return false;
    3806             :     }
    3807           0 :     if (!done) {
    3808           0 :       ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of Element.convertQuadFromNode", "Text, Element, Document");
    3809           0 :       return false;
    3810             :     }
    3811             :   }
    3812           0 :   binding_detail::FastConvertCoordinateOptions arg2;
    3813           0 :   if (!arg2.Init(cx, (args.hasDefined(2)) ? args[2] : JS::NullHandleValue,  "Argument 3 of Element.convertQuadFromNode", false)) {
    3814           0 :     return false;
    3815             :   }
    3816           0 :   binding_detail::FastErrorResult rv;
    3817           0 :   auto result(StrongOrRawPtr<mozilla::dom::DOMQuad>(self->ConvertQuadFromNode(NonNullHelper(arg0), Constify(arg1), Constify(arg2), nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv)));
    3818           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    3819           0 :     return false;
    3820             :   }
    3821           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3822           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    3823           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    3824           0 :     return false;
    3825             :   }
    3826           0 :   return true;
    3827             : }
    3828             : 
    3829             : static const JSJitInfo convertQuadFromNode_methodinfo = {
    3830             :   { (JSJitGetterOp)convertQuadFromNode },
    3831             :   { prototypes::id::Element },
    3832             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3833             :   JSJitInfo::Method,
    3834             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3835             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    3836             :   false,  /* isInfallible. False in setters. */
    3837             :   false,  /* isMovable.  Not relevant for setters. */
    3838             :   false, /* isEliminatable.  Not relevant for setters. */
    3839             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3840             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3841             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3842             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3843             : };
    3844             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3845             : static_assert(0 < 1, "There is no slot for us");
    3846             : 
    3847             : static bool
    3848           0 : convertRectFromNode(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3849             : {
    3850           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
    3851           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.convertRectFromNode");
    3852             :   }
    3853           0 :   NonNull<mozilla::dom::DOMRectReadOnly> arg0;
    3854           0 :   if (args[0].isObject()) {
    3855             :     {
    3856           0 :       nsresult rv = UnwrapObject<prototypes::id::DOMRectReadOnly, mozilla::dom::DOMRectReadOnly>(args[0], arg0);
    3857           0 :       if (NS_FAILED(rv)) {
    3858           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of Element.convertRectFromNode", "DOMRectReadOnly");
    3859           0 :         return false;
    3860             :       }
    3861             :     }
    3862             :   } else {
    3863           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of Element.convertRectFromNode");
    3864           0 :     return false;
    3865             :   }
    3866           0 :   TextOrElementOrDocument arg1;
    3867           0 :   TextOrElementOrDocumentArgument arg1_holder(arg1);
    3868             :   {
    3869           0 :     bool done = false, failed = false, tryNext;
    3870           0 :     if (args[1].isObject()) {
    3871           0 :       done = (failed = !arg1_holder.TrySetToText(cx, args[1], tryNext, false)) || !tryNext ||
    3872           0 :              (failed = !arg1_holder.TrySetToElement(cx, args[1], tryNext, false)) || !tryNext ||
    3873           0 :              (failed = !arg1_holder.TrySetToDocument(cx, args[1], tryNext, false)) || !tryNext;
    3874             : 
    3875             :     }
    3876           0 :     if (failed) {
    3877           0 :       return false;
    3878             :     }
    3879           0 :     if (!done) {
    3880           0 :       ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of Element.convertRectFromNode", "Text, Element, Document");
    3881           0 :       return false;
    3882             :     }
    3883             :   }
    3884           0 :   binding_detail::FastConvertCoordinateOptions arg2;
    3885           0 :   if (!arg2.Init(cx, (args.hasDefined(2)) ? args[2] : JS::NullHandleValue,  "Argument 3 of Element.convertRectFromNode", false)) {
    3886           0 :     return false;
    3887             :   }
    3888           0 :   binding_detail::FastErrorResult rv;
    3889           0 :   auto result(StrongOrRawPtr<mozilla::dom::DOMQuad>(self->ConvertRectFromNode(NonNullHelper(arg0), Constify(arg1), Constify(arg2), nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv)));
    3890           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    3891           0 :     return false;
    3892             :   }
    3893           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3894           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    3895           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    3896           0 :     return false;
    3897             :   }
    3898           0 :   return true;
    3899             : }
    3900             : 
    3901             : static const JSJitInfo convertRectFromNode_methodinfo = {
    3902             :   { (JSJitGetterOp)convertRectFromNode },
    3903             :   { prototypes::id::Element },
    3904             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3905             :   JSJitInfo::Method,
    3906             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3907             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    3908             :   false,  /* isInfallible. False in setters. */
    3909             :   false,  /* isMovable.  Not relevant for setters. */
    3910             :   false, /* isEliminatable.  Not relevant for setters. */
    3911             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3912             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3913             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3914             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3915             : };
    3916             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3917             : static_assert(0 < 1, "There is no slot for us");
    3918             : 
    3919             : static bool
    3920           0 : convertPointFromNode(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    3921             : {
    3922           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
    3923           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "Element.convertPointFromNode");
    3924             :   }
    3925           0 :   binding_detail::FastDOMPointInit arg0;
    3926           0 :   if (!arg0.Init(cx, args[0],  "Argument 1 of Element.convertPointFromNode", false)) {
    3927           0 :     return false;
    3928             :   }
    3929           0 :   TextOrElementOrDocument arg1;
    3930           0 :   TextOrElementOrDocumentArgument arg1_holder(arg1);
    3931             :   {
    3932           0 :     bool done = false, failed = false, tryNext;
    3933           0 :     if (args[1].isObject()) {
    3934           0 :       done = (failed = !arg1_holder.TrySetToText(cx, args[1], tryNext, false)) || !tryNext ||
    3935           0 :              (failed = !arg1_holder.TrySetToElement(cx, args[1], tryNext, false)) || !tryNext ||
    3936           0 :              (failed = !arg1_holder.TrySetToDocument(cx, args[1], tryNext, false)) || !tryNext;
    3937             : 
    3938             :     }
    3939           0 :     if (failed) {
    3940           0 :       return false;
    3941             :     }
    3942           0 :     if (!done) {
    3943           0 :       ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 2 of Element.convertPointFromNode", "Text, Element, Document");
    3944           0 :       return false;
    3945             :     }
    3946             :   }
    3947           0 :   binding_detail::FastConvertCoordinateOptions arg2;
    3948           0 :   if (!arg2.Init(cx, (args.hasDefined(2)) ? args[2] : JS::NullHandleValue,  "Argument 3 of Element.convertPointFromNode", false)) {
    3949           0 :     return false;
    3950             :   }
    3951           0 :   binding_detail::FastErrorResult rv;
    3952           0 :   auto result(StrongOrRawPtr<mozilla::dom::DOMPoint>(self->ConvertPointFromNode(Constify(arg0), Constify(arg1), Constify(arg2), nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv)));
    3953           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    3954           0 :     return false;
    3955             :   }
    3956           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3957           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    3958           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    3959           0 :     return false;
    3960             :   }
    3961           0 :   return true;
    3962             : }
    3963             : 
    3964             : static const JSJitInfo convertPointFromNode_methodinfo = {
    3965             :   { (JSJitGetterOp)convertPointFromNode },
    3966             :   { prototypes::id::Element },
    3967             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    3968             :   JSJitInfo::Method,
    3969             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    3970             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    3971             :   false,  /* isInfallible. False in setters. */
    3972             :   false,  /* isMovable.  Not relevant for setters. */
    3973             :   false, /* isEliminatable.  Not relevant for setters. */
    3974             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    3975             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    3976             :   false,  /* isTypedMethod.  Only relevant for methods. */
    3977             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    3978             : };
    3979             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    3980             : static_assert(0 < 1, "There is no slot for us");
    3981             : 
    3982             : static bool
    3983           0 : get_previousElementSibling(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    3984             : {
    3985           0 :   auto result(StrongOrRawPtr<mozilla::dom::Element>(self->GetPreviousElementSibling()));
    3986           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    3987           0 :   if (!result) {
    3988           0 :     args.rval().setNull();
    3989           0 :     return true;
    3990             :   }
    3991           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    3992           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    3993           0 :     return false;
    3994             :   }
    3995           0 :   return true;
    3996             : }
    3997             : 
    3998             : static const JSJitInfo previousElementSibling_getterinfo = {
    3999             :   { (JSJitGetterOp)get_previousElementSibling },
    4000             :   { prototypes::id::Element },
    4001             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    4002             :   JSJitInfo::Getter,
    4003             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    4004             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    4005             :   false,  /* isInfallible. False in setters. */
    4006             :   true,  /* isMovable.  Not relevant for setters. */
    4007             :   true, /* isEliminatable.  Not relevant for setters. */
    4008             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    4009             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    4010             :   false,  /* isTypedMethod.  Only relevant for methods. */
    4011             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    4012             : };
    4013             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    4014             : static_assert(0 < 1, "There is no slot for us");
    4015             : 
    4016             : static bool
    4017           0 : get_nextElementSibling(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    4018             : {
    4019           0 :   auto result(StrongOrRawPtr<mozilla::dom::Element>(self->GetNextElementSibling()));
    4020           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    4021           0 :   if (!result) {
    4022           0 :     args.rval().setNull();
    4023           0 :     return true;
    4024             :   }
    4025           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    4026           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    4027           0 :     return false;
    4028             :   }
    4029           0 :   return true;
    4030             : }
    4031             : 
    4032             : static const JSJitInfo nextElementSibling_getterinfo = {
    4033             :   { (JSJitGetterOp)get_nextElementSibling },
    4034             :   { prototypes::id::Element },
    4035             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    4036             :   JSJitInfo::Getter,
    4037             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    4038             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    4039             :   false,  /* isInfallible. False in setters. */
    4040             :   true,  /* isMovable.  Not relevant for setters. */
    4041             :   true, /* isEliminatable.  Not relevant for setters. */
    4042             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    4043             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    4044             :   false,  /* isTypedMethod.  Only relevant for methods. */
    4045             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    4046             : };
    4047             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    4048             : static_assert(0 < 1, "There is no slot for us");
    4049             : 
    4050             : static bool
    4051           3 : get_children(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    4052             : {
    4053           3 :   auto result(StrongOrRawPtr<nsIHTMLCollection>(self->Children()));
    4054           3 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    4055           3 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    4056           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    4057           0 :     return false;
    4058             :   }
    4059           3 :   return true;
    4060             : }
    4061             : 
    4062             : static const JSJitInfo children_getterinfo = {
    4063             :   { (JSJitGetterOp)get_children },
    4064             :   { prototypes::id::Element },
    4065             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    4066             :   JSJitInfo::Getter,
    4067             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
    4068             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
    4069             :   false,  /* isInfallible. False in setters. */
    4070             :   true,  /* isMovable.  Not relevant for setters. */
    4071             :   true, /* isEliminatable.  Not relevant for setters. */
    4072             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    4073             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    4074             :   false,  /* isTypedMethod.  Only relevant for methods. */
    4075             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    4076             : };
    4077             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    4078             : static_assert(0 < 1, "There is no slot for us");
    4079             : 
    4080             : static bool
    4081           0 : get_firstElementChild(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    4082             : {
    4083           0 :   auto result(StrongOrRawPtr<mozilla::dom::Element>(self->GetFirstElementChild()));
    4084           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    4085           0 :   if (!result) {
    4086           0 :     args.rval().setNull();
    4087           0 :     return true;
    4088             :   }
    4089           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    4090           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    4091           0 :     return false;
    4092             :   }
    4093           0 :   return true;
    4094             : }
    4095             : 
    4096             : static const JSJitInfo firstElementChild_getterinfo = {
    4097             :   { (JSJitGetterOp)get_firstElementChild },
    4098             :   { prototypes::id::Element },
    4099             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    4100             :   JSJitInfo::Getter,
    4101             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    4102             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    4103             :   false,  /* isInfallible. False in setters. */
    4104             :   true,  /* isMovable.  Not relevant for setters. */
    4105             :   true, /* isEliminatable.  Not relevant for setters. */
    4106             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    4107             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    4108             :   false,  /* isTypedMethod.  Only relevant for methods. */
    4109             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    4110             : };
    4111             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    4112             : static_assert(0 < 1, "There is no slot for us");
    4113             : 
    4114             : static bool
    4115           0 : get_lastElementChild(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    4116             : {
    4117           0 :   auto result(StrongOrRawPtr<mozilla::dom::Element>(self->GetLastElementChild()));
    4118           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    4119           0 :   if (!result) {
    4120           0 :     args.rval().setNull();
    4121           0 :     return true;
    4122             :   }
    4123           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
    4124           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    4125           0 :     return false;
    4126             :   }
    4127           0 :   return true;
    4128             : }
    4129             : 
    4130             : static const JSJitInfo lastElementChild_getterinfo = {
    4131             :   { (JSJitGetterOp)get_lastElementChild },
    4132             :   { prototypes::id::Element },
    4133             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    4134             :   JSJitInfo::Getter,
    4135             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    4136             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    4137             :   false,  /* isInfallible. False in setters. */
    4138             :   true,  /* isMovable.  Not relevant for setters. */
    4139             :   true, /* isEliminatable.  Not relevant for setters. */
    4140             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    4141             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    4142             :   false,  /* isTypedMethod.  Only relevant for methods. */
    4143             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    4144             : };
    4145             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    4146             : static_assert(0 < 1, "There is no slot for us");
    4147             : 
    4148             : static bool
    4149           0 : get_childElementCount(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, JSJitGetterCallArgs args)
    4150             : {
    4151           0 :   uint32_t result(self->ChildElementCount());
    4152           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    4153           0 :   args.rval().setNumber(result);
    4154           0 :   return true;
    4155             : }
    4156             : 
    4157             : static const JSJitInfo childElementCount_getterinfo = {
    4158             :   { (JSJitGetterOp)get_childElementCount },
    4159             :   { prototypes::id::Element },
    4160             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    4161             :   JSJitInfo::Getter,
    4162             :   JSJitInfo::AliasDOMSets, /* aliasSet.  Not relevant for setters. */
    4163             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
    4164             :   true,  /* isInfallible. False in setters. */
    4165             :   true,  /* isMovable.  Not relevant for setters. */
    4166             :   true, /* isEliminatable.  Not relevant for setters. */
    4167             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    4168             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    4169             :   false,  /* isTypedMethod.  Only relevant for methods. */
    4170             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    4171             : };
    4172             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    4173             : static_assert(0 < 1, "There is no slot for us");
    4174             : 
    4175             : static bool
    4176           0 : prepend(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    4177             : {
    4178           0 :   binding_detail::AutoSequence<OwningNodeOrString> arg0;
    4179           0 :   if (args.length() > 0) {
    4180           0 :     if (!arg0.SetCapacity(args.length() - 0, mozilla::fallible)) {
    4181           0 :       JS_ReportOutOfMemory(cx);
    4182           0 :       return false;
    4183             :     }
    4184           0 :     for (uint32_t variadicArg = 0; variadicArg < args.length(); ++variadicArg) {
    4185           0 :       OwningNodeOrString& slot = *arg0.AppendElement(mozilla::fallible);
    4186             :       {
    4187           0 :         bool done = false, failed = false, tryNext;
    4188           0 :         if (args[variadicArg].isObject()) {
    4189           0 :           done = (failed = !slot.TrySetToNode(cx, args[variadicArg], tryNext, false)) || !tryNext;
    4190             : 
    4191             :         }
    4192           0 :         if (!done) {
    4193             :           do {
    4194           0 :             done = (failed = !slot.TrySetToString(cx, args[variadicArg], tryNext)) || !tryNext;
    4195           0 :             break;
    4196             :           } while (0);
    4197             :         }
    4198           0 :         if (failed) {
    4199           0 :           return false;
    4200             :         }
    4201           0 :         if (!done) {
    4202           0 :           ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 1 of Element.prepend", "Node");
    4203           0 :           return false;
    4204             :         }
    4205             :       }
    4206             :     }
    4207             :   }
    4208           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
    4209           0 :   Maybe<AutoCEReaction> ceReaction;
    4210           0 :   if (reactionsStack) {
    4211           0 :     ceReaction.emplace(reactionsStack);
    4212             :   }
    4213           0 :   binding_detail::FastErrorResult rv;
    4214           0 :   self->Prepend(Constify(arg0), rv);
    4215           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    4216           0 :     return false;
    4217             :   }
    4218           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    4219           0 :   args.rval().setUndefined();
    4220           0 :   return true;
    4221             : }
    4222             : 
    4223             : static const JSJitInfo prepend_methodinfo = {
    4224             :   { (JSJitGetterOp)prepend },
    4225             :   { prototypes::id::Element },
    4226             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    4227             :   JSJitInfo::Method,
    4228             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    4229             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    4230             :   false,  /* isInfallible. False in setters. */
    4231             :   false,  /* isMovable.  Not relevant for setters. */
    4232             :   false, /* isEliminatable.  Not relevant for setters. */
    4233             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    4234             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    4235             :   false,  /* isTypedMethod.  Only relevant for methods. */
    4236             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    4237             : };
    4238             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    4239             : static_assert(0 < 1, "There is no slot for us");
    4240             : 
    4241             : static bool
    4242           0 : append(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::Element* self, const JSJitMethodCallArgs& args)
    4243             : {
    4244           0 :   binding_detail::AutoSequence<OwningNodeOrString> arg0;
    4245           0 :   if (args.length() > 0) {
    4246           0 :     if (!arg0.SetCapacity(args.length() - 0, mozilla::fallible)) {
    4247           0 :       JS_ReportOutOfMemory(cx);
    4248           0 :       return false;
    4249             :     }
    4250           0 :     for (uint32_t variadicArg = 0; variadicArg < args.length(); ++variadicArg) {
    4251           0 :       OwningNodeOrString& slot = *arg0.AppendElement(mozilla::fallible);
    4252             :       {
    4253           0 :         bool done = false, failed = false, tryNext;
    4254           0 :         if (args[variadicArg].isObject()) {
    4255           0 :           done = (failed = !slot.TrySetToNode(cx, args[variadicArg], tryNext, false)) || !tryNext;
    4256             : 
    4257             :         }
    4258           0 :         if (!done) {
    4259             :           do {
    4260           0 :             done = (failed = !slot.TrySetToString(cx, args[variadicArg], tryNext)) || !tryNext;
    4261           0 :             break;
    4262             :           } while (0);
    4263             :         }
    4264           0 :         if (failed) {
    4265           0 :           return false;
    4266             :         }
    4267           0 :         if (!done) {
    4268           0 :           ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 1 of Element.append", "Node");
    4269           0 :           return false;
    4270             :         }
    4271             :       }
    4272             :     }
    4273             :   }
    4274           0 :   CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
    4275           0 :   Maybe<AutoCEReaction> ceReaction;
    4276           0 :   if (reactionsStack) {
    4277           0 :     ceReaction.emplace(reactionsStack);
    4278             :   }
    4279           0 :   binding_detail::FastErrorResult rv;
    4280           0 :   self->Append(Constify(arg0), rv);
    4281           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    4282           0 :     return false;
    4283             :   }
    4284           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    4285           0 :   args.rval().setUndefined();
    4286           0 :   return true;
    4287             : }
    4288             : 
    4289             : static const JSJitInfo append_methodinfo = {
    4290             :   { (JSJitGetterOp)append },
    4291             :   { prototypes::id::Element },
    4292             :   { PrototypeTraits<prototypes::id::Element>::Depth },
    4293             :   JSJitInfo::Method,
    4294             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    4295             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    4296             :   false,  /* isInfallible. False in setters. */
    4297             :   false,  /* isMovable.  Not relevant for setters. */
    4298             :   false, /* isEliminatable.  Not relevant for setters. */
    4299             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    4300             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    4301             :   false,  /* isTypedMethod.  Only relevant for methods. */
    4302             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    4303             : };
    4304             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    4305             : static_assert(0 < 1, "There is no slot for us");
    4306             : 
    4307             : static bool
    4308           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
    4309             : {
    4310           0 :   mozilla::dom::Element* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::Element>(obj);
    4311             :   // We don't want to preserve if we don't have a wrapper, and we
    4312             :   // obviously can't preserve if we're not initialized.
    4313           0 :   if (self && self->GetWrapperPreserveColor()) {
    4314           0 :     PreserveWrapper(self);
    4315             :   }
    4316           0 :   return true;
    4317             : }
    4318             : 
    4319             : static void
    4320           0 : _finalize(js::FreeOp* fop, JSObject* obj)
    4321             : {
    4322           0 :   mozilla::dom::Element* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::Element>(obj);
    4323           0 :   if (self) {
    4324           0 :     ClearWrapper(self, self, obj);
    4325           0 :     AddForDeferredFinalization<mozilla::dom::Element>(self);
    4326             :   }
    4327           0 : }
    4328             : 
    4329             : static void
    4330           0 : _objectMoved(JSObject* obj, const JSObject* old)
    4331             : {
    4332           0 :   mozilla::dom::Element* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::Element>(obj);
    4333           0 :   if (self) {
    4334           0 :     UpdateWrapper(self, self, obj, old);
    4335             :   }
    4336           0 : }
    4337             : 
    4338             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
    4339             : #if defined(__clang__)
    4340             : #pragma clang diagnostic push
    4341             : #pragma clang diagnostic ignored "-Wmissing-braces"
    4342             : #endif
    4343             : static const JSFunctionSpec sMethods_specs[] = {
    4344             :   JS_FNSPEC("getAttributeNames", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getAttributeNames_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4345             :   JS_FNSPEC("getAttribute", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getAttribute_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4346             :   JS_FNSPEC("getAttributeNS", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getAttributeNS_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    4347             :   JS_FNSPEC("setAttribute", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setAttribute_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    4348             :   JS_FNSPEC("setAttributeNS", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setAttributeNS_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
    4349             :   JS_FNSPEC("removeAttribute", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&removeAttribute_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4350             :   JS_FNSPEC("removeAttributeNS", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&removeAttributeNS_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    4351             :   JS_FNSPEC("hasAttribute", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&hasAttribute_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4352             :   JS_FNSPEC("hasAttributeNS", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&hasAttributeNS_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    4353             :   JS_FNSPEC("hasAttributes", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&hasAttributes_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4354             :   JS_FNSPEC("closest", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&closest_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4355             :   JS_FNSPEC("matches", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&matches_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4356             :   JS_FNSPEC("webkitMatchesSelector", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&webkitMatchesSelector_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4357             :   JS_FNSPEC("getElementsByTagName", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getElementsByTagName_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4358             :   JS_FNSPEC("getElementsByTagNameNS", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getElementsByTagNameNS_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    4359             :   JS_FNSPEC("getElementsByClassName", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getElementsByClassName_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4360             :   JS_FNSPEC("insertAdjacentElement", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&insertAdjacentElement_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    4361             :   JS_FNSPEC("insertAdjacentText", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&insertAdjacentText_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    4362             :   JS_FNSPEC("mozMatchesSelector", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&mozMatchesSelector_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4363             :   JS_FS_END,
    4364             :   JS_FNSPEC("setPointerCapture", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setPointerCapture_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4365             :   JS_FNSPEC("releasePointerCapture", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&releasePointerCapture_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4366             :   JS_FNSPEC("hasPointerCapture", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&hasPointerCapture_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4367             :   JS_FS_END,
    4368             :   JS_FNSPEC("setCapture", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setCapture_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4369             :   JS_FNSPEC("releaseCapture", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&releaseCapture_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4370             :   JS_FNSPEC("getAttributeNode", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getAttributeNode_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4371             :   JS_FNSPEC("setAttributeNode", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setAttributeNode_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4372             :   JS_FNSPEC("removeAttributeNode", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&removeAttributeNode_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4373             :   JS_FNSPEC("getAttributeNodeNS", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getAttributeNodeNS_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    4374             :   JS_FNSPEC("setAttributeNodeNS", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setAttributeNodeNS_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4375             :   JS_FNSPEC("getClientRects", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getClientRects_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4376             :   JS_FNSPEC("getBoundingClientRect", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getBoundingClientRect_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4377             :   JS_FNSPEC("scrollIntoView", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&scrollIntoView_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4378             :   JS_FNSPEC("scroll", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&scroll_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4379             :   JS_FNSPEC("scrollTo", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&scrollTo_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4380             :   JS_FNSPEC("scrollBy", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&scrollBy_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4381             :   JS_FNSPEC("insertAdjacentHTML", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&insertAdjacentHTML_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    4382             :   JS_FNSPEC("querySelector", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&querySelector_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4383             :   JS_FNSPEC("querySelectorAll", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&querySelectorAll_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4384             :   JS_FS_END,
    4385             :   JS_FNSPEC("createShadowRoot", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createShadowRoot_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4386             :   JS_FNSPEC("getDestinationInsertionPoints", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getDestinationInsertionPoints_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4387             :   JS_FS_END,
    4388             :   JS_FNSPEC("requestFullscreen", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&requestFullscreen_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4389             :   JS_FS_END,
    4390             :   JS_FNSPEC("mozRequestFullScreen", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&mozRequestFullScreen_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4391             :   JS_FNSPEC("requestPointerLock", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&requestPointerLock_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4392             :   JS_FS_END,
    4393             :   JS_FNSPEC("animate", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&animate_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4394             :   JS_FS_END,
    4395             :   JS_FNSPEC("getAnimations", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getAnimations_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4396             :   JS_FS_END,
    4397             :   JS_FNSPEC("before", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&before_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4398             :   JS_FNSPEC("after", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&after_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4399             :   JS_FNSPEC("replaceWith", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&replaceWith_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4400             :   JS_FNSPEC("remove", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&remove_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4401             :   JS_FS_END,
    4402             :   JS_FNSPEC("getBoxQuads", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getBoxQuads_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4403             :   JS_FS_END,
    4404             :   JS_FNSPEC("convertQuadFromNode", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&convertQuadFromNode_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    4405             :   JS_FNSPEC("convertRectFromNode", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&convertRectFromNode_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    4406             :   JS_FNSPEC("convertPointFromNode", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&convertPointFromNode_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    4407             :   JS_FS_END,
    4408             :   JS_FNSPEC("QueryInterface", QueryInterface, nullptr, 1, 0, nullptr),
    4409             :   JS_FS_END,
    4410             :   JS_FNSPEC("prepend", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&prepend_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4411             :   JS_FNSPEC("append", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&append_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4412             :   JS_FS_END
    4413             : };
    4414             : #if defined(__clang__)
    4415             : #pragma clang diagnostic pop
    4416             : #endif
    4417             : 
    4418             : static PrefableDisablers sMethods_disablers20 = {
    4419             :   true, false, 0, nullptr
    4420             : };
    4421             : 
    4422             : static PrefableDisablers sMethods_disablers41 = {
    4423             :   true, false, 0, &nsDocument::IsWebComponentsEnabled
    4424             : };
    4425             : 
    4426             : static PrefableDisablers sMethods_disablers44 = {
    4427             :   true, false, 0, &nsDocument::IsUnprefixedFullscreenEnabled
    4428             : };
    4429             : 
    4430             : static PrefableDisablers sMethods_disablers49 = {
    4431             :   true, false, 0, &nsDocument::IsElementAnimateEnabled
    4432             : };
    4433             : 
    4434             : static PrefableDisablers sMethods_disablers51 = {
    4435             :   true, false, 0, &nsDocument::IsWebAnimationsEnabled
    4436             : };
    4437             : 
    4438             : static PrefableDisablers sMethods_disablers58 = {
    4439             :   true, false, 0, &nsINode::HasBoxQuadsSupport
    4440             : };
    4441             : 
    4442             : static PrefableDisablers sMethods_disablers60 = {
    4443             :   true, false, 0, nullptr
    4444             : };
    4445             : 
    4446             : static PrefableDisablers sMethods_disablers64 = {
    4447             :   true, false, 0, &WantsQueryInterface<mozilla::dom::Element>::Enabled
    4448             : };
    4449             : 
    4450             : // Can't be const because the pref-enabled boolean needs to be writable
    4451             : static Prefable<const JSFunctionSpec> sMethods[] = {
    4452             :   { nullptr, &sMethods_specs[0] },
    4453             :   { &sMethods_disablers20, &sMethods_specs[20] },
    4454             :   { nullptr, &sMethods_specs[24] },
    4455             :   { &sMethods_disablers41, &sMethods_specs[41] },
    4456             :   { &sMethods_disablers44, &sMethods_specs[44] },
    4457             :   { nullptr, &sMethods_specs[46] },
    4458             :   { &sMethods_disablers49, &sMethods_specs[49] },
    4459             :   { &sMethods_disablers51, &sMethods_specs[51] },
    4460             :   { nullptr, &sMethods_specs[53] },
    4461             :   { &sMethods_disablers58, &sMethods_specs[58] },
    4462             :   { &sMethods_disablers60, &sMethods_specs[60] },
    4463             :   { &sMethods_disablers64, &sMethods_specs[64] },
    4464             :   { nullptr, &sMethods_specs[66] },
    4465             :   { nullptr, nullptr }
    4466             : };
    4467             : 
    4468             : static_assert(13 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
    4469             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
    4470             : static_assert(19 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    4471             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
    4472             : 
    4473             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
    4474             : #if defined(__clang__)
    4475             : #pragma clang diagnostic push
    4476             : #pragma clang diagnostic ignored "-Wmissing-braces"
    4477             : #endif
    4478             : static const JSFunctionSpec sChromeMethods_specs[] = {
    4479             :   JS_FNSPEC("setCaptureAlways", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setCaptureAlways_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4480             :   JS_FNSPEC("scrollByNoFlush", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&scrollByNoFlush_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
    4481             :   JS_FNSPEC("getGridFragments", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getGridFragments_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4482             :   JS_FNSPEC("getTransformToAncestor", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getTransformToAncestor_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
    4483             :   JS_FNSPEC("getTransformToParent", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getTransformToParent_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4484             :   JS_FNSPEC("getTransformToViewport", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getTransformToViewport_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4485             :   JS_FNSPEC("mozScrollSnap", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&mozScrollSnap_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    4486             :   JS_FS_END
    4487             : };
    4488             : #if defined(__clang__)
    4489             : #pragma clang diagnostic pop
    4490             : #endif
    4491             : 
    4492             : 
    4493             : // Can't be const because the pref-enabled boolean needs to be writable
    4494             : static Prefable<const JSFunctionSpec> sChromeMethods[] = {
    4495             :   { nullptr, &sChromeMethods_specs[0] },
    4496             :   { nullptr, nullptr }
    4497             : };
    4498             : 
    4499             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
    4500             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
    4501             : static_assert(7 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    4502             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
    4503             : 
    4504             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
    4505             : #if defined(__clang__)
    4506             : #pragma clang diagnostic push
    4507             : #pragma clang diagnostic ignored "-Wmissing-braces"
    4508             : #endif
    4509             : static const JSPropertySpec sAttributes_specs[] = {
    4510             :   { "namespaceURI", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &namespaceURI_getterinfo, nullptr, nullptr },
    4511             :   { "prefix", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &prefix_getterinfo, nullptr, nullptr },
    4512             :   { "localName", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &localName_getterinfo, nullptr, nullptr },
    4513             :   { "tagName", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &tagName_getterinfo, nullptr, nullptr },
    4514             :   { "id", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &id_getterinfo, GenericBindingSetter, &id_setterinfo },
    4515             :   { "className", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &className_getterinfo, GenericBindingSetter, &className_setterinfo },
    4516             :   { "classList", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &classList_getterinfo, GenericBindingSetter, &classList_setterinfo },
    4517             :   { "attributes", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &attributes_getterinfo, nullptr, nullptr },
    4518             :   { "scrollTop", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &scrollTop_getterinfo, GenericBindingSetter, &scrollTop_setterinfo },
    4519             :   { "scrollLeft", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &scrollLeft_getterinfo, GenericBindingSetter, &scrollLeft_setterinfo },
    4520             :   { "scrollWidth", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &scrollWidth_getterinfo, nullptr, nullptr },
    4521             :   { "scrollHeight", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &scrollHeight_getterinfo, nullptr, nullptr },
    4522             :   { "clientTop", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &clientTop_getterinfo, nullptr, nullptr },
    4523             :   { "clientLeft", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &clientLeft_getterinfo, nullptr, nullptr },
    4524             :   { "clientWidth", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &clientWidth_getterinfo, nullptr, nullptr },
    4525             :   { "clientHeight", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &clientHeight_getterinfo, nullptr, nullptr },
    4526             :   { "scrollTopMax", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &scrollTopMax_getterinfo, nullptr, nullptr },
    4527             :   { "scrollLeftMax", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &scrollLeftMax_getterinfo, nullptr, nullptr },
    4528             :   { "innerHTML", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &innerHTML_getterinfo, GenericBindingSetter, &innerHTML_setterinfo },
    4529             :   { "outerHTML", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &outerHTML_getterinfo, GenericBindingSetter, &outerHTML_setterinfo },
    4530             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr },
    4531             :   { "shadowRoot", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &shadowRoot_getterinfo, nullptr, nullptr },
    4532             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr },
    4533             :   { "previousElementSibling", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &previousElementSibling_getterinfo, nullptr, nullptr },
    4534             :   { "nextElementSibling", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &nextElementSibling_getterinfo, nullptr, nullptr },
    4535             :   { "children", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &children_getterinfo, nullptr, nullptr },
    4536             :   { "firstElementChild", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &firstElementChild_getterinfo, nullptr, nullptr },
    4537             :   { "lastElementChild", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &lastElementChild_getterinfo, nullptr, nullptr },
    4538             :   { "childElementCount", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &childElementCount_getterinfo, nullptr, nullptr },
    4539             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
    4540             : };
    4541             : #if defined(__clang__)
    4542             : #pragma clang diagnostic pop
    4543             : #endif
    4544             : 
    4545             : static PrefableDisablers sAttributes_disablers21 = {
    4546             :   true, false, 0, &nsDocument::IsWebComponentsEnabled
    4547             : };
    4548             : 
    4549             : // Can't be const because the pref-enabled boolean needs to be writable
    4550             : static Prefable<const JSPropertySpec> sAttributes[] = {
    4551             :   { nullptr, &sAttributes_specs[0] },
    4552             :   { &sAttributes_disablers21, &sAttributes_specs[21] },
    4553             :   { nullptr, &sAttributes_specs[23] },
    4554             :   { nullptr, nullptr }
    4555             : };
    4556             : 
    4557             : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
    4558             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
    4559             : static_assert(20 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    4560             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
    4561             : 
    4562             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
    4563             : #if defined(__clang__)
    4564             : #pragma clang diagnostic push
    4565             : #pragma clang diagnostic ignored "-Wmissing-braces"
    4566             : #endif
    4567             : static const JSPropertySpec sChromeAttributes_specs[] = {
    4568             :   { "fontSizeInflation", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &fontSizeInflation_getterinfo, nullptr, nullptr },
    4569             :   { "scrollTopMin", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &scrollTopMin_getterinfo, nullptr, nullptr },
    4570             :   { "scrollLeftMin", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &scrollLeftMin_getterinfo, nullptr, nullptr },
    4571             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
    4572             : };
    4573             : #if defined(__clang__)
    4574             : #pragma clang diagnostic pop
    4575             : #endif
    4576             : 
    4577             : 
    4578             : // Can't be const because the pref-enabled boolean needs to be writable
    4579             : static Prefable<const JSPropertySpec> sChromeAttributes[] = {
    4580             :   { nullptr, &sChromeAttributes_specs[0] },
    4581             :   { nullptr, nullptr }
    4582             : };
    4583             : 
    4584             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
    4585             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
    4586             : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    4587             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
    4588             : 
    4589             : 
    4590             : static uint16_t sNativeProperties_sortedPropertyIndices[83];
    4591             : static PropertyInfo sNativeProperties_propertyInfos[83];
    4592             : 
    4593             : static const NativePropertiesN<2> sNativeProperties = {
    4594             :   false, 0,
    4595             :   false, 0,
    4596             :   true,  0 /* sMethods */,
    4597             :   true,  1 /* sAttributes */,
    4598             :   false, 0,
    4599             :   false, 0,
    4600             :   false, 0,
    4601             :   -1,
    4602             :   83,
    4603             :   sNativeProperties_sortedPropertyIndices,
    4604             :   {
    4605             :     { sMethods, &sNativeProperties_propertyInfos[0] },
    4606             :     { sAttributes, &sNativeProperties_propertyInfos[56] }
    4607             :   }
    4608             : };
    4609             : static_assert(83 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
    4610             :     "We have a property info count that is oversized");
    4611             : 
    4612             : static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[10];
    4613             : static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[10];
    4614             : 
    4615             : static const NativePropertiesN<2> sChromeOnlyNativeProperties = {
    4616             :   false, 0,
    4617             :   false, 0,
    4618             :   true,  0 /* sChromeMethods */,
    4619             :   true,  1 /* sChromeAttributes */,
    4620             :   false, 0,
    4621             :   false, 0,
    4622             :   false, 0,
    4623             :   -1,
    4624             :   10,
    4625             :   sChromeOnlyNativeProperties_sortedPropertyIndices,
    4626             :   {
    4627             :     { sChromeMethods, &sChromeOnlyNativeProperties_propertyInfos[0] },
    4628             :     { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[7] }
    4629             :   }
    4630             : };
    4631             : static_assert(10 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount),
    4632             :     "We have a property info count that is oversized");
    4633             : 
    4634             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
    4635             :   {
    4636             :     "Function",
    4637             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
    4638             :     &sBoringInterfaceObjectClassClassOps,
    4639             :     JS_NULL_CLASS_SPEC,
    4640             :     JS_NULL_CLASS_EXT,
    4641             :     &sInterfaceObjectClassObjectOps
    4642             :   },
    4643             :   eInterface,
    4644             :   true,
    4645             :   prototypes::id::Element,
    4646             :   PrototypeTraits<prototypes::id::Element>::Depth,
    4647             :   sNativePropertyHooks,
    4648             :   "function Element() {\n    [native code]\n}",
    4649             :   NodeBinding::GetConstructorObject
    4650             : };
    4651             : 
    4652             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
    4653             :   {
    4654             :     "ElementPrototype",
    4655             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
    4656             :     JS_NULL_CLASS_OPS,
    4657             :     JS_NULL_CLASS_SPEC,
    4658             :     JS_NULL_CLASS_EXT,
    4659             :     JS_NULL_OBJECT_OPS
    4660             :   },
    4661             :   eInterfacePrototype,
    4662             :   false,
    4663             :   prototypes::id::Element,
    4664             :   PrototypeTraits<prototypes::id::Element>::Depth,
    4665             :   sNativePropertyHooks,
    4666             :   "[object ElementPrototype]",
    4667             :   NodeBinding::GetProtoObject
    4668             : };
    4669             : 
    4670             : JSObject*
    4671           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
    4672             : {
    4673           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
    4674             : }
    4675             : 
    4676             : static const js::ClassOps sClassOps = {
    4677             :   _addProperty, /* addProperty */
    4678             :   nullptr,               /* delProperty */
    4679             :   nullptr,               /* getProperty */
    4680             :   nullptr,               /* setProperty */
    4681             :   nullptr,               /* enumerate */
    4682             :   nullptr, /* newEnumerate */
    4683             :   nullptr, /* resolve */
    4684             :   nullptr, /* mayResolve */
    4685             :   _finalize, /* finalize */
    4686             :   nullptr, /* call */
    4687             :   nullptr,               /* hasInstance */
    4688             :   nullptr,               /* construct */
    4689             :   nullptr, /* trace */
    4690             : };
    4691             : 
    4692             : static const js::ClassExtension sClassExtension = {
    4693             :   nullptr, /* weakmapKeyDelegateOp */
    4694             :   _objectMoved /* objectMovedOp */
    4695             : };
    4696             : 
    4697             : static const DOMJSClass sClass = {
    4698             :   { "Element",
    4699             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
    4700             :     &sClassOps,
    4701             :     JS_NULL_CLASS_SPEC,
    4702             :     &sClassExtension,
    4703             :     JS_NULL_OBJECT_OPS
    4704             :   },
    4705             :   { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
    4706             :   IsBaseOf<nsISupports, mozilla::dom::Element >::value,
    4707             :   sNativePropertyHooks,
    4708             :   FindAssociatedGlobalForNative<mozilla::dom::Element>::Get,
    4709             :   GetProtoObjectHandle,
    4710             :   GetCCParticipant<mozilla::dom::Element>::Get()
    4711             : };
    4712             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
    4713             :               "Must have the right minimal number of reserved slots.");
    4714             : static_assert(1 >= 1,
    4715             :               "Must have enough reserved slots.");
    4716             : 
    4717             : const JSClass*
    4718           0 : GetJSClass()
    4719             : {
    4720           0 :   return sClass.ToJSClass();
    4721             : }
    4722             : 
    4723             : bool
    4724           0 : Wrap(JSContext* aCx, mozilla::dom::Element* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
    4725             : {
    4726             :   MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
    4727             :              reinterpret_cast<mozilla::dom::Element*>(aObject),
    4728             :              "Multiple inheritance for mozilla::dom::Element is broken.");
    4729             :   MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
    4730             :              reinterpret_cast<nsINode*>(aObject),
    4731             :              "Multiple inheritance for nsINode is broken.");
    4732             :   MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
    4733             :              reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
    4734             :              "Multiple inheritance for mozilla::dom::EventTarget is broken.");
    4735           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
    4736           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
    4737           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
    4738             :              "You should probably not be using Wrap() directly; use "
    4739             :              "GetOrCreateDOMReflector instead");
    4740             : 
    4741           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
    4742             :              "nsISupports must be on our primary inheritance chain");
    4743             : 
    4744           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
    4745           0 :   if (!global) {
    4746           0 :     return false;
    4747             :   }
    4748           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
    4749           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
    4750             : 
    4751             :   // That might have ended up wrapping us already, due to the wonders
    4752             :   // of XBL.  Check for that, and bail out as needed.
    4753           0 :   aReflector.set(aCache->GetWrapper());
    4754           0 :   if (aReflector) {
    4755             : #ifdef DEBUG
    4756           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
    4757             : #endif // DEBUG
    4758           0 :     return true;
    4759             :   }
    4760             : 
    4761           0 :   JSAutoCompartment ac(aCx, global);
    4762           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
    4763           0 :   if (!canonicalProto) {
    4764           0 :     return false;
    4765             :   }
    4766           0 :   JS::Rooted<JSObject*> proto(aCx);
    4767           0 :   if (aGivenProto) {
    4768           0 :     proto = aGivenProto;
    4769             :     // Unfortunately, while aGivenProto was in the compartment of aCx
    4770             :     // coming in, we changed compartments to that of "parent" so may need
    4771             :     // to wrap the proto here.
    4772           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
    4773           0 :       if (!JS_WrapObject(aCx, &proto)) {
    4774           0 :         return false;
    4775             :       }
    4776             :     }
    4777             :   } else {
    4778           0 :     proto = canonicalProto;
    4779             :   }
    4780             : 
    4781           0 :   BindingJSObjectCreator<mozilla::dom::Element> creator(aCx);
    4782           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
    4783           0 :   if (!aReflector) {
    4784           0 :     return false;
    4785             :   }
    4786             : 
    4787           0 :   aCache->SetWrapper(aReflector);
    4788           0 :   creator.InitializationSucceeded();
    4789             : 
    4790           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
    4791             :              aCache->GetWrapperPreserveColor() == aReflector);
    4792             :   // If proto != canonicalProto, we have to preserve our wrapper;
    4793             :   // otherwise we won't be able to properly recreate it later, since
    4794             :   // we won't know what proto to use.  Note that we don't check
    4795             :   // aGivenProto here, since it's entirely possible (and even
    4796             :   // somewhat common) to have a non-null aGivenProto which is the
    4797             :   // same as canonicalProto.
    4798           0 :   if (proto != canonicalProto) {
    4799           0 :     PreserveWrapper(aObject);
    4800             :   }
    4801             : 
    4802           0 :   return true;
    4803             : }
    4804             : 
    4805             : const NativePropertyHooks sNativePropertyHooks[] = { {
    4806             :   nullptr,
    4807             :   nullptr,
    4808             :   nullptr,
    4809             :   { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() },
    4810             :   prototypes::id::Element,
    4811             :   constructors::id::Element,
    4812             :   NodeBinding::sNativePropertyHooks,
    4813             :   &DefaultXrayExpandoObjectClass
    4814             : } };
    4815             : 
    4816             : static const char* const unscopableNames[] = {
    4817             :   "before",
    4818             :   "after",
    4819             :   "replaceWith",
    4820             :   "remove",
    4821             :   "prepend",
    4822             :   "append",
    4823             :   nullptr
    4824             : };
    4825             : 
    4826             : void
    4827           2 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
    4828             : {
    4829           2 :   JS::Handle<JSObject*> parentProto(NodeBinding::GetProtoObjectHandle(aCx));
    4830           2 :   if (!parentProto) {
    4831           0 :     return;
    4832             :   }
    4833             : 
    4834           2 :   JS::Handle<JSObject*> constructorProto(NodeBinding::GetConstructorObjectHandle(aCx));
    4835           2 :   if (!constructorProto) {
    4836           0 :     return;
    4837             :   }
    4838             : 
    4839             :   static bool sIdsInited = false;
    4840           2 :   if (!sIdsInited && NS_IsMainThread()) {
    4841           2 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
    4842           0 :       return;
    4843             :     }
    4844           2 :     if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) {
    4845           0 :       return;
    4846             :     }
    4847           2 :     sIdsInited = true;
    4848             :   }
    4849             : 
    4850             :   static bool sPrefCachesInited = false;
    4851           2 :   if (!sPrefCachesInited && NS_IsMainThread()) {
    4852           2 :     sPrefCachesInited = true;
    4853           2 :     Preferences::AddBoolVarCache(&sMethods[1].disablers->enabled, "dom.w3c_pointer_events.enabled");
    4854           2 :     Preferences::AddBoolVarCache(&sMethods[10].disablers->enabled, "layout.css.convertFromNode.enabled");
    4855             :   }
    4856             : 
    4857           2 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::Element);
    4858           2 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::Element);
    4859           4 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
    4860             :                               &sPrototypeClass.mBase, protoCache,
    4861             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
    4862             :                               interfaceCache,
    4863             :                               sNativeProperties.Upcast(),
    4864           2 :                               nsContentUtils::ThreadsafeIsSystemCaller(aCx) ? sChromeOnlyNativeProperties.Upcast() : nullptr,
    4865             :                               "Element", aDefineOnGlobal,
    4866             :                               unscopableNames,
    4867           2 :                               false);
    4868             : }
    4869             : 
    4870             : JS::Handle<JSObject*>
    4871           3 : GetProtoObjectHandle(JSContext* aCx)
    4872             : {
    4873             :   /* Get the interface prototype object for this class.  This will create the
    4874             :      object as needed. */
    4875           3 :   bool aDefineOnGlobal = true;
    4876             : 
    4877             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    4878           3 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    4879           3 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    4880           0 :     return nullptr;
    4881             :   }
    4882             : 
    4883             :   /* Check to see whether the interface objects are already installed */
    4884           3 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    4885           3 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::Element)) {
    4886           4 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    4887           2 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    4888             :   }
    4889             : 
    4890             :   /*
    4891             :    * The object might _still_ be null, but that's OK.
    4892             :    *
    4893             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    4894             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    4895             :    * changed after they have been set.
    4896             :    *
    4897             :    * Calling address() avoids the read read barrier that does gray
    4898             :    * unmarking, but it's not possible for the object to be gray here.
    4899             :    */
    4900             : 
    4901           3 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::Element);
    4902           3 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    4903           3 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    4904             : }
    4905             : 
    4906             : JSObject*
    4907           0 : GetProtoObject(JSContext* aCx)
    4908             : {
    4909           0 :   return GetProtoObjectHandle(aCx);
    4910             : }
    4911             : 
    4912             : JS::Handle<JSObject*>
    4913           3 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
    4914             : {
    4915             :   /* Get the interface object for this class.  This will create the object as
    4916             :      needed. */
    4917             : 
    4918             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    4919           3 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    4920           3 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    4921           0 :     return nullptr;
    4922             :   }
    4923             : 
    4924             :   /* Check to see whether the interface objects are already installed */
    4925           3 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    4926           3 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::Element)) {
    4927           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    4928           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    4929             :   }
    4930             : 
    4931             :   /*
    4932             :    * The object might _still_ be null, but that's OK.
    4933             :    *
    4934             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    4935             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    4936             :    * changed after they have been set.
    4937             :    *
    4938             :    * Calling address() avoids the read read barrier that does gray
    4939             :    * unmarking, but it's not possible for the object to be gray here.
    4940             :    */
    4941             : 
    4942           3 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::Element);
    4943           3 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    4944           3 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    4945             : }
    4946             : 
    4947             : JSObject*
    4948           0 : GetConstructorObject(JSContext* aCx)
    4949             : {
    4950           0 :   return GetConstructorObjectHandle(aCx);
    4951             : }
    4952             : 
    4953             : } // namespace ElementBinding
    4954             : 
    4955             : 
    4956             : 
    4957             : } // namespace dom
    4958             : } // namespace mozilla

Generated by: LCOV version 1.13