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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM SpeechRecognition.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "DOMMediaStream.h"
       4             : #include "EventHandlerBinding.h"
       5             : #include "EventTargetBinding.h"
       6             : #include "SpeechRecognition.h"
       7             : #include "SpeechRecognitionBinding.h"
       8             : #include "WrapperFactory.h"
       9             : #include "mozilla/OwningNonNull.h"
      10             : #include "mozilla/Preferences.h"
      11             : #include "mozilla/dom/BindingUtils.h"
      12             : #include "mozilla/dom/DOMJSClass.h"
      13             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      14             : #include "mozilla/dom/Nullable.h"
      15             : #include "mozilla/dom/PrimitiveConversions.h"
      16             : #include "mozilla/dom/SpeechGrammarList.h"
      17             : #include "mozilla/dom/SpeechRecognition.h"
      18             : #include "mozilla/dom/XrayExpandoClass.h"
      19             : #include "nsContentUtils.h"
      20             : 
      21             : namespace mozilla {
      22             : namespace dom {
      23             : 
      24             : namespace SpeechRecognitionBinding {
      25             : 
      26             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<EventTargetBinding::NativeType>::value,
      27             :               "Can't inherit from an interface with a different ownership model.");
      28             : 
      29             : static bool
      30           0 : get_grammars(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
      31             : {
      32           0 :   auto result(StrongOrRawPtr<mozilla::dom::SpeechGrammarList>(self->Grammars()));
      33           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      34           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      35           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      36           0 :     return false;
      37             :   }
      38           0 :   return true;
      39             : }
      40             : 
      41             : static bool
      42           0 : set_grammars(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
      43             : {
      44           0 :   NonNull<mozilla::dom::SpeechGrammarList> arg0;
      45           0 :   if (args[0].isObject()) {
      46             :     {
      47           0 :       nsresult rv = UnwrapObject<prototypes::id::SpeechGrammarList, mozilla::dom::SpeechGrammarList>(args[0], arg0);
      48           0 :       if (NS_FAILED(rv)) {
      49           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Value being assigned to SpeechRecognition.grammars", "SpeechGrammarList");
      50           0 :         return false;
      51             :       }
      52             :     }
      53             :   } else {
      54           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Value being assigned to SpeechRecognition.grammars");
      55           0 :     return false;
      56             :   }
      57           0 :   self->SetGrammars(NonNullHelper(arg0));
      58           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      59             : 
      60           0 :   return true;
      61             : }
      62             : 
      63             : static const JSJitInfo grammars_getterinfo = {
      64             :   { (JSJitGetterOp)get_grammars },
      65             :   { prototypes::id::SpeechRecognition },
      66             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
      67             :   JSJitInfo::Getter,
      68             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      69             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
      70             :   false,  /* isInfallible. False in setters. */
      71             :   false,  /* isMovable.  Not relevant for setters. */
      72             :   false, /* isEliminatable.  Not relevant for setters. */
      73             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      74             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      75             :   false,  /* isTypedMethod.  Only relevant for methods. */
      76             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      77             : };
      78             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      79             : static_assert(0 < 1, "There is no slot for us");
      80             : static const JSJitInfo grammars_setterinfo = {
      81             :   { (JSJitGetterOp)set_grammars },
      82             :   { prototypes::id::SpeechRecognition },
      83             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
      84             :   JSJitInfo::Setter,
      85             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      86             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
      87             :   false,  /* isInfallible. False in setters. */
      88             :   false,  /* isMovable.  Not relevant for setters. */
      89             :   false, /* isEliminatable.  Not relevant for setters. */
      90             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      91             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      92             :   false,  /* isTypedMethod.  Only relevant for methods. */
      93             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      94             : };
      95             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      96             : static_assert(0 < 1, "There is no slot for us");
      97             : 
      98             : static bool
      99           0 : get_lang(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
     100             : {
     101           0 :   DOMString result;
     102           0 :   self->GetLang(result);
     103           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     104           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     105           0 :     return false;
     106             :   }
     107           0 :   return true;
     108             : }
     109             : 
     110             : static bool
     111           0 : set_lang(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
     112             : {
     113           0 :   binding_detail::FakeString arg0;
     114           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     115           0 :     return false;
     116             :   }
     117           0 :   self->SetLang(NonNullHelper(Constify(arg0)));
     118           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     119             : 
     120           0 :   return true;
     121             : }
     122             : 
     123             : static const JSJitInfo lang_getterinfo = {
     124             :   { (JSJitGetterOp)get_lang },
     125             :   { prototypes::id::SpeechRecognition },
     126             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     127             :   JSJitInfo::Getter,
     128             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     129             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     130             :   false,  /* isInfallible. False in setters. */
     131             :   false,  /* isMovable.  Not relevant for setters. */
     132             :   false, /* isEliminatable.  Not relevant for setters. */
     133             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     134             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     135             :   false,  /* isTypedMethod.  Only relevant for methods. */
     136             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     137             : };
     138             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     139             : static_assert(0 < 1, "There is no slot for us");
     140             : static const JSJitInfo lang_setterinfo = {
     141             :   { (JSJitGetterOp)set_lang },
     142             :   { prototypes::id::SpeechRecognition },
     143             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     144             :   JSJitInfo::Setter,
     145             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     146             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     147             :   false,  /* isInfallible. False in setters. */
     148             :   false,  /* isMovable.  Not relevant for setters. */
     149             :   false, /* isEliminatable.  Not relevant for setters. */
     150             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     151             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     152             :   false,  /* isTypedMethod.  Only relevant for methods. */
     153             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     154             : };
     155             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     156             : static_assert(0 < 1, "There is no slot for us");
     157             : 
     158             : static bool
     159           0 : get_continuous(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
     160             : {
     161           0 :   binding_detail::FastErrorResult rv;
     162           0 :   bool result(self->GetContinuous(rv));
     163           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     164           0 :     return false;
     165             :   }
     166           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     167           0 :   args.rval().setBoolean(result);
     168           0 :   return true;
     169             : }
     170             : 
     171             : static bool
     172           0 : set_continuous(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
     173             : {
     174             :   bool arg0;
     175           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
     176           0 :     return false;
     177             :   }
     178           0 :   binding_detail::FastErrorResult rv;
     179           0 :   self->SetContinuous(arg0, rv);
     180           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     181           0 :     return false;
     182             :   }
     183           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     184             : 
     185           0 :   return true;
     186             : }
     187             : 
     188             : static const JSJitInfo continuous_getterinfo = {
     189             :   { (JSJitGetterOp)get_continuous },
     190             :   { prototypes::id::SpeechRecognition },
     191             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     192             :   JSJitInfo::Getter,
     193             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     194             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     195             :   false,  /* isInfallible. False in setters. */
     196             :   false,  /* isMovable.  Not relevant for setters. */
     197             :   false, /* isEliminatable.  Not relevant for setters. */
     198             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     199             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     200             :   false,  /* isTypedMethod.  Only relevant for methods. */
     201             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     202             : };
     203             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     204             : static_assert(0 < 1, "There is no slot for us");
     205             : static const JSJitInfo continuous_setterinfo = {
     206             :   { (JSJitGetterOp)set_continuous },
     207             :   { prototypes::id::SpeechRecognition },
     208             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     209             :   JSJitInfo::Setter,
     210             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     211             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     212             :   false,  /* isInfallible. False in setters. */
     213             :   false,  /* isMovable.  Not relevant for setters. */
     214             :   false, /* isEliminatable.  Not relevant for setters. */
     215             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     216             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     217             :   false,  /* isTypedMethod.  Only relevant for methods. */
     218             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     219             : };
     220             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     221             : static_assert(0 < 1, "There is no slot for us");
     222             : 
     223             : static bool
     224           0 : get_interimResults(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
     225             : {
     226           0 :   bool result(self->InterimResults());
     227           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     228           0 :   args.rval().setBoolean(result);
     229           0 :   return true;
     230             : }
     231             : 
     232             : static bool
     233           0 : set_interimResults(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
     234             : {
     235             :   bool arg0;
     236           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
     237           0 :     return false;
     238             :   }
     239           0 :   self->SetInterimResults(arg0);
     240           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     241             : 
     242           0 :   return true;
     243             : }
     244             : 
     245             : static const JSJitInfo interimResults_getterinfo = {
     246             :   { (JSJitGetterOp)get_interimResults },
     247             :   { prototypes::id::SpeechRecognition },
     248             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     249             :   JSJitInfo::Getter,
     250             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     251             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     252             :   true,  /* isInfallible. False in setters. */
     253             :   false,  /* isMovable.  Not relevant for setters. */
     254             :   false, /* isEliminatable.  Not relevant for setters. */
     255             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     256             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     257             :   false,  /* isTypedMethod.  Only relevant for methods. */
     258             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     259             : };
     260             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     261             : static_assert(0 < 1, "There is no slot for us");
     262             : static const JSJitInfo interimResults_setterinfo = {
     263             :   { (JSJitGetterOp)set_interimResults },
     264             :   { prototypes::id::SpeechRecognition },
     265             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     266             :   JSJitInfo::Setter,
     267             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     268             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     269             :   false,  /* isInfallible. False in setters. */
     270             :   false,  /* isMovable.  Not relevant for setters. */
     271             :   false, /* isEliminatable.  Not relevant for setters. */
     272             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     273             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     274             :   false,  /* isTypedMethod.  Only relevant for methods. */
     275             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     276             : };
     277             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     278             : static_assert(0 < 1, "There is no slot for us");
     279             : 
     280             : static bool
     281           0 : get_maxAlternatives(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
     282             : {
     283           0 :   uint32_t result(self->MaxAlternatives());
     284           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     285           0 :   args.rval().setNumber(result);
     286           0 :   return true;
     287             : }
     288             : 
     289             : static bool
     290           0 : set_maxAlternatives(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
     291             : {
     292             :   uint32_t arg0;
     293           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
     294           0 :     return false;
     295             :   }
     296           0 :   self->SetMaxAlternatives(arg0);
     297           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     298             : 
     299           0 :   return true;
     300             : }
     301             : 
     302             : static const JSJitInfo maxAlternatives_getterinfo = {
     303             :   { (JSJitGetterOp)get_maxAlternatives },
     304             :   { prototypes::id::SpeechRecognition },
     305             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     306             :   JSJitInfo::Getter,
     307             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     308             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
     309             :   true,  /* 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             : static const JSJitInfo maxAlternatives_setterinfo = {
     320             :   { (JSJitGetterOp)set_maxAlternatives },
     321             :   { prototypes::id::SpeechRecognition },
     322             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     323             :   JSJitInfo::Setter,
     324             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     325             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     326             :   false,  /* isInfallible. False in setters. */
     327             :   false,  /* isMovable.  Not relevant for setters. */
     328             :   false, /* isEliminatable.  Not relevant for setters. */
     329             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     330             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     331             :   false,  /* isTypedMethod.  Only relevant for methods. */
     332             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     333             : };
     334             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     335             : static_assert(0 < 1, "There is no slot for us");
     336             : 
     337             : static bool
     338           0 : get_serviceURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
     339             : {
     340           0 :   binding_detail::FastErrorResult rv;
     341           0 :   DOMString result;
     342           0 :   self->GetServiceURI(result, rv);
     343           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     344           0 :     return false;
     345             :   }
     346           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     347           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     348           0 :     return false;
     349             :   }
     350           0 :   return true;
     351             : }
     352             : 
     353             : static bool
     354           0 : set_serviceURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
     355             : {
     356           0 :   binding_detail::FakeString arg0;
     357           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     358           0 :     return false;
     359             :   }
     360           0 :   binding_detail::FastErrorResult rv;
     361           0 :   self->SetServiceURI(NonNullHelper(Constify(arg0)), rv);
     362           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     363           0 :     return false;
     364             :   }
     365           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     366             : 
     367           0 :   return true;
     368             : }
     369             : 
     370             : static const JSJitInfo serviceURI_getterinfo = {
     371             :   { (JSJitGetterOp)get_serviceURI },
     372             :   { prototypes::id::SpeechRecognition },
     373             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     374             :   JSJitInfo::Getter,
     375             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     376             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     377             :   false,  /* isInfallible. False in setters. */
     378             :   false,  /* isMovable.  Not relevant for setters. */
     379             :   false, /* isEliminatable.  Not relevant for setters. */
     380             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     381             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     382             :   false,  /* isTypedMethod.  Only relevant for methods. */
     383             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     384             : };
     385             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     386             : static_assert(0 < 1, "There is no slot for us");
     387             : static const JSJitInfo serviceURI_setterinfo = {
     388             :   { (JSJitGetterOp)set_serviceURI },
     389             :   { prototypes::id::SpeechRecognition },
     390             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     391             :   JSJitInfo::Setter,
     392             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     393             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     394             :   false,  /* isInfallible. False in setters. */
     395             :   false,  /* isMovable.  Not relevant for setters. */
     396             :   false, /* isEliminatable.  Not relevant for setters. */
     397             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     398             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     399             :   false,  /* isTypedMethod.  Only relevant for methods. */
     400             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     401             : };
     402             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     403             : static_assert(0 < 1, "There is no slot for us");
     404             : 
     405             : static bool
     406           0 : start(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, const JSJitMethodCallArgs& args)
     407             : {
     408           0 :   if (!mozilla::dom::EnforceNotInPrerendering(cx, obj)) {
     409             :       // Return false from the JSNative in order to trigger
     410             :       // an uncatchable exception.
     411           0 :       MOZ_ASSERT(!JS_IsExceptionPending(cx));
     412           0 :       return false;
     413             :   }
     414           0 :   Optional<NonNull<mozilla::DOMMediaStream>> arg0;
     415           0 :   if (args.hasDefined(0)) {
     416           0 :     arg0.Construct();
     417           0 :     if (args[0].isObject()) {
     418             :       {
     419           0 :         nsresult rv = UnwrapObject<prototypes::id::MediaStream, mozilla::DOMMediaStream>(args[0], arg0.Value());
     420           0 :         if (NS_FAILED(rv)) {
     421           0 :           ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of SpeechRecognition.start", "MediaStream");
     422           0 :           return false;
     423             :         }
     424             :       }
     425             :     } else {
     426           0 :       ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of SpeechRecognition.start");
     427           0 :       return false;
     428             :     }
     429             :   }
     430           0 :   binding_detail::FastErrorResult rv;
     431           0 :   self->Start(NonNullHelper(Constify(arg0)), nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv);
     432           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     433           0 :     return false;
     434             :   }
     435           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     436           0 :   args.rval().setUndefined();
     437           0 :   return true;
     438             : }
     439             : 
     440             : static const JSJitInfo start_methodinfo = {
     441             :   { (JSJitGetterOp)start },
     442             :   { prototypes::id::SpeechRecognition },
     443             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     444             :   JSJitInfo::Method,
     445             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     446             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     447             :   false,  /* isInfallible. False in setters. */
     448             :   false,  /* isMovable.  Not relevant for setters. */
     449             :   false, /* isEliminatable.  Not relevant for setters. */
     450             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     451             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     452             :   false,  /* isTypedMethod.  Only relevant for methods. */
     453             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     454             : };
     455             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     456             : static_assert(0 < 1, "There is no slot for us");
     457             : 
     458             : static bool
     459           0 : stop(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, const JSJitMethodCallArgs& args)
     460             : {
     461           0 :   self->Stop();
     462           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     463           0 :   args.rval().setUndefined();
     464           0 :   return true;
     465             : }
     466             : 
     467             : static const JSJitInfo stop_methodinfo = {
     468             :   { (JSJitGetterOp)stop },
     469             :   { prototypes::id::SpeechRecognition },
     470             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     471             :   JSJitInfo::Method,
     472             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     473             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     474             :   true,  /* isInfallible. False in setters. */
     475             :   false,  /* isMovable.  Not relevant for setters. */
     476             :   false, /* isEliminatable.  Not relevant for setters. */
     477             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     478             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     479             :   false,  /* isTypedMethod.  Only relevant for methods. */
     480             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     481             : };
     482             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     483             : static_assert(0 < 1, "There is no slot for us");
     484             : 
     485             : static bool
     486           0 : abort(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, const JSJitMethodCallArgs& args)
     487             : {
     488           0 :   self->Abort();
     489           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     490           0 :   args.rval().setUndefined();
     491           0 :   return true;
     492             : }
     493             : 
     494             : static const JSJitInfo abort_methodinfo = {
     495             :   { (JSJitGetterOp)abort },
     496             :   { prototypes::id::SpeechRecognition },
     497             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     498             :   JSJitInfo::Method,
     499             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     500             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     501             :   true,  /* isInfallible. False in setters. */
     502             :   false,  /* isMovable.  Not relevant for setters. */
     503             :   false, /* isEliminatable.  Not relevant for setters. */
     504             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     505             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     506             :   false,  /* isTypedMethod.  Only relevant for methods. */
     507             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     508             : };
     509             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     510             : static_assert(0 < 1, "There is no slot for us");
     511             : 
     512             : static bool
     513           0 : get_onaudiostart(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
     514             : {
     515           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnaudiostart());
     516           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     517           0 :   if (result) {
     518           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
     519           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
     520           0 :       return false;
     521             :     }
     522           0 :     return true;
     523             :   } else {
     524           0 :     args.rval().setNull();
     525           0 :     return true;
     526             :   }
     527             : }
     528             : 
     529             : static bool
     530           0 : set_onaudiostart(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
     531             : {
     532           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
     533           0 :   if (args[0].isObject()) {
     534             :     { // scope for tempRoot
     535           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
     536           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
     537             :     }
     538             :   } else {
     539           0 :     arg0 = nullptr;
     540             :   }
     541           0 :   self->SetOnaudiostart(Constify(arg0));
     542           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     543             : 
     544           0 :   return true;
     545             : }
     546             : 
     547             : static const JSJitInfo onaudiostart_getterinfo = {
     548             :   { (JSJitGetterOp)get_onaudiostart },
     549             :   { prototypes::id::SpeechRecognition },
     550             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     551             :   JSJitInfo::Getter,
     552             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     553             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     554             :   false,  /* isInfallible. False in setters. */
     555             :   false,  /* isMovable.  Not relevant for setters. */
     556             :   false, /* isEliminatable.  Not relevant for setters. */
     557             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     558             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     559             :   false,  /* isTypedMethod.  Only relevant for methods. */
     560             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     561             : };
     562             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     563             : static_assert(0 < 1, "There is no slot for us");
     564             : static const JSJitInfo onaudiostart_setterinfo = {
     565             :   { (JSJitGetterOp)set_onaudiostart },
     566             :   { prototypes::id::SpeechRecognition },
     567             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     568             :   JSJitInfo::Setter,
     569             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     570             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     571             :   false,  /* isInfallible. False in setters. */
     572             :   false,  /* isMovable.  Not relevant for setters. */
     573             :   false, /* isEliminatable.  Not relevant for setters. */
     574             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     575             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     576             :   false,  /* isTypedMethod.  Only relevant for methods. */
     577             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     578             : };
     579             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     580             : static_assert(0 < 1, "There is no slot for us");
     581             : 
     582             : static bool
     583           0 : get_onsoundstart(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
     584             : {
     585           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnsoundstart());
     586           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     587           0 :   if (result) {
     588           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
     589           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
     590           0 :       return false;
     591             :     }
     592           0 :     return true;
     593             :   } else {
     594           0 :     args.rval().setNull();
     595           0 :     return true;
     596             :   }
     597             : }
     598             : 
     599             : static bool
     600           0 : set_onsoundstart(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
     601             : {
     602           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
     603           0 :   if (args[0].isObject()) {
     604             :     { // scope for tempRoot
     605           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
     606           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
     607             :     }
     608             :   } else {
     609           0 :     arg0 = nullptr;
     610             :   }
     611           0 :   self->SetOnsoundstart(Constify(arg0));
     612           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     613             : 
     614           0 :   return true;
     615             : }
     616             : 
     617             : static const JSJitInfo onsoundstart_getterinfo = {
     618             :   { (JSJitGetterOp)get_onsoundstart },
     619             :   { prototypes::id::SpeechRecognition },
     620             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     621             :   JSJitInfo::Getter,
     622             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     623             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     624             :   false,  /* isInfallible. False in setters. */
     625             :   false,  /* isMovable.  Not relevant for setters. */
     626             :   false, /* isEliminatable.  Not relevant for setters. */
     627             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     628             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     629             :   false,  /* isTypedMethod.  Only relevant for methods. */
     630             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     631             : };
     632             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     633             : static_assert(0 < 1, "There is no slot for us");
     634             : static const JSJitInfo onsoundstart_setterinfo = {
     635             :   { (JSJitGetterOp)set_onsoundstart },
     636             :   { prototypes::id::SpeechRecognition },
     637             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     638             :   JSJitInfo::Setter,
     639             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     640             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     641             :   false,  /* isInfallible. False in setters. */
     642             :   false,  /* isMovable.  Not relevant for setters. */
     643             :   false, /* isEliminatable.  Not relevant for setters. */
     644             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     645             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     646             :   false,  /* isTypedMethod.  Only relevant for methods. */
     647             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     648             : };
     649             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     650             : static_assert(0 < 1, "There is no slot for us");
     651             : 
     652             : static bool
     653           0 : get_onspeechstart(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
     654             : {
     655           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnspeechstart());
     656           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     657           0 :   if (result) {
     658           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
     659           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
     660           0 :       return false;
     661             :     }
     662           0 :     return true;
     663             :   } else {
     664           0 :     args.rval().setNull();
     665           0 :     return true;
     666             :   }
     667             : }
     668             : 
     669             : static bool
     670           0 : set_onspeechstart(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
     671             : {
     672           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
     673           0 :   if (args[0].isObject()) {
     674             :     { // scope for tempRoot
     675           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
     676           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
     677             :     }
     678             :   } else {
     679           0 :     arg0 = nullptr;
     680             :   }
     681           0 :   self->SetOnspeechstart(Constify(arg0));
     682           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     683             : 
     684           0 :   return true;
     685             : }
     686             : 
     687             : static const JSJitInfo onspeechstart_getterinfo = {
     688             :   { (JSJitGetterOp)get_onspeechstart },
     689             :   { prototypes::id::SpeechRecognition },
     690             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     691             :   JSJitInfo::Getter,
     692             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     693             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     694             :   false,  /* isInfallible. False in setters. */
     695             :   false,  /* isMovable.  Not relevant for setters. */
     696             :   false, /* isEliminatable.  Not relevant for setters. */
     697             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     698             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     699             :   false,  /* isTypedMethod.  Only relevant for methods. */
     700             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     701             : };
     702             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     703             : static_assert(0 < 1, "There is no slot for us");
     704             : static const JSJitInfo onspeechstart_setterinfo = {
     705             :   { (JSJitGetterOp)set_onspeechstart },
     706             :   { prototypes::id::SpeechRecognition },
     707             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     708             :   JSJitInfo::Setter,
     709             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     710             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     711             :   false,  /* isInfallible. False in setters. */
     712             :   false,  /* isMovable.  Not relevant for setters. */
     713             :   false, /* isEliminatable.  Not relevant for setters. */
     714             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     715             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     716             :   false,  /* isTypedMethod.  Only relevant for methods. */
     717             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     718             : };
     719             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     720             : static_assert(0 < 1, "There is no slot for us");
     721             : 
     722             : static bool
     723           0 : get_onspeechend(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
     724             : {
     725           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnspeechend());
     726           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     727           0 :   if (result) {
     728           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
     729           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
     730           0 :       return false;
     731             :     }
     732           0 :     return true;
     733             :   } else {
     734           0 :     args.rval().setNull();
     735           0 :     return true;
     736             :   }
     737             : }
     738             : 
     739             : static bool
     740           0 : set_onspeechend(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
     741             : {
     742           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
     743           0 :   if (args[0].isObject()) {
     744             :     { // scope for tempRoot
     745           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
     746           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
     747             :     }
     748             :   } else {
     749           0 :     arg0 = nullptr;
     750             :   }
     751           0 :   self->SetOnspeechend(Constify(arg0));
     752           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     753             : 
     754           0 :   return true;
     755             : }
     756             : 
     757             : static const JSJitInfo onspeechend_getterinfo = {
     758             :   { (JSJitGetterOp)get_onspeechend },
     759             :   { prototypes::id::SpeechRecognition },
     760             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     761             :   JSJitInfo::Getter,
     762             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     763             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     764             :   false,  /* isInfallible. False in setters. */
     765             :   false,  /* isMovable.  Not relevant for setters. */
     766             :   false, /* isEliminatable.  Not relevant for setters. */
     767             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     768             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     769             :   false,  /* isTypedMethod.  Only relevant for methods. */
     770             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     771             : };
     772             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     773             : static_assert(0 < 1, "There is no slot for us");
     774             : static const JSJitInfo onspeechend_setterinfo = {
     775             :   { (JSJitGetterOp)set_onspeechend },
     776             :   { prototypes::id::SpeechRecognition },
     777             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     778             :   JSJitInfo::Setter,
     779             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     780             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     781             :   false,  /* isInfallible. False in setters. */
     782             :   false,  /* isMovable.  Not relevant for setters. */
     783             :   false, /* isEliminatable.  Not relevant for setters. */
     784             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     785             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     786             :   false,  /* isTypedMethod.  Only relevant for methods. */
     787             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     788             : };
     789             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     790             : static_assert(0 < 1, "There is no slot for us");
     791             : 
     792             : static bool
     793           0 : get_onsoundend(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
     794             : {
     795           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnsoundend());
     796           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     797           0 :   if (result) {
     798           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
     799           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
     800           0 :       return false;
     801             :     }
     802           0 :     return true;
     803             :   } else {
     804           0 :     args.rval().setNull();
     805           0 :     return true;
     806             :   }
     807             : }
     808             : 
     809             : static bool
     810           0 : set_onsoundend(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
     811             : {
     812           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
     813           0 :   if (args[0].isObject()) {
     814             :     { // scope for tempRoot
     815           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
     816           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
     817             :     }
     818             :   } else {
     819           0 :     arg0 = nullptr;
     820             :   }
     821           0 :   self->SetOnsoundend(Constify(arg0));
     822           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     823             : 
     824           0 :   return true;
     825             : }
     826             : 
     827             : static const JSJitInfo onsoundend_getterinfo = {
     828             :   { (JSJitGetterOp)get_onsoundend },
     829             :   { prototypes::id::SpeechRecognition },
     830             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     831             :   JSJitInfo::Getter,
     832             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     833             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     834             :   false,  /* isInfallible. False in setters. */
     835             :   false,  /* isMovable.  Not relevant for setters. */
     836             :   false, /* isEliminatable.  Not relevant for setters. */
     837             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     838             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     839             :   false,  /* isTypedMethod.  Only relevant for methods. */
     840             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     841             : };
     842             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     843             : static_assert(0 < 1, "There is no slot for us");
     844             : static const JSJitInfo onsoundend_setterinfo = {
     845             :   { (JSJitGetterOp)set_onsoundend },
     846             :   { prototypes::id::SpeechRecognition },
     847             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     848             :   JSJitInfo::Setter,
     849             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     850             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     851             :   false,  /* isInfallible. False in setters. */
     852             :   false,  /* isMovable.  Not relevant for setters. */
     853             :   false, /* isEliminatable.  Not relevant for setters. */
     854             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     855             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     856             :   false,  /* isTypedMethod.  Only relevant for methods. */
     857             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     858             : };
     859             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     860             : static_assert(0 < 1, "There is no slot for us");
     861             : 
     862             : static bool
     863           0 : get_onaudioend(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
     864             : {
     865           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnaudioend());
     866           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     867           0 :   if (result) {
     868           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
     869           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
     870           0 :       return false;
     871             :     }
     872           0 :     return true;
     873             :   } else {
     874           0 :     args.rval().setNull();
     875           0 :     return true;
     876             :   }
     877             : }
     878             : 
     879             : static bool
     880           0 : set_onaudioend(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
     881             : {
     882           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
     883           0 :   if (args[0].isObject()) {
     884             :     { // scope for tempRoot
     885           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
     886           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
     887             :     }
     888             :   } else {
     889           0 :     arg0 = nullptr;
     890             :   }
     891           0 :   self->SetOnaudioend(Constify(arg0));
     892           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     893             : 
     894           0 :   return true;
     895             : }
     896             : 
     897             : static const JSJitInfo onaudioend_getterinfo = {
     898             :   { (JSJitGetterOp)get_onaudioend },
     899             :   { prototypes::id::SpeechRecognition },
     900             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     901             :   JSJitInfo::Getter,
     902             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     903             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     904             :   false,  /* isInfallible. False in setters. */
     905             :   false,  /* isMovable.  Not relevant for setters. */
     906             :   false, /* isEliminatable.  Not relevant for setters. */
     907             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     908             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     909             :   false,  /* isTypedMethod.  Only relevant for methods. */
     910             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     911             : };
     912             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     913             : static_assert(0 < 1, "There is no slot for us");
     914             : static const JSJitInfo onaudioend_setterinfo = {
     915             :   { (JSJitGetterOp)set_onaudioend },
     916             :   { prototypes::id::SpeechRecognition },
     917             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     918             :   JSJitInfo::Setter,
     919             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     920             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     921             :   false,  /* isInfallible. False in setters. */
     922             :   false,  /* isMovable.  Not relevant for setters. */
     923             :   false, /* isEliminatable.  Not relevant for setters. */
     924             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     925             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     926             :   false,  /* isTypedMethod.  Only relevant for methods. */
     927             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     928             : };
     929             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     930             : static_assert(0 < 1, "There is no slot for us");
     931             : 
     932             : static bool
     933           0 : get_onresult(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
     934             : {
     935           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnresult());
     936           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     937           0 :   if (result) {
     938           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
     939           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
     940           0 :       return false;
     941             :     }
     942           0 :     return true;
     943             :   } else {
     944           0 :     args.rval().setNull();
     945           0 :     return true;
     946             :   }
     947             : }
     948             : 
     949             : static bool
     950           0 : set_onresult(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
     951             : {
     952           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
     953           0 :   if (args[0].isObject()) {
     954             :     { // scope for tempRoot
     955           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
     956           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
     957             :     }
     958             :   } else {
     959           0 :     arg0 = nullptr;
     960             :   }
     961           0 :   self->SetOnresult(Constify(arg0));
     962           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     963             : 
     964           0 :   return true;
     965             : }
     966             : 
     967             : static const JSJitInfo onresult_getterinfo = {
     968             :   { (JSJitGetterOp)get_onresult },
     969             :   { prototypes::id::SpeechRecognition },
     970             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     971             :   JSJitInfo::Getter,
     972             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     973             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     974             :   false,  /* isInfallible. False in setters. */
     975             :   false,  /* isMovable.  Not relevant for setters. */
     976             :   false, /* isEliminatable.  Not relevant for setters. */
     977             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     978             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     979             :   false,  /* isTypedMethod.  Only relevant for methods. */
     980             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     981             : };
     982             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     983             : static_assert(0 < 1, "There is no slot for us");
     984             : static const JSJitInfo onresult_setterinfo = {
     985             :   { (JSJitGetterOp)set_onresult },
     986             :   { prototypes::id::SpeechRecognition },
     987             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
     988             :   JSJitInfo::Setter,
     989             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     990             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     991             :   false,  /* isInfallible. False in setters. */
     992             :   false,  /* isMovable.  Not relevant for setters. */
     993             :   false, /* isEliminatable.  Not relevant for setters. */
     994             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     995             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     996             :   false,  /* isTypedMethod.  Only relevant for methods. */
     997             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     998             : };
     999             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1000             : static_assert(0 < 1, "There is no slot for us");
    1001             : 
    1002             : static bool
    1003           0 : get_onnomatch(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
    1004             : {
    1005           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnnomatch());
    1006           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1007           0 :   if (result) {
    1008           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
    1009           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
    1010           0 :       return false;
    1011             :     }
    1012           0 :     return true;
    1013             :   } else {
    1014           0 :     args.rval().setNull();
    1015           0 :     return true;
    1016             :   }
    1017             : }
    1018             : 
    1019             : static bool
    1020           0 : set_onnomatch(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
    1021             : {
    1022           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
    1023           0 :   if (args[0].isObject()) {
    1024             :     { // scope for tempRoot
    1025           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
    1026           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
    1027             :     }
    1028             :   } else {
    1029           0 :     arg0 = nullptr;
    1030             :   }
    1031           0 :   self->SetOnnomatch(Constify(arg0));
    1032           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1033             : 
    1034           0 :   return true;
    1035             : }
    1036             : 
    1037             : static const JSJitInfo onnomatch_getterinfo = {
    1038             :   { (JSJitGetterOp)get_onnomatch },
    1039             :   { prototypes::id::SpeechRecognition },
    1040             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
    1041             :   JSJitInfo::Getter,
    1042             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1043             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    1044             :   false,  /* isInfallible. False in setters. */
    1045             :   false,  /* isMovable.  Not relevant for setters. */
    1046             :   false, /* isEliminatable.  Not relevant for setters. */
    1047             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1048             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1049             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1050             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1051             : };
    1052             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1053             : static_assert(0 < 1, "There is no slot for us");
    1054             : static const JSJitInfo onnomatch_setterinfo = {
    1055             :   { (JSJitGetterOp)set_onnomatch },
    1056             :   { prototypes::id::SpeechRecognition },
    1057             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
    1058             :   JSJitInfo::Setter,
    1059             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1060             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    1061             :   false,  /* isInfallible. False in setters. */
    1062             :   false,  /* isMovable.  Not relevant for setters. */
    1063             :   false, /* isEliminatable.  Not relevant for setters. */
    1064             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1065             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1066             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1067             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1068             : };
    1069             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1070             : static_assert(0 < 1, "There is no slot for us");
    1071             : 
    1072             : static bool
    1073           0 : get_onerror(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
    1074             : {
    1075           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnerror());
    1076           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1077           0 :   if (result) {
    1078           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
    1079           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
    1080           0 :       return false;
    1081             :     }
    1082           0 :     return true;
    1083             :   } else {
    1084           0 :     args.rval().setNull();
    1085           0 :     return true;
    1086             :   }
    1087             : }
    1088             : 
    1089             : static bool
    1090           0 : set_onerror(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
    1091             : {
    1092           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
    1093           0 :   if (args[0].isObject()) {
    1094             :     { // scope for tempRoot
    1095           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
    1096           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
    1097             :     }
    1098             :   } else {
    1099           0 :     arg0 = nullptr;
    1100             :   }
    1101           0 :   self->SetOnerror(Constify(arg0));
    1102           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1103             : 
    1104           0 :   return true;
    1105             : }
    1106             : 
    1107             : static const JSJitInfo onerror_getterinfo = {
    1108             :   { (JSJitGetterOp)get_onerror },
    1109             :   { prototypes::id::SpeechRecognition },
    1110             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
    1111             :   JSJitInfo::Getter,
    1112             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1113             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    1114             :   false,  /* isInfallible. False in setters. */
    1115             :   false,  /* isMovable.  Not relevant for setters. */
    1116             :   false, /* isEliminatable.  Not relevant for setters. */
    1117             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1118             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1119             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1120             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1121             : };
    1122             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1123             : static_assert(0 < 1, "There is no slot for us");
    1124             : static const JSJitInfo onerror_setterinfo = {
    1125             :   { (JSJitGetterOp)set_onerror },
    1126             :   { prototypes::id::SpeechRecognition },
    1127             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
    1128             :   JSJitInfo::Setter,
    1129             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1130             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    1131             :   false,  /* isInfallible. False in setters. */
    1132             :   false,  /* isMovable.  Not relevant for setters. */
    1133             :   false, /* isEliminatable.  Not relevant for setters. */
    1134             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1135             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1136             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1137             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1138             : };
    1139             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1140             : static_assert(0 < 1, "There is no slot for us");
    1141             : 
    1142             : static bool
    1143           0 : get_onstart(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
    1144             : {
    1145           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnstart());
    1146           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1147           0 :   if (result) {
    1148           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
    1149           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
    1150           0 :       return false;
    1151             :     }
    1152           0 :     return true;
    1153             :   } else {
    1154           0 :     args.rval().setNull();
    1155           0 :     return true;
    1156             :   }
    1157             : }
    1158             : 
    1159             : static bool
    1160           0 : set_onstart(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
    1161             : {
    1162           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
    1163           0 :   if (args[0].isObject()) {
    1164             :     { // scope for tempRoot
    1165           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
    1166           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
    1167             :     }
    1168             :   } else {
    1169           0 :     arg0 = nullptr;
    1170             :   }
    1171           0 :   self->SetOnstart(Constify(arg0));
    1172           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1173             : 
    1174           0 :   return true;
    1175             : }
    1176             : 
    1177             : static const JSJitInfo onstart_getterinfo = {
    1178             :   { (JSJitGetterOp)get_onstart },
    1179             :   { prototypes::id::SpeechRecognition },
    1180             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
    1181             :   JSJitInfo::Getter,
    1182             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1183             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    1184             :   false,  /* isInfallible. False in setters. */
    1185             :   false,  /* isMovable.  Not relevant for setters. */
    1186             :   false, /* isEliminatable.  Not relevant for setters. */
    1187             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1188             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1189             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1190             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1191             : };
    1192             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1193             : static_assert(0 < 1, "There is no slot for us");
    1194             : static const JSJitInfo onstart_setterinfo = {
    1195             :   { (JSJitGetterOp)set_onstart },
    1196             :   { prototypes::id::SpeechRecognition },
    1197             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
    1198             :   JSJitInfo::Setter,
    1199             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1200             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    1201             :   false,  /* isInfallible. False in setters. */
    1202             :   false,  /* isMovable.  Not relevant for setters. */
    1203             :   false, /* isEliminatable.  Not relevant for setters. */
    1204             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1205             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1206             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1207             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1208             : };
    1209             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1210             : static_assert(0 < 1, "There is no slot for us");
    1211             : 
    1212             : static bool
    1213           0 : get_onend(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitGetterCallArgs args)
    1214             : {
    1215           0 :   RefPtr<EventHandlerNonNull> result(self->GetOnend());
    1216           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1217           0 :   if (result) {
    1218           0 :     args.rval().setObjectOrNull(GetCallbackFromCallbackObject(result));
    1219           0 :     if (!MaybeWrapObjectOrNullValue(cx, args.rval())) {
    1220           0 :       return false;
    1221             :     }
    1222           0 :     return true;
    1223             :   } else {
    1224           0 :     args.rval().setNull();
    1225           0 :     return true;
    1226             :   }
    1227             : }
    1228             : 
    1229             : static bool
    1230           0 : set_onend(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SpeechRecognition* self, JSJitSetterCallArgs args)
    1231             : {
    1232           0 :   RootedCallback<RefPtr<binding_detail::FastEventHandlerNonNull>> arg0(cx);
    1233           0 :   if (args[0].isObject()) {
    1234             :     { // scope for tempRoot
    1235           0 :       JS::Rooted<JSObject*> tempRoot(cx, &args[0].toObject());
    1236           0 :       arg0 = new binding_detail::FastEventHandlerNonNull(tempRoot);
    1237             :     }
    1238             :   } else {
    1239           0 :     arg0 = nullptr;
    1240             :   }
    1241           0 :   self->SetOnend(Constify(arg0));
    1242           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1243             : 
    1244           0 :   return true;
    1245             : }
    1246             : 
    1247             : static const JSJitInfo onend_getterinfo = {
    1248             :   { (JSJitGetterOp)get_onend },
    1249             :   { prototypes::id::SpeechRecognition },
    1250             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
    1251             :   JSJitInfo::Getter,
    1252             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1253             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
    1254             :   false,  /* isInfallible. False in setters. */
    1255             :   false,  /* isMovable.  Not relevant for setters. */
    1256             :   false, /* isEliminatable.  Not relevant for setters. */
    1257             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1258             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1259             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1260             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1261             : };
    1262             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1263             : static_assert(0 < 1, "There is no slot for us");
    1264             : static const JSJitInfo onend_setterinfo = {
    1265             :   { (JSJitGetterOp)set_onend },
    1266             :   { prototypes::id::SpeechRecognition },
    1267             :   { PrototypeTraits<prototypes::id::SpeechRecognition>::Depth },
    1268             :   JSJitInfo::Setter,
    1269             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
    1270             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
    1271             :   false,  /* isInfallible. False in setters. */
    1272             :   false,  /* isMovable.  Not relevant for setters. */
    1273             :   false, /* isEliminatable.  Not relevant for setters. */
    1274             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
    1275             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
    1276             :   false,  /* isTypedMethod.  Only relevant for methods. */
    1277             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
    1278             : };
    1279             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
    1280             : static_assert(0 < 1, "There is no slot for us");
    1281             : 
    1282             : static bool
    1283           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
    1284             : {
    1285           0 :   mozilla::dom::SpeechRecognition* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SpeechRecognition>(obj);
    1286             :   // We don't want to preserve if we don't have a wrapper, and we
    1287             :   // obviously can't preserve if we're not initialized.
    1288           0 :   if (self && self->GetWrapperPreserveColor()) {
    1289           0 :     PreserveWrapper(self);
    1290             :   }
    1291           0 :   return true;
    1292             : }
    1293             : 
    1294             : static void
    1295           0 : _finalize(js::FreeOp* fop, JSObject* obj)
    1296             : {
    1297           0 :   mozilla::dom::SpeechRecognition* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SpeechRecognition>(obj);
    1298           0 :   if (self) {
    1299           0 :     ClearWrapper(self, self, obj);
    1300           0 :     AddForDeferredFinalization<mozilla::dom::SpeechRecognition>(self);
    1301             :   }
    1302           0 : }
    1303             : 
    1304             : static void
    1305           0 : _objectMoved(JSObject* obj, const JSObject* old)
    1306             : {
    1307           0 :   mozilla::dom::SpeechRecognition* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SpeechRecognition>(obj);
    1308           0 :   if (self) {
    1309           0 :     UpdateWrapper(self, self, obj, old);
    1310             :   }
    1311           0 : }
    1312             : 
    1313             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
    1314             : #if defined(__clang__)
    1315             : #pragma clang diagnostic push
    1316             : #pragma clang diagnostic ignored "-Wmissing-braces"
    1317             : #endif
    1318             : static const JSFunctionSpec sMethods_specs[] = {
    1319             :   JS_FNSPEC("start", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&start_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    1320             :   JS_FNSPEC("stop", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&stop_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    1321             :   JS_FNSPEC("abort", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&abort_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
    1322             :   JS_FS_END
    1323             : };
    1324             : #if defined(__clang__)
    1325             : #pragma clang diagnostic pop
    1326             : #endif
    1327             : 
    1328             : 
    1329             : // Can't be const because the pref-enabled boolean needs to be writable
    1330             : static Prefable<const JSFunctionSpec> sMethods[] = {
    1331             :   { nullptr, &sMethods_specs[0] },
    1332             :   { nullptr, nullptr }
    1333             : };
    1334             : 
    1335             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
    1336             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
    1337             : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    1338             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
    1339             : 
    1340             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
    1341             : #if defined(__clang__)
    1342             : #pragma clang diagnostic push
    1343             : #pragma clang diagnostic ignored "-Wmissing-braces"
    1344             : #endif
    1345             : static const JSPropertySpec sAttributes_specs[] = {
    1346             :   { "grammars", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &grammars_getterinfo, GenericBindingSetter, &grammars_setterinfo },
    1347             :   { "lang", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &lang_getterinfo, GenericBindingSetter, &lang_setterinfo },
    1348             :   { "continuous", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &continuous_getterinfo, GenericBindingSetter, &continuous_setterinfo },
    1349             :   { "interimResults", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &interimResults_getterinfo, GenericBindingSetter, &interimResults_setterinfo },
    1350             :   { "maxAlternatives", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &maxAlternatives_getterinfo, GenericBindingSetter, &maxAlternatives_setterinfo },
    1351             :   { "serviceURI", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &serviceURI_getterinfo, GenericBindingSetter, &serviceURI_setterinfo },
    1352             :   { "onaudiostart", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onaudiostart_getterinfo, GenericBindingSetter, &onaudiostart_setterinfo },
    1353             :   { "onsoundstart", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onsoundstart_getterinfo, GenericBindingSetter, &onsoundstart_setterinfo },
    1354             :   { "onspeechstart", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onspeechstart_getterinfo, GenericBindingSetter, &onspeechstart_setterinfo },
    1355             :   { "onspeechend", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onspeechend_getterinfo, GenericBindingSetter, &onspeechend_setterinfo },
    1356             :   { "onsoundend", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onsoundend_getterinfo, GenericBindingSetter, &onsoundend_setterinfo },
    1357             :   { "onaudioend", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onaudioend_getterinfo, GenericBindingSetter, &onaudioend_setterinfo },
    1358             :   { "onresult", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onresult_getterinfo, GenericBindingSetter, &onresult_setterinfo },
    1359             :   { "onnomatch", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onnomatch_getterinfo, GenericBindingSetter, &onnomatch_setterinfo },
    1360             :   { "onerror", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onerror_getterinfo, GenericBindingSetter, &onerror_setterinfo },
    1361             :   { "onstart", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onstart_getterinfo, GenericBindingSetter, &onstart_setterinfo },
    1362             :   { "onend", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &onend_getterinfo, GenericBindingSetter, &onend_setterinfo },
    1363             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
    1364             : };
    1365             : #if defined(__clang__)
    1366             : #pragma clang diagnostic pop
    1367             : #endif
    1368             : 
    1369             : 
    1370             : // Can't be const because the pref-enabled boolean needs to be writable
    1371             : static Prefable<const JSPropertySpec> sAttributes[] = {
    1372             :   { nullptr, &sAttributes_specs[0] },
    1373             :   { nullptr, nullptr }
    1374             : };
    1375             : 
    1376             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
    1377             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
    1378             : static_assert(17 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    1379             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
    1380             : 
    1381             : 
    1382             : static uint16_t sNativeProperties_sortedPropertyIndices[20];
    1383             : static PropertyInfo sNativeProperties_propertyInfos[20];
    1384             : 
    1385             : static const NativePropertiesN<2> sNativeProperties = {
    1386             :   false, 0,
    1387             :   false, 0,
    1388             :   true,  0 /* sMethods */,
    1389             :   true,  1 /* sAttributes */,
    1390             :   false, 0,
    1391             :   false, 0,
    1392             :   false, 0,
    1393             :   -1,
    1394             :   20,
    1395             :   sNativeProperties_sortedPropertyIndices,
    1396             :   {
    1397             :     { sMethods, &sNativeProperties_propertyInfos[0] },
    1398             :     { sAttributes, &sNativeProperties_propertyInfos[3] }
    1399             :   }
    1400             : };
    1401             : static_assert(20 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
    1402             :     "We have a property info count that is oversized");
    1403             : 
    1404             : static bool
    1405           0 : _constructor(JSContext* cx, unsigned argc, JS::Value* vp)
    1406             : {
    1407           0 :   JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
    1408           0 :   JS::Rooted<JSObject*> obj(cx, &args.callee());
    1409           0 :   if (!args.isConstructing()) {
    1410             :     // XXXbz wish I could get the name from the callee instead of
    1411             :     // Adding more relocations
    1412           0 :     return ThrowConstructorWithoutNew(cx, "SpeechRecognition");
    1413             :   }
    1414             : 
    1415           0 :   GlobalObject global(cx, obj);
    1416           0 :   if (global.Failed()) {
    1417           0 :     return false;
    1418             :   }
    1419             : 
    1420           0 :   JS::Rooted<JSObject*> desiredProto(cx);
    1421           0 :   if (!GetDesiredProto(cx, args, &desiredProto)) {
    1422           0 :     return false;
    1423             :   }
    1424             : 
    1425           0 :   bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
    1426           0 :   Maybe<JSAutoCompartment> ac;
    1427           0 :   if (objIsXray) {
    1428           0 :     obj = js::CheckedUnwrap(obj);
    1429           0 :     if (!obj) {
    1430           0 :       return false;
    1431             :     }
    1432           0 :     ac.emplace(cx, obj);
    1433           0 :     if (!JS_WrapObject(cx, &desiredProto)) {
    1434           0 :       return false;
    1435             :     }
    1436             :   }
    1437           0 :   binding_detail::FastErrorResult rv;
    1438           0 :   auto result(StrongOrRawPtr<mozilla::dom::SpeechRecognition>(mozilla::dom::SpeechRecognition::Constructor(global, rv)));
    1439           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
    1440           0 :     return false;
    1441             :   }
    1442           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
    1443             :   static_assert(!IsPointer<decltype(result)>::value,
    1444             :                 "NewObject implies that we need to keep the object alive with a strong reference.");
    1445           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) {
    1446           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
    1447           0 :     return false;
    1448             :   }
    1449           0 :   return true;
    1450             : }
    1451             : 
    1452             : static const js::ClassOps sInterfaceObjectClassOps = {
    1453             :     nullptr,               /* addProperty */
    1454             :     nullptr,               /* delProperty */
    1455             :     nullptr,               /* getProperty */
    1456             :     nullptr,               /* setProperty */
    1457             :     nullptr,               /* enumerate */
    1458             :     nullptr,               /* newEnumerate */
    1459             :     nullptr,               /* resolve */
    1460             :     nullptr,               /* mayResolve */
    1461             :     nullptr,               /* finalize */
    1462             :     _constructor, /* call */
    1463             :     nullptr,               /* hasInstance */
    1464             :     _constructor, /* construct */
    1465             :     nullptr,               /* trace */
    1466             : };
    1467             : 
    1468             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
    1469             :   {
    1470             :     "Function",
    1471             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
    1472             :     &sInterfaceObjectClassOps,
    1473             :     JS_NULL_CLASS_SPEC,
    1474             :     JS_NULL_CLASS_EXT,
    1475             :     &sInterfaceObjectClassObjectOps
    1476             :   },
    1477             :   eInterface,
    1478             :   true,
    1479             :   prototypes::id::SpeechRecognition,
    1480             :   PrototypeTraits<prototypes::id::SpeechRecognition>::Depth,
    1481             :   sNativePropertyHooks,
    1482             :   "function SpeechRecognition() {\n    [native code]\n}",
    1483             :   EventTargetBinding::GetConstructorObject
    1484             : };
    1485             : 
    1486             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
    1487             :   {
    1488             :     "SpeechRecognitionPrototype",
    1489             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
    1490             :     JS_NULL_CLASS_OPS,
    1491             :     JS_NULL_CLASS_SPEC,
    1492             :     JS_NULL_CLASS_EXT,
    1493             :     JS_NULL_OBJECT_OPS
    1494             :   },
    1495             :   eInterfacePrototype,
    1496             :   false,
    1497             :   prototypes::id::SpeechRecognition,
    1498             :   PrototypeTraits<prototypes::id::SpeechRecognition>::Depth,
    1499             :   sNativePropertyHooks,
    1500             :   "[object SpeechRecognitionPrototype]",
    1501             :   EventTargetBinding::GetProtoObject
    1502             : };
    1503             : 
    1504             : bool
    1505           0 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
    1506             : {
    1507             :   static bool sPrefValue;
    1508             :   static bool sPrefCacheSetUp = false;
    1509           0 :   if (!sPrefCacheSetUp) {
    1510           0 :     sPrefCacheSetUp = true;
    1511           0 :     Preferences::AddBoolVarCache(&sPrefValue, "media.webspeech.recognition.enable");
    1512             :   }
    1513             : 
    1514           0 :   return sPrefValue &&
    1515           0 :          SpeechRecognition::IsAuthorized(aCx, aObj);
    1516             : }
    1517             : 
    1518             : JSObject*
    1519           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
    1520             : {
    1521           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
    1522             : }
    1523             : 
    1524             : static const js::ClassOps sClassOps = {
    1525             :   _addProperty, /* addProperty */
    1526             :   nullptr,               /* delProperty */
    1527             :   nullptr,               /* getProperty */
    1528             :   nullptr,               /* setProperty */
    1529             :   nullptr,               /* enumerate */
    1530             :   nullptr, /* newEnumerate */
    1531             :   nullptr, /* resolve */
    1532             :   nullptr, /* mayResolve */
    1533             :   _finalize, /* finalize */
    1534             :   nullptr, /* call */
    1535             :   nullptr,               /* hasInstance */
    1536             :   nullptr,               /* construct */
    1537             :   nullptr, /* trace */
    1538             : };
    1539             : 
    1540             : static const js::ClassExtension sClassExtension = {
    1541             :   nullptr, /* weakmapKeyDelegateOp */
    1542             :   _objectMoved /* objectMovedOp */
    1543             : };
    1544             : 
    1545             : static const DOMJSClass sClass = {
    1546             :   { "SpeechRecognition",
    1547             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
    1548             :     &sClassOps,
    1549             :     JS_NULL_CLASS_SPEC,
    1550             :     &sClassExtension,
    1551             :     JS_NULL_OBJECT_OPS
    1552             :   },
    1553             :   { prototypes::id::EventTarget, prototypes::id::SpeechRecognition, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
    1554             :   IsBaseOf<nsISupports, mozilla::dom::SpeechRecognition >::value,
    1555             :   sNativePropertyHooks,
    1556             :   FindAssociatedGlobalForNative<mozilla::dom::SpeechRecognition>::Get,
    1557             :   GetProtoObjectHandle,
    1558             :   GetCCParticipant<mozilla::dom::SpeechRecognition>::Get()
    1559             : };
    1560             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
    1561             :               "Must have the right minimal number of reserved slots.");
    1562             : static_assert(1 >= 1,
    1563             :               "Must have enough reserved slots.");
    1564             : 
    1565             : const JSClass*
    1566           0 : GetJSClass()
    1567             : {
    1568           0 :   return sClass.ToJSClass();
    1569             : }
    1570             : 
    1571             : bool
    1572           0 : Wrap(JSContext* aCx, mozilla::dom::SpeechRecognition* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
    1573             : {
    1574             :   MOZ_ASSERT(static_cast<mozilla::dom::SpeechRecognition*>(aObject) ==
    1575             :              reinterpret_cast<mozilla::dom::SpeechRecognition*>(aObject),
    1576             :              "Multiple inheritance for mozilla::dom::SpeechRecognition is broken.");
    1577             :   MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
    1578             :              reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
    1579             :              "Multiple inheritance for mozilla::dom::EventTarget is broken.");
    1580           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
    1581           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
    1582           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
    1583             :              "You should probably not be using Wrap() directly; use "
    1584             :              "GetOrCreateDOMReflector instead");
    1585             : 
    1586           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
    1587             :              "nsISupports must be on our primary inheritance chain");
    1588             : 
    1589           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
    1590           0 :   if (!global) {
    1591           0 :     return false;
    1592             :   }
    1593           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
    1594           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
    1595             : 
    1596             :   // That might have ended up wrapping us already, due to the wonders
    1597             :   // of XBL.  Check for that, and bail out as needed.
    1598           0 :   aReflector.set(aCache->GetWrapper());
    1599           0 :   if (aReflector) {
    1600             : #ifdef DEBUG
    1601           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
    1602             : #endif // DEBUG
    1603           0 :     return true;
    1604             :   }
    1605             : 
    1606           0 :   JSAutoCompartment ac(aCx, global);
    1607           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
    1608           0 :   if (!canonicalProto) {
    1609           0 :     return false;
    1610             :   }
    1611           0 :   JS::Rooted<JSObject*> proto(aCx);
    1612           0 :   if (aGivenProto) {
    1613           0 :     proto = aGivenProto;
    1614             :     // Unfortunately, while aGivenProto was in the compartment of aCx
    1615             :     // coming in, we changed compartments to that of "parent" so may need
    1616             :     // to wrap the proto here.
    1617           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
    1618           0 :       if (!JS_WrapObject(aCx, &proto)) {
    1619           0 :         return false;
    1620             :       }
    1621             :     }
    1622             :   } else {
    1623           0 :     proto = canonicalProto;
    1624             :   }
    1625             : 
    1626           0 :   BindingJSObjectCreator<mozilla::dom::SpeechRecognition> creator(aCx);
    1627           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
    1628           0 :   if (!aReflector) {
    1629           0 :     return false;
    1630             :   }
    1631             : 
    1632           0 :   aCache->SetWrapper(aReflector);
    1633           0 :   creator.InitializationSucceeded();
    1634             : 
    1635           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
    1636             :              aCache->GetWrapperPreserveColor() == aReflector);
    1637             :   // If proto != canonicalProto, we have to preserve our wrapper;
    1638             :   // otherwise we won't be able to properly recreate it later, since
    1639             :   // we won't know what proto to use.  Note that we don't check
    1640             :   // aGivenProto here, since it's entirely possible (and even
    1641             :   // somewhat common) to have a non-null aGivenProto which is the
    1642             :   // same as canonicalProto.
    1643           0 :   if (proto != canonicalProto) {
    1644           0 :     PreserveWrapper(aObject);
    1645             :   }
    1646             : 
    1647           0 :   return true;
    1648             : }
    1649             : 
    1650             : const NativePropertyHooks sNativePropertyHooks[] = { {
    1651             :   nullptr,
    1652             :   nullptr,
    1653             :   nullptr,
    1654             :   { sNativeProperties.Upcast(), nullptr },
    1655             :   prototypes::id::SpeechRecognition,
    1656             :   constructors::id::SpeechRecognition,
    1657             :   EventTargetBinding::sNativePropertyHooks,
    1658             :   &DefaultXrayExpandoObjectClass
    1659             : } };
    1660             : 
    1661             : void
    1662           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
    1663             : {
    1664           0 :   JS::Handle<JSObject*> parentProto(EventTargetBinding::GetProtoObjectHandle(aCx));
    1665           0 :   if (!parentProto) {
    1666           0 :     return;
    1667             :   }
    1668             : 
    1669           0 :   JS::Handle<JSObject*> constructorProto(EventTargetBinding::GetConstructorObjectHandle(aCx));
    1670           0 :   if (!constructorProto) {
    1671           0 :     return;
    1672             :   }
    1673             : 
    1674             :   static bool sIdsInited = false;
    1675           0 :   if (!sIdsInited && NS_IsMainThread()) {
    1676           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
    1677           0 :       return;
    1678             :     }
    1679           0 :     sIdsInited = true;
    1680             :   }
    1681             : 
    1682           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SpeechRecognition);
    1683           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SpeechRecognition);
    1684           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
    1685             :                               &sPrototypeClass.mBase, protoCache,
    1686             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
    1687             :                               interfaceCache,
    1688             :                               sNativeProperties.Upcast(),
    1689             :                               nullptr,
    1690             :                               "SpeechRecognition", aDefineOnGlobal,
    1691             :                               nullptr,
    1692           0 :                               false);
    1693             : }
    1694             : 
    1695             : JS::Handle<JSObject*>
    1696           0 : GetProtoObjectHandle(JSContext* aCx)
    1697             : {
    1698             :   /* Get the interface prototype object for this class.  This will create the
    1699             :      object as needed. */
    1700           0 :   bool aDefineOnGlobal = true;
    1701             : 
    1702             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    1703           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    1704           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    1705           0 :     return nullptr;
    1706             :   }
    1707             : 
    1708             :   /* Check to see whether the interface objects are already installed */
    1709           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    1710           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SpeechRecognition)) {
    1711           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    1712           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    1713             :   }
    1714             : 
    1715             :   /*
    1716             :    * The object might _still_ be null, but that's OK.
    1717             :    *
    1718             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    1719             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    1720             :    * changed after they have been set.
    1721             :    *
    1722             :    * Calling address() avoids the read read barrier that does gray
    1723             :    * unmarking, but it's not possible for the object to be gray here.
    1724             :    */
    1725             : 
    1726           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SpeechRecognition);
    1727           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    1728           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    1729             : }
    1730             : 
    1731             : JS::Handle<JSObject*>
    1732           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
    1733             : {
    1734             :   /* Get the interface object for this class.  This will create the object as
    1735             :      needed. */
    1736             : 
    1737             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    1738           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    1739           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    1740           0 :     return nullptr;
    1741             :   }
    1742             : 
    1743             :   /* Check to see whether the interface objects are already installed */
    1744           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    1745           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SpeechRecognition)) {
    1746           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    1747           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    1748             :   }
    1749             : 
    1750             :   /*
    1751             :    * The object might _still_ be null, but that's OK.
    1752             :    *
    1753             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    1754             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    1755             :    * changed after they have been set.
    1756             :    *
    1757             :    * Calling address() avoids the read read barrier that does gray
    1758             :    * unmarking, but it's not possible for the object to be gray here.
    1759             :    */
    1760             : 
    1761           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SpeechRecognition);
    1762           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    1763           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    1764             : }
    1765             : 
    1766             : JSObject*
    1767           0 : GetConstructorObject(JSContext* aCx)
    1768             : {
    1769           0 :   return GetConstructorObjectHandle(aCx);
    1770             : }
    1771             : 
    1772             : } // namespace SpeechRecognitionBinding
    1773             : 
    1774             : 
    1775             : 
    1776             : } // namespace dom
    1777             : } // namespace mozilla

Generated by: LCOV version 1.13