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

Generated by: LCOV version 1.13