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

Generated by: LCOV version 1.13