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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM MediaStreamError.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "MediaStreamErrorBinding.h"
       4             : #include "WrapperFactory.h"
       5             : #include "mozilla/OwningNonNull.h"
       6             : #include "mozilla/dom/BindingUtils.h"
       7             : #include "mozilla/dom/DOMJSClass.h"
       8             : #include "mozilla/dom/MediaStreamError.h"
       9             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      10             : #include "mozilla/dom/Nullable.h"
      11             : #include "mozilla/dom/XrayExpandoClass.h"
      12             : 
      13             : namespace mozilla {
      14             : namespace dom {
      15             : 
      16             : namespace MediaStreamErrorBinding {
      17             : 
      18             : static bool
      19           0 : get_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::MediaStreamError* self, JSJitGetterCallArgs args)
      20             : {
      21           0 :   DOMString result;
      22           0 :   self->GetName(result);
      23           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      24           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
      25           0 :     return false;
      26             :   }
      27           0 :   return true;
      28             : }
      29             : 
      30             : static const JSJitInfo name_getterinfo = {
      31             :   { (JSJitGetterOp)get_name },
      32             :   { prototypes::id::MediaStreamError },
      33             :   { PrototypeTraits<prototypes::id::MediaStreamError>::Depth },
      34             :   JSJitInfo::Getter,
      35             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      36             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
      37             :   false,  /* isInfallible. False in setters. */
      38             :   false,  /* isMovable.  Not relevant for setters. */
      39             :   false, /* isEliminatable.  Not relevant for setters. */
      40             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      41             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      42             :   false,  /* isTypedMethod.  Only relevant for methods. */
      43             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      44             : };
      45             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      46             : static_assert(0 < 1, "There is no slot for us");
      47             : 
      48             : static bool
      49           0 : get_message(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::MediaStreamError* self, JSJitGetterCallArgs args)
      50             : {
      51           0 :   DOMString result;
      52           0 :   self->GetMessage(result);
      53           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      54           0 :   if (!xpc::StringToJsval(cx, result, args.rval())) {
      55           0 :     return false;
      56             :   }
      57           0 :   return true;
      58             : }
      59             : 
      60             : static const JSJitInfo message_getterinfo = {
      61             :   { (JSJitGetterOp)get_message },
      62             :   { prototypes::id::MediaStreamError },
      63             :   { PrototypeTraits<prototypes::id::MediaStreamError>::Depth },
      64             :   JSJitInfo::Getter,
      65             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      66             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
      67             :   false,  /* isInfallible. False in setters. */
      68             :   false,  /* isMovable.  Not relevant for setters. */
      69             :   false, /* isEliminatable.  Not relevant for setters. */
      70             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      71             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      72             :   false,  /* isTypedMethod.  Only relevant for methods. */
      73             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      74             : };
      75             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      76             : static_assert(0 < 1, "There is no slot for us");
      77             : 
      78             : static bool
      79           0 : get_constraint(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::MediaStreamError* self, JSJitGetterCallArgs args)
      80             : {
      81           0 :   DOMString result;
      82           0 :   self->GetConstraint(result);
      83           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      84           0 :   if (!xpc::StringToJsval(cx, result, args.rval())) {
      85           0 :     return false;
      86             :   }
      87           0 :   return true;
      88             : }
      89             : 
      90             : static const JSJitInfo constraint_getterinfo = {
      91             :   { (JSJitGetterOp)get_constraint },
      92             :   { prototypes::id::MediaStreamError },
      93             :   { PrototypeTraits<prototypes::id::MediaStreamError>::Depth },
      94             :   JSJitInfo::Getter,
      95             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      96             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
      97             :   false,  /* isInfallible. False in setters. */
      98             :   false,  /* isMovable.  Not relevant for setters. */
      99             :   false, /* isEliminatable.  Not relevant for setters. */
     100             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     101             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     102             :   false,  /* isTypedMethod.  Only relevant for methods. */
     103             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     104             : };
     105             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     106             : static_assert(0 < 1, "There is no slot for us");
     107             : 
     108             : static bool
     109           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     110             : {
     111           0 :   mozilla::dom::MediaStreamError* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::MediaStreamError>(obj);
     112             :   // We don't want to preserve if we don't have a wrapper, and we
     113             :   // obviously can't preserve if we're not initialized.
     114           0 :   if (self && self->GetWrapperPreserveColor()) {
     115           0 :     PreserveWrapper(self);
     116             :   }
     117           0 :   return true;
     118             : }
     119             : 
     120             : static void
     121           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     122             : {
     123           0 :   mozilla::dom::MediaStreamError* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::MediaStreamError>(obj);
     124           0 :   if (self) {
     125           0 :     ClearWrapper(self, self, obj);
     126           0 :     AddForDeferredFinalization<mozilla::dom::MediaStreamError>(self);
     127             :   }
     128           0 : }
     129             : 
     130             : static void
     131           0 : _objectMoved(JSObject* obj, const JSObject* old)
     132             : {
     133           0 :   mozilla::dom::MediaStreamError* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::MediaStreamError>(obj);
     134           0 :   if (self) {
     135           0 :     UpdateWrapper(self, self, obj, old);
     136             :   }
     137           0 : }
     138             : 
     139             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     140             : #if defined(__clang__)
     141             : #pragma clang diagnostic push
     142             : #pragma clang diagnostic ignored "-Wmissing-braces"
     143             : #endif
     144             : static const JSPropertySpec sAttributes_specs[] = {
     145             :   { "name", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &name_getterinfo, nullptr, nullptr },
     146             :   { "message", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &message_getterinfo, nullptr, nullptr },
     147             :   { "constraint", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &constraint_getterinfo, nullptr, nullptr },
     148             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     149             : };
     150             : #if defined(__clang__)
     151             : #pragma clang diagnostic pop
     152             : #endif
     153             : 
     154             : 
     155             : // Can't be const because the pref-enabled boolean needs to be writable
     156             : static Prefable<const JSPropertySpec> sAttributes[] = {
     157             :   { nullptr, &sAttributes_specs[0] },
     158             :   { nullptr, nullptr }
     159             : };
     160             : 
     161             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     162             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     163             : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     164             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     165             : 
     166             : 
     167             : static uint16_t sNativeProperties_sortedPropertyIndices[3];
     168             : static PropertyInfo sNativeProperties_propertyInfos[3];
     169             : 
     170             : static const NativePropertiesN<1> sNativeProperties = {
     171             :   false, 0,
     172             :   false, 0,
     173             :   false, 0,
     174             :   true,  0 /* sAttributes */,
     175             :   false, 0,
     176             :   false, 0,
     177             :   false, 0,
     178             :   -1,
     179             :   3,
     180             :   sNativeProperties_sortedPropertyIndices,
     181             :   {
     182             :     { sAttributes, &sNativeProperties_propertyInfos[0] }
     183             :   }
     184             : };
     185             : static_assert(3 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     186             :     "We have a property info count that is oversized");
     187             : 
     188             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     189             :   {
     190             :     "MediaStreamErrorPrototype",
     191             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     192             :     JS_NULL_CLASS_OPS,
     193             :     JS_NULL_CLASS_SPEC,
     194             :     JS_NULL_CLASS_EXT,
     195             :     JS_NULL_OBJECT_OPS
     196             :   },
     197             :   eInterfacePrototype,
     198             :   false,
     199             :   prototypes::id::MediaStreamError,
     200             :   PrototypeTraits<prototypes::id::MediaStreamError>::Depth,
     201             :   sNativePropertyHooks,
     202             :   "[object MediaStreamErrorPrototype]",
     203             :   JS::GetRealmErrorPrototype
     204             : };
     205             : 
     206             : static const js::ClassOps sClassOps = {
     207             :   _addProperty, /* addProperty */
     208             :   nullptr,               /* delProperty */
     209             :   nullptr,               /* getProperty */
     210             :   nullptr,               /* setProperty */
     211             :   nullptr,               /* enumerate */
     212             :   nullptr, /* newEnumerate */
     213             :   nullptr, /* resolve */
     214             :   nullptr, /* mayResolve */
     215             :   _finalize, /* finalize */
     216             :   nullptr, /* call */
     217             :   nullptr,               /* hasInstance */
     218             :   nullptr,               /* construct */
     219             :   nullptr, /* trace */
     220             : };
     221             : 
     222             : static const js::ClassExtension sClassExtension = {
     223             :   nullptr, /* weakmapKeyDelegateOp */
     224             :   _objectMoved /* objectMovedOp */
     225             : };
     226             : 
     227             : static const DOMJSClass sClass = {
     228             :   { "MediaStreamError",
     229             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
     230             :     &sClassOps,
     231             :     JS_NULL_CLASS_SPEC,
     232             :     &sClassExtension,
     233             :     JS_NULL_OBJECT_OPS
     234             :   },
     235             :   { prototypes::id::MediaStreamError, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
     236             :   IsBaseOf<nsISupports, mozilla::dom::MediaStreamError >::value,
     237             :   sNativePropertyHooks,
     238             :   FindAssociatedGlobalForNative<mozilla::dom::MediaStreamError>::Get,
     239             :   GetProtoObjectHandle,
     240             :   GetCCParticipant<mozilla::dom::MediaStreamError>::Get()
     241             : };
     242             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     243             :               "Must have the right minimal number of reserved slots.");
     244             : static_assert(1 >= 1,
     245             :               "Must have enough reserved slots.");
     246             : 
     247             : const JSClass*
     248           0 : GetJSClass()
     249             : {
     250           0 :   return sClass.ToJSClass();
     251             : }
     252             : 
     253             : bool
     254           0 : Wrap(JSContext* aCx, mozilla::dom::MediaStreamError* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     255             : {
     256             :   MOZ_ASSERT(static_cast<mozilla::dom::MediaStreamError*>(aObject) ==
     257             :              reinterpret_cast<mozilla::dom::MediaStreamError*>(aObject),
     258             :              "Multiple inheritance for mozilla::dom::MediaStreamError is broken.");
     259           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     260           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     261           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     262             :              "You should probably not be using Wrap() directly; use "
     263             :              "GetOrCreateDOMReflector instead");
     264             : 
     265           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     266             :              "nsISupports must be on our primary inheritance chain");
     267             : 
     268           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     269           0 :   if (!global) {
     270           0 :     return false;
     271             :   }
     272           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     273           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     274             : 
     275             :   // That might have ended up wrapping us already, due to the wonders
     276             :   // of XBL.  Check for that, and bail out as needed.
     277           0 :   aReflector.set(aCache->GetWrapper());
     278           0 :   if (aReflector) {
     279             : #ifdef DEBUG
     280           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     281             : #endif // DEBUG
     282           0 :     return true;
     283             :   }
     284             : 
     285           0 :   JSAutoCompartment ac(aCx, global);
     286           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     287           0 :   if (!canonicalProto) {
     288           0 :     return false;
     289             :   }
     290           0 :   JS::Rooted<JSObject*> proto(aCx);
     291           0 :   if (aGivenProto) {
     292           0 :     proto = aGivenProto;
     293             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     294             :     // coming in, we changed compartments to that of "parent" so may need
     295             :     // to wrap the proto here.
     296           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     297           0 :       if (!JS_WrapObject(aCx, &proto)) {
     298           0 :         return false;
     299             :       }
     300             :     }
     301             :   } else {
     302           0 :     proto = canonicalProto;
     303             :   }
     304             : 
     305           0 :   BindingJSObjectCreator<mozilla::dom::MediaStreamError> creator(aCx);
     306           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     307           0 :   if (!aReflector) {
     308           0 :     return false;
     309             :   }
     310             : 
     311           0 :   aCache->SetWrapper(aReflector);
     312           0 :   creator.InitializationSucceeded();
     313             : 
     314           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     315             :              aCache->GetWrapperPreserveColor() == aReflector);
     316             :   // If proto != canonicalProto, we have to preserve our wrapper;
     317             :   // otherwise we won't be able to properly recreate it later, since
     318             :   // we won't know what proto to use.  Note that we don't check
     319             :   // aGivenProto here, since it's entirely possible (and even
     320             :   // somewhat common) to have a non-null aGivenProto which is the
     321             :   // same as canonicalProto.
     322           0 :   if (proto != canonicalProto) {
     323           0 :     PreserveWrapper(aObject);
     324             :   }
     325             : 
     326           0 :   return true;
     327             : }
     328             : 
     329             : const NativePropertyHooks sNativePropertyHooks[] = { {
     330             :   nullptr,
     331             :   nullptr,
     332             :   nullptr,
     333             :   { sNativeProperties.Upcast(), nullptr },
     334             :   prototypes::id::MediaStreamError,
     335             :   constructors::id::_ID_Count,
     336             :   nullptr,
     337             :   &DefaultXrayExpandoObjectClass
     338             : } };
     339             : 
     340             : void
     341           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     342             : {
     343           0 :   JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmErrorPrototype(aCx));
     344           0 :   if (!parentProto) {
     345           0 :     return;
     346             :   }
     347             : 
     348             :   static bool sIdsInited = false;
     349           0 :   if (!sIdsInited && NS_IsMainThread()) {
     350           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     351           0 :       return;
     352             :     }
     353           0 :     sIdsInited = true;
     354             :   }
     355             : 
     356           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::MediaStreamError);
     357           0 :   JS::Heap<JSObject*>* interfaceCache = nullptr;
     358           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     359             :                               &sPrototypeClass.mBase, protoCache,
     360             :                               nullptr, nullptr, 0, nullptr,
     361             :                               interfaceCache,
     362             :                               sNativeProperties.Upcast(),
     363             :                               nullptr,
     364             :                               nullptr, aDefineOnGlobal,
     365             :                               nullptr,
     366           0 :                               false);
     367             : }
     368             : 
     369             : JS::Handle<JSObject*>
     370           0 : GetProtoObjectHandle(JSContext* aCx)
     371             : {
     372             :   /* Get the interface prototype object for this class.  This will create the
     373             :      object as needed. */
     374           0 :   bool aDefineOnGlobal = true;
     375             : 
     376             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     377           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     378           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     379           0 :     return nullptr;
     380             :   }
     381             : 
     382             :   /* Check to see whether the interface objects are already installed */
     383           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     384           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::MediaStreamError)) {
     385           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     386           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     387             :   }
     388             : 
     389             :   /*
     390             :    * The object might _still_ be null, but that's OK.
     391             :    *
     392             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     393             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     394             :    * changed after they have been set.
     395             :    *
     396             :    * Calling address() avoids the read read barrier that does gray
     397             :    * unmarking, but it's not possible for the object to be gray here.
     398             :    */
     399             : 
     400           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::MediaStreamError);
     401           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     402           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     403             : }
     404             : 
     405             : } // namespace MediaStreamErrorBinding
     406             : 
     407             : 
     408             : 
     409             : } // namespace dom
     410             : } // namespace mozilla

Generated by: LCOV version 1.13