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

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

Generated by: LCOV version 1.13