LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dom/bindings - SVGFilterElementBinding.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 SVGFilterElement.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "SVGElementBinding.h"
       4             : #include "SVGFilterElementBinding.h"
       5             : #include "WrapperFactory.h"
       6             : #include "mozilla/OwningNonNull.h"
       7             : #include "mozilla/dom/BindingUtils.h"
       8             : #include "mozilla/dom/DOMJSClass.h"
       9             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      10             : #include "mozilla/dom/SVGAnimatedEnumeration.h"
      11             : #include "mozilla/dom/SVGAnimatedLength.h"
      12             : #include "mozilla/dom/SVGAnimatedString.h"
      13             : #include "mozilla/dom/SVGFilterElement.h"
      14             : #include "mozilla/dom/XrayExpandoClass.h"
      15             : 
      16             : namespace mozilla {
      17             : namespace dom {
      18             : 
      19             : namespace SVGFilterElementBinding {
      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_filterUnits(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFilterElement* self, JSJitGetterCallArgs args)
      26             : {
      27           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->FilterUnits()));
      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 filterUnits_getterinfo = {
      37             :   { (JSJitGetterOp)get_filterUnits },
      38             :   { prototypes::id::SVGFilterElement },
      39             :   { PrototypeTraits<prototypes::id::SVGFilterElement>::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_primitiveUnits(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFilterElement* self, JSJitGetterCallArgs args)
      56             : {
      57           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->PrimitiveUnits()));
      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 primitiveUnits_getterinfo = {
      67             :   { (JSJitGetterOp)get_primitiveUnits },
      68             :   { prototypes::id::SVGFilterElement },
      69             :   { PrototypeTraits<prototypes::id::SVGFilterElement>::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_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFilterElement* self, JSJitGetterCallArgs args)
      86             : {
      87           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->X()));
      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 x_getterinfo = {
      97             :   { (JSJitGetterOp)get_x },
      98             :   { prototypes::id::SVGFilterElement },
      99             :   { PrototypeTraits<prototypes::id::SVGFilterElement>::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_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFilterElement* self, JSJitGetterCallArgs args)
     116             : {
     117           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Y()));
     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 y_getterinfo = {
     127             :   { (JSJitGetterOp)get_y },
     128             :   { prototypes::id::SVGFilterElement },
     129             :   { PrototypeTraits<prototypes::id::SVGFilterElement>::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_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFilterElement* self, JSJitGetterCallArgs args)
     146             : {
     147           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Width()));
     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 width_getterinfo = {
     157             :   { (JSJitGetterOp)get_width },
     158             :   { prototypes::id::SVGFilterElement },
     159             :   { PrototypeTraits<prototypes::id::SVGFilterElement>::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_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFilterElement* self, JSJitGetterCallArgs args)
     176             : {
     177           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Height()));
     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 height_getterinfo = {
     187             :   { (JSJitGetterOp)get_height },
     188             :   { prototypes::id::SVGFilterElement },
     189             :   { PrototypeTraits<prototypes::id::SVGFilterElement>::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::SVGFilterElement* 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::SVGFilterElement },
     219             :   { PrototypeTraits<prototypes::id::SVGFilterElement>::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::SVGFilterElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFilterElement>(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::SVGFilterElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFilterElement>(obj);
     250           0 :   if (self) {
     251           0 :     ClearWrapper(self, self, obj);
     252           0 :     AddForDeferredFinalization<mozilla::dom::SVGFilterElement>(self);
     253             :   }
     254           0 : }
     255             : 
     256             : static void
     257           0 : _objectMoved(JSObject* obj, const JSObject* old)
     258             : {
     259           0 :   mozilla::dom::SVGFilterElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFilterElement>(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             :   { "filterUnits", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &filterUnits_getterinfo, nullptr, nullptr },
     272             :   { "primitiveUnits", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &primitiveUnits_getterinfo, nullptr, nullptr },
     273             :   { "x", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &x_getterinfo, nullptr, nullptr },
     274             :   { "y", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &y_getterinfo, nullptr, nullptr },
     275             :   { "width", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &width_getterinfo, nullptr, nullptr },
     276             :   { "height", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &height_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             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     297             : #if defined(__clang__)
     298             : #pragma clang diagnostic push
     299             : #pragma clang diagnostic ignored "-Wmissing-braces"
     300             : #endif
     301             : static const ConstantSpec sConstants_specs[] = {
     302             :   { "SVG_UNIT_TYPE_UNKNOWN", JS::Int32Value(0) },
     303             :   { "SVG_UNIT_TYPE_USERSPACEONUSE", JS::Int32Value(1) },
     304             :   { "SVG_UNIT_TYPE_OBJECTBOUNDINGBOX", JS::Int32Value(2) },
     305             :   { 0, JS::UndefinedValue() }
     306             : };
     307             : #if defined(__clang__)
     308             : #pragma clang diagnostic pop
     309             : #endif
     310             : 
     311             : 
     312             : // Can't be const because the pref-enabled boolean needs to be writable
     313             : static Prefable<const ConstantSpec> sConstants[] = {
     314             :   { nullptr, &sConstants_specs[0] },
     315             :   { nullptr, nullptr }
     316             : };
     317             : 
     318             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     319             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     320             : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     321             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     322             : 
     323             : 
     324             : static uint16_t sNativeProperties_sortedPropertyIndices[10];
     325             : static PropertyInfo sNativeProperties_propertyInfos[10];
     326             : 
     327             : static const NativePropertiesN<2> sNativeProperties = {
     328             :   false, 0,
     329             :   false, 0,
     330             :   false, 0,
     331             :   true,  0 /* sAttributes */,
     332             :   false, 0,
     333             :   false, 0,
     334             :   true,  1 /* sConstants */,
     335             :   -1,
     336             :   10,
     337             :   sNativeProperties_sortedPropertyIndices,
     338             :   {
     339             :     { sAttributes, &sNativeProperties_propertyInfos[0] },
     340             :     { sConstants, &sNativeProperties_propertyInfos[7] }
     341             :   }
     342             : };
     343             : static_assert(10 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     344             :     "We have a property info count that is oversized");
     345             : 
     346             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     347             :   {
     348             :     "Function",
     349             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     350             :     &sBoringInterfaceObjectClassClassOps,
     351             :     JS_NULL_CLASS_SPEC,
     352             :     JS_NULL_CLASS_EXT,
     353             :     &sInterfaceObjectClassObjectOps
     354             :   },
     355             :   eInterface,
     356             :   true,
     357             :   prototypes::id::SVGFilterElement,
     358             :   PrototypeTraits<prototypes::id::SVGFilterElement>::Depth,
     359             :   sNativePropertyHooks,
     360             :   "function SVGFilterElement() {\n    [native code]\n}",
     361             :   SVGElementBinding::GetConstructorObject
     362             : };
     363             : 
     364             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     365             :   {
     366             :     "SVGFilterElementPrototype",
     367             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     368             :     JS_NULL_CLASS_OPS,
     369             :     JS_NULL_CLASS_SPEC,
     370             :     JS_NULL_CLASS_EXT,
     371             :     JS_NULL_OBJECT_OPS
     372             :   },
     373             :   eInterfacePrototype,
     374             :   false,
     375             :   prototypes::id::SVGFilterElement,
     376             :   PrototypeTraits<prototypes::id::SVGFilterElement>::Depth,
     377             :   sNativePropertyHooks,
     378             :   "[object SVGFilterElementPrototype]",
     379             :   SVGElementBinding::GetProtoObject
     380             : };
     381             : 
     382             : JSObject*
     383           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     384             : {
     385           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     386             : }
     387             : 
     388             : static const js::ClassOps sClassOps = {
     389             :   _addProperty, /* addProperty */
     390             :   nullptr,               /* delProperty */
     391             :   nullptr,               /* getProperty */
     392             :   nullptr,               /* setProperty */
     393             :   nullptr,               /* enumerate */
     394             :   nullptr, /* newEnumerate */
     395             :   nullptr, /* resolve */
     396             :   nullptr, /* mayResolve */
     397             :   _finalize, /* finalize */
     398             :   nullptr, /* call */
     399             :   nullptr,               /* hasInstance */
     400             :   nullptr,               /* construct */
     401             :   nullptr, /* trace */
     402             : };
     403             : 
     404             : static const js::ClassExtension sClassExtension = {
     405             :   nullptr, /* weakmapKeyDelegateOp */
     406             :   _objectMoved /* objectMovedOp */
     407             : };
     408             : 
     409             : static const DOMJSClass sClass = {
     410             :   { "SVGFilterElement",
     411             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
     412             :     &sClassOps,
     413             :     JS_NULL_CLASS_SPEC,
     414             :     &sClassExtension,
     415             :     JS_NULL_OBJECT_OPS
     416             :   },
     417             :   { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGFilterElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
     418             :   IsBaseOf<nsISupports, mozilla::dom::SVGFilterElement >::value,
     419             :   sNativePropertyHooks,
     420             :   FindAssociatedGlobalForNative<mozilla::dom::SVGFilterElement>::Get,
     421             :   GetProtoObjectHandle,
     422             :   GetCCParticipant<mozilla::dom::SVGFilterElement>::Get()
     423             : };
     424             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     425             :               "Must have the right minimal number of reserved slots.");
     426             : static_assert(1 >= 1,
     427             :               "Must have enough reserved slots.");
     428             : 
     429             : const JSClass*
     430           0 : GetJSClass()
     431             : {
     432           0 :   return sClass.ToJSClass();
     433             : }
     434             : 
     435             : bool
     436           0 : Wrap(JSContext* aCx, mozilla::dom::SVGFilterElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     437             : {
     438             :   MOZ_ASSERT(static_cast<mozilla::dom::SVGFilterElement*>(aObject) ==
     439             :              reinterpret_cast<mozilla::dom::SVGFilterElement*>(aObject),
     440             :              "Multiple inheritance for mozilla::dom::SVGFilterElement is broken.");
     441             :   MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
     442             :              reinterpret_cast<nsSVGElement*>(aObject),
     443             :              "Multiple inheritance for nsSVGElement is broken.");
     444             :   MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
     445             :              reinterpret_cast<mozilla::dom::Element*>(aObject),
     446             :              "Multiple inheritance for mozilla::dom::Element is broken.");
     447             :   MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
     448             :              reinterpret_cast<nsINode*>(aObject),
     449             :              "Multiple inheritance for nsINode is broken.");
     450             :   MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
     451             :              reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
     452             :              "Multiple inheritance for mozilla::dom::EventTarget is broken.");
     453           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     454           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     455           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     456             :              "You should probably not be using Wrap() directly; use "
     457             :              "GetOrCreateDOMReflector instead");
     458             : 
     459           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     460             :              "nsISupports must be on our primary inheritance chain");
     461             : 
     462           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     463           0 :   if (!global) {
     464           0 :     return false;
     465             :   }
     466           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     467           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     468             : 
     469             :   // That might have ended up wrapping us already, due to the wonders
     470             :   // of XBL.  Check for that, and bail out as needed.
     471           0 :   aReflector.set(aCache->GetWrapper());
     472           0 :   if (aReflector) {
     473             : #ifdef DEBUG
     474           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     475             : #endif // DEBUG
     476           0 :     return true;
     477             :   }
     478             : 
     479           0 :   JSAutoCompartment ac(aCx, global);
     480           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     481           0 :   if (!canonicalProto) {
     482           0 :     return false;
     483             :   }
     484           0 :   JS::Rooted<JSObject*> proto(aCx);
     485           0 :   if (aGivenProto) {
     486           0 :     proto = aGivenProto;
     487             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     488             :     // coming in, we changed compartments to that of "parent" so may need
     489             :     // to wrap the proto here.
     490           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     491           0 :       if (!JS_WrapObject(aCx, &proto)) {
     492           0 :         return false;
     493             :       }
     494             :     }
     495             :   } else {
     496           0 :     proto = canonicalProto;
     497             :   }
     498             : 
     499           0 :   BindingJSObjectCreator<mozilla::dom::SVGFilterElement> creator(aCx);
     500           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     501           0 :   if (!aReflector) {
     502           0 :     return false;
     503             :   }
     504             : 
     505           0 :   aCache->SetWrapper(aReflector);
     506           0 :   creator.InitializationSucceeded();
     507             : 
     508           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     509             :              aCache->GetWrapperPreserveColor() == aReflector);
     510             :   // If proto != canonicalProto, we have to preserve our wrapper;
     511             :   // otherwise we won't be able to properly recreate it later, since
     512             :   // we won't know what proto to use.  Note that we don't check
     513             :   // aGivenProto here, since it's entirely possible (and even
     514             :   // somewhat common) to have a non-null aGivenProto which is the
     515             :   // same as canonicalProto.
     516           0 :   if (proto != canonicalProto) {
     517           0 :     PreserveWrapper(aObject);
     518             :   }
     519             : 
     520           0 :   return true;
     521             : }
     522             : 
     523             : const NativePropertyHooks sNativePropertyHooks[] = { {
     524             :   nullptr,
     525             :   nullptr,
     526             :   nullptr,
     527             :   { sNativeProperties.Upcast(), nullptr },
     528             :   prototypes::id::SVGFilterElement,
     529             :   constructors::id::SVGFilterElement,
     530             :   SVGElementBinding::sNativePropertyHooks,
     531             :   &DefaultXrayExpandoObjectClass
     532             : } };
     533             : 
     534             : void
     535           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     536             : {
     537           0 :   JS::Handle<JSObject*> parentProto(SVGElementBinding::GetProtoObjectHandle(aCx));
     538           0 :   if (!parentProto) {
     539           0 :     return;
     540             :   }
     541             : 
     542           0 :   JS::Handle<JSObject*> constructorProto(SVGElementBinding::GetConstructorObjectHandle(aCx));
     543           0 :   if (!constructorProto) {
     544           0 :     return;
     545             :   }
     546             : 
     547             :   static bool sIdsInited = false;
     548           0 :   if (!sIdsInited && NS_IsMainThread()) {
     549           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     550           0 :       return;
     551             :     }
     552           0 :     sIdsInited = true;
     553             :   }
     554             : 
     555           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGFilterElement);
     556           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGFilterElement);
     557           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     558             :                               &sPrototypeClass.mBase, protoCache,
     559             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     560             :                               interfaceCache,
     561             :                               sNativeProperties.Upcast(),
     562             :                               nullptr,
     563             :                               "SVGFilterElement", aDefineOnGlobal,
     564             :                               nullptr,
     565           0 :                               false);
     566             : }
     567             : 
     568             : JS::Handle<JSObject*>
     569           0 : GetProtoObjectHandle(JSContext* aCx)
     570             : {
     571             :   /* Get the interface prototype object for this class.  This will create the
     572             :      object as needed. */
     573           0 :   bool aDefineOnGlobal = true;
     574             : 
     575             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     576           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     577           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     578           0 :     return nullptr;
     579             :   }
     580             : 
     581             :   /* Check to see whether the interface objects are already installed */
     582           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     583           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGFilterElement)) {
     584           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     585           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     586             :   }
     587             : 
     588             :   /*
     589             :    * The object might _still_ be null, but that's OK.
     590             :    *
     591             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     592             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     593             :    * changed after they have been set.
     594             :    *
     595             :    * Calling address() avoids the read read barrier that does gray
     596             :    * unmarking, but it's not possible for the object to be gray here.
     597             :    */
     598             : 
     599           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGFilterElement);
     600           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     601           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     602             : }
     603             : 
     604             : JS::Handle<JSObject*>
     605           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     606             : {
     607             :   /* Get the interface object for this class.  This will create the object as
     608             :      needed. */
     609             : 
     610             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     611           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     612           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     613           0 :     return nullptr;
     614             :   }
     615             : 
     616             :   /* Check to see whether the interface objects are already installed */
     617           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     618           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGFilterElement)) {
     619           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     620           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     621             :   }
     622             : 
     623             :   /*
     624             :    * The object might _still_ be null, but that's OK.
     625             :    *
     626             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     627             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     628             :    * changed after they have been set.
     629             :    *
     630             :    * Calling address() avoids the read read barrier that does gray
     631             :    * unmarking, but it's not possible for the object to be gray here.
     632             :    */
     633             : 
     634           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGFilterElement);
     635           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     636           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     637             : }
     638             : 
     639             : JSObject*
     640           0 : GetConstructorObject(JSContext* aCx)
     641             : {
     642           0 :   return GetConstructorObjectHandle(aCx);
     643             : }
     644             : 
     645             : } // namespace SVGFilterElementBinding
     646             : 
     647             : 
     648             : 
     649             : } // namespace dom
     650             : } // namespace mozilla

Generated by: LCOV version 1.13