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

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

Generated by: LCOV version 1.13