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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM VTTRegion.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "VTTRegionBinding.h"
       4             : #include "WrapperFactory.h"
       5             : #include "mozilla/FloatingPoint.h"
       6             : #include "mozilla/OwningNonNull.h"
       7             : #include "mozilla/Preferences.h"
       8             : #include "mozilla/dom/BindingUtils.h"
       9             : #include "mozilla/dom/DOMJSClass.h"
      10             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      11             : #include "mozilla/dom/PrimitiveConversions.h"
      12             : #include "mozilla/dom/TextTrackRegion.h"
      13             : #include "mozilla/dom/XrayExpandoClass.h"
      14             : 
      15             : namespace mozilla {
      16             : namespace dom {
      17             : 
      18             : namespace VTTRegionBinding {
      19             : 
      20             : static bool
      21           0 : get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackRegion* self, JSJitGetterCallArgs args)
      22             : {
      23           0 :   double result(self->Width());
      24           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      25           0 :   args.rval().set(JS_NumberValue(double(result)));
      26           0 :   return true;
      27             : }
      28             : 
      29             : static bool
      30           0 : set_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackRegion* self, JSJitSetterCallArgs args)
      31             : {
      32             :   double arg0;
      33           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
      34           0 :     return false;
      35           0 :   } else if (!mozilla::IsFinite(arg0)) {
      36           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to VTTRegion.width");
      37           0 :     return false;
      38             :   }
      39           0 :   binding_detail::FastErrorResult rv;
      40           0 :   self->SetWidth(arg0, rv);
      41           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
      42           0 :     return false;
      43             :   }
      44           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      45             : 
      46           0 :   return true;
      47             : }
      48             : 
      49             : static const JSJitInfo width_getterinfo = {
      50             :   { (JSJitGetterOp)get_width },
      51             :   { prototypes::id::VTTRegion },
      52             :   { PrototypeTraits<prototypes::id::VTTRegion>::Depth },
      53             :   JSJitInfo::Getter,
      54             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      55             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
      56             :   true,  /* isInfallible. False in setters. */
      57             :   false,  /* isMovable.  Not relevant for setters. */
      58             :   false, /* isEliminatable.  Not relevant for setters. */
      59             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      60             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      61             :   false,  /* isTypedMethod.  Only relevant for methods. */
      62             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      63             : };
      64             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      65             : static_assert(0 < 1, "There is no slot for us");
      66             : static const JSJitInfo width_setterinfo = {
      67             :   { (JSJitGetterOp)set_width },
      68             :   { prototypes::id::VTTRegion },
      69             :   { PrototypeTraits<prototypes::id::VTTRegion>::Depth },
      70             :   JSJitInfo::Setter,
      71             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      72             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
      73             :   false,  /* isInfallible. False in setters. */
      74             :   false,  /* isMovable.  Not relevant for setters. */
      75             :   false, /* isEliminatable.  Not relevant for setters. */
      76             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      77             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      78             :   false,  /* isTypedMethod.  Only relevant for methods. */
      79             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      80             : };
      81             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      82             : static_assert(0 < 1, "There is no slot for us");
      83             : 
      84             : static bool
      85           0 : get_lines(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackRegion* self, JSJitGetterCallArgs args)
      86             : {
      87           0 :   int32_t result(self->Lines());
      88           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      89           0 :   args.rval().setInt32(int32_t(result));
      90           0 :   return true;
      91             : }
      92             : 
      93             : static bool
      94           0 : set_lines(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackRegion* self, JSJitSetterCallArgs args)
      95             : {
      96             :   int32_t arg0;
      97           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
      98           0 :     return false;
      99             :   }
     100           0 :   self->SetLines(arg0);
     101           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     102             : 
     103           0 :   return true;
     104             : }
     105             : 
     106             : static const JSJitInfo lines_getterinfo = {
     107             :   { (JSJitGetterOp)get_lines },
     108             :   { prototypes::id::VTTRegion },
     109             :   { PrototypeTraits<prototypes::id::VTTRegion>::Depth },
     110             :   JSJitInfo::Getter,
     111             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     112             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
     113             :   true,  /* isInfallible. False in setters. */
     114             :   false,  /* isMovable.  Not relevant for setters. */
     115             :   false, /* isEliminatable.  Not relevant for setters. */
     116             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     117             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     118             :   false,  /* isTypedMethod.  Only relevant for methods. */
     119             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     120             : };
     121             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     122             : static_assert(0 < 1, "There is no slot for us");
     123             : static const JSJitInfo lines_setterinfo = {
     124             :   { (JSJitGetterOp)set_lines },
     125             :   { prototypes::id::VTTRegion },
     126             :   { PrototypeTraits<prototypes::id::VTTRegion>::Depth },
     127             :   JSJitInfo::Setter,
     128             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     129             :   JSVAL_TYPE_UNDEFINED,  /* 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             : 
     141             : static bool
     142           0 : get_regionAnchorX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackRegion* self, JSJitGetterCallArgs args)
     143             : {
     144           0 :   double result(self->RegionAnchorX());
     145           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     146           0 :   args.rval().set(JS_NumberValue(double(result)));
     147           0 :   return true;
     148             : }
     149             : 
     150             : static bool
     151           0 : set_regionAnchorX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackRegion* self, JSJitSetterCallArgs args)
     152             : {
     153             :   double arg0;
     154           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
     155           0 :     return false;
     156           0 :   } else if (!mozilla::IsFinite(arg0)) {
     157           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to VTTRegion.regionAnchorX");
     158           0 :     return false;
     159             :   }
     160           0 :   binding_detail::FastErrorResult rv;
     161           0 :   self->SetRegionAnchorX(arg0, rv);
     162           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     163           0 :     return false;
     164             :   }
     165           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     166             : 
     167           0 :   return true;
     168             : }
     169             : 
     170             : static const JSJitInfo regionAnchorX_getterinfo = {
     171             :   { (JSJitGetterOp)get_regionAnchorX },
     172             :   { prototypes::id::VTTRegion },
     173             :   { PrototypeTraits<prototypes::id::VTTRegion>::Depth },
     174             :   JSJitInfo::Getter,
     175             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     176             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
     177             :   true,  /* isInfallible. False in setters. */
     178             :   false,  /* isMovable.  Not relevant for setters. */
     179             :   false, /* isEliminatable.  Not relevant for setters. */
     180             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     181             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     182             :   false,  /* isTypedMethod.  Only relevant for methods. */
     183             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     184             : };
     185             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     186             : static_assert(0 < 1, "There is no slot for us");
     187             : static const JSJitInfo regionAnchorX_setterinfo = {
     188             :   { (JSJitGetterOp)set_regionAnchorX },
     189             :   { prototypes::id::VTTRegion },
     190             :   { PrototypeTraits<prototypes::id::VTTRegion>::Depth },
     191             :   JSJitInfo::Setter,
     192             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     193             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     194             :   false,  /* isInfallible. False in setters. */
     195             :   false,  /* isMovable.  Not relevant for setters. */
     196             :   false, /* isEliminatable.  Not relevant for setters. */
     197             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     198             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     199             :   false,  /* isTypedMethod.  Only relevant for methods. */
     200             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     201             : };
     202             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     203             : static_assert(0 < 1, "There is no slot for us");
     204             : 
     205             : static bool
     206           0 : get_regionAnchorY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackRegion* self, JSJitGetterCallArgs args)
     207             : {
     208           0 :   double result(self->RegionAnchorY());
     209           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     210           0 :   args.rval().set(JS_NumberValue(double(result)));
     211           0 :   return true;
     212             : }
     213             : 
     214             : static bool
     215           0 : set_regionAnchorY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackRegion* self, JSJitSetterCallArgs args)
     216             : {
     217             :   double arg0;
     218           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
     219           0 :     return false;
     220           0 :   } else if (!mozilla::IsFinite(arg0)) {
     221           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to VTTRegion.regionAnchorY");
     222           0 :     return false;
     223             :   }
     224           0 :   binding_detail::FastErrorResult rv;
     225           0 :   self->SetRegionAnchorY(arg0, rv);
     226           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     227           0 :     return false;
     228             :   }
     229           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     230             : 
     231           0 :   return true;
     232             : }
     233             : 
     234             : static const JSJitInfo regionAnchorY_getterinfo = {
     235             :   { (JSJitGetterOp)get_regionAnchorY },
     236             :   { prototypes::id::VTTRegion },
     237             :   { PrototypeTraits<prototypes::id::VTTRegion>::Depth },
     238             :   JSJitInfo::Getter,
     239             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     240             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
     241             :   true,  /* isInfallible. False in setters. */
     242             :   false,  /* isMovable.  Not relevant for setters. */
     243             :   false, /* isEliminatable.  Not relevant for setters. */
     244             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     245             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     246             :   false,  /* isTypedMethod.  Only relevant for methods. */
     247             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     248             : };
     249             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     250             : static_assert(0 < 1, "There is no slot for us");
     251             : static const JSJitInfo regionAnchorY_setterinfo = {
     252             :   { (JSJitGetterOp)set_regionAnchorY },
     253             :   { prototypes::id::VTTRegion },
     254             :   { PrototypeTraits<prototypes::id::VTTRegion>::Depth },
     255             :   JSJitInfo::Setter,
     256             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     257             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     258             :   false,  /* isInfallible. False in setters. */
     259             :   false,  /* isMovable.  Not relevant for setters. */
     260             :   false, /* isEliminatable.  Not relevant for setters. */
     261             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     262             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     263             :   false,  /* isTypedMethod.  Only relevant for methods. */
     264             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     265             : };
     266             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     267             : static_assert(0 < 1, "There is no slot for us");
     268             : 
     269             : static bool
     270           0 : get_viewportAnchorX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackRegion* self, JSJitGetterCallArgs args)
     271             : {
     272           0 :   double result(self->ViewportAnchorX());
     273           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     274           0 :   args.rval().set(JS_NumberValue(double(result)));
     275           0 :   return true;
     276             : }
     277             : 
     278             : static bool
     279           0 : set_viewportAnchorX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackRegion* self, JSJitSetterCallArgs args)
     280             : {
     281             :   double arg0;
     282           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
     283           0 :     return false;
     284           0 :   } else if (!mozilla::IsFinite(arg0)) {
     285           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to VTTRegion.viewportAnchorX");
     286           0 :     return false;
     287             :   }
     288           0 :   binding_detail::FastErrorResult rv;
     289           0 :   self->SetViewportAnchorX(arg0, rv);
     290           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     291           0 :     return false;
     292             :   }
     293           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     294             : 
     295           0 :   return true;
     296             : }
     297             : 
     298             : static const JSJitInfo viewportAnchorX_getterinfo = {
     299             :   { (JSJitGetterOp)get_viewportAnchorX },
     300             :   { prototypes::id::VTTRegion },
     301             :   { PrototypeTraits<prototypes::id::VTTRegion>::Depth },
     302             :   JSJitInfo::Getter,
     303             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     304             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
     305             :   true,  /* isInfallible. False in setters. */
     306             :   false,  /* isMovable.  Not relevant for setters. */
     307             :   false, /* isEliminatable.  Not relevant for setters. */
     308             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     309             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     310             :   false,  /* isTypedMethod.  Only relevant for methods. */
     311             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     312             : };
     313             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     314             : static_assert(0 < 1, "There is no slot for us");
     315             : static const JSJitInfo viewportAnchorX_setterinfo = {
     316             :   { (JSJitGetterOp)set_viewportAnchorX },
     317             :   { prototypes::id::VTTRegion },
     318             :   { PrototypeTraits<prototypes::id::VTTRegion>::Depth },
     319             :   JSJitInfo::Setter,
     320             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     321             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     322             :   false,  /* isInfallible. False in setters. */
     323             :   false,  /* isMovable.  Not relevant for setters. */
     324             :   false, /* isEliminatable.  Not relevant for setters. */
     325             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     326             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     327             :   false,  /* isTypedMethod.  Only relevant for methods. */
     328             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     329             : };
     330             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     331             : static_assert(0 < 1, "There is no slot for us");
     332             : 
     333             : static bool
     334           0 : get_viewportAnchorY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackRegion* self, JSJitGetterCallArgs args)
     335             : {
     336           0 :   double result(self->ViewportAnchorY());
     337           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     338           0 :   args.rval().set(JS_NumberValue(double(result)));
     339           0 :   return true;
     340             : }
     341             : 
     342             : static bool
     343           0 : set_viewportAnchorY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackRegion* self, JSJitSetterCallArgs args)
     344             : {
     345             :   double arg0;
     346           0 :   if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) {
     347           0 :     return false;
     348           0 :   } else if (!mozilla::IsFinite(arg0)) {
     349           0 :     ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to VTTRegion.viewportAnchorY");
     350           0 :     return false;
     351             :   }
     352           0 :   binding_detail::FastErrorResult rv;
     353           0 :   self->SetViewportAnchorY(arg0, rv);
     354           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     355           0 :     return false;
     356             :   }
     357           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     358             : 
     359           0 :   return true;
     360             : }
     361             : 
     362             : static const JSJitInfo viewportAnchorY_getterinfo = {
     363             :   { (JSJitGetterOp)get_viewportAnchorY },
     364             :   { prototypes::id::VTTRegion },
     365             :   { PrototypeTraits<prototypes::id::VTTRegion>::Depth },
     366             :   JSJitInfo::Getter,
     367             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     368             :   JSVAL_TYPE_DOUBLE,  /* returnType.  Not relevant for setters. */
     369             :   true,  /* isInfallible. False in setters. */
     370             :   false,  /* isMovable.  Not relevant for setters. */
     371             :   false, /* isEliminatable.  Not relevant for setters. */
     372             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     373             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     374             :   false,  /* isTypedMethod.  Only relevant for methods. */
     375             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     376             : };
     377             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     378             : static_assert(0 < 1, "There is no slot for us");
     379             : static const JSJitInfo viewportAnchorY_setterinfo = {
     380             :   { (JSJitGetterOp)set_viewportAnchorY },
     381             :   { prototypes::id::VTTRegion },
     382             :   { PrototypeTraits<prototypes::id::VTTRegion>::Depth },
     383             :   JSJitInfo::Setter,
     384             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     385             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     386             :   false,  /* isInfallible. False in setters. */
     387             :   false,  /* isMovable.  Not relevant for setters. */
     388             :   false, /* isEliminatable.  Not relevant for setters. */
     389             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     390             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     391             :   false,  /* isTypedMethod.  Only relevant for methods. */
     392             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     393             : };
     394             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     395             : static_assert(0 < 1, "There is no slot for us");
     396             : 
     397             : static bool
     398           0 : get_scroll(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackRegion* self, JSJitGetterCallArgs args)
     399             : {
     400           0 :   DOMString result;
     401           0 :   self->GetScroll(result);
     402           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     403           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     404           0 :     return false;
     405             :   }
     406           0 :   return true;
     407             : }
     408             : 
     409             : static bool
     410           0 : set_scroll(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TextTrackRegion* self, JSJitSetterCallArgs args)
     411             : {
     412           0 :   binding_detail::FakeString arg0;
     413           0 :   if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     414           0 :     return false;
     415             :   }
     416           0 :   binding_detail::FastErrorResult rv;
     417           0 :   self->SetScroll(NonNullHelper(Constify(arg0)), rv);
     418           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     419           0 :     return false;
     420             :   }
     421           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     422             : 
     423           0 :   return true;
     424             : }
     425             : 
     426             : static const JSJitInfo scroll_getterinfo = {
     427             :   { (JSJitGetterOp)get_scroll },
     428             :   { prototypes::id::VTTRegion },
     429             :   { PrototypeTraits<prototypes::id::VTTRegion>::Depth },
     430             :   JSJitInfo::Getter,
     431             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     432             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     433             :   false,  /* isInfallible. False in setters. */
     434             :   false,  /* isMovable.  Not relevant for setters. */
     435             :   false, /* isEliminatable.  Not relevant for setters. */
     436             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     437             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     438             :   false,  /* isTypedMethod.  Only relevant for methods. */
     439             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     440             : };
     441             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     442             : static_assert(0 < 1, "There is no slot for us");
     443             : static const JSJitInfo scroll_setterinfo = {
     444             :   { (JSJitGetterOp)set_scroll },
     445             :   { prototypes::id::VTTRegion },
     446             :   { PrototypeTraits<prototypes::id::VTTRegion>::Depth },
     447             :   JSJitInfo::Setter,
     448             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     449             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     450             :   false,  /* isInfallible. False in setters. */
     451             :   false,  /* isMovable.  Not relevant for setters. */
     452             :   false, /* isEliminatable.  Not relevant for setters. */
     453             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     454             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     455             :   false,  /* isTypedMethod.  Only relevant for methods. */
     456             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     457             : };
     458             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     459             : static_assert(0 < 1, "There is no slot for us");
     460             : 
     461             : static bool
     462           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     463             : {
     464           0 :   mozilla::dom::TextTrackRegion* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::TextTrackRegion>(obj);
     465             :   // We don't want to preserve if we don't have a wrapper, and we
     466             :   // obviously can't preserve if we're not initialized.
     467           0 :   if (self && self->GetWrapperPreserveColor()) {
     468           0 :     PreserveWrapper(self);
     469             :   }
     470           0 :   return true;
     471             : }
     472             : 
     473             : static void
     474           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     475             : {
     476           0 :   mozilla::dom::TextTrackRegion* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::TextTrackRegion>(obj);
     477           0 :   if (self) {
     478           0 :     ClearWrapper(self, self, obj);
     479           0 :     AddForDeferredFinalization<mozilla::dom::TextTrackRegion>(self);
     480             :   }
     481           0 : }
     482             : 
     483             : static void
     484           0 : _objectMoved(JSObject* obj, const JSObject* old)
     485             : {
     486           0 :   mozilla::dom::TextTrackRegion* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::TextTrackRegion>(obj);
     487           0 :   if (self) {
     488           0 :     UpdateWrapper(self, self, obj, old);
     489             :   }
     490           0 : }
     491             : 
     492             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     493             : #if defined(__clang__)
     494             : #pragma clang diagnostic push
     495             : #pragma clang diagnostic ignored "-Wmissing-braces"
     496             : #endif
     497             : static const JSPropertySpec sAttributes_specs[] = {
     498             :   { "width", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &width_getterinfo, GenericBindingSetter, &width_setterinfo },
     499             :   { "lines", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &lines_getterinfo, GenericBindingSetter, &lines_setterinfo },
     500             :   { "regionAnchorX", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &regionAnchorX_getterinfo, GenericBindingSetter, &regionAnchorX_setterinfo },
     501             :   { "regionAnchorY", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &regionAnchorY_getterinfo, GenericBindingSetter, &regionAnchorY_setterinfo },
     502             :   { "viewportAnchorX", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &viewportAnchorX_getterinfo, GenericBindingSetter, &viewportAnchorX_setterinfo },
     503             :   { "viewportAnchorY", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &viewportAnchorY_getterinfo, GenericBindingSetter, &viewportAnchorY_setterinfo },
     504             :   { "scroll", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &scroll_getterinfo, GenericBindingSetter, &scroll_setterinfo },
     505             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     506             : };
     507             : #if defined(__clang__)
     508             : #pragma clang diagnostic pop
     509             : #endif
     510             : 
     511             : 
     512             : // Can't be const because the pref-enabled boolean needs to be writable
     513             : static Prefable<const JSPropertySpec> sAttributes[] = {
     514             :   { nullptr, &sAttributes_specs[0] },
     515             :   { nullptr, nullptr }
     516             : };
     517             : 
     518             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     519             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     520             : static_assert(7 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     521             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     522             : 
     523             : 
     524             : static uint16_t sNativeProperties_sortedPropertyIndices[7];
     525             : static PropertyInfo sNativeProperties_propertyInfos[7];
     526             : 
     527             : static const NativePropertiesN<1> sNativeProperties = {
     528             :   false, 0,
     529             :   false, 0,
     530             :   false, 0,
     531             :   true,  0 /* sAttributes */,
     532             :   false, 0,
     533             :   false, 0,
     534             :   false, 0,
     535             :   -1,
     536             :   7,
     537             :   sNativeProperties_sortedPropertyIndices,
     538             :   {
     539             :     { sAttributes, &sNativeProperties_propertyInfos[0] }
     540             :   }
     541             : };
     542             : static_assert(7 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     543             :     "We have a property info count that is oversized");
     544             : 
     545             : static bool
     546           0 : _constructor(JSContext* cx, unsigned argc, JS::Value* vp)
     547             : {
     548           0 :   JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     549           0 :   JS::Rooted<JSObject*> obj(cx, &args.callee());
     550           0 :   if (!args.isConstructing()) {
     551             :     // XXXbz wish I could get the name from the callee instead of
     552             :     // Adding more relocations
     553           0 :     return ThrowConstructorWithoutNew(cx, "VTTRegion");
     554             :   }
     555             : 
     556           0 :   GlobalObject global(cx, obj);
     557           0 :   if (global.Failed()) {
     558           0 :     return false;
     559             :   }
     560             : 
     561           0 :   JS::Rooted<JSObject*> desiredProto(cx);
     562           0 :   if (!GetDesiredProto(cx, args, &desiredProto)) {
     563           0 :     return false;
     564             :   }
     565             : 
     566           0 :   bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
     567           0 :   Maybe<JSAutoCompartment> ac;
     568           0 :   if (objIsXray) {
     569           0 :     obj = js::CheckedUnwrap(obj);
     570           0 :     if (!obj) {
     571           0 :       return false;
     572             :     }
     573           0 :     ac.emplace(cx, obj);
     574           0 :     if (!JS_WrapObject(cx, &desiredProto)) {
     575           0 :       return false;
     576             :     }
     577             :   }
     578           0 :   binding_detail::FastErrorResult rv;
     579           0 :   auto result(StrongOrRawPtr<mozilla::dom::TextTrackRegion>(mozilla::dom::TextTrackRegion::Constructor(global, rv)));
     580           0 :   if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
     581           0 :     return false;
     582             :   }
     583           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     584             :   static_assert(!IsPointer<decltype(result)>::value,
     585             :                 "NewObject implies that we need to keep the object alive with a strong reference.");
     586           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) {
     587           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     588           0 :     return false;
     589             :   }
     590           0 :   return true;
     591             : }
     592             : 
     593             : static const js::ClassOps sInterfaceObjectClassOps = {
     594             :     nullptr,               /* addProperty */
     595             :     nullptr,               /* delProperty */
     596             :     nullptr,               /* getProperty */
     597             :     nullptr,               /* setProperty */
     598             :     nullptr,               /* enumerate */
     599             :     nullptr,               /* newEnumerate */
     600             :     nullptr,               /* resolve */
     601             :     nullptr,               /* mayResolve */
     602             :     nullptr,               /* finalize */
     603             :     _constructor, /* call */
     604             :     nullptr,               /* hasInstance */
     605             :     _constructor, /* construct */
     606             :     nullptr,               /* trace */
     607             : };
     608             : 
     609             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     610             :   {
     611             :     "Function",
     612             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     613             :     &sInterfaceObjectClassOps,
     614             :     JS_NULL_CLASS_SPEC,
     615             :     JS_NULL_CLASS_EXT,
     616             :     &sInterfaceObjectClassObjectOps
     617             :   },
     618             :   eInterface,
     619             :   true,
     620             :   prototypes::id::VTTRegion,
     621             :   PrototypeTraits<prototypes::id::VTTRegion>::Depth,
     622             :   sNativePropertyHooks,
     623             :   "function VTTRegion() {\n    [native code]\n}",
     624             :   JS::GetRealmFunctionPrototype
     625             : };
     626             : 
     627             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     628             :   {
     629             :     "VTTRegionPrototype",
     630             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     631             :     JS_NULL_CLASS_OPS,
     632             :     JS_NULL_CLASS_SPEC,
     633             :     JS_NULL_CLASS_EXT,
     634             :     JS_NULL_OBJECT_OPS
     635             :   },
     636             :   eInterfacePrototype,
     637             :   false,
     638             :   prototypes::id::VTTRegion,
     639             :   PrototypeTraits<prototypes::id::VTTRegion>::Depth,
     640             :   sNativePropertyHooks,
     641             :   "[object VTTRegionPrototype]",
     642             :   JS::GetRealmObjectPrototype
     643             : };
     644             : 
     645             : bool
     646           0 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
     647             : {
     648             :   static bool sPrefValue;
     649             :   static bool sPrefCacheSetUp = false;
     650           0 :   if (!sPrefCacheSetUp) {
     651           0 :     sPrefCacheSetUp = true;
     652           0 :     Preferences::AddBoolVarCache(&sPrefValue, "media.webvtt.regions.enabled");
     653             :   }
     654             : 
     655           0 :   return sPrefValue;
     656             : }
     657             : 
     658             : JSObject*
     659           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     660             : {
     661           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     662             : }
     663             : 
     664             : static const js::ClassOps sClassOps = {
     665             :   _addProperty, /* addProperty */
     666             :   nullptr,               /* delProperty */
     667             :   nullptr,               /* getProperty */
     668             :   nullptr,               /* setProperty */
     669             :   nullptr,               /* enumerate */
     670             :   nullptr, /* newEnumerate */
     671             :   nullptr, /* resolve */
     672             :   nullptr, /* mayResolve */
     673             :   _finalize, /* finalize */
     674             :   nullptr, /* call */
     675             :   nullptr,               /* hasInstance */
     676             :   nullptr,               /* construct */
     677             :   nullptr, /* trace */
     678             : };
     679             : 
     680             : static const js::ClassExtension sClassExtension = {
     681             :   nullptr, /* weakmapKeyDelegateOp */
     682             :   _objectMoved /* objectMovedOp */
     683             : };
     684             : 
     685             : static const DOMJSClass sClass = {
     686             :   { "VTTRegion",
     687             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
     688             :     &sClassOps,
     689             :     JS_NULL_CLASS_SPEC,
     690             :     &sClassExtension,
     691             :     JS_NULL_OBJECT_OPS
     692             :   },
     693             :   { prototypes::id::VTTRegion, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
     694             :   IsBaseOf<nsISupports, mozilla::dom::TextTrackRegion >::value,
     695             :   sNativePropertyHooks,
     696             :   FindAssociatedGlobalForNative<mozilla::dom::TextTrackRegion>::Get,
     697             :   GetProtoObjectHandle,
     698             :   GetCCParticipant<mozilla::dom::TextTrackRegion>::Get()
     699             : };
     700             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     701             :               "Must have the right minimal number of reserved slots.");
     702             : static_assert(1 >= 1,
     703             :               "Must have enough reserved slots.");
     704             : 
     705             : const JSClass*
     706           0 : GetJSClass()
     707             : {
     708           0 :   return sClass.ToJSClass();
     709             : }
     710             : 
     711             : bool
     712           0 : Wrap(JSContext* aCx, mozilla::dom::TextTrackRegion* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     713             : {
     714             :   MOZ_ASSERT(static_cast<mozilla::dom::TextTrackRegion*>(aObject) ==
     715             :              reinterpret_cast<mozilla::dom::TextTrackRegion*>(aObject),
     716             :              "Multiple inheritance for mozilla::dom::TextTrackRegion is broken.");
     717           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     718           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     719           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     720             :              "You should probably not be using Wrap() directly; use "
     721             :              "GetOrCreateDOMReflector instead");
     722             : 
     723           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     724             :              "nsISupports must be on our primary inheritance chain");
     725             : 
     726           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     727           0 :   if (!global) {
     728           0 :     return false;
     729             :   }
     730           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     731           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     732             : 
     733             :   // That might have ended up wrapping us already, due to the wonders
     734             :   // of XBL.  Check for that, and bail out as needed.
     735           0 :   aReflector.set(aCache->GetWrapper());
     736           0 :   if (aReflector) {
     737             : #ifdef DEBUG
     738           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     739             : #endif // DEBUG
     740           0 :     return true;
     741             :   }
     742             : 
     743           0 :   JSAutoCompartment ac(aCx, global);
     744           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     745           0 :   if (!canonicalProto) {
     746           0 :     return false;
     747             :   }
     748           0 :   JS::Rooted<JSObject*> proto(aCx);
     749           0 :   if (aGivenProto) {
     750           0 :     proto = aGivenProto;
     751             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     752             :     // coming in, we changed compartments to that of "parent" so may need
     753             :     // to wrap the proto here.
     754           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     755           0 :       if (!JS_WrapObject(aCx, &proto)) {
     756           0 :         return false;
     757             :       }
     758             :     }
     759             :   } else {
     760           0 :     proto = canonicalProto;
     761             :   }
     762             : 
     763           0 :   BindingJSObjectCreator<mozilla::dom::TextTrackRegion> creator(aCx);
     764           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     765           0 :   if (!aReflector) {
     766           0 :     return false;
     767             :   }
     768             : 
     769           0 :   aCache->SetWrapper(aReflector);
     770           0 :   creator.InitializationSucceeded();
     771             : 
     772           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     773             :              aCache->GetWrapperPreserveColor() == aReflector);
     774             :   // If proto != canonicalProto, we have to preserve our wrapper;
     775             :   // otherwise we won't be able to properly recreate it later, since
     776             :   // we won't know what proto to use.  Note that we don't check
     777             :   // aGivenProto here, since it's entirely possible (and even
     778             :   // somewhat common) to have a non-null aGivenProto which is the
     779             :   // same as canonicalProto.
     780           0 :   if (proto != canonicalProto) {
     781           0 :     PreserveWrapper(aObject);
     782             :   }
     783             : 
     784           0 :   return true;
     785             : }
     786             : 
     787             : const NativePropertyHooks sNativePropertyHooks[] = { {
     788             :   nullptr,
     789             :   nullptr,
     790             :   nullptr,
     791             :   { sNativeProperties.Upcast(), nullptr },
     792             :   prototypes::id::VTTRegion,
     793             :   constructors::id::VTTRegion,
     794             :   nullptr,
     795             :   &DefaultXrayExpandoObjectClass
     796             : } };
     797             : 
     798             : void
     799           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     800             : {
     801           0 :   JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
     802           0 :   if (!parentProto) {
     803           0 :     return;
     804             :   }
     805             : 
     806           0 :   JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
     807           0 :   if (!constructorProto) {
     808           0 :     return;
     809             :   }
     810             : 
     811             :   static bool sIdsInited = false;
     812           0 :   if (!sIdsInited && NS_IsMainThread()) {
     813           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     814           0 :       return;
     815             :     }
     816           0 :     sIdsInited = true;
     817             :   }
     818             : 
     819           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::VTTRegion);
     820           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::VTTRegion);
     821           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     822             :                               &sPrototypeClass.mBase, protoCache,
     823             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     824             :                               interfaceCache,
     825             :                               sNativeProperties.Upcast(),
     826             :                               nullptr,
     827             :                               "VTTRegion", aDefineOnGlobal,
     828             :                               nullptr,
     829           0 :                               false);
     830             : }
     831             : 
     832             : JS::Handle<JSObject*>
     833           0 : GetProtoObjectHandle(JSContext* aCx)
     834             : {
     835             :   /* Get the interface prototype object for this class.  This will create the
     836             :      object as needed. */
     837           0 :   bool aDefineOnGlobal = true;
     838             : 
     839             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     840           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     841           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     842           0 :     return nullptr;
     843             :   }
     844             : 
     845             :   /* Check to see whether the interface objects are already installed */
     846           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     847           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::VTTRegion)) {
     848           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     849           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     850             :   }
     851             : 
     852             :   /*
     853             :    * The object might _still_ be null, but that's OK.
     854             :    *
     855             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     856             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     857             :    * changed after they have been set.
     858             :    *
     859             :    * Calling address() avoids the read read barrier that does gray
     860             :    * unmarking, but it's not possible for the object to be gray here.
     861             :    */
     862             : 
     863           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::VTTRegion);
     864           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     865           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     866             : }
     867             : 
     868             : JS::Handle<JSObject*>
     869           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     870             : {
     871             :   /* Get the interface object for this class.  This will create the object as
     872             :      needed. */
     873             : 
     874             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     875           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     876           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     877           0 :     return nullptr;
     878             :   }
     879             : 
     880             :   /* Check to see whether the interface objects are already installed */
     881           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     882           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::VTTRegion)) {
     883           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     884           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     885             :   }
     886             : 
     887             :   /*
     888             :    * The object might _still_ be null, but that's OK.
     889             :    *
     890             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     891             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     892             :    * changed after they have been set.
     893             :    *
     894             :    * Calling address() avoids the read read barrier that does gray
     895             :    * unmarking, but it's not possible for the object to be gray here.
     896             :    */
     897             : 
     898           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::VTTRegion);
     899           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     900           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     901             : }
     902             : 
     903             : JSObject*
     904           0 : GetConstructorObject(JSContext* aCx)
     905             : {
     906           0 :   return GetConstructorObjectHandle(aCx);
     907             : }
     908             : 
     909             : } // namespace VTTRegionBinding
     910             : 
     911             : 
     912             : 
     913             : } // namespace dom
     914             : } // namespace mozilla

Generated by: LCOV version 1.13