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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM AudioListener.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "AudioListenerBinding.h"
       4             : #include "WrapperFactory.h"
       5             : #include "mozilla/FloatingPoint.h"
       6             : #include "mozilla/OwningNonNull.h"
       7             : #include "mozilla/Preferences.h"
       8             : #include "mozilla/dom/AudioListener.h"
       9             : #include "mozilla/dom/BindingUtils.h"
      10             : #include "mozilla/dom/DOMJSClass.h"
      11             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      12             : #include "mozilla/dom/PrimitiveConversions.h"
      13             : #include "mozilla/dom/XrayExpandoClass.h"
      14             : #include "nsIDocument.h"
      15             : 
      16             : namespace mozilla {
      17             : namespace dom {
      18             : 
      19             : namespace AudioListenerBinding {
      20             : 
      21             : static bool
      22           0 : get_dopplerFactor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioListener* self, JSJitGetterCallArgs args)
      23             : {
      24           0 :   DeprecationWarning(cx, obj, nsIDocument::ePannerNodeDoppler);
      25           0 :   double result(self->DopplerFactor());
      26           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      27           0 :   args.rval().set(JS_NumberValue(double(result)));
      28           0 :   return true;
      29             : }
      30             : 
      31             : static bool
      32           0 : set_dopplerFactor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioListener* self, JSJitSetterCallArgs args)
      33             : {
      34           0 :   DeprecationWarning(cx, obj, nsIDocument::ePannerNodeDoppler);
      35             :   double arg0;
      36           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
      37           0 :     return false;
      38           0 :   } else if (!mozilla::IsFinite(arg0)) {
      39           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to AudioListener.dopplerFactor");
      40           0 :     return false;
      41             :   }
      42           0 :   self->SetDopplerFactor(arg0);
      43           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      44             : 
      45           0 :   return true;
      46             : }
      47             : 
      48             : static const JSJitInfo dopplerFactor_getterinfo = {
      49             :   { (JSJitGetterOp)get_dopplerFactor },
      50             :   { prototypes::id::AudioListener },
      51             :   { PrototypeTraits<prototypes::id::AudioListener>::Depth },
      52             :   JSJitInfo::Getter,
      53             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      54             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
      55             :   true,  /* isInfallible. False in setters. */
      56             :   false,  /* isMovable.  Not relevant for setters. */
      57             :   false, /* isEliminatable.  Not relevant for setters. */
      58             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      59             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      60             :   false,  /* isTypedMethod.  Only relevant for methods. */
      61             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      62             : };
      63             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      64             : static_assert(0 < 1, "There is no slot for us");
      65             : static const JSJitInfo dopplerFactor_setterinfo = {
      66             :   { (JSJitGetterOp)set_dopplerFactor },
      67             :   { prototypes::id::AudioListener },
      68             :   { PrototypeTraits<prototypes::id::AudioListener>::Depth },
      69             :   JSJitInfo::Setter,
      70             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      71             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
      72             :   false,  /* isInfallible. False in setters. */
      73             :   false,  /* isMovable.  Not relevant for setters. */
      74             :   false, /* isEliminatable.  Not relevant for setters. */
      75             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      76             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      77             :   false,  /* isTypedMethod.  Only relevant for methods. */
      78             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      79             : };
      80             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      81             : static_assert(0 < 1, "There is no slot for us");
      82             : 
      83             : static bool
      84           0 : get_speedOfSound(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioListener* self, JSJitGetterCallArgs args)
      85             : {
      86           0 :   DeprecationWarning(cx, obj, nsIDocument::ePannerNodeDoppler);
      87           0 :   double result(self->SpeedOfSound());
      88           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      89           0 :   args.rval().set(JS_NumberValue(double(result)));
      90           0 :   return true;
      91             : }
      92             : 
      93             : static bool
      94           0 : set_speedOfSound(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioListener* self, JSJitSetterCallArgs args)
      95             : {
      96           0 :   DeprecationWarning(cx, obj, nsIDocument::ePannerNodeDoppler);
      97             :   double arg0;
      98           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
      99           0 :     return false;
     100           0 :   } else if (!mozilla::IsFinite(arg0)) {
     101           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to AudioListener.speedOfSound");
     102           0 :     return false;
     103             :   }
     104           0 :   self->SetSpeedOfSound(arg0);
     105           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     106             : 
     107           0 :   return true;
     108             : }
     109             : 
     110             : static const JSJitInfo speedOfSound_getterinfo = {
     111             :   { (JSJitGetterOp)get_speedOfSound },
     112             :   { prototypes::id::AudioListener },
     113             :   { PrototypeTraits<prototypes::id::AudioListener>::Depth },
     114             :   JSJitInfo::Getter,
     115             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     116             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
     117             :   true,  /* isInfallible. False in setters. */
     118             :   false,  /* isMovable.  Not relevant for setters. */
     119             :   false, /* isEliminatable.  Not relevant for setters. */
     120             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     121             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     122             :   false,  /* isTypedMethod.  Only relevant for methods. */
     123             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     124             : };
     125             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     126             : static_assert(0 < 1, "There is no slot for us");
     127             : static const JSJitInfo speedOfSound_setterinfo = {
     128             :   { (JSJitGetterOp)set_speedOfSound },
     129             :   { prototypes::id::AudioListener },
     130             :   { PrototypeTraits<prototypes::id::AudioListener>::Depth },
     131             :   JSJitInfo::Setter,
     132             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     133             :   JSVAL_TYPE_UNDEFINED,  /* 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             : 
     145             : static bool
     146           0 : setPosition(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioListener* self, const JSJitMethodCallArgs& args)
     147             : {
     148           0 :   if (MOZ_UNLIKELY(args.length() < 3)) {
     149           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "AudioListener.setPosition");
     150             :   }
     151             :   double arg0;
     152           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
     153           0 :     return false;
     154           0 :   } else if (!mozilla::IsFinite(arg0)) {
     155           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of AudioListener.setPosition");
     156           0 :     return false;
     157             :   }
     158             :   double arg1;
     159           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[1], &arg1)) {
     160           0 :     return false;
     161           0 :   } else if (!mozilla::IsFinite(arg1)) {
     162           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of AudioListener.setPosition");
     163           0 :     return false;
     164             :   }
     165             :   double arg2;
     166           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[2], &arg2)) {
     167           0 :     return false;
     168           0 :   } else if (!mozilla::IsFinite(arg2)) {
     169           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 3 of AudioListener.setPosition");
     170           0 :     return false;
     171             :   }
     172           0 :   self->SetPosition(arg0, arg1, arg2);
     173           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     174           0 :   args.rval().setUndefined();
     175           0 :   return true;
     176             : }
     177             : 
     178             : static const JSJitInfo setPosition_methodinfo = {
     179             :   { (JSJitGetterOp)setPosition },
     180             :   { prototypes::id::AudioListener },
     181             :   { PrototypeTraits<prototypes::id::AudioListener>::Depth },
     182             :   JSJitInfo::Method,
     183             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     184             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     185             :   false,  /* isInfallible. False in setters. */
     186             :   false,  /* isMovable.  Not relevant for setters. */
     187             :   false, /* isEliminatable.  Not relevant for setters. */
     188             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     189             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     190             :   false,  /* isTypedMethod.  Only relevant for methods. */
     191             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     192             : };
     193             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     194             : static_assert(0 < 1, "There is no slot for us");
     195             : 
     196             : static bool
     197           0 : setOrientation(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioListener* self, const JSJitMethodCallArgs& args)
     198             : {
     199           0 :   if (MOZ_UNLIKELY(args.length() < 6)) {
     200           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "AudioListener.setOrientation");
     201             :   }
     202             :   double arg0;
     203           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
     204           0 :     return false;
     205           0 :   } else if (!mozilla::IsFinite(arg0)) {
     206           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of AudioListener.setOrientation");
     207           0 :     return false;
     208             :   }
     209             :   double arg1;
     210           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[1], &arg1)) {
     211           0 :     return false;
     212           0 :   } else if (!mozilla::IsFinite(arg1)) {
     213           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of AudioListener.setOrientation");
     214           0 :     return false;
     215             :   }
     216             :   double arg2;
     217           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[2], &arg2)) {
     218           0 :     return false;
     219           0 :   } else if (!mozilla::IsFinite(arg2)) {
     220           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 3 of AudioListener.setOrientation");
     221           0 :     return false;
     222             :   }
     223             :   double arg3;
     224           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[3], &arg3)) {
     225           0 :     return false;
     226           0 :   } else if (!mozilla::IsFinite(arg3)) {
     227           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 4 of AudioListener.setOrientation");
     228           0 :     return false;
     229             :   }
     230             :   double arg4;
     231           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[4], &arg4)) {
     232           0 :     return false;
     233           0 :   } else if (!mozilla::IsFinite(arg4)) {
     234           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 5 of AudioListener.setOrientation");
     235           0 :     return false;
     236             :   }
     237             :   double arg5;
     238           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[5], &arg5)) {
     239           0 :     return false;
     240           0 :   } else if (!mozilla::IsFinite(arg5)) {
     241           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 6 of AudioListener.setOrientation");
     242           0 :     return false;
     243             :   }
     244           0 :   self->SetOrientation(arg0, arg1, arg2, arg3, arg4, arg5);
     245           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     246           0 :   args.rval().setUndefined();
     247           0 :   return true;
     248             : }
     249             : 
     250             : static const JSJitInfo setOrientation_methodinfo = {
     251             :   { (JSJitGetterOp)setOrientation },
     252             :   { prototypes::id::AudioListener },
     253             :   { PrototypeTraits<prototypes::id::AudioListener>::Depth },
     254             :   JSJitInfo::Method,
     255             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     256             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     257             :   false,  /* isInfallible. False in setters. */
     258             :   false,  /* isMovable.  Not relevant for setters. */
     259             :   false, /* isEliminatable.  Not relevant for setters. */
     260             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     261             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     262             :   false,  /* isTypedMethod.  Only relevant for methods. */
     263             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     264             : };
     265             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     266             : static_assert(0 < 1, "There is no slot for us");
     267             : 
     268             : static bool
     269           0 : setVelocity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AudioListener* self, const JSJitMethodCallArgs& args)
     270             : {
     271           0 :   if (MOZ_UNLIKELY(args.length() < 3)) {
     272           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "AudioListener.setVelocity");
     273             :   }
     274           0 :   DeprecationWarning(cx, obj, nsIDocument::ePannerNodeDoppler);
     275             :   double arg0;
     276           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
     277           0 :     return false;
     278           0 :   } else if (!mozilla::IsFinite(arg0)) {
     279           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of AudioListener.setVelocity");
     280           0 :     return false;
     281             :   }
     282             :   double arg1;
     283           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[1], &arg1)) {
     284           0 :     return false;
     285           0 :   } else if (!mozilla::IsFinite(arg1)) {
     286           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of AudioListener.setVelocity");
     287           0 :     return false;
     288             :   }
     289             :   double arg2;
     290           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[2], &arg2)) {
     291           0 :     return false;
     292           0 :   } else if (!mozilla::IsFinite(arg2)) {
     293           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 3 of AudioListener.setVelocity");
     294           0 :     return false;
     295             :   }
     296           0 :   self->SetVelocity(arg0, arg1, arg2);
     297           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     298           0 :   args.rval().setUndefined();
     299           0 :   return true;
     300             : }
     301             : 
     302             : static const JSJitInfo setVelocity_methodinfo = {
     303             :   { (JSJitGetterOp)setVelocity },
     304             :   { prototypes::id::AudioListener },
     305             :   { PrototypeTraits<prototypes::id::AudioListener>::Depth },
     306             :   JSJitInfo::Method,
     307             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     308             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     309             :   false,  /* isInfallible. False in setters. */
     310             :   false,  /* isMovable.  Not relevant for setters. */
     311             :   false, /* isEliminatable.  Not relevant for setters. */
     312             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     313             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     314             :   false,  /* isTypedMethod.  Only relevant for methods. */
     315             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     316             : };
     317             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     318             : static_assert(0 < 1, "There is no slot for us");
     319             : 
     320             : static bool
     321           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     322             : {
     323           0 :   mozilla::dom::AudioListener* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::AudioListener>(obj);
     324             :   // We don't want to preserve if we don't have a wrapper, and we
     325             :   // obviously can't preserve if we're not initialized.
     326           0 :   if (self && self->GetWrapperPreserveColor()) {
     327           0 :     PreserveWrapper(self);
     328             :   }
     329           0 :   return true;
     330             : }
     331             : 
     332             : static void
     333           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     334             : {
     335           0 :   mozilla::dom::AudioListener* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::AudioListener>(obj);
     336           0 :   if (self) {
     337           0 :     ClearWrapper(self, self, obj);
     338           0 :     AddForDeferredFinalization<mozilla::dom::AudioListener>(self);
     339             :   }
     340           0 : }
     341             : 
     342             : static void
     343           0 : _objectMoved(JSObject* obj, const JSObject* old)
     344             : {
     345           0 :   mozilla::dom::AudioListener* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::AudioListener>(obj);
     346           0 :   if (self) {
     347           0 :     UpdateWrapper(self, self, obj, old);
     348             :   }
     349           0 : }
     350             : 
     351             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     352             : #if defined(__clang__)
     353             : #pragma clang diagnostic push
     354             : #pragma clang diagnostic ignored "-Wmissing-braces"
     355             : #endif
     356             : static const JSFunctionSpec sMethods_specs[] = {
     357             :   JS_FNSPEC("setPosition", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setPosition_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
     358             :   JS_FNSPEC("setOrientation", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setOrientation_methodinfo), 6, JSPROP_ENUMERATE, nullptr),
     359             :   JS_FNSPEC("setVelocity", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setVelocity_methodinfo), 3, JSPROP_ENUMERATE, nullptr),
     360             :   JS_FS_END
     361             : };
     362             : #if defined(__clang__)
     363             : #pragma clang diagnostic pop
     364             : #endif
     365             : 
     366             : 
     367             : // Can't be const because the pref-enabled boolean needs to be writable
     368             : static Prefable<const JSFunctionSpec> sMethods[] = {
     369             :   { nullptr, &sMethods_specs[0] },
     370             :   { nullptr, nullptr }
     371             : };
     372             : 
     373             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     374             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     375             : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     376             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     377             : 
     378             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     379             : #if defined(__clang__)
     380             : #pragma clang diagnostic push
     381             : #pragma clang diagnostic ignored "-Wmissing-braces"
     382             : #endif
     383             : static const JSPropertySpec sAttributes_specs[] = {
     384             :   { "dopplerFactor", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &dopplerFactor_getterinfo, GenericBindingSetter, &dopplerFactor_setterinfo },
     385             :   { "speedOfSound", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &speedOfSound_getterinfo, GenericBindingSetter, &speedOfSound_setterinfo },
     386             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     387             : };
     388             : #if defined(__clang__)
     389             : #pragma clang diagnostic pop
     390             : #endif
     391             : 
     392             : 
     393             : // Can't be const because the pref-enabled boolean needs to be writable
     394             : static Prefable<const JSPropertySpec> sAttributes[] = {
     395             :   { nullptr, &sAttributes_specs[0] },
     396             :   { nullptr, nullptr }
     397             : };
     398             : 
     399             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     400             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     401             : static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     402             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     403             : 
     404             : 
     405             : static uint16_t sNativeProperties_sortedPropertyIndices[5];
     406             : static PropertyInfo sNativeProperties_propertyInfos[5];
     407             : 
     408             : static const NativePropertiesN<2> sNativeProperties = {
     409             :   false, 0,
     410             :   false, 0,
     411             :   true,  0 /* sMethods */,
     412             :   true,  1 /* sAttributes */,
     413             :   false, 0,
     414             :   false, 0,
     415             :   false, 0,
     416             :   -1,
     417             :   5,
     418             :   sNativeProperties_sortedPropertyIndices,
     419             :   {
     420             :     { sMethods, &sNativeProperties_propertyInfos[0] },
     421             :     { sAttributes, &sNativeProperties_propertyInfos[3] }
     422             :   }
     423             : };
     424             : static_assert(5 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     425             :     "We have a property info count that is oversized");
     426             : 
     427             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     428             :   {
     429             :     "Function",
     430             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     431             :     &sBoringInterfaceObjectClassClassOps,
     432             :     JS_NULL_CLASS_SPEC,
     433             :     JS_NULL_CLASS_EXT,
     434             :     &sInterfaceObjectClassObjectOps
     435             :   },
     436             :   eInterface,
     437             :   true,
     438             :   prototypes::id::AudioListener,
     439             :   PrototypeTraits<prototypes::id::AudioListener>::Depth,
     440             :   sNativePropertyHooks,
     441             :   "function AudioListener() {\n    [native code]\n}",
     442             :   JS::GetRealmFunctionPrototype
     443             : };
     444             : 
     445             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     446             :   {
     447             :     "AudioListenerPrototype",
     448             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     449             :     JS_NULL_CLASS_OPS,
     450             :     JS_NULL_CLASS_SPEC,
     451             :     JS_NULL_CLASS_EXT,
     452             :     JS_NULL_OBJECT_OPS
     453             :   },
     454             :   eInterfacePrototype,
     455             :   false,
     456             :   prototypes::id::AudioListener,
     457             :   PrototypeTraits<prototypes::id::AudioListener>::Depth,
     458             :   sNativePropertyHooks,
     459             :   "[object AudioListenerPrototype]",
     460             :   JS::GetRealmObjectPrototype
     461             : };
     462             : 
     463             : bool
     464           0 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
     465             : {
     466             :   static bool sPrefValue;
     467             :   static bool sPrefCacheSetUp = false;
     468           0 :   if (!sPrefCacheSetUp) {
     469           0 :     sPrefCacheSetUp = true;
     470           0 :     Preferences::AddBoolVarCache(&sPrefValue, "dom.webaudio.enabled");
     471             :   }
     472             : 
     473           0 :   return sPrefValue;
     474             : }
     475             : 
     476             : JSObject*
     477           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     478             : {
     479           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     480             : }
     481             : 
     482             : static const js::ClassOps sClassOps = {
     483             :   _addProperty, /* addProperty */
     484             :   nullptr,               /* delProperty */
     485             :   nullptr,               /* getProperty */
     486             :   nullptr,               /* setProperty */
     487             :   nullptr,               /* enumerate */
     488             :   nullptr, /* newEnumerate */
     489             :   nullptr, /* resolve */
     490             :   nullptr, /* mayResolve */
     491             :   _finalize, /* finalize */
     492             :   nullptr, /* call */
     493             :   nullptr,               /* hasInstance */
     494             :   nullptr,               /* construct */
     495             :   nullptr, /* trace */
     496             : };
     497             : 
     498             : static const js::ClassExtension sClassExtension = {
     499             :   nullptr, /* weakmapKeyDelegateOp */
     500             :   _objectMoved /* objectMovedOp */
     501             : };
     502             : 
     503             : static const DOMJSClass sClass = {
     504             :   { "AudioListener",
     505             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
     506             :     &sClassOps,
     507             :     JS_NULL_CLASS_SPEC,
     508             :     &sClassExtension,
     509             :     JS_NULL_OBJECT_OPS
     510             :   },
     511             :   { prototypes::id::AudioListener, 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 },
     512             :   IsBaseOf<nsISupports, mozilla::dom::AudioListener >::value,
     513             :   sNativePropertyHooks,
     514             :   FindAssociatedGlobalForNative<mozilla::dom::AudioListener>::Get,
     515             :   GetProtoObjectHandle,
     516             :   GetCCParticipant<mozilla::dom::AudioListener>::Get()
     517             : };
     518             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     519             :               "Must have the right minimal number of reserved slots.");
     520             : static_assert(1 >= 1,
     521             :               "Must have enough reserved slots.");
     522             : 
     523             : const JSClass*
     524           0 : GetJSClass()
     525             : {
     526           0 :   return sClass.ToJSClass();
     527             : }
     528             : 
     529             : bool
     530           0 : Wrap(JSContext* aCx, mozilla::dom::AudioListener* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     531             : {
     532             :   MOZ_ASSERT(static_cast<mozilla::dom::AudioListener*>(aObject) ==
     533             :              reinterpret_cast<mozilla::dom::AudioListener*>(aObject),
     534             :              "Multiple inheritance for mozilla::dom::AudioListener is broken.");
     535           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     536           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     537           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     538             :              "You should probably not be using Wrap() directly; use "
     539             :              "GetOrCreateDOMReflector instead");
     540             : 
     541           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     542             :              "nsISupports must be on our primary inheritance chain");
     543             : 
     544           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     545           0 :   if (!global) {
     546           0 :     return false;
     547             :   }
     548           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     549           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     550             : 
     551             :   // That might have ended up wrapping us already, due to the wonders
     552             :   // of XBL.  Check for that, and bail out as needed.
     553           0 :   aReflector.set(aCache->GetWrapper());
     554           0 :   if (aReflector) {
     555             : #ifdef DEBUG
     556           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     557             : #endif // DEBUG
     558           0 :     return true;
     559             :   }
     560             : 
     561           0 :   JSAutoCompartment ac(aCx, global);
     562           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     563           0 :   if (!canonicalProto) {
     564           0 :     return false;
     565             :   }
     566           0 :   JS::Rooted<JSObject*> proto(aCx);
     567           0 :   if (aGivenProto) {
     568           0 :     proto = aGivenProto;
     569             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     570             :     // coming in, we changed compartments to that of "parent" so may need
     571             :     // to wrap the proto here.
     572           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     573           0 :       if (!JS_WrapObject(aCx, &proto)) {
     574           0 :         return false;
     575             :       }
     576             :     }
     577             :   } else {
     578           0 :     proto = canonicalProto;
     579             :   }
     580             : 
     581           0 :   BindingJSObjectCreator<mozilla::dom::AudioListener> creator(aCx);
     582           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     583           0 :   if (!aReflector) {
     584           0 :     return false;
     585             :   }
     586             : 
     587           0 :   aCache->SetWrapper(aReflector);
     588           0 :   creator.InitializationSucceeded();
     589             : 
     590           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     591             :              aCache->GetWrapperPreserveColor() == aReflector);
     592             :   // If proto != canonicalProto, we have to preserve our wrapper;
     593             :   // otherwise we won't be able to properly recreate it later, since
     594             :   // we won't know what proto to use.  Note that we don't check
     595             :   // aGivenProto here, since it's entirely possible (and even
     596             :   // somewhat common) to have a non-null aGivenProto which is the
     597             :   // same as canonicalProto.
     598           0 :   if (proto != canonicalProto) {
     599           0 :     PreserveWrapper(aObject);
     600             :   }
     601             : 
     602           0 :   return true;
     603             : }
     604             : 
     605             : const NativePropertyHooks sNativePropertyHooks[] = { {
     606             :   nullptr,
     607             :   nullptr,
     608             :   nullptr,
     609             :   { sNativeProperties.Upcast(), nullptr },
     610             :   prototypes::id::AudioListener,
     611             :   constructors::id::AudioListener,
     612             :   nullptr,
     613             :   &DefaultXrayExpandoObjectClass
     614             : } };
     615             : 
     616             : void
     617           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     618             : {
     619           0 :   JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
     620           0 :   if (!parentProto) {
     621           0 :     return;
     622             :   }
     623             : 
     624           0 :   JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
     625           0 :   if (!constructorProto) {
     626           0 :     return;
     627             :   }
     628             : 
     629             :   static bool sIdsInited = false;
     630           0 :   if (!sIdsInited && NS_IsMainThread()) {
     631           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     632           0 :       return;
     633             :     }
     634           0 :     sIdsInited = true;
     635             :   }
     636             : 
     637           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::AudioListener);
     638           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::AudioListener);
     639           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     640             :                               &sPrototypeClass.mBase, protoCache,
     641             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     642             :                               interfaceCache,
     643             :                               sNativeProperties.Upcast(),
     644             :                               nullptr,
     645             :                               "AudioListener", aDefineOnGlobal,
     646             :                               nullptr,
     647           0 :                               false);
     648             : }
     649             : 
     650             : JS::Handle<JSObject*>
     651           0 : GetProtoObjectHandle(JSContext* aCx)
     652             : {
     653             :   /* Get the interface prototype object for this class.  This will create the
     654             :      object as needed. */
     655           0 :   bool aDefineOnGlobal = true;
     656             : 
     657             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     658           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     659           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     660           0 :     return nullptr;
     661             :   }
     662             : 
     663             :   /* Check to see whether the interface objects are already installed */
     664           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     665           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::AudioListener)) {
     666           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     667           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     668             :   }
     669             : 
     670             :   /*
     671             :    * The object might _still_ be null, but that's OK.
     672             :    *
     673             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     674             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     675             :    * changed after they have been set.
     676             :    *
     677             :    * Calling address() avoids the read read barrier that does gray
     678             :    * unmarking, but it's not possible for the object to be gray here.
     679             :    */
     680             : 
     681           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::AudioListener);
     682           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     683           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     684             : }
     685             : 
     686             : JS::Handle<JSObject*>
     687           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     688             : {
     689             :   /* Get the interface object for this class.  This will create the object as
     690             :      needed. */
     691             : 
     692             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     693           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     694           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     695           0 :     return nullptr;
     696             :   }
     697             : 
     698             :   /* Check to see whether the interface objects are already installed */
     699           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     700           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::AudioListener)) {
     701           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     702           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     703             :   }
     704             : 
     705             :   /*
     706             :    * The object might _still_ be null, but that's OK.
     707             :    *
     708             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     709             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     710             :    * changed after they have been set.
     711             :    *
     712             :    * Calling address() avoids the read read barrier that does gray
     713             :    * unmarking, but it's not possible for the object to be gray here.
     714             :    */
     715             : 
     716           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::AudioListener);
     717           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     718           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     719             : }
     720             : 
     721             : JSObject*
     722           0 : GetConstructorObject(JSContext* aCx)
     723             : {
     724           0 :   return GetConstructorObjectHandle(aCx);
     725             : }
     726             : 
     727             : } // namespace AudioListenerBinding
     728             : 
     729             : 
     730             : 
     731             : } // namespace dom
     732             : } // namespace mozilla

Generated by: LCOV version 1.13