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

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

Generated by: LCOV version 1.13