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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM SVGImageElement.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "SVGAnimatedPreserveAspectRatio.h"
       4             : #include "SVGGraphicsElementBinding.h"
       5             : #include "SVGImageElementBinding.h"
       6             : #include "WrapperFactory.h"
       7             : #include "imgINotificationObserver.h"
       8             : #include "imgIRequest.h"
       9             : #include "mozilla/OwningNonNull.h"
      10             : #include "mozilla/dom/BindingUtils.h"
      11             : #include "mozilla/dom/DOMJSClass.h"
      12             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      13             : #include "mozilla/dom/Nullable.h"
      14             : #include "mozilla/dom/PrimitiveConversions.h"
      15             : #include "mozilla/dom/SVGAnimatedLength.h"
      16             : #include "mozilla/dom/SVGAnimatedString.h"
      17             : #include "mozilla/dom/SVGImageElement.h"
      18             : #include "mozilla/dom/XrayExpandoClass.h"
      19             : #include "nsContentUtils.h"
      20             : #include "nsIURI.h"
      21             : 
      22             : namespace mozilla {
      23             : namespace dom {
      24             : 
      25             : namespace SVGImageElementBinding {
      26             : 
      27             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGGraphicsElementBinding::NativeType>::value,
      28             :               "Can't inherit from an interface with a different ownership model.");
      29             : 
      30             : static bool
      31           0 : get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, JSJitGetterCallArgs args)
      32             : {
      33           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->X()));
      34           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      35           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      36           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      37           0 :     return false;
      38             :   }
      39           0 :   return true;
      40             : }
      41             : 
      42             : static const JSJitInfo x_getterinfo = {
      43             :   { (JSJitGetterOp)get_x },
      44             :   { prototypes::id::SVGImageElement },
      45             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
      46             :   JSJitInfo::Getter,
      47             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
      48             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
      49             :   false,  /* isInfallible. False in setters. */
      50             :   true,  /* isMovable.  Not relevant for setters. */
      51             :   true, /* isEliminatable.  Not relevant for setters. */
      52             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      53             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      54             :   false,  /* isTypedMethod.  Only relevant for methods. */
      55             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      56             : };
      57             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      58             : static_assert(0 < 1, "There is no slot for us");
      59             : 
      60             : static bool
      61           0 : get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, JSJitGetterCallArgs args)
      62             : {
      63           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Y()));
      64           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      65           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      66           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      67           0 :     return false;
      68             :   }
      69           0 :   return true;
      70             : }
      71             : 
      72             : static const JSJitInfo y_getterinfo = {
      73             :   { (JSJitGetterOp)get_y },
      74             :   { prototypes::id::SVGImageElement },
      75             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
      76             :   JSJitInfo::Getter,
      77             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
      78             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
      79             :   false,  /* isInfallible. False in setters. */
      80             :   true,  /* isMovable.  Not relevant for setters. */
      81             :   true, /* isEliminatable.  Not relevant for setters. */
      82             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      83             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      84             :   false,  /* isTypedMethod.  Only relevant for methods. */
      85             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      86             : };
      87             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      88             : static_assert(0 < 1, "There is no slot for us");
      89             : 
      90             : static bool
      91           0 : get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, JSJitGetterCallArgs args)
      92             : {
      93           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Width()));
      94           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      95           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      96           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      97           0 :     return false;
      98             :   }
      99           0 :   return true;
     100             : }
     101             : 
     102             : static const JSJitInfo width_getterinfo = {
     103             :   { (JSJitGetterOp)get_width },
     104             :   { prototypes::id::SVGImageElement },
     105             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
     106             :   JSJitInfo::Getter,
     107             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     108             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     109             :   false,  /* isInfallible. False in setters. */
     110             :   true,  /* isMovable.  Not relevant for setters. */
     111             :   true, /* isEliminatable.  Not relevant for setters. */
     112             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     113             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     114             :   false,  /* isTypedMethod.  Only relevant for methods. */
     115             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     116             : };
     117             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     118             : static_assert(0 < 1, "There is no slot for us");
     119             : 
     120             : static bool
     121           0 : get_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, JSJitGetterCallArgs args)
     122             : {
     123           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Height()));
     124           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     125           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     126           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     127           0 :     return false;
     128             :   }
     129           0 :   return true;
     130             : }
     131             : 
     132             : static const JSJitInfo height_getterinfo = {
     133             :   { (JSJitGetterOp)get_height },
     134             :   { prototypes::id::SVGImageElement },
     135             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
     136             :   JSJitInfo::Getter,
     137             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     138             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     139             :   false,  /* isInfallible. False in setters. */
     140             :   true,  /* isMovable.  Not relevant for setters. */
     141             :   true, /* isEliminatable.  Not relevant for setters. */
     142             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     143             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     144             :   false,  /* isTypedMethod.  Only relevant for methods. */
     145             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     146             : };
     147             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     148             : static_assert(0 < 1, "There is no slot for us");
     149             : 
     150             : static bool
     151           0 : get_preserveAspectRatio(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, JSJitGetterCallArgs args)
     152             : {
     153           0 :   auto result(StrongOrRawPtr<mozilla::dom::DOMSVGAnimatedPreserveAspectRatio>(self->PreserveAspectRatio()));
     154           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     155           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     156           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     157           0 :     return false;
     158             :   }
     159           0 :   return true;
     160             : }
     161             : 
     162             : static const JSJitInfo preserveAspectRatio_getterinfo = {
     163             :   { (JSJitGetterOp)get_preserveAspectRatio },
     164             :   { prototypes::id::SVGImageElement },
     165             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
     166             :   JSJitInfo::Getter,
     167             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     168             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     169             :   false,  /* isInfallible. False in setters. */
     170             :   true,  /* isMovable.  Not relevant for setters. */
     171             :   true, /* isEliminatable.  Not relevant for setters. */
     172             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     173             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     174             :   false,  /* isTypedMethod.  Only relevant for methods. */
     175             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     176             : };
     177             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     178             : static_assert(0 < 1, "There is no slot for us");
     179             : 
     180             : static bool
     181           0 : get_loadingEnabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, JSJitGetterCallArgs args)
     182             : {
     183           0 :   bool result(self->LoadingEnabled());
     184           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     185           0 :   args.rval().setBoolean(result);
     186           0 :   return true;
     187             : }
     188             : 
     189             : static bool
     190           0 : set_loadingEnabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, JSJitSetterCallArgs args)
     191             : {
     192             :   bool arg0;
     193           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
     194           0 :     return false;
     195             :   }
     196           0 :   self->SetLoadingEnabled(arg0);
     197           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     198             : 
     199           0 :   return true;
     200             : }
     201             : 
     202             : static const JSJitInfo loadingEnabled_getterinfo = {
     203             :   { (JSJitGetterOp)get_loadingEnabled },
     204             :   { prototypes::id::SVGImageElement },
     205             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
     206             :   JSJitInfo::Getter,
     207             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     208             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     209             :   true,  /* isInfallible. False in setters. */
     210             :   false,  /* isMovable.  Not relevant for setters. */
     211             :   false, /* isEliminatable.  Not relevant for setters. */
     212             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     213             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     214             :   false,  /* isTypedMethod.  Only relevant for methods. */
     215             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     216             : };
     217             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     218             : static_assert(0 < 1, "There is no slot for us");
     219             : static const JSJitInfo loadingEnabled_setterinfo = {
     220             :   { (JSJitGetterOp)set_loadingEnabled },
     221             :   { prototypes::id::SVGImageElement },
     222             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
     223             :   JSJitInfo::Setter,
     224             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     225             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     226             :   false,  /* isInfallible. False in setters. */
     227             :   false,  /* isMovable.  Not relevant for setters. */
     228             :   false, /* isEliminatable.  Not relevant for setters. */
     229             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     230             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     231             :   false,  /* isTypedMethod.  Only relevant for methods. */
     232             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     233             : };
     234             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     235             : static_assert(0 < 1, "There is no slot for us");
     236             : 
     237             : static bool
     238           0 : get_imageBlockingStatus(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, JSJitGetterCallArgs args)
     239             : {
     240           0 :   int16_t result(self->ImageBlockingStatus());
     241           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     242           0 :   args.rval().setInt32(int32_t(result));
     243           0 :   return true;
     244             : }
     245             : 
     246             : static const JSJitInfo imageBlockingStatus_getterinfo = {
     247             :   { (JSJitGetterOp)get_imageBlockingStatus },
     248             :   { prototypes::id::SVGImageElement },
     249             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
     250             :   JSJitInfo::Getter,
     251             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     252             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
     253             :   true,  /* isInfallible. False in setters. */
     254             :   false,  /* isMovable.  Not relevant for setters. */
     255             :   false, /* isEliminatable.  Not relevant for setters. */
     256             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     257             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     258             :   false,  /* isTypedMethod.  Only relevant for methods. */
     259             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     260             : };
     261             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     262             : static_assert(0 < 1, "There is no slot for us");
     263             : 
     264             : static bool
     265           0 : addObserver(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, const JSJitMethodCallArgs& args)
     266             : {
     267           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     268           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGImageElement.addObserver");
     269             :   }
     270             :   imgINotificationObserver* arg0;
     271           0 :   RefPtr<imgINotificationObserver> arg0_holder;
     272           0 :   if (args[0].isObject()) {
     273           0 :     JS::Rooted<JSObject*> source(cx, &args[0].toObject());
     274           0 :     if (NS_FAILED(UnwrapArg<imgINotificationObserver>(cx, source, getter_AddRefs(arg0_holder)))) {
     275           0 :       ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of SVGImageElement.addObserver", "imgINotificationObserver");
     276           0 :       return false;
     277             :     }
     278           0 :     MOZ_ASSERT(arg0_holder);
     279           0 :     arg0 = arg0_holder;
     280             :   } else {
     281           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of SVGImageElement.addObserver");
     282           0 :     return false;
     283             :   }
     284           0 :   self->AddObserver(NonNullHelper(arg0));
     285           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     286           0 :   args.rval().setUndefined();
     287           0 :   return true;
     288             : }
     289             : 
     290             : static const JSJitInfo addObserver_methodinfo = {
     291             :   { (JSJitGetterOp)addObserver },
     292             :   { prototypes::id::SVGImageElement },
     293             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
     294             :   JSJitInfo::Method,
     295             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     296             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     297             :   false,  /* isInfallible. False in setters. */
     298             :   false,  /* isMovable.  Not relevant for setters. */
     299             :   false, /* isEliminatable.  Not relevant for setters. */
     300             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     301             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     302             :   false,  /* isTypedMethod.  Only relevant for methods. */
     303             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     304             : };
     305             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     306             : static_assert(0 < 1, "There is no slot for us");
     307             : 
     308             : static bool
     309           0 : removeObserver(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, const JSJitMethodCallArgs& args)
     310             : {
     311           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     312           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGImageElement.removeObserver");
     313             :   }
     314             :   imgINotificationObserver* arg0;
     315           0 :   RefPtr<imgINotificationObserver> arg0_holder;
     316           0 :   if (args[0].isObject()) {
     317           0 :     JS::Rooted<JSObject*> source(cx, &args[0].toObject());
     318           0 :     if (NS_FAILED(UnwrapArg<imgINotificationObserver>(cx, source, getter_AddRefs(arg0_holder)))) {
     319           0 :       ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of SVGImageElement.removeObserver", "imgINotificationObserver");
     320           0 :       return false;
     321             :     }
     322           0 :     MOZ_ASSERT(arg0_holder);
     323           0 :     arg0 = arg0_holder;
     324             :   } else {
     325           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of SVGImageElement.removeObserver");
     326           0 :     return false;
     327             :   }
     328           0 :   self->RemoveObserver(NonNullHelper(arg0));
     329           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     330           0 :   args.rval().setUndefined();
     331           0 :   return true;
     332             : }
     333             : 
     334             : static const JSJitInfo removeObserver_methodinfo = {
     335             :   { (JSJitGetterOp)removeObserver },
     336             :   { prototypes::id::SVGImageElement },
     337             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
     338             :   JSJitInfo::Method,
     339             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     340             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     341             :   false,  /* isInfallible. False in setters. */
     342             :   false,  /* isMovable.  Not relevant for setters. */
     343             :   false, /* isEliminatable.  Not relevant for setters. */
     344             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     345             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     346             :   false,  /* isTypedMethod.  Only relevant for methods. */
     347             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     348             : };
     349             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     350             : static_assert(0 < 1, "There is no slot for us");
     351             : 
     352             : static bool
     353           0 : getRequest(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, const JSJitMethodCallArgs& args)
     354             : {
     355           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     356           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGImageElement.getRequest");
     357             :   }
     358             :   int32_t arg0;
     359           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
     360           0 :     return false;
     361             :   }
     362           0 :   binding_detail::FastErrorResult rv;
     363           0 :   auto result(StrongOrRawPtr<imgIRequest>(self->GetRequest(arg0, rv)));
     364           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     365           0 :     return false;
     366             :   }
     367           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     368           0 :   if (!result) {
     369           0 :     args.rval().setNull();
     370           0 :     return true;
     371             :   }
     372           0 :   if (!WrapObject(cx, result, &NS_GET_IID(imgIRequest), args.rval())) {
     373           0 :     return false;
     374             :   }
     375           0 :   return true;
     376             : }
     377             : 
     378             : static const JSJitInfo getRequest_methodinfo = {
     379             :   { (JSJitGetterOp)getRequest },
     380             :   { prototypes::id::SVGImageElement },
     381             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
     382             :   JSJitInfo::Method,
     383             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     384             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     385             :   false,  /* isInfallible. False in setters. */
     386             :   false,  /* isMovable.  Not relevant for setters. */
     387             :   false, /* isEliminatable.  Not relevant for setters. */
     388             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     389             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     390             :   false,  /* isTypedMethod.  Only relevant for methods. */
     391             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     392             : };
     393             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     394             : static_assert(0 < 1, "There is no slot for us");
     395             : 
     396             : static bool
     397           0 : getRequestType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, const JSJitMethodCallArgs& args)
     398             : {
     399           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     400           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGImageElement.getRequestType");
     401             :   }
     402             :   imgIRequest* arg0;
     403           0 :   RefPtr<imgIRequest> arg0_holder;
     404           0 :   if (args[0].isObject()) {
     405           0 :     JS::Rooted<JSObject*> source(cx, &args[0].toObject());
     406           0 :     if (NS_FAILED(UnwrapArg<imgIRequest>(cx, source, getter_AddRefs(arg0_holder)))) {
     407           0 :       ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of SVGImageElement.getRequestType", "imgIRequest");
     408           0 :       return false;
     409             :     }
     410           0 :     MOZ_ASSERT(arg0_holder);
     411           0 :     arg0 = arg0_holder;
     412             :   } else {
     413           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of SVGImageElement.getRequestType");
     414           0 :     return false;
     415             :   }
     416           0 :   binding_detail::FastErrorResult rv;
     417           0 :   int32_t result(self->GetRequestType(NonNullHelper(arg0), rv));
     418           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     419           0 :     return false;
     420             :   }
     421           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     422           0 :   args.rval().setInt32(int32_t(result));
     423           0 :   return true;
     424             : }
     425             : 
     426             : static const JSJitInfo getRequestType_methodinfo = {
     427             :   { (JSJitGetterOp)getRequestType },
     428             :   { prototypes::id::SVGImageElement },
     429             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
     430             :   JSJitInfo::Method,
     431             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     432             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
     433             :   false,  /* isInfallible. False in setters. */
     434             :   false,  /* isMovable.  Not relevant for setters. */
     435             :   false, /* isEliminatable.  Not relevant for setters. */
     436             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     437             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     438             :   false,  /* isTypedMethod.  Only relevant for methods. */
     439             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     440             : };
     441             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     442             : static_assert(0 < 1, "There is no slot for us");
     443             : 
     444             : static bool
     445           0 : get_currentURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, JSJitGetterCallArgs args)
     446             : {
     447           0 :   binding_detail::FastErrorResult rv;
     448           0 :   auto result(StrongOrRawPtr<nsIURI>(self->GetCurrentURI(rv)));
     449           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     450           0 :     return false;
     451             :   }
     452           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     453           0 :   if (!result) {
     454           0 :     args.rval().setNull();
     455           0 :     return true;
     456             :   }
     457           0 :   if (!WrapObject(cx, result, &NS_GET_IID(nsIURI), args.rval())) {
     458           0 :     return false;
     459             :   }
     460           0 :   return true;
     461             : }
     462             : 
     463             : static const JSJitInfo currentURI_getterinfo = {
     464             :   { (JSJitGetterOp)get_currentURI },
     465             :   { prototypes::id::SVGImageElement },
     466             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
     467             :   JSJitInfo::Getter,
     468             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     469             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     470             :   false,  /* isInfallible. False in setters. */
     471             :   false,  /* isMovable.  Not relevant for setters. */
     472             :   false, /* isEliminatable.  Not relevant for setters. */
     473             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     474             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     475             :   false,  /* isTypedMethod.  Only relevant for methods. */
     476             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     477             : };
     478             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     479             : static_assert(0 < 1, "There is no slot for us");
     480             : 
     481             : static bool
     482           0 : forceReload(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, const JSJitMethodCallArgs& args)
     483             : {
     484           0 :   Optional<bool> arg0;
     485           0 :   if (args.hasDefined(0)) {
     486           0 :     arg0.Construct();
     487           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0.Value())) {
     488           0 :       return false;
     489             :     }
     490             :   }
     491           0 :   binding_detail::FastErrorResult rv;
     492           0 :   self->ForceReload(Constify(arg0), rv);
     493           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     494           0 :     return false;
     495             :   }
     496           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     497           0 :   args.rval().setUndefined();
     498           0 :   return true;
     499             : }
     500             : 
     501             : static const JSJitInfo forceReload_methodinfo = {
     502             :   { (JSJitGetterOp)forceReload },
     503             :   { prototypes::id::SVGImageElement },
     504             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
     505             :   JSJitInfo::Method,
     506             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     507             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     508             :   false,  /* isInfallible. False in setters. */
     509             :   false,  /* isMovable.  Not relevant for setters. */
     510             :   false, /* isEliminatable.  Not relevant for setters. */
     511             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     512             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     513             :   false,  /* isTypedMethod.  Only relevant for methods. */
     514             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     515             : };
     516             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     517             : static_assert(0 < 1, "There is no slot for us");
     518             : 
     519             : static bool
     520           0 : forceImageState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, const JSJitMethodCallArgs& args)
     521             : {
     522           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     523           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGImageElement.forceImageState");
     524             :   }
     525             :   bool arg0;
     526           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
     527           0 :     return false;
     528             :   }
     529             :   uint64_t arg1;
     530           0 :   if (!ValueToPrimitive<uint64_t, eDefault>(cx, args[1], &arg1)) {
     531           0 :     return false;
     532             :   }
     533           0 :   self->ForceImageState(arg0, arg1);
     534           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     535           0 :   args.rval().setUndefined();
     536           0 :   return true;
     537             : }
     538             : 
     539             : static const JSJitInfo forceImageState_methodinfo = {
     540             :   { (JSJitGetterOp)forceImageState },
     541             :   { prototypes::id::SVGImageElement },
     542             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
     543             :   JSJitInfo::Method,
     544             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     545             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     546             :   false,  /* isInfallible. False in setters. */
     547             :   false,  /* isMovable.  Not relevant for setters. */
     548             :   false, /* isEliminatable.  Not relevant for setters. */
     549             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     550             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     551             :   false,  /* isTypedMethod.  Only relevant for methods. */
     552             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     553             : };
     554             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     555             : static_assert(0 < 1, "There is no slot for us");
     556             : 
     557             : static bool
     558           0 : get_href(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGImageElement* self, JSJitGetterCallArgs args)
     559             : {
     560           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Href()));
     561           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     562           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     563           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     564           0 :     return false;
     565             :   }
     566           0 :   return true;
     567             : }
     568             : 
     569             : static const JSJitInfo href_getterinfo = {
     570             :   { (JSJitGetterOp)get_href },
     571             :   { prototypes::id::SVGImageElement },
     572             :   { PrototypeTraits<prototypes::id::SVGImageElement>::Depth },
     573             :   JSJitInfo::Getter,
     574             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     575             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     576             :   false,  /* isInfallible. False in setters. */
     577             :   true,  /* isMovable.  Not relevant for setters. */
     578             :   true, /* isEliminatable.  Not relevant for setters. */
     579             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     580             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     581             :   false,  /* isTypedMethod.  Only relevant for methods. */
     582             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     583             : };
     584             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     585             : static_assert(0 < 1, "There is no slot for us");
     586             : 
     587             : static bool
     588           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     589             : {
     590           0 :   mozilla::dom::SVGImageElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGImageElement>(obj);
     591             :   // We don't want to preserve if we don't have a wrapper, and we
     592             :   // obviously can't preserve if we're not initialized.
     593           0 :   if (self && self->GetWrapperPreserveColor()) {
     594           0 :     PreserveWrapper(self);
     595             :   }
     596           0 :   return true;
     597             : }
     598             : 
     599             : static void
     600           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     601             : {
     602           0 :   mozilla::dom::SVGImageElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGImageElement>(obj);
     603           0 :   if (self) {
     604           0 :     ClearWrapper(self, self, obj);
     605           0 :     AddForDeferredFinalization<mozilla::dom::SVGImageElement>(self);
     606             :   }
     607           0 : }
     608             : 
     609             : static void
     610           0 : _objectMoved(JSObject* obj, const JSObject* old)
     611             : {
     612           0 :   mozilla::dom::SVGImageElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGImageElement>(obj);
     613           0 :   if (self) {
     614           0 :     UpdateWrapper(self, self, obj, old);
     615             :   }
     616           0 : }
     617             : 
     618             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     619             : #if defined(__clang__)
     620             : #pragma clang diagnostic push
     621             : #pragma clang diagnostic ignored "-Wmissing-braces"
     622             : #endif
     623             : static const JSFunctionSpec sChromeMethods_specs[] = {
     624             :   JS_FNSPEC("addObserver", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&addObserver_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     625             :   JS_FNSPEC("removeObserver", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&removeObserver_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     626             :   JS_FNSPEC("getRequest", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getRequest_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     627             :   JS_FNSPEC("getRequestType", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getRequestType_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     628             :   JS_FNSPEC("forceReload", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&forceReload_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
     629             :   JS_FNSPEC("forceImageState", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&forceImageState_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
     630             :   JS_FS_END
     631             : };
     632             : #if defined(__clang__)
     633             : #pragma clang diagnostic pop
     634             : #endif
     635             : 
     636             : 
     637             : // Can't be const because the pref-enabled boolean needs to be writable
     638             : static Prefable<const JSFunctionSpec> sChromeMethods[] = {
     639             :   { nullptr, &sChromeMethods_specs[0] },
     640             :   { nullptr, nullptr }
     641             : };
     642             : 
     643             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     644             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     645             : static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     646             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     647             : 
     648             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     649             : #if defined(__clang__)
     650             : #pragma clang diagnostic push
     651             : #pragma clang diagnostic ignored "-Wmissing-braces"
     652             : #endif
     653             : static const JSPropertySpec sAttributes_specs[] = {
     654             :   { "x", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &x_getterinfo, nullptr, nullptr },
     655             :   { "y", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &y_getterinfo, nullptr, nullptr },
     656             :   { "width", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &width_getterinfo, nullptr, nullptr },
     657             :   { "height", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &height_getterinfo, nullptr, nullptr },
     658             :   { "preserveAspectRatio", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &preserveAspectRatio_getterinfo, nullptr, nullptr },
     659             :   { "href", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &href_getterinfo, nullptr, nullptr },
     660             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     661             : };
     662             : #if defined(__clang__)
     663             : #pragma clang diagnostic pop
     664             : #endif
     665             : 
     666             : 
     667             : // Can't be const because the pref-enabled boolean needs to be writable
     668             : static Prefable<const JSPropertySpec> sAttributes[] = {
     669             :   { nullptr, &sAttributes_specs[0] },
     670             :   { nullptr, nullptr }
     671             : };
     672             : 
     673             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     674             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     675             : static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     676             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     677             : 
     678             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     679             : #if defined(__clang__)
     680             : #pragma clang diagnostic push
     681             : #pragma clang diagnostic ignored "-Wmissing-braces"
     682             : #endif
     683             : static const JSPropertySpec sChromeAttributes_specs[] = {
     684             :   { "loadingEnabled", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &loadingEnabled_getterinfo, GenericBindingSetter, &loadingEnabled_setterinfo },
     685             :   { "imageBlockingStatus", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &imageBlockingStatus_getterinfo, nullptr, nullptr },
     686             :   { "currentURI", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &currentURI_getterinfo, nullptr, nullptr },
     687             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     688             : };
     689             : #if defined(__clang__)
     690             : #pragma clang diagnostic pop
     691             : #endif
     692             : 
     693             : 
     694             : // Can't be const because the pref-enabled boolean needs to be writable
     695             : static Prefable<const JSPropertySpec> sChromeAttributes[] = {
     696             :   { nullptr, &sChromeAttributes_specs[0] },
     697             :   { nullptr, nullptr }
     698             : };
     699             : 
     700             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     701             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     702             : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     703             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     704             : 
     705             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     706             : #if defined(__clang__)
     707             : #pragma clang diagnostic push
     708             : #pragma clang diagnostic ignored "-Wmissing-braces"
     709             : #endif
     710             : static const ConstantSpec sChromeConstants_specs[] = {
     711             :   { "UNKNOWN_REQUEST", JS::Int32Value(-1) },
     712             :   { "CURRENT_REQUEST", JS::Int32Value(0) },
     713             :   { "PENDING_REQUEST", JS::Int32Value(1) },
     714             :   { 0, JS::UndefinedValue() }
     715             : };
     716             : #if defined(__clang__)
     717             : #pragma clang diagnostic pop
     718             : #endif
     719             : 
     720             : 
     721             : // Can't be const because the pref-enabled boolean needs to be writable
     722             : static Prefable<const ConstantSpec> sChromeConstants[] = {
     723             :   { nullptr, &sChromeConstants_specs[0] },
     724             :   { nullptr, nullptr }
     725             : };
     726             : 
     727             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     728             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     729             : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     730             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     731             : 
     732             : 
     733             : static uint16_t sNativeProperties_sortedPropertyIndices[6];
     734             : static PropertyInfo sNativeProperties_propertyInfos[6];
     735             : 
     736             : static const NativePropertiesN<1> sNativeProperties = {
     737             :   false, 0,
     738             :   false, 0,
     739             :   false, 0,
     740             :   true,  0 /* sAttributes */,
     741             :   false, 0,
     742             :   false, 0,
     743             :   false, 0,
     744             :   -1,
     745             :   6,
     746             :   sNativeProperties_sortedPropertyIndices,
     747             :   {
     748             :     { sAttributes, &sNativeProperties_propertyInfos[0] }
     749             :   }
     750             : };
     751             : static_assert(6 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     752             :     "We have a property info count that is oversized");
     753             : 
     754             : static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[12];
     755             : static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[12];
     756             : 
     757             : static const NativePropertiesN<3> sChromeOnlyNativeProperties = {
     758             :   false, 0,
     759             :   false, 0,
     760             :   true,  0 /* sChromeMethods */,
     761             :   true,  1 /* sChromeAttributes */,
     762             :   false, 0,
     763             :   false, 0,
     764             :   true,  2 /* sChromeConstants */,
     765             :   -1,
     766             :   12,
     767             :   sChromeOnlyNativeProperties_sortedPropertyIndices,
     768             :   {
     769             :     { sChromeMethods, &sChromeOnlyNativeProperties_propertyInfos[0] },
     770             :     { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[6] },
     771             :     { sChromeConstants, &sChromeOnlyNativeProperties_propertyInfos[9] }
     772             :   }
     773             : };
     774             : static_assert(12 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount),
     775             :     "We have a property info count that is oversized");
     776             : 
     777             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     778             :   {
     779             :     "Function",
     780             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     781             :     &sBoringInterfaceObjectClassClassOps,
     782             :     JS_NULL_CLASS_SPEC,
     783             :     JS_NULL_CLASS_EXT,
     784             :     &sInterfaceObjectClassObjectOps
     785             :   },
     786             :   eInterface,
     787             :   true,
     788             :   prototypes::id::SVGImageElement,
     789             :   PrototypeTraits<prototypes::id::SVGImageElement>::Depth,
     790             :   sNativePropertyHooks,
     791             :   "function SVGImageElement() {\n    [native code]\n}",
     792             :   SVGGraphicsElementBinding::GetConstructorObject
     793             : };
     794             : 
     795             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     796             :   {
     797             :     "SVGImageElementPrototype",
     798             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     799             :     JS_NULL_CLASS_OPS,
     800             :     JS_NULL_CLASS_SPEC,
     801             :     JS_NULL_CLASS_EXT,
     802             :     JS_NULL_OBJECT_OPS
     803             :   },
     804             :   eInterfacePrototype,
     805             :   false,
     806             :   prototypes::id::SVGImageElement,
     807             :   PrototypeTraits<prototypes::id::SVGImageElement>::Depth,
     808             :   sNativePropertyHooks,
     809             :   "[object SVGImageElementPrototype]",
     810             :   SVGGraphicsElementBinding::GetProtoObject
     811             : };
     812             : 
     813             : JSObject*
     814           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     815             : {
     816           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     817             : }
     818             : 
     819             : static const js::ClassOps sClassOps = {
     820             :   _addProperty, /* addProperty */
     821             :   nullptr,               /* delProperty */
     822             :   nullptr,               /* getProperty */
     823             :   nullptr,               /* setProperty */
     824             :   nullptr,               /* enumerate */
     825             :   nullptr, /* newEnumerate */
     826             :   nullptr, /* resolve */
     827             :   nullptr, /* mayResolve */
     828             :   _finalize, /* finalize */
     829             :   nullptr, /* call */
     830             :   nullptr,               /* hasInstance */
     831             :   nullptr,               /* construct */
     832             :   nullptr, /* trace */
     833             : };
     834             : 
     835             : static const js::ClassExtension sClassExtension = {
     836             :   nullptr, /* weakmapKeyDelegateOp */
     837             :   _objectMoved /* objectMovedOp */
     838             : };
     839             : 
     840             : static const DOMJSClass sClass = {
     841             :   { "SVGImageElement",
     842             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
     843             :     &sClassOps,
     844             :     JS_NULL_CLASS_SPEC,
     845             :     &sClassExtension,
     846             :     JS_NULL_OBJECT_OPS
     847             :   },
     848             :   { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGGraphicsElement, prototypes::id::SVGImageElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
     849             :   IsBaseOf<nsISupports, mozilla::dom::SVGImageElement >::value,
     850             :   sNativePropertyHooks,
     851             :   FindAssociatedGlobalForNative<mozilla::dom::SVGImageElement>::Get,
     852             :   GetProtoObjectHandle,
     853             :   GetCCParticipant<mozilla::dom::SVGImageElement>::Get()
     854             : };
     855             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     856             :               "Must have the right minimal number of reserved slots.");
     857             : static_assert(1 >= 1,
     858             :               "Must have enough reserved slots.");
     859             : 
     860             : const JSClass*
     861           0 : GetJSClass()
     862             : {
     863           0 :   return sClass.ToJSClass();
     864             : }
     865             : 
     866             : bool
     867           0 : Wrap(JSContext* aCx, mozilla::dom::SVGImageElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     868             : {
     869             :   MOZ_ASSERT(static_cast<mozilla::dom::SVGImageElement*>(aObject) ==
     870             :              reinterpret_cast<mozilla::dom::SVGImageElement*>(aObject),
     871             :              "Multiple inheritance for mozilla::dom::SVGImageElement is broken.");
     872             :   MOZ_ASSERT(static_cast<mozilla::dom::SVGGraphicsElement*>(aObject) ==
     873             :              reinterpret_cast<mozilla::dom::SVGGraphicsElement*>(aObject),
     874             :              "Multiple inheritance for mozilla::dom::SVGGraphicsElement is broken.");
     875             :   MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
     876             :              reinterpret_cast<nsSVGElement*>(aObject),
     877             :              "Multiple inheritance for nsSVGElement is broken.");
     878             :   MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
     879             :              reinterpret_cast<mozilla::dom::Element*>(aObject),
     880             :              "Multiple inheritance for mozilla::dom::Element is broken.");
     881             :   MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
     882             :              reinterpret_cast<nsINode*>(aObject),
     883             :              "Multiple inheritance for nsINode is broken.");
     884             :   MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
     885             :              reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
     886             :              "Multiple inheritance for mozilla::dom::EventTarget is broken.");
     887           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     888           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     889           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     890             :              "You should probably not be using Wrap() directly; use "
     891             :              "GetOrCreateDOMReflector instead");
     892             : 
     893           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     894             :              "nsISupports must be on our primary inheritance chain");
     895             : 
     896           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     897           0 :   if (!global) {
     898           0 :     return false;
     899             :   }
     900           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     901           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     902             : 
     903             :   // That might have ended up wrapping us already, due to the wonders
     904             :   // of XBL.  Check for that, and bail out as needed.
     905           0 :   aReflector.set(aCache->GetWrapper());
     906           0 :   if (aReflector) {
     907             : #ifdef DEBUG
     908           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     909             : #endif // DEBUG
     910           0 :     return true;
     911             :   }
     912             : 
     913           0 :   JSAutoCompartment ac(aCx, global);
     914           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     915           0 :   if (!canonicalProto) {
     916           0 :     return false;
     917             :   }
     918           0 :   JS::Rooted<JSObject*> proto(aCx);
     919           0 :   if (aGivenProto) {
     920           0 :     proto = aGivenProto;
     921             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     922             :     // coming in, we changed compartments to that of "parent" so may need
     923             :     // to wrap the proto here.
     924           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     925           0 :       if (!JS_WrapObject(aCx, &proto)) {
     926           0 :         return false;
     927             :       }
     928             :     }
     929             :   } else {
     930           0 :     proto = canonicalProto;
     931             :   }
     932             : 
     933           0 :   BindingJSObjectCreator<mozilla::dom::SVGImageElement> creator(aCx);
     934           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     935           0 :   if (!aReflector) {
     936           0 :     return false;
     937             :   }
     938             : 
     939           0 :   aCache->SetWrapper(aReflector);
     940           0 :   creator.InitializationSucceeded();
     941             : 
     942           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     943             :              aCache->GetWrapperPreserveColor() == aReflector);
     944             :   // If proto != canonicalProto, we have to preserve our wrapper;
     945             :   // otherwise we won't be able to properly recreate it later, since
     946             :   // we won't know what proto to use.  Note that we don't check
     947             :   // aGivenProto here, since it's entirely possible (and even
     948             :   // somewhat common) to have a non-null aGivenProto which is the
     949             :   // same as canonicalProto.
     950           0 :   if (proto != canonicalProto) {
     951           0 :     PreserveWrapper(aObject);
     952             :   }
     953             : 
     954           0 :   return true;
     955             : }
     956             : 
     957             : const NativePropertyHooks sNativePropertyHooks[] = { {
     958             :   nullptr,
     959             :   nullptr,
     960             :   nullptr,
     961             :   { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() },
     962             :   prototypes::id::SVGImageElement,
     963             :   constructors::id::SVGImageElement,
     964             :   SVGGraphicsElementBinding::sNativePropertyHooks,
     965             :   &DefaultXrayExpandoObjectClass
     966             : } };
     967             : 
     968             : void
     969           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     970             : {
     971           0 :   JS::Handle<JSObject*> parentProto(SVGGraphicsElementBinding::GetProtoObjectHandle(aCx));
     972           0 :   if (!parentProto) {
     973           0 :     return;
     974             :   }
     975             : 
     976           0 :   JS::Handle<JSObject*> constructorProto(SVGGraphicsElementBinding::GetConstructorObjectHandle(aCx));
     977           0 :   if (!constructorProto) {
     978           0 :     return;
     979             :   }
     980             : 
     981             :   static bool sIdsInited = false;
     982           0 :   if (!sIdsInited && NS_IsMainThread()) {
     983           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     984           0 :       return;
     985             :     }
     986           0 :     if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) {
     987           0 :       return;
     988             :     }
     989           0 :     sIdsInited = true;
     990             :   }
     991             : 
     992           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGImageElement);
     993           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGImageElement);
     994           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     995             :                               &sPrototypeClass.mBase, protoCache,
     996             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     997             :                               interfaceCache,
     998             :                               sNativeProperties.Upcast(),
     999           0 :                               nsContentUtils::ThreadsafeIsSystemCaller(aCx) ? sChromeOnlyNativeProperties.Upcast() : nullptr,
    1000             :                               "SVGImageElement", aDefineOnGlobal,
    1001             :                               nullptr,
    1002           0 :                               false);
    1003             : }
    1004             : 
    1005             : JS::Handle<JSObject*>
    1006           0 : GetProtoObjectHandle(JSContext* aCx)
    1007             : {
    1008             :   /* Get the interface prototype object for this class.  This will create the
    1009             :      object as needed. */
    1010           0 :   bool aDefineOnGlobal = true;
    1011             : 
    1012             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    1013           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    1014           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    1015           0 :     return nullptr;
    1016             :   }
    1017             : 
    1018             :   /* Check to see whether the interface objects are already installed */
    1019           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    1020           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGImageElement)) {
    1021           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    1022           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    1023             :   }
    1024             : 
    1025             :   /*
    1026             :    * The object might _still_ be null, but that's OK.
    1027             :    *
    1028             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    1029             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    1030             :    * changed after they have been set.
    1031             :    *
    1032             :    * Calling address() avoids the read read barrier that does gray
    1033             :    * unmarking, but it's not possible for the object to be gray here.
    1034             :    */
    1035             : 
    1036           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGImageElement);
    1037           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    1038           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    1039             : }
    1040             : 
    1041             : JS::Handle<JSObject*>
    1042           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
    1043             : {
    1044             :   /* Get the interface object for this class.  This will create the object as
    1045             :      needed. */
    1046             : 
    1047             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    1048           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    1049           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    1050           0 :     return nullptr;
    1051             :   }
    1052             : 
    1053             :   /* Check to see whether the interface objects are already installed */
    1054           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    1055           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGImageElement)) {
    1056           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    1057           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    1058             :   }
    1059             : 
    1060             :   /*
    1061             :    * The object might _still_ be null, but that's OK.
    1062             :    *
    1063             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    1064             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    1065             :    * changed after they have been set.
    1066             :    *
    1067             :    * Calling address() avoids the read read barrier that does gray
    1068             :    * unmarking, but it's not possible for the object to be gray here.
    1069             :    */
    1070             : 
    1071           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGImageElement);
    1072           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    1073           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    1074             : }
    1075             : 
    1076             : JSObject*
    1077           0 : GetConstructorObject(JSContext* aCx)
    1078             : {
    1079           0 :   return GetConstructorObjectHandle(aCx);
    1080             : }
    1081             : 
    1082             : } // namespace SVGImageElementBinding
    1083             : 
    1084             : 
    1085             : 
    1086             : } // namespace dom
    1087             : } // namespace mozilla

Generated by: LCOV version 1.13