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

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

Generated by: LCOV version 1.13