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

Generated by: LCOV version 1.13