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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM SVGStyleElement.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "SVGElementBinding.h"
       4             : #include "SVGStyleElementBinding.h"
       5             : #include "WrapperFactory.h"
       6             : #include "mozilla/OwningNonNull.h"
       7             : #include "mozilla/Preferences.h"
       8             : #include "mozilla/StyleSheetInlines.h"
       9             : #include "mozilla/dom/BindingUtils.h"
      10             : #include "mozilla/dom/DOMJSClass.h"
      11             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      12             : #include "mozilla/dom/Nullable.h"
      13             : #include "mozilla/dom/PrimitiveConversions.h"
      14             : #include "mozilla/dom/SVGStyleElement.h"
      15             : #include "mozilla/dom/XrayExpandoClass.h"
      16             : 
      17             : namespace mozilla {
      18             : namespace dom {
      19             : 
      20             : namespace SVGStyleElementBinding {
      21             : 
      22             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGElementBinding::NativeType>::value,
      23             :               "Can't inherit from an interface with a different ownership model.");
      24             : 
      25             : static bool
      26           0 : get_xmlspace(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGStyleElement* self, JSJitGetterCallArgs args)
      27             : {
      28           0 :   DOMString result;
      29           0 :   self->GetXmlspace(result);
      30           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      31           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
      32           0 :     return false;
      33             :   }
      34           0 :   return true;
      35             : }
      36             : 
      37             : static bool
      38           0 : set_xmlspace(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGStyleElement* self, JSJitSetterCallArgs args)
      39             : {
      40           0 :   binding_detail::FakeString arg0;
      41           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
      42           0 :     return false;
      43             :   }
      44           0 :   binding_detail::FastErrorResult rv;
      45           0 :   self->SetXmlspace(NonNullHelper(Constify(arg0)), rv);
      46           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
      47           0 :     return false;
      48             :   }
      49           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      50             : 
      51           0 :   return true;
      52             : }
      53             : 
      54             : static const JSJitInfo xmlspace_getterinfo = {
      55             :   { (JSJitGetterOp)get_xmlspace },
      56             :   { prototypes::id::SVGStyleElement },
      57             :   { PrototypeTraits<prototypes::id::SVGStyleElement>::Depth },
      58             :   JSJitInfo::Getter,
      59             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      60             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
      61             :   false,  /* isInfallible. False in setters. */
      62             :   false,  /* isMovable.  Not relevant for setters. */
      63             :   false, /* isEliminatable.  Not relevant for setters. */
      64             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      65             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      66             :   false,  /* isTypedMethod.  Only relevant for methods. */
      67             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      68             : };
      69             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      70             : static_assert(0 < 1, "There is no slot for us");
      71             : static const JSJitInfo xmlspace_setterinfo = {
      72             :   { (JSJitGetterOp)set_xmlspace },
      73             :   { prototypes::id::SVGStyleElement },
      74             :   { PrototypeTraits<prototypes::id::SVGStyleElement>::Depth },
      75             :   JSJitInfo::Setter,
      76             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      77             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
      78             :   false,  /* isInfallible. False in setters. */
      79             :   false,  /* isMovable.  Not relevant for setters. */
      80             :   false, /* isEliminatable.  Not relevant for setters. */
      81             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      82             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      83             :   false,  /* isTypedMethod.  Only relevant for methods. */
      84             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      85             : };
      86             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      87             : static_assert(0 < 1, "There is no slot for us");
      88             : 
      89             : static bool
      90           0 : get_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGStyleElement* self, JSJitGetterCallArgs args)
      91             : {
      92           0 :   DOMString result;
      93           0 :   self->GetType(result);
      94           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      95           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
      96           0 :     return false;
      97             :   }
      98           0 :   return true;
      99             : }
     100             : 
     101             : static bool
     102           0 : set_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGStyleElement* self, JSJitSetterCallArgs args)
     103             : {
     104           0 :   binding_detail::FakeString arg0;
     105           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     106           0 :     return false;
     107             :   }
     108           0 :   binding_detail::FastErrorResult rv;
     109           0 :   self->SetType(NonNullHelper(Constify(arg0)), rv);
     110           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     111           0 :     return false;
     112             :   }
     113           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     114             : 
     115           0 :   return true;
     116             : }
     117             : 
     118             : static const JSJitInfo type_getterinfo = {
     119             :   { (JSJitGetterOp)get_type },
     120             :   { prototypes::id::SVGStyleElement },
     121             :   { PrototypeTraits<prototypes::id::SVGStyleElement>::Depth },
     122             :   JSJitInfo::Getter,
     123             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     124             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     125             :   false,  /* isInfallible. False in setters. */
     126             :   false,  /* isMovable.  Not relevant for setters. */
     127             :   false, /* isEliminatable.  Not relevant for setters. */
     128             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     129             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     130             :   false,  /* isTypedMethod.  Only relevant for methods. */
     131             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     132             : };
     133             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     134             : static_assert(0 < 1, "There is no slot for us");
     135             : static const JSJitInfo type_setterinfo = {
     136             :   { (JSJitGetterOp)set_type },
     137             :   { prototypes::id::SVGStyleElement },
     138             :   { PrototypeTraits<prototypes::id::SVGStyleElement>::Depth },
     139             :   JSJitInfo::Setter,
     140             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     141             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     142             :   false,  /* isInfallible. False in setters. */
     143             :   false,  /* isMovable.  Not relevant for setters. */
     144             :   false, /* isEliminatable.  Not relevant for setters. */
     145             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     146             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     147             :   false,  /* isTypedMethod.  Only relevant for methods. */
     148             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     149             : };
     150             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     151             : static_assert(0 < 1, "There is no slot for us");
     152             : 
     153             : static bool
     154           0 : get_media(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGStyleElement* self, JSJitGetterCallArgs args)
     155             : {
     156           0 :   DOMString result;
     157           0 :   self->GetMedia(result);
     158           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     159           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     160           0 :     return false;
     161             :   }
     162           0 :   return true;
     163             : }
     164             : 
     165             : static bool
     166           0 : set_media(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGStyleElement* self, JSJitSetterCallArgs args)
     167             : {
     168           0 :   binding_detail::FakeString arg0;
     169           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     170           0 :     return false;
     171             :   }
     172           0 :   binding_detail::FastErrorResult rv;
     173           0 :   self->SetMedia(NonNullHelper(Constify(arg0)), rv);
     174           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     175           0 :     return false;
     176             :   }
     177           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     178             : 
     179           0 :   return true;
     180             : }
     181             : 
     182             : static const JSJitInfo media_getterinfo = {
     183             :   { (JSJitGetterOp)get_media },
     184             :   { prototypes::id::SVGStyleElement },
     185             :   { PrototypeTraits<prototypes::id::SVGStyleElement>::Depth },
     186             :   JSJitInfo::Getter,
     187             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     188             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     189             :   false,  /* isInfallible. False in setters. */
     190             :   false,  /* isMovable.  Not relevant for setters. */
     191             :   false, /* isEliminatable.  Not relevant for setters. */
     192             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     193             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     194             :   false,  /* isTypedMethod.  Only relevant for methods. */
     195             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     196             : };
     197             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     198             : static_assert(0 < 1, "There is no slot for us");
     199             : static const JSJitInfo media_setterinfo = {
     200             :   { (JSJitGetterOp)set_media },
     201             :   { prototypes::id::SVGStyleElement },
     202             :   { PrototypeTraits<prototypes::id::SVGStyleElement>::Depth },
     203             :   JSJitInfo::Setter,
     204             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     205             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     206             :   false,  /* isInfallible. False in setters. */
     207             :   false,  /* isMovable.  Not relevant for setters. */
     208             :   false, /* isEliminatable.  Not relevant for setters. */
     209             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     210             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     211             :   false,  /* isTypedMethod.  Only relevant for methods. */
     212             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     213             : };
     214             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     215             : static_assert(0 < 1, "There is no slot for us");
     216             : 
     217             : static bool
     218           0 : get_title(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGStyleElement* self, JSJitGetterCallArgs args)
     219             : {
     220           0 :   DOMString result;
     221           0 :   self->GetTitle(result);
     222           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     223           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     224           0 :     return false;
     225             :   }
     226           0 :   return true;
     227             : }
     228             : 
     229             : static bool
     230           0 : set_title(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGStyleElement* self, JSJitSetterCallArgs args)
     231             : {
     232           0 :   binding_detail::FakeString arg0;
     233           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     234           0 :     return false;
     235             :   }
     236           0 :   binding_detail::FastErrorResult rv;
     237           0 :   self->SetTitle(NonNullHelper(Constify(arg0)), rv);
     238           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     239           0 :     return false;
     240             :   }
     241           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     242             : 
     243           0 :   return true;
     244             : }
     245             : 
     246             : static const JSJitInfo title_getterinfo = {
     247             :   { (JSJitGetterOp)get_title },
     248             :   { prototypes::id::SVGStyleElement },
     249             :   { PrototypeTraits<prototypes::id::SVGStyleElement>::Depth },
     250             :   JSJitInfo::Getter,
     251             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     252             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     253             :   false,  /* isInfallible. False in setters. */
     254             :   false,  /* isMovable.  Not relevant for setters. */
     255             :   false, /* isEliminatable.  Not relevant for setters. */
     256             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     257             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     258             :   false,  /* isTypedMethod.  Only relevant for methods. */
     259             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     260             : };
     261             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     262             : static_assert(0 < 1, "There is no slot for us");
     263             : static const JSJitInfo title_setterinfo = {
     264             :   { (JSJitGetterOp)set_title },
     265             :   { prototypes::id::SVGStyleElement },
     266             :   { PrototypeTraits<prototypes::id::SVGStyleElement>::Depth },
     267             :   JSJitInfo::Setter,
     268             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     269             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     270             :   false,  /* isInfallible. False in setters. */
     271             :   false,  /* isMovable.  Not relevant for setters. */
     272             :   false, /* isEliminatable.  Not relevant for setters. */
     273             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     274             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     275             :   false,  /* isTypedMethod.  Only relevant for methods. */
     276             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     277             : };
     278             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     279             : static_assert(0 < 1, "There is no slot for us");
     280             : 
     281             : static bool
     282           0 : get_scoped(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGStyleElement* self, JSJitGetterCallArgs args)
     283             : {
     284           0 :   bool result(self->Scoped());
     285           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     286           0 :   args.rval().setBoolean(result);
     287           0 :   return true;
     288             : }
     289             : 
     290             : static bool
     291           0 : set_scoped(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGStyleElement* self, JSJitSetterCallArgs args)
     292             : {
     293             :   bool arg0;
     294           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
     295           0 :     return false;
     296             :   }
     297           0 :   binding_detail::FastErrorResult rv;
     298           0 :   self->SetScoped(arg0, rv);
     299           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     300           0 :     return false;
     301             :   }
     302           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     303             : 
     304           0 :   return true;
     305             : }
     306             : 
     307             : static const JSJitInfo scoped_getterinfo = {
     308             :   { (JSJitGetterOp)get_scoped },
     309             :   { prototypes::id::SVGStyleElement },
     310             :   { PrototypeTraits<prototypes::id::SVGStyleElement>::Depth },
     311             :   JSJitInfo::Getter,
     312             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     313             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     314             :   true,  /* isInfallible. False in setters. */
     315             :   false,  /* isMovable.  Not relevant for setters. */
     316             :   false, /* isEliminatable.  Not relevant for setters. */
     317             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     318             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     319             :   false,  /* isTypedMethod.  Only relevant for methods. */
     320             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     321             : };
     322             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     323             : static_assert(0 < 1, "There is no slot for us");
     324             : static const JSJitInfo scoped_setterinfo = {
     325             :   { (JSJitGetterOp)set_scoped },
     326             :   { prototypes::id::SVGStyleElement },
     327             :   { PrototypeTraits<prototypes::id::SVGStyleElement>::Depth },
     328             :   JSJitInfo::Setter,
     329             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     330             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     331             :   false,  /* isInfallible. False in setters. */
     332             :   false,  /* isMovable.  Not relevant for setters. */
     333             :   false, /* isEliminatable.  Not relevant for setters. */
     334             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     335             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     336             :   false,  /* isTypedMethod.  Only relevant for methods. */
     337             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     338             : };
     339             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     340             : static_assert(0 < 1, "There is no slot for us");
     341             : 
     342             : static bool
     343           0 : get_sheet(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGStyleElement* self, JSJitGetterCallArgs args)
     344             : {
     345           0 :   auto result(StrongOrRawPtr<mozilla::StyleSheet>(self->GetSheet()));
     346           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     347           0 :   if (!result) {
     348           0 :     args.rval().setNull();
     349           0 :     return true;
     350             :   }
     351           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     352           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     353           0 :     return false;
     354             :   }
     355           0 :   return true;
     356             : }
     357             : 
     358             : static const JSJitInfo sheet_getterinfo = {
     359             :   { (JSJitGetterOp)get_sheet },
     360             :   { prototypes::id::SVGStyleElement },
     361             :   { PrototypeTraits<prototypes::id::SVGStyleElement>::Depth },
     362             :   JSJitInfo::Getter,
     363             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     364             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     365             :   false,  /* isInfallible. False in setters. */
     366             :   false,  /* isMovable.  Not relevant for setters. */
     367             :   false, /* isEliminatable.  Not relevant for setters. */
     368             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     369             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     370             :   false,  /* isTypedMethod.  Only relevant for methods. */
     371             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     372             : };
     373             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     374             : static_assert(0 < 1, "There is no slot for us");
     375             : 
     376             : static bool
     377           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     378             : {
     379           0 :   mozilla::dom::SVGStyleElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGStyleElement>(obj);
     380             :   // We don't want to preserve if we don't have a wrapper, and we
     381             :   // obviously can't preserve if we're not initialized.
     382           0 :   if (self && self->GetWrapperPreserveColor()) {
     383           0 :     PreserveWrapper(self);
     384             :   }
     385           0 :   return true;
     386             : }
     387             : 
     388             : static void
     389           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     390             : {
     391           0 :   mozilla::dom::SVGStyleElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGStyleElement>(obj);
     392           0 :   if (self) {
     393           0 :     ClearWrapper(self, self, obj);
     394           0 :     AddForDeferredFinalization<mozilla::dom::SVGStyleElement>(self);
     395             :   }
     396           0 : }
     397             : 
     398             : static void
     399           0 : _objectMoved(JSObject* obj, const JSObject* old)
     400             : {
     401           0 :   mozilla::dom::SVGStyleElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGStyleElement>(obj);
     402           0 :   if (self) {
     403           0 :     UpdateWrapper(self, self, obj, old);
     404             :   }
     405           0 : }
     406             : 
     407             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     408             : #if defined(__clang__)
     409             : #pragma clang diagnostic push
     410             : #pragma clang diagnostic ignored "-Wmissing-braces"
     411             : #endif
     412             : static const JSPropertySpec sAttributes_specs[] = {
     413             :   { "xmlspace", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &xmlspace_getterinfo, GenericBindingSetter, &xmlspace_setterinfo },
     414             :   { "type", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &type_getterinfo, GenericBindingSetter, &type_setterinfo },
     415             :   { "media", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &media_getterinfo, GenericBindingSetter, &media_setterinfo },
     416             :   { "title", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &title_getterinfo, GenericBindingSetter, &title_setterinfo },
     417             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr },
     418             :   { "scoped", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &scoped_getterinfo, GenericBindingSetter, &scoped_setterinfo },
     419             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr },
     420             :   { "sheet", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &sheet_getterinfo, nullptr, nullptr },
     421             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     422             : };
     423             : #if defined(__clang__)
     424             : #pragma clang diagnostic pop
     425             : #endif
     426             : 
     427             : static PrefableDisablers sAttributes_disablers5 = {
     428             :   true, false, 0, nullptr
     429             : };
     430             : 
     431             : // Can't be const because the pref-enabled boolean needs to be writable
     432             : static Prefable<const JSPropertySpec> sAttributes[] = {
     433             :   { nullptr, &sAttributes_specs[0] },
     434             :   { &sAttributes_disablers5, &sAttributes_specs[5] },
     435             :   { nullptr, &sAttributes_specs[7] },
     436             :   { nullptr, nullptr }
     437             : };
     438             : 
     439             : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     440             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     441             : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     442             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     443             : 
     444             : 
     445             : static uint16_t sNativeProperties_sortedPropertyIndices[6];
     446             : static PropertyInfo sNativeProperties_propertyInfos[6];
     447             : 
     448             : static const NativePropertiesN<1> sNativeProperties = {
     449             :   false, 0,
     450             :   false, 0,
     451             :   false, 0,
     452             :   true,  0 /* sAttributes */,
     453             :   false, 0,
     454             :   false, 0,
     455             :   false, 0,
     456             :   -1,
     457             :   6,
     458             :   sNativeProperties_sortedPropertyIndices,
     459             :   {
     460             :     { sAttributes, &sNativeProperties_propertyInfos[0] }
     461             :   }
     462             : };
     463             : static_assert(6 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     464             :     "We have a property info count that is oversized");
     465             : 
     466             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     467             :   {
     468             :     "Function",
     469             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     470             :     &sBoringInterfaceObjectClassClassOps,
     471             :     JS_NULL_CLASS_SPEC,
     472             :     JS_NULL_CLASS_EXT,
     473             :     &sInterfaceObjectClassObjectOps
     474             :   },
     475             :   eInterface,
     476             :   true,
     477             :   prototypes::id::SVGStyleElement,
     478             :   PrototypeTraits<prototypes::id::SVGStyleElement>::Depth,
     479             :   sNativePropertyHooks,
     480             :   "function SVGStyleElement() {\n    [native code]\n}",
     481             :   SVGElementBinding::GetConstructorObject
     482             : };
     483             : 
     484             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     485             :   {
     486             :     "SVGStyleElementPrototype",
     487             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     488             :     JS_NULL_CLASS_OPS,
     489             :     JS_NULL_CLASS_SPEC,
     490             :     JS_NULL_CLASS_EXT,
     491             :     JS_NULL_OBJECT_OPS
     492             :   },
     493             :   eInterfacePrototype,
     494             :   false,
     495             :   prototypes::id::SVGStyleElement,
     496             :   PrototypeTraits<prototypes::id::SVGStyleElement>::Depth,
     497             :   sNativePropertyHooks,
     498             :   "[object SVGStyleElementPrototype]",
     499             :   SVGElementBinding::GetProtoObject
     500             : };
     501             : 
     502             : JSObject*
     503           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     504             : {
     505           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     506             : }
     507             : 
     508             : static const js::ClassOps sClassOps = {
     509             :   _addProperty, /* addProperty */
     510             :   nullptr,               /* delProperty */
     511             :   nullptr,               /* getProperty */
     512             :   nullptr,               /* setProperty */
     513             :   nullptr,               /* enumerate */
     514             :   nullptr, /* newEnumerate */
     515             :   nullptr, /* resolve */
     516             :   nullptr, /* mayResolve */
     517             :   _finalize, /* finalize */
     518             :   nullptr, /* call */
     519             :   nullptr,               /* hasInstance */
     520             :   nullptr,               /* construct */
     521             :   nullptr, /* trace */
     522             : };
     523             : 
     524             : static const js::ClassExtension sClassExtension = {
     525             :   nullptr, /* weakmapKeyDelegateOp */
     526             :   _objectMoved /* objectMovedOp */
     527             : };
     528             : 
     529             : static const DOMJSClass sClass = {
     530             :   { "SVGStyleElement",
     531             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
     532             :     &sClassOps,
     533             :     JS_NULL_CLASS_SPEC,
     534             :     &sClassExtension,
     535             :     JS_NULL_OBJECT_OPS
     536             :   },
     537             :   { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGStyleElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
     538             :   IsBaseOf<nsISupports, mozilla::dom::SVGStyleElement >::value,
     539             :   sNativePropertyHooks,
     540             :   FindAssociatedGlobalForNative<mozilla::dom::SVGStyleElement>::Get,
     541             :   GetProtoObjectHandle,
     542             :   GetCCParticipant<mozilla::dom::SVGStyleElement>::Get()
     543             : };
     544             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     545             :               "Must have the right minimal number of reserved slots.");
     546             : static_assert(1 >= 1,
     547             :               "Must have enough reserved slots.");
     548             : 
     549             : const JSClass*
     550           0 : GetJSClass()
     551             : {
     552           0 :   return sClass.ToJSClass();
     553             : }
     554             : 
     555             : bool
     556           0 : Wrap(JSContext* aCx, mozilla::dom::SVGStyleElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     557             : {
     558             :   MOZ_ASSERT(static_cast<mozilla::dom::SVGStyleElement*>(aObject) ==
     559             :              reinterpret_cast<mozilla::dom::SVGStyleElement*>(aObject),
     560             :              "Multiple inheritance for mozilla::dom::SVGStyleElement is broken.");
     561             :   MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
     562             :              reinterpret_cast<nsSVGElement*>(aObject),
     563             :              "Multiple inheritance for nsSVGElement is broken.");
     564             :   MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
     565             :              reinterpret_cast<mozilla::dom::Element*>(aObject),
     566             :              "Multiple inheritance for mozilla::dom::Element is broken.");
     567             :   MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
     568             :              reinterpret_cast<nsINode*>(aObject),
     569             :              "Multiple inheritance for nsINode is broken.");
     570             :   MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
     571             :              reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
     572             :              "Multiple inheritance for mozilla::dom::EventTarget is broken.");
     573           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     574           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     575           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     576             :              "You should probably not be using Wrap() directly; use "
     577             :              "GetOrCreateDOMReflector instead");
     578             : 
     579           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     580             :              "nsISupports must be on our primary inheritance chain");
     581             : 
     582           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     583           0 :   if (!global) {
     584           0 :     return false;
     585             :   }
     586           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     587           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     588             : 
     589             :   // That might have ended up wrapping us already, due to the wonders
     590             :   // of XBL.  Check for that, and bail out as needed.
     591           0 :   aReflector.set(aCache->GetWrapper());
     592           0 :   if (aReflector) {
     593             : #ifdef DEBUG
     594           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     595             : #endif // DEBUG
     596           0 :     return true;
     597             :   }
     598             : 
     599           0 :   JSAutoCompartment ac(aCx, global);
     600           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     601           0 :   if (!canonicalProto) {
     602           0 :     return false;
     603             :   }
     604           0 :   JS::Rooted<JSObject*> proto(aCx);
     605           0 :   if (aGivenProto) {
     606           0 :     proto = aGivenProto;
     607             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     608             :     // coming in, we changed compartments to that of "parent" so may need
     609             :     // to wrap the proto here.
     610           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     611           0 :       if (!JS_WrapObject(aCx, &proto)) {
     612           0 :         return false;
     613             :       }
     614             :     }
     615             :   } else {
     616           0 :     proto = canonicalProto;
     617             :   }
     618             : 
     619           0 :   BindingJSObjectCreator<mozilla::dom::SVGStyleElement> creator(aCx);
     620           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     621           0 :   if (!aReflector) {
     622           0 :     return false;
     623             :   }
     624             : 
     625           0 :   aCache->SetWrapper(aReflector);
     626           0 :   creator.InitializationSucceeded();
     627             : 
     628           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     629             :              aCache->GetWrapperPreserveColor() == aReflector);
     630             :   // If proto != canonicalProto, we have to preserve our wrapper;
     631             :   // otherwise we won't be able to properly recreate it later, since
     632             :   // we won't know what proto to use.  Note that we don't check
     633             :   // aGivenProto here, since it's entirely possible (and even
     634             :   // somewhat common) to have a non-null aGivenProto which is the
     635             :   // same as canonicalProto.
     636           0 :   if (proto != canonicalProto) {
     637           0 :     PreserveWrapper(aObject);
     638             :   }
     639             : 
     640           0 :   return true;
     641             : }
     642             : 
     643             : const NativePropertyHooks sNativePropertyHooks[] = { {
     644             :   nullptr,
     645             :   nullptr,
     646             :   nullptr,
     647             :   { sNativeProperties.Upcast(), nullptr },
     648             :   prototypes::id::SVGStyleElement,
     649             :   constructors::id::SVGStyleElement,
     650             :   SVGElementBinding::sNativePropertyHooks,
     651             :   &DefaultXrayExpandoObjectClass
     652             : } };
     653             : 
     654             : void
     655           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     656             : {
     657           0 :   JS::Handle<JSObject*> parentProto(SVGElementBinding::GetProtoObjectHandle(aCx));
     658           0 :   if (!parentProto) {
     659           0 :     return;
     660             :   }
     661             : 
     662           0 :   JS::Handle<JSObject*> constructorProto(SVGElementBinding::GetConstructorObjectHandle(aCx));
     663           0 :   if (!constructorProto) {
     664           0 :     return;
     665             :   }
     666             : 
     667             :   static bool sIdsInited = false;
     668           0 :   if (!sIdsInited && NS_IsMainThread()) {
     669           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     670           0 :       return;
     671             :     }
     672           0 :     sIdsInited = true;
     673             :   }
     674             : 
     675             :   static bool sPrefCachesInited = false;
     676           0 :   if (!sPrefCachesInited && NS_IsMainThread()) {
     677           0 :     sPrefCachesInited = true;
     678           0 :     Preferences::AddBoolVarCache(&sAttributes[1].disablers->enabled, "layout.css.scoped-style.enabled");
     679             :   }
     680             : 
     681           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGStyleElement);
     682           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGStyleElement);
     683           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     684             :                               &sPrototypeClass.mBase, protoCache,
     685             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     686             :                               interfaceCache,
     687             :                               sNativeProperties.Upcast(),
     688             :                               nullptr,
     689             :                               "SVGStyleElement", aDefineOnGlobal,
     690             :                               nullptr,
     691           0 :                               false);
     692             : }
     693             : 
     694             : JS::Handle<JSObject*>
     695           0 : GetProtoObjectHandle(JSContext* aCx)
     696             : {
     697             :   /* Get the interface prototype object for this class.  This will create the
     698             :      object as needed. */
     699           0 :   bool aDefineOnGlobal = true;
     700             : 
     701             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     702           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     703           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     704           0 :     return nullptr;
     705             :   }
     706             : 
     707             :   /* Check to see whether the interface objects are already installed */
     708           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     709           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGStyleElement)) {
     710           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     711           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     712             :   }
     713             : 
     714             :   /*
     715             :    * The object might _still_ be null, but that's OK.
     716             :    *
     717             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     718             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     719             :    * changed after they have been set.
     720             :    *
     721             :    * Calling address() avoids the read read barrier that does gray
     722             :    * unmarking, but it's not possible for the object to be gray here.
     723             :    */
     724             : 
     725           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGStyleElement);
     726           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     727           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     728             : }
     729             : 
     730             : JS::Handle<JSObject*>
     731           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     732             : {
     733             :   /* Get the interface object for this class.  This will create the object as
     734             :      needed. */
     735             : 
     736             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     737           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     738           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     739           0 :     return nullptr;
     740             :   }
     741             : 
     742             :   /* Check to see whether the interface objects are already installed */
     743           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     744           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGStyleElement)) {
     745           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     746           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     747             :   }
     748             : 
     749             :   /*
     750             :    * The object might _still_ be null, but that's OK.
     751             :    *
     752             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     753             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     754             :    * changed after they have been set.
     755             :    *
     756             :    * Calling address() avoids the read read barrier that does gray
     757             :    * unmarking, but it's not possible for the object to be gray here.
     758             :    */
     759             : 
     760           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGStyleElement);
     761           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     762           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     763             : }
     764             : 
     765             : JSObject*
     766           0 : GetConstructorObject(JSContext* aCx)
     767             : {
     768           0 :   return GetConstructorObjectHandle(aCx);
     769             : }
     770             : 
     771             : } // namespace SVGStyleElementBinding
     772             : 
     773             : 
     774             : 
     775             : } // namespace dom
     776             : } // namespace mozilla

Generated by: LCOV version 1.13