LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dom/bindings - IDBFileRequestBinding.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 134 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 IDBFileRequest.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "DOMRequestBinding.h"
       4             : #include "EventHandlerBinding.h"
       5             : #include "IDBFileRequestBinding.h"
       6             : #include "WrapperFactory.h"
       7             : #include "mozilla/OwningNonNull.h"
       8             : #include "mozilla/dom/BindingUtils.h"
       9             : #include "mozilla/dom/DOMJSClass.h"
      10             : #include "mozilla/dom/IDBFileHandle.h"
      11             : #include "mozilla/dom/IDBFileRequest.h"
      12             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      13             : #include "mozilla/dom/Nullable.h"
      14             : #include "mozilla/dom/XrayExpandoClass.h"
      15             : 
      16             : namespace mozilla {
      17             : namespace dom {
      18             : 
      19             : namespace IDBFileRequestBinding {
      20             : 
      21             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<DOMRequestBinding::NativeType>::value,
      22             :               "Can't inherit from an interface with a different ownership model.");
      23             : 
      24             : static bool
      25           0 : get_fileHandle(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::IDBFileRequest* self, JSJitGetterCallArgs args)
      26             : {
      27           0 :   auto result(StrongOrRawPtr<mozilla::dom::IDBFileHandle>(self->GetFileHandle()));
      28           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      29           0 :   if (!result) {
      30           0 :     args.rval().setNull();
      31           0 :     return true;
      32             :   }
      33           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      34           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      35           0 :     return false;
      36             :   }
      37           0 :   return true;
      38             : }
      39             : 
      40             : static const JSJitInfo fileHandle_getterinfo = {
      41             :   { (JSJitGetterOp)get_fileHandle },
      42             :   { prototypes::id::IDBFileRequest },
      43             :   { PrototypeTraits<prototypes::id::IDBFileRequest>::Depth },
      44             :   JSJitInfo::Getter,
      45             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      46             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
      47             :   false,  /* isInfallible. False in setters. */
      48             :   false,  /* isMovable.  Not relevant for setters. */
      49             :   false, /* isEliminatable.  Not relevant for setters. */
      50             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      51             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      52             :   false,  /* isTypedMethod.  Only relevant for methods. */
      53             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      54             : };
      55             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      56             : static_assert(0 < 1, "There is no slot for us");
      57             : 
      58             : static bool
      59           0 : get_lockedFile(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::IDBFileRequest* self, JSJitGetterCallArgs args)
      60             : {
      61           0 :   auto result(StrongOrRawPtr<mozilla::dom::IDBFileHandle>(self->GetLockedFile()));
      62           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      63           0 :   if (!result) {
      64           0 :     args.rval().setNull();
      65           0 :     return true;
      66             :   }
      67           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      68           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      69           0 :     return false;
      70             :   }
      71           0 :   return true;
      72             : }
      73             : 
      74             : static const JSJitInfo lockedFile_getterinfo = {
      75             :   { (JSJitGetterOp)get_lockedFile },
      76             :   { prototypes::id::IDBFileRequest },
      77             :   { PrototypeTraits<prototypes::id::IDBFileRequest>::Depth },
      78             :   JSJitInfo::Getter,
      79             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      80             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
      81             :   false,  /* isInfallible. False in setters. */
      82             :   false,  /* isMovable.  Not relevant for setters. */
      83             :   false, /* isEliminatable.  Not relevant for setters. */
      84             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      85             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      86             :   false,  /* isTypedMethod.  Only relevant for methods. */
      87             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      88             : };
      89             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      90             : static_assert(0 < 1, "There is no slot for us");
      91             : 
      92             : static bool
      93           0 : get_onprogress(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::IDBFileRequest* self, JSJitGetterCallArgs args)
      94             : {
      95           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnprogress());
      96           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      97           0 :   if (result) {
      98           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
      99           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
     100           0 :       return false;
     101             :     }
     102           0 :     return true;
     103             :   } else {
     104           0 :     args.rval().setNull();
     105           0 :     return true;
     106             :   }
     107             : }
     108             : 
     109             : static bool
     110           0 : set_onprogress(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::IDBFileRequest* self, JSJitSetterCallArgs args)
     111             : {
     112           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
     113           0 :   if (args[0].isObject()) {
     114             :     { // scope for tempRoot
     115           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
     116           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
     117             :     }
     118             :   } else {
     119           0 :     arg0 = nullptr;
     120             :   }
     121           0 :   self->SetOnprogress(Constify(arg0));
     122           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     123             : 
     124           0 :   return true;
     125             : }
     126             : 
     127             : static const JSJitInfo onprogress_getterinfo = {
     128             :   { (JSJitGetterOp)get_onprogress },
     129             :   { prototypes::id::IDBFileRequest },
     130             :   { PrototypeTraits<prototypes::id::IDBFileRequest>::Depth },
     131             :   JSJitInfo::Getter,
     132             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     133             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     134             :   false,  /* isInfallible. False in setters. */
     135             :   false,  /* isMovable.  Not relevant for setters. */
     136             :   false, /* isEliminatable.  Not relevant for setters. */
     137             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     138             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     139             :   false,  /* isTypedMethod.  Only relevant for methods. */
     140             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     141             : };
     142             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     143             : static_assert(0 < 1, "There is no slot for us");
     144             : static const JSJitInfo onprogress_setterinfo = {
     145             :   { (JSJitGetterOp)set_onprogress },
     146             :   { prototypes::id::IDBFileRequest },
     147             :   { PrototypeTraits<prototypes::id::IDBFileRequest>::Depth },
     148             :   JSJitInfo::Setter,
     149             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     150             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     151             :   false,  /* isInfallible. False in setters. */
     152             :   false,  /* isMovable.  Not relevant for setters. */
     153             :   false, /* isEliminatable.  Not relevant for setters. */
     154             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     155             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     156             :   false,  /* isTypedMethod.  Only relevant for methods. */
     157             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     158             : };
     159             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     160             : static_assert(0 < 1, "There is no slot for us");
     161             : 
     162             : static bool
     163           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     164             : {
     165           0 :   mozilla::dom::IDBFileRequest* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::IDBFileRequest>(obj);
     166             :   // We don't want to preserve if we don't have a wrapper, and we
     167             :   // obviously can't preserve if we're not initialized.
     168           0 :   if (self && self->GetWrapperPreserveColor()) {
     169           0 :     PreserveWrapper(self);
     170             :   }
     171           0 :   return true;
     172             : }
     173             : 
     174             : static void
     175           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     176             : {
     177           0 :   mozilla::dom::IDBFileRequest* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::IDBFileRequest>(obj);
     178           0 :   if (self) {
     179           0 :     ClearWrapper(self, self, obj);
     180           0 :     AddForDeferredFinalization<mozilla::dom::IDBFileRequest>(self);
     181             :   }
     182           0 : }
     183             : 
     184             : static void
     185           0 : _objectMoved(JSObject* obj, const JSObject* old)
     186             : {
     187           0 :   mozilla::dom::IDBFileRequest* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::IDBFileRequest>(obj);
     188           0 :   if (self) {
     189           0 :     UpdateWrapper(self, self, obj, old);
     190             :   }
     191           0 : }
     192             : 
     193             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     194             : #if defined(__clang__)
     195             : #pragma clang diagnostic push
     196             : #pragma clang diagnostic ignored "-Wmissing-braces"
     197             : #endif
     198             : static const JSPropertySpec sAttributes_specs[] = {
     199             :   { "fileHandle", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &fileHandle_getterinfo, nullptr, nullptr },
     200             :   { "lockedFile", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &lockedFile_getterinfo, nullptr, nullptr },
     201             :   { "onprogress", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onprogress_getterinfo, GenericBindingSetter, &onprogress_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(3 <= 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[3];
     222             : static PropertyInfo sNativeProperties_propertyInfos[3];
     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             :   3,
     234             :   sNativeProperties_sortedPropertyIndices,
     235             :   {
     236             :     { sAttributes, &sNativeProperties_propertyInfos[0] }
     237             :   }
     238             : };
     239             : static_assert(3 < 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::IDBFileRequest,
     254             :   PrototypeTraits<prototypes::id::IDBFileRequest>::Depth,
     255             :   sNativePropertyHooks,
     256             :   "function IDBFileRequest() {\n    [native code]\n}",
     257             :   DOMRequestBinding::GetConstructorObject
     258             : };
     259             : 
     260             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     261             :   {
     262             :     "IDBFileRequestPrototype",
     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::IDBFileRequest,
     272             :   PrototypeTraits<prototypes::id::IDBFileRequest>::Depth,
     273             :   sNativePropertyHooks,
     274             :   "[object IDBFileRequestPrototype]",
     275             :   DOMRequestBinding::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             :   { "IDBFileRequest",
     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::DOMRequest, prototypes::id::IDBFileRequest, 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::IDBFileRequest >::value,
     315             :   sNativePropertyHooks,
     316             :   FindAssociatedGlobalForNative<mozilla::dom::IDBFileRequest>::Get,
     317             :   GetProtoObjectHandle,
     318             :   GetCCParticipant<mozilla::dom::IDBFileRequest>::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::IDBFileRequest* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     333             : {
     334             :   MOZ_ASSERT(static_cast<mozilla::dom::IDBFileRequest*>(aObject) ==
     335             :              reinterpret_cast<mozilla::dom::IDBFileRequest*>(aObject),
     336             :              "Multiple inheritance for mozilla::dom::IDBFileRequest is broken.");
     337             :   MOZ_ASSERT(static_cast<mozilla::dom::DOMRequest*>(aObject) ==
     338             :              reinterpret_cast<mozilla::dom::DOMRequest*>(aObject),
     339             :              "Multiple inheritance for mozilla::dom::DOMRequest 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::IDBFileRequest> 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::IDBFileRequest,
     419             :   constructors::id::IDBFileRequest,
     420             :   DOMRequestBinding::sNativePropertyHooks,
     421             :   &DefaultXrayExpandoObjectClass
     422             : } };
     423             : 
     424             : void
     425           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     426             : {
     427           0 :   JS::Handle<JSObject*> parentProto(DOMRequestBinding::GetProtoObjectHandle(aCx));
     428           0 :   if (!parentProto) {
     429           0 :     return;
     430             :   }
     431             : 
     432           0 :   JS::Handle<JSObject*> constructorProto(DOMRequestBinding::GetConstructorObjectHandle(aCx));
     433           0 :   if (!constructorProto) {
     434           0 :     return;
     435             :   }
     436             : 
     437             :   static bool sIdsInited = false;
     438           0 :   if (!sIdsInited && NS_IsMainThread()) {
     439           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     440           0 :       return;
     441             :     }
     442           0 :     sIdsInited = true;
     443             :   }
     444             : 
     445           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::IDBFileRequest);
     446           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::IDBFileRequest);
     447           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     448             :                               &sPrototypeClass.mBase, protoCache,
     449             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     450             :                               interfaceCache,
     451             :                               sNativeProperties.Upcast(),
     452             :                               nullptr,
     453             :                               "IDBFileRequest", aDefineOnGlobal,
     454             :                               nullptr,
     455           0 :                               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::IDBFileRequest)) {
     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::IDBFileRequest);
     490           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     491           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     492             : }
     493             : 
     494             : JS::Handle<JSObject*>
     495           0 : 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           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     502           0 :   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           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     508           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::IDBFileRequest)) {
     509           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     510           0 :     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           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::IDBFileRequest);
     525           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     526           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     527             : }
     528             : 
     529             : JSObject*
     530           0 : GetConstructorObject(JSContext* aCx)
     531             : {
     532           0 :   return GetConstructorObjectHandle(aCx);
     533             : }
     534             : 
     535             : } // namespace IDBFileRequestBinding
     536             : 
     537             : 
     538             : 
     539             : } // namespace dom
     540             : } // namespace mozilla

Generated by: LCOV version 1.13