LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dom/bindings - PopupBoxObjectBinding.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 67 390 17.2 %
Date: 2017-07-14 16:53:18 Functions: 6 31 19.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM PopupBoxObject.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "BoxObjectBinding.h"
       4             : #include "PopupBoxObjectBinding.h"
       5             : #include "WrapperFactory.h"
       6             : #include "mozilla/OwningNonNull.h"
       7             : #include "mozilla/dom/BindingUtils.h"
       8             : #include "mozilla/dom/DOMJSClass.h"
       9             : #include "mozilla/dom/DOMRect.h"
      10             : #include "mozilla/dom/Element.h"
      11             : #include "mozilla/dom/Event.h"
      12             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      13             : #include "mozilla/dom/Nullable.h"
      14             : #include "mozilla/dom/PopupBoxObject.h"
      15             : #include "mozilla/dom/PrimitiveConversions.h"
      16             : #include "mozilla/dom/XrayExpandoClass.h"
      17             : #include "nsINode.h"
      18             : 
      19             : namespace mozilla {
      20             : namespace dom {
      21             : 
      22             : namespace PopupBoxObjectBinding {
      23             : 
      24             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<BoxObjectBinding::NativeType>::value,
      25             :               "Can't inherit from an interface with a different ownership model.");
      26             : 
      27             : static bool
      28           0 : showPopup(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, const JSJitMethodCallArgs& args)
      29             : {
      30           0 :   if (MOZ_UNLIKELY(args.length() < 4)) {
      31           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PopupBoxObject.showPopup");
      32             :   }
      33             :   mozilla::dom::Element* arg0;
      34           0 :   if (args[0].isObject()) {
      35             :     {
      36           0 :       nsresult rv = UnwrapObject<prototypes::id::Element, mozilla::dom::Element>(args[0], arg0);
      37           0 :       if (NS_FAILED(rv)) {
      38           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PopupBoxObject.showPopup", "Element");
      39           0 :         return false;
      40             :       }
      41             :     }
      42           0 :   } else if (args[0].isNullOrUndefined()) {
      43           0 :     arg0 = nullptr;
      44             :   } else {
      45           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PopupBoxObject.showPopup");
      46           0 :     return false;
      47             :   }
      48           0 :   NonNull<mozilla::dom::Element> arg1;
      49           0 :   if (args[1].isObject()) {
      50             :     {
      51           0 :       nsresult rv = UnwrapObject<prototypes::id::Element, mozilla::dom::Element>(args[1], arg1);
      52           0 :       if (NS_FAILED(rv)) {
      53           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of PopupBoxObject.showPopup", "Element");
      54           0 :         return false;
      55             :       }
      56             :     }
      57             :   } else {
      58           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of PopupBoxObject.showPopup");
      59           0 :     return false;
      60             :   }
      61             :   int32_t arg2;
      62           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
      63           0 :     return false;
      64             :   }
      65             :   int32_t arg3;
      66           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
      67           0 :     return false;
      68             :   }
      69           0 :   binding_detail::FakeString arg4;
      70           0 :   if (args.hasDefined(4)) {
      71           0 :     if (!ConvertJSValueToString(cx, args[4], eStringify, eStringify, arg4)) {
      72           0 :       return false;
      73             :     }
      74             :   } else {
      75             :     static const char16_t data[] = { 0 };
      76           0 :     arg4.Rebind(data, ArrayLength(data) - 1);
      77             :   }
      78           0 :   binding_detail::FakeString arg5;
      79           0 :   if (args.hasDefined(5)) {
      80           0 :     if (!ConvertJSValueToString(cx, args[5], eStringify, eStringify, arg5)) {
      81           0 :       return false;
      82             :     }
      83             :   } else {
      84             :     static const char16_t data[] = { 0 };
      85           0 :     arg5.Rebind(data, ArrayLength(data) - 1);
      86             :   }
      87           0 :   binding_detail::FakeString arg6;
      88           0 :   if (args.hasDefined(6)) {
      89           0 :     if (!ConvertJSValueToString(cx, args[6], eStringify, eStringify, arg6)) {
      90           0 :       return false;
      91             :     }
      92             :   } else {
      93             :     static const char16_t data[] = { 0 };
      94           0 :     arg6.Rebind(data, ArrayLength(data) - 1);
      95             :   }
      96           0 :   self->ShowPopup(Constify(arg0), NonNullHelper(arg1), arg2, arg3, NonNullHelper(Constify(arg4)), NonNullHelper(Constify(arg5)), NonNullHelper(Constify(arg6)));
      97           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      98           0 :   args.rval().setUndefined();
      99           0 :   return true;
     100             : }
     101             : 
     102             : static const JSJitInfo showPopup_methodinfo = {
     103             :   { (JSJitGetterOp)showPopup },
     104             :   { prototypes::id::PopupBoxObject },
     105             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     106             :   JSJitInfo::Method,
     107             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     108             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     109             :   false,  /* isInfallible. False in setters. */
     110             :   false,  /* isMovable.  Not relevant for setters. */
     111             :   false, /* isEliminatable.  Not relevant for setters. */
     112             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     113             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     114             :   false,  /* isTypedMethod.  Only relevant for methods. */
     115             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     116             : };
     117             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     118             : static_assert(0 < 1, "There is no slot for us");
     119             : 
     120             : static bool
     121           1 : hidePopup(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, const JSJitMethodCallArgs& args)
     122             : {
     123             :   bool arg0;
     124           1 :   if (args.hasDefined(0)) {
     125           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
     126           0 :       return false;
     127             :     }
     128             :   } else {
     129           1 :     arg0 = false;
     130             :   }
     131           1 :   self->HidePopup(arg0);
     132           1 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     133           1 :   args.rval().setUndefined();
     134           1 :   return true;
     135             : }
     136             : 
     137             : static const JSJitInfo hidePopup_methodinfo = {
     138             :   { (JSJitGetterOp)hidePopup },
     139             :   { prototypes::id::PopupBoxObject },
     140             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     141             :   JSJitInfo::Method,
     142             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     143             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     144             :   false,  /* isInfallible. False in setters. */
     145             :   false,  /* isMovable.  Not relevant for setters. */
     146             :   false, /* isEliminatable.  Not relevant for setters. */
     147             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     148             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     149             :   false,  /* isTypedMethod.  Only relevant for methods. */
     150             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     151             : };
     152             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     153             : static_assert(0 < 1, "There is no slot for us");
     154             : 
     155             : static bool
     156           0 : get_autoPosition(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, JSJitGetterCallArgs args)
     157             : {
     158           0 :   bool result(self->AutoPosition());
     159           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     160           0 :   args.rval().setBoolean(result);
     161           0 :   return true;
     162             : }
     163             : 
     164             : static bool
     165           0 : set_autoPosition(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, JSJitSetterCallArgs args)
     166             : {
     167             :   bool arg0;
     168           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
     169           0 :     return false;
     170             :   }
     171           0 :   self->SetAutoPosition(arg0);
     172           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     173             : 
     174           0 :   return true;
     175             : }
     176             : 
     177             : static const JSJitInfo autoPosition_getterinfo = {
     178             :   { (JSJitGetterOp)get_autoPosition },
     179             :   { prototypes::id::PopupBoxObject },
     180             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     181             :   JSJitInfo::Getter,
     182             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     183             :   JSVAL_TYPE_BOOLEAN,  /* returnType.  Not relevant for setters. */
     184             :   true,  /* isInfallible. False in setters. */
     185             :   false,  /* isMovable.  Not relevant for setters. */
     186             :   false, /* isEliminatable.  Not relevant for setters. */
     187             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     188             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     189             :   false,  /* isTypedMethod.  Only relevant for methods. */
     190             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     191             : };
     192             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     193             : static_assert(0 < 1, "There is no slot for us");
     194             : static const JSJitInfo autoPosition_setterinfo = {
     195             :   { (JSJitGetterOp)set_autoPosition },
     196             :   { prototypes::id::PopupBoxObject },
     197             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     198             :   JSJitInfo::Setter,
     199             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     200             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     201             :   false,  /* isInfallible. False in setters. */
     202             :   false,  /* isMovable.  Not relevant for setters. */
     203             :   false, /* isEliminatable.  Not relevant for setters. */
     204             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     205             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     206             :   false,  /* isTypedMethod.  Only relevant for methods. */
     207             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     208             : };
     209             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     210             : static_assert(0 < 1, "There is no slot for us");
     211             : 
     212             : static bool
     213           0 : enableKeyboardNavigator(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, const JSJitMethodCallArgs& args)
     214             : {
     215           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     216           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PopupBoxObject.enableKeyboardNavigator");
     217             :   }
     218             :   bool arg0;
     219           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
     220           0 :     return false;
     221             :   }
     222           0 :   self->EnableKeyboardNavigator(arg0);
     223           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     224           0 :   args.rval().setUndefined();
     225           0 :   return true;
     226             : }
     227             : 
     228             : static const JSJitInfo enableKeyboardNavigator_methodinfo = {
     229             :   { (JSJitGetterOp)enableKeyboardNavigator },
     230             :   { prototypes::id::PopupBoxObject },
     231             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     232             :   JSJitInfo::Method,
     233             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     234             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     235             :   false,  /* isInfallible. False in setters. */
     236             :   false,  /* isMovable.  Not relevant for setters. */
     237             :   false, /* isEliminatable.  Not relevant for setters. */
     238             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     239             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     240             :   false,  /* isTypedMethod.  Only relevant for methods. */
     241             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     242             : };
     243             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     244             : static_assert(0 < 1, "There is no slot for us");
     245             : 
     246             : static bool
     247           0 : enableRollup(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, const JSJitMethodCallArgs& args)
     248             : {
     249           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     250           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PopupBoxObject.enableRollup");
     251             :   }
     252             :   bool arg0;
     253           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
     254           0 :     return false;
     255             :   }
     256           0 :   self->EnableRollup(arg0);
     257           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     258           0 :   args.rval().setUndefined();
     259           0 :   return true;
     260             : }
     261             : 
     262             : static const JSJitInfo enableRollup_methodinfo = {
     263             :   { (JSJitGetterOp)enableRollup },
     264             :   { prototypes::id::PopupBoxObject },
     265             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     266             :   JSJitInfo::Method,
     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 : setConsumeRollupEvent(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, const JSJitMethodCallArgs& args)
     282             : {
     283           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     284           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PopupBoxObject.setConsumeRollupEvent");
     285             :   }
     286             :   uint32_t arg0;
     287           0 :   if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
     288           0 :     return false;
     289             :   }
     290           0 :   self->SetConsumeRollupEvent(arg0);
     291           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     292           0 :   args.rval().setUndefined();
     293           0 :   return true;
     294             : }
     295             : 
     296             : static const JSJitInfo setConsumeRollupEvent_methodinfo = {
     297             :   { (JSJitGetterOp)setConsumeRollupEvent },
     298             :   { prototypes::id::PopupBoxObject },
     299             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     300             :   JSJitInfo::Method,
     301             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     302             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     303             :   false,  /* isInfallible. False in setters. */
     304             :   false,  /* isMovable.  Not relevant for setters. */
     305             :   false, /* isEliminatable.  Not relevant for setters. */
     306             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     307             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     308             :   false,  /* isTypedMethod.  Only relevant for methods. */
     309             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     310             : };
     311             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     312             : static_assert(0 < 1, "There is no slot for us");
     313             : 
     314             : static bool
     315           0 : sizeTo(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, const JSJitMethodCallArgs& args)
     316             : {
     317           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     318           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PopupBoxObject.sizeTo");
     319             :   }
     320             :   int32_t arg0;
     321           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
     322           0 :     return false;
     323             :   }
     324             :   int32_t arg1;
     325           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
     326           0 :     return false;
     327             :   }
     328           0 :   self->SizeTo(arg0, arg1);
     329           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     330           0 :   args.rval().setUndefined();
     331           0 :   return true;
     332             : }
     333             : 
     334             : static const JSJitInfo sizeTo_methodinfo = {
     335             :   { (JSJitGetterOp)sizeTo },
     336             :   { prototypes::id::PopupBoxObject },
     337             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     338             :   JSJitInfo::Method,
     339             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     340             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     341             :   false,  /* isInfallible. False in setters. */
     342             :   false,  /* isMovable.  Not relevant for setters. */
     343             :   false, /* isEliminatable.  Not relevant for setters. */
     344             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     345             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     346             :   false,  /* isTypedMethod.  Only relevant for methods. */
     347             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     348             : };
     349             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     350             : static_assert(0 < 1, "There is no slot for us");
     351             : 
     352             : static bool
     353           0 : moveTo(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, const JSJitMethodCallArgs& args)
     354             : {
     355           0 :   if (MOZ_UNLIKELY(args.length() < 2)) {
     356           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PopupBoxObject.moveTo");
     357             :   }
     358             :   int32_t arg0;
     359           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
     360           0 :     return false;
     361             :   }
     362             :   int32_t arg1;
     363           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
     364           0 :     return false;
     365             :   }
     366           0 :   self->MoveTo(arg0, arg1);
     367           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     368           0 :   args.rval().setUndefined();
     369           0 :   return true;
     370             : }
     371             : 
     372             : static const JSJitInfo moveTo_methodinfo = {
     373             :   { (JSJitGetterOp)moveTo },
     374             :   { prototypes::id::PopupBoxObject },
     375             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     376             :   JSJitInfo::Method,
     377             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     378             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     379             :   false,  /* isInfallible. False in setters. */
     380             :   false,  /* isMovable.  Not relevant for setters. */
     381             :   false, /* isEliminatable.  Not relevant for setters. */
     382             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     383             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     384             :   false,  /* isTypedMethod.  Only relevant for methods. */
     385             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     386             : };
     387             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     388             : static_assert(0 < 1, "There is no slot for us");
     389             : 
     390             : static bool
     391           0 : openPopup(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, const JSJitMethodCallArgs& args)
     392             : {
     393           0 :   if (MOZ_UNLIKELY(args.length() < 7)) {
     394           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PopupBoxObject.openPopup");
     395             :   }
     396             :   mozilla::dom::Element* arg0;
     397           0 :   if (args[0].isObject()) {
     398             :     {
     399           0 :       nsresult rv = UnwrapObject<prototypes::id::Element, mozilla::dom::Element>(args[0], arg0);
     400           0 :       if (NS_FAILED(rv)) {
     401           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PopupBoxObject.openPopup", "Element");
     402           0 :         return false;
     403             :       }
     404             :     }
     405           0 :   } else if (args[0].isNullOrUndefined()) {
     406           0 :     arg0 = nullptr;
     407             :   } else {
     408           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PopupBoxObject.openPopup");
     409           0 :     return false;
     410             :   }
     411           0 :   binding_detail::FakeString arg1;
     412           0 :   if (args.hasDefined(1)) {
     413           0 :     if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
     414           0 :       return false;
     415             :     }
     416             :   } else {
     417             :     static const char16_t data[] = { 0 };
     418           0 :     arg1.Rebind(data, ArrayLength(data) - 1);
     419             :   }
     420             :   int32_t arg2;
     421           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
     422           0 :     return false;
     423             :   }
     424             :   int32_t arg3;
     425           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
     426           0 :     return false;
     427             :   }
     428             :   bool arg4;
     429           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[4], &arg4)) {
     430           0 :     return false;
     431             :   }
     432             :   bool arg5;
     433           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[5], &arg5)) {
     434           0 :     return false;
     435             :   }
     436             :   mozilla::dom::Event* arg6;
     437           0 :   if (args[6].isObject()) {
     438             :     {
     439           0 :       nsresult rv = UnwrapObject<prototypes::id::Event, mozilla::dom::Event>(args[6], arg6);
     440           0 :       if (NS_FAILED(rv)) {
     441           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 7 of PopupBoxObject.openPopup", "Event");
     442           0 :         return false;
     443             :       }
     444             :     }
     445           0 :   } else if (args[6].isNullOrUndefined()) {
     446           0 :     arg6 = nullptr;
     447             :   } else {
     448           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 7 of PopupBoxObject.openPopup");
     449           0 :     return false;
     450             :   }
     451           0 :   self->OpenPopup(Constify(arg0), NonNullHelper(Constify(arg1)), arg2, arg3, arg4, arg5, Constify(arg6));
     452           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     453           0 :   args.rval().setUndefined();
     454           0 :   return true;
     455             : }
     456             : 
     457             : static const JSJitInfo openPopup_methodinfo = {
     458             :   { (JSJitGetterOp)openPopup },
     459             :   { prototypes::id::PopupBoxObject },
     460             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     461             :   JSJitInfo::Method,
     462             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     463             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     464             :   false,  /* isInfallible. False in setters. */
     465             :   false,  /* isMovable.  Not relevant for setters. */
     466             :   false, /* isEliminatable.  Not relevant for setters. */
     467             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     468             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     469             :   false,  /* isTypedMethod.  Only relevant for methods. */
     470             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     471             : };
     472             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     473             : static_assert(0 < 1, "There is no slot for us");
     474             : 
     475             : static bool
     476           0 : openPopupAtScreen(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, const JSJitMethodCallArgs& args)
     477             : {
     478           0 :   if (MOZ_UNLIKELY(args.length() < 4)) {
     479           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PopupBoxObject.openPopupAtScreen");
     480             :   }
     481             :   int32_t arg0;
     482           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
     483           0 :     return false;
     484             :   }
     485             :   int32_t arg1;
     486           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
     487           0 :     return false;
     488             :   }
     489             :   bool arg2;
     490           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[2], &arg2)) {
     491           0 :     return false;
     492             :   }
     493             :   mozilla::dom::Event* arg3;
     494           0 :   if (args[3].isObject()) {
     495             :     {
     496           0 :       nsresult rv = UnwrapObject<prototypes::id::Event, mozilla::dom::Event>(args[3], arg3);
     497           0 :       if (NS_FAILED(rv)) {
     498           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 4 of PopupBoxObject.openPopupAtScreen", "Event");
     499           0 :         return false;
     500             :       }
     501             :     }
     502           0 :   } else if (args[3].isNullOrUndefined()) {
     503           0 :     arg3 = nullptr;
     504             :   } else {
     505           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 4 of PopupBoxObject.openPopupAtScreen");
     506           0 :     return false;
     507             :   }
     508           0 :   self->OpenPopupAtScreen(arg0, arg1, arg2, Constify(arg3));
     509           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     510           0 :   args.rval().setUndefined();
     511           0 :   return true;
     512             : }
     513             : 
     514             : static const JSJitInfo openPopupAtScreen_methodinfo = {
     515             :   { (JSJitGetterOp)openPopupAtScreen },
     516             :   { prototypes::id::PopupBoxObject },
     517             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     518             :   JSJitInfo::Method,
     519             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     520             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     521             :   false,  /* isInfallible. False in setters. */
     522             :   false,  /* isMovable.  Not relevant for setters. */
     523             :   false, /* isEliminatable.  Not relevant for setters. */
     524             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     525             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     526             :   false,  /* isTypedMethod.  Only relevant for methods. */
     527             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     528             : };
     529             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     530             : static_assert(0 < 1, "There is no slot for us");
     531             : 
     532             : static bool
     533           0 : openPopupAtScreenRect(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, const JSJitMethodCallArgs& args)
     534             : {
     535           0 :   if (MOZ_UNLIKELY(args.length() < 8)) {
     536           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PopupBoxObject.openPopupAtScreenRect");
     537             :   }
     538           0 :   binding_detail::FakeString arg0;
     539           0 :   if (args.hasDefined(0)) {
     540           0 :     if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
     541           0 :       return false;
     542             :     }
     543             :   } else {
     544             :     static const char16_t data[] = { 0 };
     545           0 :     arg0.Rebind(data, ArrayLength(data) - 1);
     546             :   }
     547             :   int32_t arg1;
     548           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) {
     549           0 :     return false;
     550             :   }
     551             :   int32_t arg2;
     552           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
     553           0 :     return false;
     554             :   }
     555             :   int32_t arg3;
     556           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
     557           0 :     return false;
     558             :   }
     559             :   int32_t arg4;
     560           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[4], &arg4)) {
     561           0 :     return false;
     562             :   }
     563             :   bool arg5;
     564           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[5], &arg5)) {
     565           0 :     return false;
     566             :   }
     567             :   bool arg6;
     568           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[6], &arg6)) {
     569           0 :     return false;
     570             :   }
     571             :   mozilla::dom::Event* arg7;
     572           0 :   if (args[7].isObject()) {
     573             :     {
     574           0 :       nsresult rv = UnwrapObject<prototypes::id::Event, mozilla::dom::Event>(args[7], arg7);
     575           0 :       if (NS_FAILED(rv)) {
     576           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 8 of PopupBoxObject.openPopupAtScreenRect", "Event");
     577           0 :         return false;
     578             :       }
     579             :     }
     580           0 :   } else if (args[7].isNullOrUndefined()) {
     581           0 :     arg7 = nullptr;
     582             :   } else {
     583           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 8 of PopupBoxObject.openPopupAtScreenRect");
     584           0 :     return false;
     585             :   }
     586           0 :   self->OpenPopupAtScreenRect(NonNullHelper(Constify(arg0)), arg1, arg2, arg3, arg4, arg5, arg6, Constify(arg7));
     587           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     588           0 :   args.rval().setUndefined();
     589           0 :   return true;
     590             : }
     591             : 
     592             : static const JSJitInfo openPopupAtScreenRect_methodinfo = {
     593             :   { (JSJitGetterOp)openPopupAtScreenRect },
     594             :   { prototypes::id::PopupBoxObject },
     595             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     596             :   JSJitInfo::Method,
     597             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     598             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     599             :   false,  /* isInfallible. False in setters. */
     600             :   false,  /* isMovable.  Not relevant for setters. */
     601             :   false, /* isEliminatable.  Not relevant for setters. */
     602             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     603             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     604             :   false,  /* isTypedMethod.  Only relevant for methods. */
     605             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     606             : };
     607             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     608             : static_assert(0 < 1, "There is no slot for us");
     609             : 
     610             : static bool
     611           4 : get_popupState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, JSJitGetterCallArgs args)
     612             : {
     613           8 :   DOMString result;
     614           4 :   self->GetPopupState(result);
     615           4 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     616           4 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     617           0 :     return false;
     618             :   }
     619           4 :   return true;
     620             : }
     621             : 
     622             : static const JSJitInfo popupState_getterinfo = {
     623             :   { (JSJitGetterOp)get_popupState },
     624             :   { prototypes::id::PopupBoxObject },
     625             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     626             :   JSJitInfo::Getter,
     627             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     628             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     629             :   false,  /* isInfallible. False in setters. */
     630             :   false,  /* isMovable.  Not relevant for setters. */
     631             :   false, /* isEliminatable.  Not relevant for setters. */
     632             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     633             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     634             :   false,  /* isTypedMethod.  Only relevant for methods. */
     635             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     636             : };
     637             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     638             : static_assert(0 < 1, "There is no slot for us");
     639             : 
     640             : static bool
     641           1 : get_triggerNode(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, JSJitGetterCallArgs args)
     642             : {
     643           1 :   auto result(StrongOrRawPtr<nsINode>(self->GetTriggerNode()));
     644           1 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     645           1 :   if (!result) {
     646           1 :     args.rval().setNull();
     647           1 :     return true;
     648             :   }
     649           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     650           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     651           0 :     return false;
     652             :   }
     653           0 :   return true;
     654             : }
     655             : 
     656             : static const JSJitInfo triggerNode_getterinfo = {
     657             :   { (JSJitGetterOp)get_triggerNode },
     658             :   { prototypes::id::PopupBoxObject },
     659             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     660             :   JSJitInfo::Getter,
     661             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     662             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     663             :   false,  /* isInfallible. False in setters. */
     664             :   false,  /* isMovable.  Not relevant for setters. */
     665             :   false, /* isEliminatable.  Not relevant for setters. */
     666             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     667             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     668             :   false,  /* isTypedMethod.  Only relevant for methods. */
     669             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     670             : };
     671             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     672             : static_assert(0 < 1, "There is no slot for us");
     673             : 
     674             : static bool
     675           0 : get_anchorNode(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, JSJitGetterCallArgs args)
     676             : {
     677           0 :   auto result(StrongOrRawPtr<mozilla::dom::Element>(self->GetAnchorNode()));
     678           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     679           0 :   if (!result) {
     680           0 :     args.rval().setNull();
     681           0 :     return true;
     682             :   }
     683           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     684           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     685           0 :     return false;
     686             :   }
     687           0 :   return true;
     688             : }
     689             : 
     690             : static const JSJitInfo anchorNode_getterinfo = {
     691             :   { (JSJitGetterOp)get_anchorNode },
     692             :   { prototypes::id::PopupBoxObject },
     693             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     694             :   JSJitInfo::Getter,
     695             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     696             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
     697             :   false,  /* isInfallible. False in setters. */
     698             :   false,  /* isMovable.  Not relevant for setters. */
     699             :   false, /* isEliminatable.  Not relevant for setters. */
     700             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     701             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     702             :   false,  /* isTypedMethod.  Only relevant for methods. */
     703             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     704             : };
     705             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     706             : static_assert(0 < 1, "There is no slot for us");
     707             : 
     708             : static bool
     709           0 : getOuterScreenRect(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, const JSJitMethodCallArgs& args)
     710             : {
     711           0 :   auto result(StrongOrRawPtr<mozilla::dom::DOMRect>(self->GetOuterScreenRect()));
     712           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     713           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     714           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     715           0 :     return false;
     716             :   }
     717           0 :   return true;
     718             : }
     719             : 
     720             : static const JSJitInfo getOuterScreenRect_methodinfo = {
     721             :   { (JSJitGetterOp)getOuterScreenRect },
     722             :   { prototypes::id::PopupBoxObject },
     723             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     724             :   JSJitInfo::Method,
     725             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     726             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     727             :   false,  /* isInfallible. False in setters. */
     728             :   false,  /* isMovable.  Not relevant for setters. */
     729             :   false, /* isEliminatable.  Not relevant for setters. */
     730             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     731             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     732             :   false,  /* isTypedMethod.  Only relevant for methods. */
     733             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     734             : };
     735             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     736             : static_assert(0 < 1, "There is no slot for us");
     737             : 
     738             : static bool
     739           0 : moveToAnchor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, const JSJitMethodCallArgs& args)
     740             : {
     741           0 :   if (MOZ_UNLIKELY(args.length() < 5)) {
     742           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PopupBoxObject.moveToAnchor");
     743             :   }
     744             :   mozilla::dom::Element* arg0;
     745           0 :   if (args[0].isObject()) {
     746             :     {
     747           0 :       nsresult rv = UnwrapObject<prototypes::id::Element, mozilla::dom::Element>(args[0], arg0);
     748           0 :       if (NS_FAILED(rv)) {
     749           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PopupBoxObject.moveToAnchor", "Element");
     750           0 :         return false;
     751             :       }
     752             :     }
     753           0 :   } else if (args[0].isNullOrUndefined()) {
     754           0 :     arg0 = nullptr;
     755             :   } else {
     756           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PopupBoxObject.moveToAnchor");
     757           0 :     return false;
     758             :   }
     759           0 :   binding_detail::FakeString arg1;
     760           0 :   if (args.hasDefined(1)) {
     761           0 :     if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) {
     762           0 :       return false;
     763             :     }
     764             :   } else {
     765             :     static const char16_t data[] = { 0 };
     766           0 :     arg1.Rebind(data, ArrayLength(data) - 1);
     767             :   }
     768             :   int32_t arg2;
     769           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[2], &arg2)) {
     770           0 :     return false;
     771             :   }
     772             :   int32_t arg3;
     773           0 :   if (!ValueToPrimitive<int32_t, eDefault>(cx, args[3], &arg3)) {
     774           0 :     return false;
     775             :   }
     776             :   bool arg4;
     777           0 :   if (!ValueToPrimitive<bool, eDefault>(cx, args[4], &arg4)) {
     778           0 :     return false;
     779             :   }
     780           0 :   self->MoveToAnchor(Constify(arg0), NonNullHelper(Constify(arg1)), arg2, arg3, arg4);
     781           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     782           0 :   args.rval().setUndefined();
     783           0 :   return true;
     784             : }
     785             : 
     786             : static const JSJitInfo moveToAnchor_methodinfo = {
     787             :   { (JSJitGetterOp)moveToAnchor },
     788             :   { prototypes::id::PopupBoxObject },
     789             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     790             :   JSJitInfo::Method,
     791             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     792             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     793             :   false,  /* isInfallible. False in setters. */
     794             :   false,  /* isMovable.  Not relevant for setters. */
     795             :   false, /* isEliminatable.  Not relevant for setters. */
     796             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     797             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     798             :   false,  /* isTypedMethod.  Only relevant for methods. */
     799             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     800             : };
     801             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     802             : static_assert(0 < 1, "There is no slot for us");
     803             : 
     804             : static bool
     805           0 : get_alignmentPosition(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, JSJitGetterCallArgs args)
     806             : {
     807           0 :   DOMString result;
     808           0 :   self->GetAlignmentPosition(result);
     809           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     810           0 :   if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
     811           0 :     return false;
     812             :   }
     813           0 :   return true;
     814             : }
     815             : 
     816             : static const JSJitInfo alignmentPosition_getterinfo = {
     817             :   { (JSJitGetterOp)get_alignmentPosition },
     818             :   { prototypes::id::PopupBoxObject },
     819             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     820             :   JSJitInfo::Getter,
     821             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     822             :   JSVAL_TYPE_STRING,  /* returnType.  Not relevant for setters. */
     823             :   false,  /* isInfallible. False in setters. */
     824             :   false,  /* isMovable.  Not relevant for setters. */
     825             :   false, /* isEliminatable.  Not relevant for setters. */
     826             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     827             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     828             :   false,  /* isTypedMethod.  Only relevant for methods. */
     829             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     830             : };
     831             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     832             : static_assert(0 < 1, "There is no slot for us");
     833             : 
     834             : static bool
     835           0 : get_alignmentOffset(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, JSJitGetterCallArgs args)
     836             : {
     837           0 :   int32_t result(self->AlignmentOffset());
     838           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     839           0 :   args.rval().setInt32(int32_t(result));
     840           0 :   return true;
     841             : }
     842             : 
     843             : static const JSJitInfo alignmentOffset_getterinfo = {
     844             :   { (JSJitGetterOp)get_alignmentOffset },
     845             :   { prototypes::id::PopupBoxObject },
     846             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     847             :   JSJitInfo::Getter,
     848             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     849             :   JSVAL_TYPE_INT32,  /* returnType.  Not relevant for setters. */
     850             :   true,  /* isInfallible. False in setters. */
     851             :   false,  /* isMovable.  Not relevant for setters. */
     852             :   false, /* isEliminatable.  Not relevant for setters. */
     853             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     854             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     855             :   false,  /* isTypedMethod.  Only relevant for methods. */
     856             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     857             : };
     858             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     859             : static_assert(0 < 1, "There is no slot for us");
     860             : 
     861             : static bool
     862           0 : setConstraintRect(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBoxObject* self, const JSJitMethodCallArgs& args)
     863             : {
     864           0 :   if (MOZ_UNLIKELY(args.length() < 1)) {
     865           0 :     return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PopupBoxObject.setConstraintRect");
     866             :   }
     867           0 :   NonNull<mozilla::dom::DOMRectReadOnly> arg0;
     868           0 :   if (args[0].isObject()) {
     869             :     {
     870           0 :       nsresult rv = UnwrapObject<prototypes::id::DOMRectReadOnly, mozilla::dom::DOMRectReadOnly>(args[0], arg0);
     871           0 :       if (NS_FAILED(rv)) {
     872           0 :         ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PopupBoxObject.setConstraintRect", "DOMRectReadOnly");
     873           0 :         return false;
     874             :       }
     875             :     }
     876             :   } else {
     877           0 :     ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PopupBoxObject.setConstraintRect");
     878           0 :     return false;
     879             :   }
     880           0 :   self->SetConstraintRect(NonNullHelper(arg0));
     881           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     882           0 :   args.rval().setUndefined();
     883           0 :   return true;
     884             : }
     885             : 
     886             : static const JSJitInfo setConstraintRect_methodinfo = {
     887             :   { (JSJitGetterOp)setConstraintRect },
     888             :   { prototypes::id::PopupBoxObject },
     889             :   { PrototypeTraits<prototypes::id::PopupBoxObject>::Depth },
     890             :   JSJitInfo::Method,
     891             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
     892             :   JSVAL_TYPE_UNDEFINED,  /* returnType.  Not relevant for setters. */
     893             :   false,  /* isInfallible. False in setters. */
     894             :   false,  /* isMovable.  Not relevant for setters. */
     895             :   false, /* isEliminatable.  Not relevant for setters. */
     896             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     897             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     898             :   false,  /* isTypedMethod.  Only relevant for methods. */
     899             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     900             : };
     901             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     902             : static_assert(0 < 1, "There is no slot for us");
     903             : 
     904             : static bool
     905           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     906             : {
     907           0 :   mozilla::dom::PopupBoxObject* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::PopupBoxObject>(obj);
     908             :   // We don't want to preserve if we don't have a wrapper, and we
     909             :   // obviously can't preserve if we're not initialized.
     910           0 :   if (self && self->GetWrapperPreserveColor()) {
     911           0 :     PreserveWrapper(self);
     912             :   }
     913           0 :   return true;
     914             : }
     915             : 
     916             : static void
     917           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     918             : {
     919           0 :   mozilla::dom::PopupBoxObject* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::PopupBoxObject>(obj);
     920           0 :   if (self) {
     921           0 :     ClearWrapper(self, self, obj);
     922           0 :     AddForDeferredFinalization<mozilla::dom::PopupBoxObject>(self);
     923             :   }
     924           0 : }
     925             : 
     926             : static void
     927           0 : _objectMoved(JSObject* obj, const JSObject* old)
     928             : {
     929           0 :   mozilla::dom::PopupBoxObject* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::PopupBoxObject>(obj);
     930           0 :   if (self) {
     931           0 :     UpdateWrapper(self, self, obj, old);
     932             :   }
     933           0 : }
     934             : 
     935             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     936             : #if defined(__clang__)
     937             : #pragma clang diagnostic push
     938             : #pragma clang diagnostic ignored "-Wmissing-braces"
     939             : #endif
     940             : static const JSFunctionSpec sMethods_specs[] = {
     941             :   JS_FNSPEC("showPopup", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&showPopup_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
     942             :   JS_FNSPEC("hidePopup", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&hidePopup_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
     943             :   JS_FNSPEC("enableKeyboardNavigator", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&enableKeyboardNavigator_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     944             :   JS_FNSPEC("enableRollup", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&enableRollup_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     945             :   JS_FNSPEC("setConsumeRollupEvent", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setConsumeRollupEvent_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     946             :   JS_FNSPEC("sizeTo", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&sizeTo_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
     947             :   JS_FNSPEC("moveTo", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&moveTo_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
     948             :   JS_FNSPEC("openPopup", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&openPopup_methodinfo), 7, JSPROP_ENUMERATE, nullptr),
     949             :   JS_FNSPEC("openPopupAtScreen", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&openPopupAtScreen_methodinfo), 4, JSPROP_ENUMERATE, nullptr),
     950             :   JS_FNSPEC("openPopupAtScreenRect", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&openPopupAtScreenRect_methodinfo), 8, JSPROP_ENUMERATE, nullptr),
     951             :   JS_FNSPEC("getOuterScreenRect", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getOuterScreenRect_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
     952             :   JS_FNSPEC("moveToAnchor", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&moveToAnchor_methodinfo), 5, JSPROP_ENUMERATE, nullptr),
     953             :   JS_FNSPEC("setConstraintRect", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setConstraintRect_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
     954             :   JS_FS_END
     955             : };
     956             : #if defined(__clang__)
     957             : #pragma clang diagnostic pop
     958             : #endif
     959             : 
     960             : 
     961             : // Can't be const because the pref-enabled boolean needs to be writable
     962             : static Prefable<const JSFunctionSpec> sMethods[] = {
     963             :   { nullptr, &sMethods_specs[0] },
     964             :   { nullptr, nullptr }
     965             : };
     966             : 
     967             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     968             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     969             : static_assert(13 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     970             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     971             : 
     972             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     973             : #if defined(__clang__)
     974             : #pragma clang diagnostic push
     975             : #pragma clang diagnostic ignored "-Wmissing-braces"
     976             : #endif
     977             : static const JSPropertySpec sAttributes_specs[] = {
     978             :   { "autoPosition", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &autoPosition_getterinfo, GenericBindingSetter, &autoPosition_setterinfo },
     979             :   { "popupState", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &popupState_getterinfo, nullptr, nullptr },
     980             :   { "triggerNode", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &triggerNode_getterinfo, nullptr, nullptr },
     981             :   { "anchorNode", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &anchorNode_getterinfo, nullptr, nullptr },
     982             :   { "alignmentPosition", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &alignmentPosition_getterinfo, nullptr, nullptr },
     983             :   { "alignmentOffset", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &alignmentOffset_getterinfo, nullptr, nullptr },
     984             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     985             : };
     986             : #if defined(__clang__)
     987             : #pragma clang diagnostic pop
     988             : #endif
     989             : 
     990             : 
     991             : // Can't be const because the pref-enabled boolean needs to be writable
     992             : static Prefable<const JSPropertySpec> sAttributes[] = {
     993             :   { nullptr, &sAttributes_specs[0] },
     994             :   { nullptr, nullptr }
     995             : };
     996             : 
     997             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     998             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     999             : static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    1000             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
    1001             : 
    1002             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
    1003             : #if defined(__clang__)
    1004             : #pragma clang diagnostic push
    1005             : #pragma clang diagnostic ignored "-Wmissing-braces"
    1006             : #endif
    1007             : static const ConstantSpec sConstants_specs[] = {
    1008             :   { "ROLLUP_DEFAULT", JS::NumberValue(0U) },
    1009             :   { "ROLLUP_CONSUME", JS::NumberValue(1U) },
    1010             :   { "ROLLUP_NO_CONSUME", JS::NumberValue(2U) },
    1011             :   { 0, JS::UndefinedValue() }
    1012             : };
    1013             : #if defined(__clang__)
    1014             : #pragma clang diagnostic pop
    1015             : #endif
    1016             : 
    1017             : 
    1018             : // Can't be const because the pref-enabled boolean needs to be writable
    1019             : static Prefable<const ConstantSpec> sConstants[] = {
    1020             :   { nullptr, &sConstants_specs[0] },
    1021             :   { nullptr, nullptr }
    1022             : };
    1023             : 
    1024             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
    1025             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
    1026             : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    1027             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
    1028             : 
    1029             : 
    1030             : static uint16_t sNativeProperties_sortedPropertyIndices[22];
    1031             : static PropertyInfo sNativeProperties_propertyInfos[22];
    1032             : 
    1033             : static const NativePropertiesN<3> sNativeProperties = {
    1034             :   false, 0,
    1035             :   false, 0,
    1036             :   true,  0 /* sMethods */,
    1037             :   true,  1 /* sAttributes */,
    1038             :   false, 0,
    1039             :   false, 0,
    1040             :   true,  2 /* sConstants */,
    1041             :   -1,
    1042             :   22,
    1043             :   sNativeProperties_sortedPropertyIndices,
    1044             :   {
    1045             :     { sMethods, &sNativeProperties_propertyInfos[0] },
    1046             :     { sAttributes, &sNativeProperties_propertyInfos[13] },
    1047             :     { sConstants, &sNativeProperties_propertyInfos[19] }
    1048             :   }
    1049             : };
    1050             : static_assert(22 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
    1051             :     "We have a property info count that is oversized");
    1052             : 
    1053             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
    1054             :   {
    1055             :     "Function",
    1056             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
    1057             :     &sBoringInterfaceObjectClassClassOps,
    1058             :     JS_NULL_CLASS_SPEC,
    1059             :     JS_NULL_CLASS_EXT,
    1060             :     &sInterfaceObjectClassObjectOps
    1061             :   },
    1062             :   eInterface,
    1063             :   true,
    1064             :   prototypes::id::PopupBoxObject,
    1065             :   PrototypeTraits<prototypes::id::PopupBoxObject>::Depth,
    1066             :   sNativePropertyHooks,
    1067             :   "function PopupBoxObject() {\n    [native code]\n}",
    1068             :   BoxObjectBinding::GetConstructorObject
    1069             : };
    1070             : 
    1071             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
    1072             :   {
    1073             :     "PopupBoxObjectPrototype",
    1074             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
    1075             :     JS_NULL_CLASS_OPS,
    1076             :     JS_NULL_CLASS_SPEC,
    1077             :     JS_NULL_CLASS_EXT,
    1078             :     JS_NULL_OBJECT_OPS
    1079             :   },
    1080             :   eInterfacePrototype,
    1081             :   false,
    1082             :   prototypes::id::PopupBoxObject,
    1083             :   PrototypeTraits<prototypes::id::PopupBoxObject>::Depth,
    1084             :   sNativePropertyHooks,
    1085             :   "[object PopupBoxObjectPrototype]",
    1086             :   BoxObjectBinding::GetProtoObject
    1087             : };
    1088             : 
    1089             : bool
    1090           0 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
    1091             : {
    1092           0 :   return IsChromeOrXBL(aCx, aObj);
    1093             : }
    1094             : 
    1095             : JSObject*
    1096           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
    1097             : {
    1098           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
    1099             : }
    1100             : 
    1101             : static const js::ClassOps sClassOps = {
    1102             :   _addProperty, /* addProperty */
    1103             :   nullptr,               /* delProperty */
    1104             :   nullptr,               /* getProperty */
    1105             :   nullptr,               /* setProperty */
    1106             :   nullptr,               /* enumerate */
    1107             :   nullptr, /* newEnumerate */
    1108             :   nullptr, /* resolve */
    1109             :   nullptr, /* mayResolve */
    1110             :   _finalize, /* finalize */
    1111             :   nullptr, /* call */
    1112             :   nullptr,               /* hasInstance */
    1113             :   nullptr,               /* construct */
    1114             :   nullptr, /* trace */
    1115             : };
    1116             : 
    1117             : static const js::ClassExtension sClassExtension = {
    1118             :   nullptr, /* weakmapKeyDelegateOp */
    1119             :   _objectMoved /* objectMovedOp */
    1120             : };
    1121             : 
    1122             : static const DOMJSClass sClass = {
    1123             :   { "PopupBoxObject",
    1124             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
    1125             :     &sClassOps,
    1126             :     JS_NULL_CLASS_SPEC,
    1127             :     &sClassExtension,
    1128             :     JS_NULL_OBJECT_OPS
    1129             :   },
    1130             :   { prototypes::id::BoxObject, prototypes::id::PopupBoxObject, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
    1131             :   IsBaseOf<nsISupports, mozilla::dom::PopupBoxObject >::value,
    1132             :   sNativePropertyHooks,
    1133             :   FindAssociatedGlobalForNative<mozilla::dom::PopupBoxObject>::Get,
    1134             :   GetProtoObjectHandle,
    1135             :   GetCCParticipant<mozilla::dom::PopupBoxObject>::Get()
    1136             : };
    1137             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
    1138             :               "Must have the right minimal number of reserved slots.");
    1139             : static_assert(1 >= 1,
    1140             :               "Must have enough reserved slots.");
    1141             : 
    1142             : const JSClass*
    1143           0 : GetJSClass()
    1144             : {
    1145           0 :   return sClass.ToJSClass();
    1146             : }
    1147             : 
    1148             : bool
    1149           6 : Wrap(JSContext* aCx, mozilla::dom::PopupBoxObject* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
    1150             : {
    1151             :   MOZ_ASSERT(static_cast<mozilla::dom::PopupBoxObject*>(aObject) ==
    1152             :              reinterpret_cast<mozilla::dom::PopupBoxObject*>(aObject),
    1153             :              "Multiple inheritance for mozilla::dom::PopupBoxObject is broken.");
    1154             :   MOZ_ASSERT(static_cast<mozilla::dom::BoxObject*>(aObject) ==
    1155             :              reinterpret_cast<mozilla::dom::BoxObject*>(aObject),
    1156             :              "Multiple inheritance for mozilla::dom::BoxObject is broken.");
    1157           6 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
    1158           6 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
    1159           6 :   MOZ_ASSERT(!aCache->GetWrapper(),
    1160             :              "You should probably not be using Wrap() directly; use "
    1161             :              "GetOrCreateDOMReflector instead");
    1162             : 
    1163           6 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
    1164             :              "nsISupports must be on our primary inheritance chain");
    1165             : 
    1166          12 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
    1167           6 :   if (!global) {
    1168           0 :     return false;
    1169             :   }
    1170           6 :   MOZ_ASSERT(JS_IsGlobalObject(global));
    1171           6 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
    1172             : 
    1173             :   // That might have ended up wrapping us already, due to the wonders
    1174             :   // of XBL.  Check for that, and bail out as needed.
    1175           6 :   aReflector.set(aCache->GetWrapper());
    1176           6 :   if (aReflector) {
    1177             : #ifdef DEBUG
    1178           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
    1179             : #endif // DEBUG
    1180           0 :     return true;
    1181             :   }
    1182             : 
    1183          12 :   JSAutoCompartment ac(aCx, global);
    1184           6 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
    1185           6 :   if (!canonicalProto) {
    1186           0 :     return false;
    1187             :   }
    1188          12 :   JS::Rooted<JSObject*> proto(aCx);
    1189           6 :   if (aGivenProto) {
    1190           0 :     proto = aGivenProto;
    1191             :     // Unfortunately, while aGivenProto was in the compartment of aCx
    1192             :     // coming in, we changed compartments to that of "parent" so may need
    1193             :     // to wrap the proto here.
    1194           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
    1195           0 :       if (!JS_WrapObject(aCx, &proto)) {
    1196           0 :         return false;
    1197             :       }
    1198             :     }
    1199             :   } else {
    1200           6 :     proto = canonicalProto;
    1201             :   }
    1202             : 
    1203          12 :   BindingJSObjectCreator<mozilla::dom::PopupBoxObject> creator(aCx);
    1204           6 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
    1205           6 :   if (!aReflector) {
    1206           0 :     return false;
    1207             :   }
    1208             : 
    1209           6 :   aCache->SetWrapper(aReflector);
    1210           6 :   creator.InitializationSucceeded();
    1211             : 
    1212           6 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
    1213             :              aCache->GetWrapperPreserveColor() == aReflector);
    1214             :   // If proto != canonicalProto, we have to preserve our wrapper;
    1215             :   // otherwise we won't be able to properly recreate it later, since
    1216             :   // we won't know what proto to use.  Note that we don't check
    1217             :   // aGivenProto here, since it's entirely possible (and even
    1218             :   // somewhat common) to have a non-null aGivenProto which is the
    1219             :   // same as canonicalProto.
    1220           6 :   if (proto != canonicalProto) {
    1221           0 :     PreserveWrapper(aObject);
    1222             :   }
    1223             : 
    1224           6 :   return true;
    1225             : }
    1226             : 
    1227             : const NativePropertyHooks sNativePropertyHooks[] = { {
    1228             :   nullptr,
    1229             :   nullptr,
    1230             :   nullptr,
    1231             :   { sNativeProperties.Upcast(), nullptr },
    1232             :   prototypes::id::PopupBoxObject,
    1233             :   constructors::id::PopupBoxObject,
    1234             :   BoxObjectBinding::sNativePropertyHooks,
    1235             :   &DefaultXrayExpandoObjectClass
    1236             : } };
    1237             : 
    1238             : void
    1239           1 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
    1240             : {
    1241           1 :   JS::Handle<JSObject*> parentProto(BoxObjectBinding::GetProtoObjectHandle(aCx));
    1242           1 :   if (!parentProto) {
    1243           0 :     return;
    1244             :   }
    1245             : 
    1246           1 :   JS::Handle<JSObject*> constructorProto(BoxObjectBinding::GetConstructorObjectHandle(aCx));
    1247           1 :   if (!constructorProto) {
    1248           0 :     return;
    1249             :   }
    1250             : 
    1251             :   static bool sIdsInited = false;
    1252           1 :   if (!sIdsInited && NS_IsMainThread()) {
    1253           1 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
    1254           0 :       return;
    1255             :     }
    1256           1 :     sIdsInited = true;
    1257             :   }
    1258             : 
    1259           1 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::PopupBoxObject);
    1260           1 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::PopupBoxObject);
    1261           1 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
    1262             :                               &sPrototypeClass.mBase, protoCache,
    1263             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
    1264             :                               interfaceCache,
    1265             :                               sNativeProperties.Upcast(),
    1266             :                               nullptr,
    1267             :                               "PopupBoxObject", aDefineOnGlobal,
    1268             :                               nullptr,
    1269           1 :                               false);
    1270             : }
    1271             : 
    1272             : JS::Handle<JSObject*>
    1273           6 : GetProtoObjectHandle(JSContext* aCx)
    1274             : {
    1275             :   /* Get the interface prototype object for this class.  This will create the
    1276             :      object as needed. */
    1277           6 :   bool aDefineOnGlobal = true;
    1278             : 
    1279             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    1280           6 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    1281           6 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    1282           0 :     return nullptr;
    1283             :   }
    1284             : 
    1285             :   /* Check to see whether the interface objects are already installed */
    1286           6 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    1287           6 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::PopupBoxObject)) {
    1288           2 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    1289           1 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    1290             :   }
    1291             : 
    1292             :   /*
    1293             :    * The object might _still_ be null, but that's OK.
    1294             :    *
    1295             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    1296             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    1297             :    * changed after they have been set.
    1298             :    *
    1299             :    * Calling address() avoids the read read barrier that does gray
    1300             :    * unmarking, but it's not possible for the object to be gray here.
    1301             :    */
    1302             : 
    1303           6 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::PopupBoxObject);
    1304           6 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    1305           6 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    1306             : }
    1307             : 
    1308             : JS::Handle<JSObject*>
    1309           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
    1310             : {
    1311             :   /* Get the interface object for this class.  This will create the object as
    1312             :      needed. */
    1313             : 
    1314             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
    1315           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
    1316           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
    1317           0 :     return nullptr;
    1318             :   }
    1319             : 
    1320             :   /* Check to see whether the interface objects are already installed */
    1321           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
    1322           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::PopupBoxObject)) {
    1323           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
    1324           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
    1325             :   }
    1326             : 
    1327             :   /*
    1328             :    * The object might _still_ be null, but that's OK.
    1329             :    *
    1330             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
    1331             :    * traced by TraceProtoAndIfaceCache() and its contents are never
    1332             :    * changed after they have been set.
    1333             :    *
    1334             :    * Calling address() avoids the read read barrier that does gray
    1335             :    * unmarking, but it's not possible for the object to be gray here.
    1336             :    */
    1337             : 
    1338           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::PopupBoxObject);
    1339           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
    1340           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
    1341             : }
    1342             : 
    1343             : JSObject*
    1344           0 : GetConstructorObject(JSContext* aCx)
    1345             : {
    1346           0 :   return GetConstructorObjectHandle(aCx);
    1347             : }
    1348             : 
    1349             : } // namespace PopupBoxObjectBinding
    1350             : 
    1351             : 
    1352             : 
    1353             : } // namespace dom
    1354             : } // namespace mozilla

Generated by: LCOV version 1.13