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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM CSSConditionRule.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "CSSConditionRuleBinding.h"
       4             : #include "CSSGroupingRuleBinding.h"
       5             : #include "WrapperFactory.h"
       6             : #include "mozilla/OwningNonNull.h"
       7             : #include "mozilla/css/GroupRule.h"
       8             : #include "mozilla/dom/BindingUtils.h"
       9             : #include "mozilla/dom/DOMJSClass.h"
      10             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      11             : #include "mozilla/dom/XrayExpandoClass.h"
      12             : 
      13             : namespace mozilla {
      14             : namespace dom {
      15             : 
      16             : namespace CSSConditionRuleBinding {
      17             : 
      18             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<CSSGroupingRuleBinding::NativeType>::value,
      19             :               "Can't inherit from an interface with a different ownership model.");
      20             : 
      21             : static bool
      22           0 : get_conditionText(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::css::ConditionRule* self, JSJitGetterCallArgs args)
      23             : {
      24           0 :   DOMString result;
      25           0 :   self->GetConditionText(result);
      26           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      27           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
      28           0 :     return false;
      29             :   }
      30           0 :   return true;
      31             : }
      32             : 
      33             : static bool
      34           0 : set_conditionText(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::css::ConditionRule* self, JSJitSetterCallArgs args)
      35             : {
      36           0 :   binding_detail::FakeString arg0;
      37           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
      38           0 :     return false;
      39             :   }
      40           0 :   binding_detail::FastErrorResult rv;
      41           0 :   self->SetConditionText(NonNullHelper(Constify(arg0)), rv);
      42           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
      43           0 :     return false;
      44             :   }
      45           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      46             : 
      47           0 :   return true;
      48             : }
      49             : 
      50             : static const JSJitInfo conditionText_getterinfo = {
      51             :   { (JSJitGetterOp)get_conditionText },
      52             :   { prototypes::id::CSSConditionRule },
      53             :   { PrototypeTraits<prototypes::id::CSSConditionRule>::Depth },
      54             :   JSJitInfo::Getter,
      55             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      56             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
      57             :   false,  /* isInfallible. False in setters. */
      58             :   false,  /* isMovable.  Not relevant for setters. */
      59             :   false, /* isEliminatable.  Not relevant for setters. */
      60             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      61             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      62             :   false,  /* isTypedMethod.  Only relevant for methods. */
      63             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      64             : };
      65             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      66             : static_assert(0 < 1, "There is no slot for us");
      67             : static const JSJitInfo conditionText_setterinfo = {
      68             :   { (JSJitGetterOp)set_conditionText },
      69             :   { prototypes::id::CSSConditionRule },
      70             :   { PrototypeTraits<prototypes::id::CSSConditionRule>::Depth },
      71             :   JSJitInfo::Setter,
      72             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      73             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
      74             :   false,  /* isInfallible. False in setters. */
      75             :   false,  /* isMovable.  Not relevant for setters. */
      76             :   false, /* isEliminatable.  Not relevant for setters. */
      77             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      78             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      79             :   false,  /* isTypedMethod.  Only relevant for methods. */
      80             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      81             : };
      82             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      83             : static_assert(0 < 1, "There is no slot for us");
      84             : 
      85             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
      86             : #if defined(__clang__)
      87             : #pragma clang diagnostic push
      88             : #pragma clang diagnostic ignored "-Wmissing-braces"
      89             : #endif
      90             : static const JSPropertySpec sAttributes_specs[] = {
      91             :   { "conditionText", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &conditionText_getterinfo, GenericBindingSetter, &conditionText_setterinfo },
      92             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
      93             : };
      94             : #if defined(__clang__)
      95             : #pragma clang diagnostic pop
      96             : #endif
      97             : 
      98             : 
      99             : // Can't be const because the pref-enabled boolean needs to be writable
     100             : static Prefable<const JSPropertySpec> sAttributes[] = {
     101             :   { nullptr, &sAttributes_specs[0] },
     102             :   { nullptr, nullptr }
     103             : };
     104             : 
     105             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     106             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     107             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     108             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     109             : 
     110             : 
     111             : static uint16_t sNativeProperties_sortedPropertyIndices[1];
     112             : static PropertyInfo sNativeProperties_propertyInfos[1];
     113             : 
     114             : static const NativePropertiesN<1> sNativeProperties = {
     115             :   false, 0,
     116             :   false, 0,
     117             :   false, 0,
     118             :   true,  0 /* sAttributes */,
     119             :   false, 0,
     120             :   false, 0,
     121             :   false, 0,
     122             :   -1,
     123             :   1,
     124             :   sNativeProperties_sortedPropertyIndices,
     125             :   {
     126             :     { sAttributes, &sNativeProperties_propertyInfos[0] }
     127             :   }
     128             : };
     129             : static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     130             :     "We have a property info count that is oversized");
     131             : 
     132             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     133             :   {
     134             :     "Function",
     135             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     136             :     &sBoringInterfaceObjectClassClassOps,
     137             :     JS_NULL_CLASS_SPEC,
     138             :     JS_NULL_CLASS_EXT,
     139             :     &sInterfaceObjectClassObjectOps
     140             :   },
     141             :   eInterface,
     142             :   true,
     143             :   prototypes::id::CSSConditionRule,
     144             :   PrototypeTraits<prototypes::id::CSSConditionRule>::Depth,
     145             :   sNativePropertyHooks,
     146             :   "function CSSConditionRule() {\n    [native code]\n}",
     147             :   CSSGroupingRuleBinding::GetConstructorObject
     148             : };
     149             : 
     150             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     151             :   {
     152             :     "CSSConditionRulePrototype",
     153             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     154             :     JS_NULL_CLASS_OPS,
     155             :     JS_NULL_CLASS_SPEC,
     156             :     JS_NULL_CLASS_EXT,
     157             :     JS_NULL_OBJECT_OPS
     158             :   },
     159             :   eInterfacePrototype,
     160             :   false,
     161             :   prototypes::id::CSSConditionRule,
     162             :   PrototypeTraits<prototypes::id::CSSConditionRule>::Depth,
     163             :   sNativePropertyHooks,
     164             :   "[object CSSConditionRulePrototype]",
     165             :   CSSGroupingRuleBinding::GetProtoObject
     166             : };
     167             : 
     168             : JSObject*
     169           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     170             : {
     171           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     172             : }
     173             : 
     174             : const NativePropertyHooks sNativePropertyHooks[] = { {
     175             :   nullptr,
     176             :   nullptr,
     177             :   nullptr,
     178             :   { sNativeProperties.Upcast(), nullptr },
     179             :   prototypes::id::CSSConditionRule,
     180             :   constructors::id::CSSConditionRule,
     181             :   CSSGroupingRuleBinding::sNativePropertyHooks,
     182             :   &DefaultXrayExpandoObjectClass
     183             : } };
     184             : 
     185             : void
     186           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     187             : {
     188           0 :   JS::Handle<JSObject*> parentProto(CSSGroupingRuleBinding::GetProtoObjectHandle(aCx));
     189           0 :   if (!parentProto) {
     190           0 :     return;
     191             :   }
     192             : 
     193           0 :   JS::Handle<JSObject*> constructorProto(CSSGroupingRuleBinding::GetConstructorObjectHandle(aCx));
     194           0 :   if (!constructorProto) {
     195           0 :     return;
     196             :   }
     197             : 
     198             :   static bool sIdsInited = false;
     199           0 :   if (!sIdsInited && NS_IsMainThread()) {
     200           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     201           0 :       return;
     202             :     }
     203           0 :     sIdsInited = true;
     204             :   }
     205             : 
     206           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::CSSConditionRule);
     207           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::CSSConditionRule);
     208           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     209             :                               &sPrototypeClass.mBase, protoCache,
     210             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     211             :                               interfaceCache,
     212             :                               sNativeProperties.Upcast(),
     213             :                               nullptr,
     214             :                               "CSSConditionRule", aDefineOnGlobal,
     215             :                               nullptr,
     216           0 :                               false);
     217             : }
     218             : 
     219             : JS::Handle<JSObject*>
     220           0 : GetProtoObjectHandle(JSContext* aCx)
     221             : {
     222             :   /* Get the interface prototype object for this class.  This will create the
     223             :      object as needed. */
     224           0 :   bool aDefineOnGlobal = true;
     225             : 
     226             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     227           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     228           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     229           0 :     return nullptr;
     230             :   }
     231             : 
     232             :   /* Check to see whether the interface objects are already installed */
     233           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     234           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::CSSConditionRule)) {
     235           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     236           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     237             :   }
     238             : 
     239             :   /*
     240             :    * The object might _still_ be null, but that's OK.
     241             :    *
     242             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     243             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     244             :    * changed after they have been set.
     245             :    *
     246             :    * Calling address() avoids the read read barrier that does gray
     247             :    * unmarking, but it's not possible for the object to be gray here.
     248             :    */
     249             : 
     250           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::CSSConditionRule);
     251           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     252           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     253             : }
     254             : 
     255             : JSObject*
     256           0 : GetProtoObject(JSContext* aCx)
     257             : {
     258           0 :   return GetProtoObjectHandle(aCx);
     259             : }
     260             : 
     261             : JS::Handle<JSObject*>
     262           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     263             : {
     264             :   /* Get the interface object for this class.  This will create the object as
     265             :      needed. */
     266             : 
     267             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     268           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     269           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     270           0 :     return nullptr;
     271             :   }
     272             : 
     273             :   /* Check to see whether the interface objects are already installed */
     274           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     275           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::CSSConditionRule)) {
     276           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     277           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     278             :   }
     279             : 
     280             :   /*
     281             :    * The object might _still_ be null, but that's OK.
     282             :    *
     283             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     284             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     285             :    * changed after they have been set.
     286             :    *
     287             :    * Calling address() avoids the read read barrier that does gray
     288             :    * unmarking, but it's not possible for the object to be gray here.
     289             :    */
     290             : 
     291           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::CSSConditionRule);
     292           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     293           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     294             : }
     295             : 
     296             : JSObject*
     297           0 : GetConstructorObject(JSContext* aCx)
     298             : {
     299           0 :   return GetConstructorObjectHandle(aCx);
     300             : }
     301             : 
     302             : } // namespace CSSConditionRuleBinding
     303             : 
     304             : 
     305             : 
     306             : } // namespace dom
     307             : } // namespace mozilla

Generated by: LCOV version 1.13