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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM SVGFEImageElement.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "SVGAnimatedPreserveAspectRatio.h"
       4             : #include "SVGElementBinding.h"
       5             : #include "SVGFEImageElementBinding.h"
       6             : #include "WrapperFactory.h"
       7             : #include "mozilla/OwningNonNull.h"
       8             : #include "mozilla/dom/BindingUtils.h"
       9             : #include "mozilla/dom/DOMJSClass.h"
      10             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      11             : #include "mozilla/dom/SVGAnimatedLength.h"
      12             : #include "mozilla/dom/SVGAnimatedString.h"
      13             : #include "mozilla/dom/SVGFEImageElement.h"
      14             : #include "mozilla/dom/XrayExpandoClass.h"
      15             : 
      16             : namespace mozilla {
      17             : namespace dom {
      18             : 
      19             : namespace SVGFEImageElementBinding {
      20             : 
      21             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGElementBinding::NativeType>::value,
      22             :               "Can't inherit from an interface with a different ownership model.");
      23             : 
      24             : static bool
      25           0 : get_preserveAspectRatio(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEImageElement* self, JSJitGetterCallArgs args)
      26             : {
      27           0 :   auto result(StrongOrRawPtr<mozilla::dom::DOMSVGAnimatedPreserveAspectRatio>(self->PreserveAspectRatio()));
      28           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      29           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      30           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      31           0 :     return false;
      32             :   }
      33           0 :   return true;
      34             : }
      35             : 
      36             : static const JSJitInfo preserveAspectRatio_getterinfo = {
      37             :   { (JSJitGetterOp)get_preserveAspectRatio },
      38             :   { prototypes::id::SVGFEImageElement },
      39             :   { PrototypeTraits<prototypes::id::SVGFEImageElement>::Depth },
      40             :   JSJitInfo::Getter,
      41             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
      42             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
      43             :   false,  /* isInfallible. False in setters. */
      44             :   true,  /* isMovable.  Not relevant for setters. */
      45             :   true, /* isEliminatable.  Not relevant for setters. */
      46             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      47             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      48             :   false,  /* isTypedMethod.  Only relevant for methods. */
      49             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      50             : };
      51             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      52             : static_assert(0 < 1, "There is no slot for us");
      53             : 
      54             : static bool
      55           0 : get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEImageElement* self, JSJitGetterCallArgs args)
      56             : {
      57           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->X()));
      58           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      59           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      60           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      61           0 :     return false;
      62             :   }
      63           0 :   return true;
      64             : }
      65             : 
      66             : static const JSJitInfo x_getterinfo = {
      67             :   { (JSJitGetterOp)get_x },
      68             :   { prototypes::id::SVGFEImageElement },
      69             :   { PrototypeTraits<prototypes::id::SVGFEImageElement>::Depth },
      70             :   JSJitInfo::Getter,
      71             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
      72             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
      73             :   false,  /* isInfallible. False in setters. */
      74             :   true,  /* isMovable.  Not relevant for setters. */
      75             :   true, /* isEliminatable.  Not relevant for setters. */
      76             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      77             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      78             :   false,  /* isTypedMethod.  Only relevant for methods. */
      79             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      80             : };
      81             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      82             : static_assert(0 < 1, "There is no slot for us");
      83             : 
      84             : static bool
      85           0 : get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEImageElement* self, JSJitGetterCallArgs args)
      86             : {
      87           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Y()));
      88           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      89           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      90           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      91           0 :     return false;
      92             :   }
      93           0 :   return true;
      94             : }
      95             : 
      96             : static const JSJitInfo y_getterinfo = {
      97             :   { (JSJitGetterOp)get_y },
      98             :   { prototypes::id::SVGFEImageElement },
      99             :   { PrototypeTraits<prototypes::id::SVGFEImageElement>::Depth },
     100             :   JSJitInfo::Getter,
     101             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     102             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     103             :   false,  /* isInfallible. False in setters. */
     104             :   true,  /* isMovable.  Not relevant for setters. */
     105             :   true, /* isEliminatable.  Not relevant for setters. */
     106             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     107             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     108             :   false,  /* isTypedMethod.  Only relevant for methods. */
     109             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     110             : };
     111             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     112             : static_assert(0 < 1, "There is no slot for us");
     113             : 
     114             : static bool
     115           0 : get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEImageElement* self, JSJitGetterCallArgs args)
     116             : {
     117           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Width()));
     118           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     119           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     120           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     121           0 :     return false;
     122             :   }
     123           0 :   return true;
     124             : }
     125             : 
     126             : static const JSJitInfo width_getterinfo = {
     127             :   { (JSJitGetterOp)get_width },
     128             :   { prototypes::id::SVGFEImageElement },
     129             :   { PrototypeTraits<prototypes::id::SVGFEImageElement>::Depth },
     130             :   JSJitInfo::Getter,
     131             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     132             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     133             :   false,  /* isInfallible. False in setters. */
     134             :   true,  /* isMovable.  Not relevant for setters. */
     135             :   true, /* isEliminatable.  Not relevant for setters. */
     136             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     137             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     138             :   false,  /* isTypedMethod.  Only relevant for methods. */
     139             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     140             : };
     141             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     142             : static_assert(0 < 1, "There is no slot for us");
     143             : 
     144             : static bool
     145           0 : get_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEImageElement* self, JSJitGetterCallArgs args)
     146             : {
     147           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Height()));
     148           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     149           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     150           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     151           0 :     return false;
     152             :   }
     153           0 :   return true;
     154             : }
     155             : 
     156             : static const JSJitInfo height_getterinfo = {
     157             :   { (JSJitGetterOp)get_height },
     158             :   { prototypes::id::SVGFEImageElement },
     159             :   { PrototypeTraits<prototypes::id::SVGFEImageElement>::Depth },
     160             :   JSJitInfo::Getter,
     161             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     162             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     163             :   false,  /* isInfallible. False in setters. */
     164             :   true,  /* isMovable.  Not relevant for setters. */
     165             :   true, /* isEliminatable.  Not relevant for setters. */
     166             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     167             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     168             :   false,  /* isTypedMethod.  Only relevant for methods. */
     169             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     170             : };
     171             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     172             : static_assert(0 < 1, "There is no slot for us");
     173             : 
     174             : static bool
     175           0 : get_result(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEImageElement* self, JSJitGetterCallArgs args)
     176             : {
     177           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Result()));
     178           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     179           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     180           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     181           0 :     return false;
     182             :   }
     183           0 :   return true;
     184             : }
     185             : 
     186             : static const JSJitInfo result_getterinfo = {
     187             :   { (JSJitGetterOp)get_result },
     188             :   { prototypes::id::SVGFEImageElement },
     189             :   { PrototypeTraits<prototypes::id::SVGFEImageElement>::Depth },
     190             :   JSJitInfo::Getter,
     191             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     192             :   JSVAL_TYPE_OBJECT,  /* 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             : 
     204             : static bool
     205           0 : get_href(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEImageElement* self, JSJitGetterCallArgs args)
     206             : {
     207           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Href()));
     208           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     209           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     210           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     211           0 :     return false;
     212             :   }
     213           0 :   return true;
     214             : }
     215             : 
     216             : static const JSJitInfo href_getterinfo = {
     217             :   { (JSJitGetterOp)get_href },
     218             :   { prototypes::id::SVGFEImageElement },
     219             :   { PrototypeTraits<prototypes::id::SVGFEImageElement>::Depth },
     220             :   JSJitInfo::Getter,
     221             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     222             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     223             :   false,  /* isInfallible. False in setters. */
     224             :   true,  /* isMovable.  Not relevant for setters. */
     225             :   true, /* isEliminatable.  Not relevant for setters. */
     226             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     227             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     228             :   false,  /* isTypedMethod.  Only relevant for methods. */
     229             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     230             : };
     231             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     232             : static_assert(0 < 1, "There is no slot for us");
     233             : 
     234             : static bool
     235           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     236             : {
     237           0 :   mozilla::dom::SVGFEImageElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEImageElement>(obj);
     238             :   // We don't want to preserve if we don't have a wrapper, and we
     239             :   // obviously can't preserve if we're not initialized.
     240           0 :   if (self && self->GetWrapperPreserveColor()) {
     241           0 :     PreserveWrapper(self);
     242             :   }
     243           0 :   return true;
     244             : }
     245             : 
     246             : static void
     247           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     248             : {
     249           0 :   mozilla::dom::SVGFEImageElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEImageElement>(obj);
     250           0 :   if (self) {
     251           0 :     ClearWrapper(self, self, obj);
     252           0 :     AddForDeferredFinalization<mozilla::dom::SVGFEImageElement>(self);
     253             :   }
     254           0 : }
     255             : 
     256             : static void
     257           0 : _objectMoved(JSObject* obj, const JSObject* old)
     258             : {
     259           0 :   mozilla::dom::SVGFEImageElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEImageElement>(obj);
     260           0 :   if (self) {
     261           0 :     UpdateWrapper(self, self, obj, old);
     262             :   }
     263           0 : }
     264             : 
     265             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     266             : #if defined(__clang__)
     267             : #pragma clang diagnostic push
     268             : #pragma clang diagnostic ignored "-Wmissing-braces"
     269             : #endif
     270             : static const JSPropertySpec sAttributes_specs[] = {
     271             :   { "preserveAspectRatio", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &preserveAspectRatio_getterinfo, nullptr, nullptr },
     272             :   { "x", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &x_getterinfo, nullptr, nullptr },
     273             :   { "y", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &y_getterinfo, nullptr, nullptr },
     274             :   { "width", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &width_getterinfo, nullptr, nullptr },
     275             :   { "height", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &height_getterinfo, nullptr, nullptr },
     276             :   { "result", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &result_getterinfo, nullptr, nullptr },
     277             :   { "href", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &href_getterinfo, nullptr, nullptr },
     278             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     279             : };
     280             : #if defined(__clang__)
     281             : #pragma clang diagnostic pop
     282             : #endif
     283             : 
     284             : 
     285             : // Can't be const because the pref-enabled boolean needs to be writable
     286             : static Prefable<const JSPropertySpec> sAttributes[] = {
     287             :   { nullptr, &sAttributes_specs[0] },
     288             :   { nullptr, nullptr }
     289             : };
     290             : 
     291             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     292             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     293             : static_assert(7 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     294             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     295             : 
     296             : 
     297             : static uint16_t sNativeProperties_sortedPropertyIndices[7];
     298             : static PropertyInfo sNativeProperties_propertyInfos[7];
     299             : 
     300             : static const NativePropertiesN<1> sNativeProperties = {
     301             :   false, 0,
     302             :   false, 0,
     303             :   false, 0,
     304             :   true,  0 /* sAttributes */,
     305             :   false, 0,
     306             :   false, 0,
     307             :   false, 0,
     308             :   -1,
     309             :   7,
     310             :   sNativeProperties_sortedPropertyIndices,
     311             :   {
     312             :     { sAttributes, &sNativeProperties_propertyInfos[0] }
     313             :   }
     314             : };
     315             : static_assert(7 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     316             :     "We have a property info count that is oversized");
     317             : 
     318             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     319             :   {
     320             :     "Function",
     321             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     322             :     &sBoringInterfaceObjectClassClassOps,
     323             :     JS_NULL_CLASS_SPEC,
     324             :     JS_NULL_CLASS_EXT,
     325             :     &sInterfaceObjectClassObjectOps
     326             :   },
     327             :   eInterface,
     328             :   true,
     329             :   prototypes::id::SVGFEImageElement,
     330             :   PrototypeTraits<prototypes::id::SVGFEImageElement>::Depth,
     331             :   sNativePropertyHooks,
     332             :   "function SVGFEImageElement() {\n    [native code]\n}",
     333             :   SVGElementBinding::GetConstructorObject
     334             : };
     335             : 
     336             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     337             :   {
     338             :     "SVGFEImageElementPrototype",
     339             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     340             :     JS_NULL_CLASS_OPS,
     341             :     JS_NULL_CLASS_SPEC,
     342             :     JS_NULL_CLASS_EXT,
     343             :     JS_NULL_OBJECT_OPS
     344             :   },
     345             :   eInterfacePrototype,
     346             :   false,
     347             :   prototypes::id::SVGFEImageElement,
     348             :   PrototypeTraits<prototypes::id::SVGFEImageElement>::Depth,
     349             :   sNativePropertyHooks,
     350             :   "[object SVGFEImageElementPrototype]",
     351             :   SVGElementBinding::GetProtoObject
     352             : };
     353             : 
     354             : JSObject*
     355           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     356             : {
     357           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     358             : }
     359             : 
     360             : static const js::ClassOps sClassOps = {
     361             :   _addProperty, /* addProperty */
     362             :   nullptr,               /* delProperty */
     363             :   nullptr,               /* getProperty */
     364             :   nullptr,               /* setProperty */
     365             :   nullptr,               /* enumerate */
     366             :   nullptr, /* newEnumerate */
     367             :   nullptr, /* resolve */
     368             :   nullptr, /* mayResolve */
     369             :   _finalize, /* finalize */
     370             :   nullptr, /* call */
     371             :   nullptr,               /* hasInstance */
     372             :   nullptr,               /* construct */
     373             :   nullptr, /* trace */
     374             : };
     375             : 
     376             : static const js::ClassExtension sClassExtension = {
     377             :   nullptr, /* weakmapKeyDelegateOp */
     378             :   _objectMoved /* objectMovedOp */
     379             : };
     380             : 
     381             : static const DOMJSClass sClass = {
     382             :   { "SVGFEImageElement",
     383             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
     384             :     &sClassOps,
     385             :     JS_NULL_CLASS_SPEC,
     386             :     &sClassExtension,
     387             :     JS_NULL_OBJECT_OPS
     388             :   },
     389             :   { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGFEImageElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
     390             :   IsBaseOf<nsISupports, mozilla::dom::SVGFEImageElement >::value,
     391             :   sNativePropertyHooks,
     392             :   FindAssociatedGlobalForNative<mozilla::dom::SVGFEImageElement>::Get,
     393             :   GetProtoObjectHandle,
     394             :   GetCCParticipant<mozilla::dom::SVGFEImageElement>::Get()
     395             : };
     396             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     397             :               "Must have the right minimal number of reserved slots.");
     398             : static_assert(1 >= 1,
     399             :               "Must have enough reserved slots.");
     400             : 
     401             : const JSClass*
     402           0 : GetJSClass()
     403             : {
     404           0 :   return sClass.ToJSClass();
     405             : }
     406             : 
     407             : bool
     408           0 : Wrap(JSContext* aCx, mozilla::dom::SVGFEImageElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     409             : {
     410             :   MOZ_ASSERT(static_cast<mozilla::dom::SVGFEImageElement*>(aObject) ==
     411             :              reinterpret_cast<mozilla::dom::SVGFEImageElement*>(aObject),
     412             :              "Multiple inheritance for mozilla::dom::SVGFEImageElement is broken.");
     413             :   MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
     414             :              reinterpret_cast<nsSVGElement*>(aObject),
     415             :              "Multiple inheritance for nsSVGElement is broken.");
     416             :   MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
     417             :              reinterpret_cast<mozilla::dom::Element*>(aObject),
     418             :              "Multiple inheritance for mozilla::dom::Element is broken.");
     419             :   MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
     420             :              reinterpret_cast<nsINode*>(aObject),
     421             :              "Multiple inheritance for nsINode is broken.");
     422             :   MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
     423             :              reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
     424             :              "Multiple inheritance for mozilla::dom::EventTarget is broken.");
     425           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     426           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     427           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     428             :              "You should probably not be using Wrap() directly; use "
     429             :              "GetOrCreateDOMReflector instead");
     430             : 
     431           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     432             :              "nsISupports must be on our primary inheritance chain");
     433             : 
     434           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     435           0 :   if (!global) {
     436           0 :     return false;
     437             :   }
     438           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     439           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     440             : 
     441             :   // That might have ended up wrapping us already, due to the wonders
     442             :   // of XBL.  Check for that, and bail out as needed.
     443           0 :   aReflector.set(aCache->GetWrapper());
     444           0 :   if (aReflector) {
     445             : #ifdef DEBUG
     446           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     447             : #endif // DEBUG
     448           0 :     return true;
     449             :   }
     450             : 
     451           0 :   JSAutoCompartment ac(aCx, global);
     452           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     453           0 :   if (!canonicalProto) {
     454           0 :     return false;
     455             :   }
     456           0 :   JS::Rooted<JSObject*> proto(aCx);
     457           0 :   if (aGivenProto) {
     458           0 :     proto = aGivenProto;
     459             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     460             :     // coming in, we changed compartments to that of "parent" so may need
     461             :     // to wrap the proto here.
     462           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     463           0 :       if (!JS_WrapObject(aCx, &proto)) {
     464           0 :         return false;
     465             :       }
     466             :     }
     467             :   } else {
     468           0 :     proto = canonicalProto;
     469             :   }
     470             : 
     471           0 :   BindingJSObjectCreator<mozilla::dom::SVGFEImageElement> creator(aCx);
     472           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     473           0 :   if (!aReflector) {
     474           0 :     return false;
     475             :   }
     476             : 
     477           0 :   aCache->SetWrapper(aReflector);
     478           0 :   creator.InitializationSucceeded();
     479             : 
     480           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     481             :              aCache->GetWrapperPreserveColor() == aReflector);
     482             :   // If proto != canonicalProto, we have to preserve our wrapper;
     483             :   // otherwise we won't be able to properly recreate it later, since
     484             :   // we won't know what proto to use.  Note that we don't check
     485             :   // aGivenProto here, since it's entirely possible (and even
     486             :   // somewhat common) to have a non-null aGivenProto which is the
     487             :   // same as canonicalProto.
     488           0 :   if (proto != canonicalProto) {
     489           0 :     PreserveWrapper(aObject);
     490             :   }
     491             : 
     492           0 :   return true;
     493             : }
     494             : 
     495             : const NativePropertyHooks sNativePropertyHooks[] = { {
     496             :   nullptr,
     497             :   nullptr,
     498             :   nullptr,
     499             :   { sNativeProperties.Upcast(), nullptr },
     500             :   prototypes::id::SVGFEImageElement,
     501             :   constructors::id::SVGFEImageElement,
     502             :   SVGElementBinding::sNativePropertyHooks,
     503             :   &DefaultXrayExpandoObjectClass
     504             : } };
     505             : 
     506             : void
     507           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     508             : {
     509           0 :   JS::Handle<JSObject*> parentProto(SVGElementBinding::GetProtoObjectHandle(aCx));
     510           0 :   if (!parentProto) {
     511           0 :     return;
     512             :   }
     513             : 
     514           0 :   JS::Handle<JSObject*> constructorProto(SVGElementBinding::GetConstructorObjectHandle(aCx));
     515           0 :   if (!constructorProto) {
     516           0 :     return;
     517             :   }
     518             : 
     519             :   static bool sIdsInited = false;
     520           0 :   if (!sIdsInited && NS_IsMainThread()) {
     521           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     522           0 :       return;
     523             :     }
     524           0 :     sIdsInited = true;
     525             :   }
     526             : 
     527           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGFEImageElement);
     528           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGFEImageElement);
     529           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     530             :                               &sPrototypeClass.mBase, protoCache,
     531             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     532             :                               interfaceCache,
     533             :                               sNativeProperties.Upcast(),
     534             :                               nullptr,
     535             :                               "SVGFEImageElement", aDefineOnGlobal,
     536             :                               nullptr,
     537           0 :                               false);
     538             : }
     539             : 
     540             : JS::Handle<JSObject*>
     541           0 : GetProtoObjectHandle(JSContext* aCx)
     542             : {
     543             :   /* Get the interface prototype object for this class.  This will create the
     544             :      object as needed. */
     545           0 :   bool aDefineOnGlobal = true;
     546             : 
     547             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     548           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     549           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     550           0 :     return nullptr;
     551             :   }
     552             : 
     553             :   /* Check to see whether the interface objects are already installed */
     554           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     555           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGFEImageElement)) {
     556           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     557           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     558             :   }
     559             : 
     560             :   /*
     561             :    * The object might _still_ be null, but that's OK.
     562             :    *
     563             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     564             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     565             :    * changed after they have been set.
     566             :    *
     567             :    * Calling address() avoids the read read barrier that does gray
     568             :    * unmarking, but it's not possible for the object to be gray here.
     569             :    */
     570             : 
     571           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGFEImageElement);
     572           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     573           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     574             : }
     575             : 
     576             : JS::Handle<JSObject*>
     577           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     578             : {
     579             :   /* Get the interface object for this class.  This will create the object as
     580             :      needed. */
     581             : 
     582             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     583           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     584           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     585           0 :     return nullptr;
     586             :   }
     587             : 
     588             :   /* Check to see whether the interface objects are already installed */
     589           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     590           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGFEImageElement)) {
     591           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     592           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     593             :   }
     594             : 
     595             :   /*
     596             :    * The object might _still_ be null, but that's OK.
     597             :    *
     598             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     599             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     600             :    * changed after they have been set.
     601             :    *
     602             :    * Calling address() avoids the read read barrier that does gray
     603             :    * unmarking, but it's not possible for the object to be gray here.
     604             :    */
     605             : 
     606           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGFEImageElement);
     607           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     608           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     609             : }
     610             : 
     611             : JSObject*
     612           0 : GetConstructorObject(JSContext* aCx)
     613             : {
     614           0 :   return GetConstructorObjectHandle(aCx);
     615             : }
     616             : 
     617             : } // namespace SVGFEImageElementBinding
     618             : 
     619             : 
     620             : 
     621             : } // namespace dom
     622             : } // namespace mozilla

Generated by: LCOV version 1.13