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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM KeyEvent.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "KeyEventBinding.h"
       4             : #include "KeyboardEventBinding.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/NonRefcountedDOMObject.h"
      10             : #include "mozilla/dom/Nullable.h"
      11             : #include "mozilla/dom/PrimitiveConversions.h"
      12             : #include "mozilla/dom/XrayExpandoClass.h"
      13             : #include "nsGlobalWindow.h"
      14             : 
      15             : namespace mozilla {
      16             : namespace dom {
      17             : 
      18             : namespace KeyEventBinding {
      19             : 
      20             : static bool
      21           0 : _hasInstance(JSContext* cx, unsigned argc, JS::Value* vp)
      22             : {
      23           0 :   JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
      24           0 :   if (!args.get(0).isObject()) {
      25           0 :     args.rval().setBoolean(false);
      26           0 :     return true;
      27             :   }
      28             : 
      29           0 :   JS::Rooted<JSObject*> instance(cx, &args[0].toObject());
      30             : 
      31           0 :   const DOMJSClass* domClass = GetDOMClass(js::UncheckedUnwrap(instance, /* stopAtWindowProxy = */ false));
      32           0 :   if (!domClass) {
      33             :     // Not a DOM object, so certainly not an instance of this interface
      34           0 :     args.rval().setBoolean(false);
      35           0 :     return true;
      36             :   }
      37             : 
      38           0 :   if (domClass->mInterfaceChain[PrototypeTraits<prototypes::id::KeyboardEvent>::Depth] == prototypes::id::KeyboardEvent) {
      39           0 :     args.rval().setBoolean(true);
      40           0 :     return true;
      41             :   }
      42           0 :   args.rval().setBoolean(false);
      43           0 :   return true;
      44             : }
      45             : 
      46             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
      47             : #if defined(__clang__)
      48             : #pragma clang diagnostic push
      49             : #pragma clang diagnostic ignored "-Wmissing-braces"
      50             : #endif
      51             : static const JSFunctionSpec sStaticMethods_specs[] = {
      52             :   JS_SYM_FNSPEC(hasInstance, _hasInstance, nullptr, 1, JSPROP_READONLY | JSPROP_PERMANENT, nullptr),
      53             :   JS_FS_END
      54             : };
      55             : #if defined(__clang__)
      56             : #pragma clang diagnostic pop
      57             : #endif
      58             : 
      59             : 
      60             : // Can't be const because the pref-enabled boolean needs to be writable
      61             : static Prefable<const JSFunctionSpec> sStaticMethods[] = {
      62             :   { nullptr, &sStaticMethods_specs[0] },
      63             :   { nullptr, nullptr }
      64             : };
      65             : 
      66             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
      67             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
      68             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
      69             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
      70             : 
      71             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
      72             : #if defined(__clang__)
      73             : #pragma clang diagnostic push
      74             : #pragma clang diagnostic ignored "-Wmissing-braces"
      75             : #endif
      76             : static const ConstantSpec sConstants_specs[] = {
      77             :   { "DOM_VK_CANCEL", JS::NumberValue(3U) },
      78             :   { "DOM_VK_HELP", JS::NumberValue(6U) },
      79             :   { "DOM_VK_BACK_SPACE", JS::NumberValue(8U) },
      80             :   { "DOM_VK_TAB", JS::NumberValue(9U) },
      81             :   { "DOM_VK_CLEAR", JS::NumberValue(12U) },
      82             :   { "DOM_VK_RETURN", JS::NumberValue(13U) },
      83             :   { "DOM_VK_SHIFT", JS::NumberValue(16U) },
      84             :   { "DOM_VK_CONTROL", JS::NumberValue(17U) },
      85             :   { "DOM_VK_ALT", JS::NumberValue(18U) },
      86             :   { "DOM_VK_PAUSE", JS::NumberValue(19U) },
      87             :   { "DOM_VK_CAPS_LOCK", JS::NumberValue(20U) },
      88             :   { "DOM_VK_KANA", JS::NumberValue(21U) },
      89             :   { "DOM_VK_HANGUL", JS::NumberValue(21U) },
      90             :   { "DOM_VK_EISU", JS::NumberValue(22U) },
      91             :   { "DOM_VK_JUNJA", JS::NumberValue(23U) },
      92             :   { "DOM_VK_FINAL", JS::NumberValue(24U) },
      93             :   { "DOM_VK_HANJA", JS::NumberValue(25U) },
      94             :   { "DOM_VK_KANJI", JS::NumberValue(25U) },
      95             :   { "DOM_VK_ESCAPE", JS::NumberValue(27U) },
      96             :   { "DOM_VK_CONVERT", JS::NumberValue(28U) },
      97             :   { "DOM_VK_NONCONVERT", JS::NumberValue(29U) },
      98             :   { "DOM_VK_ACCEPT", JS::NumberValue(30U) },
      99             :   { "DOM_VK_MODECHANGE", JS::NumberValue(31U) },
     100             :   { "DOM_VK_SPACE", JS::NumberValue(32U) },
     101             :   { "DOM_VK_PAGE_UP", JS::NumberValue(33U) },
     102             :   { "DOM_VK_PAGE_DOWN", JS::NumberValue(34U) },
     103             :   { "DOM_VK_END", JS::NumberValue(35U) },
     104             :   { "DOM_VK_HOME", JS::NumberValue(36U) },
     105             :   { "DOM_VK_LEFT", JS::NumberValue(37U) },
     106             :   { "DOM_VK_UP", JS::NumberValue(38U) },
     107             :   { "DOM_VK_RIGHT", JS::NumberValue(39U) },
     108             :   { "DOM_VK_DOWN", JS::NumberValue(40U) },
     109             :   { "DOM_VK_SELECT", JS::NumberValue(41U) },
     110             :   { "DOM_VK_PRINT", JS::NumberValue(42U) },
     111             :   { "DOM_VK_EXECUTE", JS::NumberValue(43U) },
     112             :   { "DOM_VK_PRINTSCREEN", JS::NumberValue(44U) },
     113             :   { "DOM_VK_INSERT", JS::NumberValue(45U) },
     114             :   { "DOM_VK_DELETE", JS::NumberValue(46U) },
     115             :   { "DOM_VK_0", JS::NumberValue(48U) },
     116             :   { "DOM_VK_1", JS::NumberValue(49U) },
     117             :   { "DOM_VK_2", JS::NumberValue(50U) },
     118             :   { "DOM_VK_3", JS::NumberValue(51U) },
     119             :   { "DOM_VK_4", JS::NumberValue(52U) },
     120             :   { "DOM_VK_5", JS::NumberValue(53U) },
     121             :   { "DOM_VK_6", JS::NumberValue(54U) },
     122             :   { "DOM_VK_7", JS::NumberValue(55U) },
     123             :   { "DOM_VK_8", JS::NumberValue(56U) },
     124             :   { "DOM_VK_9", JS::NumberValue(57U) },
     125             :   { "DOM_VK_COLON", JS::NumberValue(58U) },
     126             :   { "DOM_VK_SEMICOLON", JS::NumberValue(59U) },
     127             :   { "DOM_VK_LESS_THAN", JS::NumberValue(60U) },
     128             :   { "DOM_VK_EQUALS", JS::NumberValue(61U) },
     129             :   { "DOM_VK_GREATER_THAN", JS::NumberValue(62U) },
     130             :   { "DOM_VK_QUESTION_MARK", JS::NumberValue(63U) },
     131             :   { "DOM_VK_AT", JS::NumberValue(64U) },
     132             :   { "DOM_VK_A", JS::NumberValue(65U) },
     133             :   { "DOM_VK_B", JS::NumberValue(66U) },
     134             :   { "DOM_VK_C", JS::NumberValue(67U) },
     135             :   { "DOM_VK_D", JS::NumberValue(68U) },
     136             :   { "DOM_VK_E", JS::NumberValue(69U) },
     137             :   { "DOM_VK_F", JS::NumberValue(70U) },
     138             :   { "DOM_VK_G", JS::NumberValue(71U) },
     139             :   { "DOM_VK_H", JS::NumberValue(72U) },
     140             :   { "DOM_VK_I", JS::NumberValue(73U) },
     141             :   { "DOM_VK_J", JS::NumberValue(74U) },
     142             :   { "DOM_VK_K", JS::NumberValue(75U) },
     143             :   { "DOM_VK_L", JS::NumberValue(76U) },
     144             :   { "DOM_VK_M", JS::NumberValue(77U) },
     145             :   { "DOM_VK_N", JS::NumberValue(78U) },
     146             :   { "DOM_VK_O", JS::NumberValue(79U) },
     147             :   { "DOM_VK_P", JS::NumberValue(80U) },
     148             :   { "DOM_VK_Q", JS::NumberValue(81U) },
     149             :   { "DOM_VK_R", JS::NumberValue(82U) },
     150             :   { "DOM_VK_S", JS::NumberValue(83U) },
     151             :   { "DOM_VK_T", JS::NumberValue(84U) },
     152             :   { "DOM_VK_U", JS::NumberValue(85U) },
     153             :   { "DOM_VK_V", JS::NumberValue(86U) },
     154             :   { "DOM_VK_W", JS::NumberValue(87U) },
     155             :   { "DOM_VK_X", JS::NumberValue(88U) },
     156             :   { "DOM_VK_Y", JS::NumberValue(89U) },
     157             :   { "DOM_VK_Z", JS::NumberValue(90U) },
     158             :   { "DOM_VK_WIN", JS::NumberValue(91U) },
     159             :   { "DOM_VK_CONTEXT_MENU", JS::NumberValue(93U) },
     160             :   { "DOM_VK_SLEEP", JS::NumberValue(95U) },
     161             :   { "DOM_VK_NUMPAD0", JS::NumberValue(96U) },
     162             :   { "DOM_VK_NUMPAD1", JS::NumberValue(97U) },
     163             :   { "DOM_VK_NUMPAD2", JS::NumberValue(98U) },
     164             :   { "DOM_VK_NUMPAD3", JS::NumberValue(99U) },
     165             :   { "DOM_VK_NUMPAD4", JS::NumberValue(100U) },
     166             :   { "DOM_VK_NUMPAD5", JS::NumberValue(101U) },
     167             :   { "DOM_VK_NUMPAD6", JS::NumberValue(102U) },
     168             :   { "DOM_VK_NUMPAD7", JS::NumberValue(103U) },
     169             :   { "DOM_VK_NUMPAD8", JS::NumberValue(104U) },
     170             :   { "DOM_VK_NUMPAD9", JS::NumberValue(105U) },
     171             :   { "DOM_VK_MULTIPLY", JS::NumberValue(106U) },
     172             :   { "DOM_VK_ADD", JS::NumberValue(107U) },
     173             :   { "DOM_VK_SEPARATOR", JS::NumberValue(108U) },
     174             :   { "DOM_VK_SUBTRACT", JS::NumberValue(109U) },
     175             :   { "DOM_VK_DECIMAL", JS::NumberValue(110U) },
     176             :   { "DOM_VK_DIVIDE", JS::NumberValue(111U) },
     177             :   { "DOM_VK_F1", JS::NumberValue(112U) },
     178             :   { "DOM_VK_F2", JS::NumberValue(113U) },
     179             :   { "DOM_VK_F3", JS::NumberValue(114U) },
     180             :   { "DOM_VK_F4", JS::NumberValue(115U) },
     181             :   { "DOM_VK_F5", JS::NumberValue(116U) },
     182             :   { "DOM_VK_F6", JS::NumberValue(117U) },
     183             :   { "DOM_VK_F7", JS::NumberValue(118U) },
     184             :   { "DOM_VK_F8", JS::NumberValue(119U) },
     185             :   { "DOM_VK_F9", JS::NumberValue(120U) },
     186             :   { "DOM_VK_F10", JS::NumberValue(121U) },
     187             :   { "DOM_VK_F11", JS::NumberValue(122U) },
     188             :   { "DOM_VK_F12", JS::NumberValue(123U) },
     189             :   { "DOM_VK_F13", JS::NumberValue(124U) },
     190             :   { "DOM_VK_F14", JS::NumberValue(125U) },
     191             :   { "DOM_VK_F15", JS::NumberValue(126U) },
     192             :   { "DOM_VK_F16", JS::NumberValue(127U) },
     193             :   { "DOM_VK_F17", JS::NumberValue(128U) },
     194             :   { "DOM_VK_F18", JS::NumberValue(129U) },
     195             :   { "DOM_VK_F19", JS::NumberValue(130U) },
     196             :   { "DOM_VK_F20", JS::NumberValue(131U) },
     197             :   { "DOM_VK_F21", JS::NumberValue(132U) },
     198             :   { "DOM_VK_F22", JS::NumberValue(133U) },
     199             :   { "DOM_VK_F23", JS::NumberValue(134U) },
     200             :   { "DOM_VK_F24", JS::NumberValue(135U) },
     201             :   { "DOM_VK_NUM_LOCK", JS::NumberValue(144U) },
     202             :   { "DOM_VK_SCROLL_LOCK", JS::NumberValue(145U) },
     203             :   { "DOM_VK_WIN_OEM_FJ_JISHO", JS::NumberValue(146U) },
     204             :   { "DOM_VK_WIN_OEM_FJ_MASSHOU", JS::NumberValue(147U) },
     205             :   { "DOM_VK_WIN_OEM_FJ_TOUROKU", JS::NumberValue(148U) },
     206             :   { "DOM_VK_WIN_OEM_FJ_LOYA", JS::NumberValue(149U) },
     207             :   { "DOM_VK_WIN_OEM_FJ_ROYA", JS::NumberValue(150U) },
     208             :   { "DOM_VK_CIRCUMFLEX", JS::NumberValue(160U) },
     209             :   { "DOM_VK_EXCLAMATION", JS::NumberValue(161U) },
     210             :   { "DOM_VK_DOUBLE_QUOTE", JS::NumberValue(162U) },
     211             :   { "DOM_VK_HASH", JS::NumberValue(163U) },
     212             :   { "DOM_VK_DOLLAR", JS::NumberValue(164U) },
     213             :   { "DOM_VK_PERCENT", JS::NumberValue(165U) },
     214             :   { "DOM_VK_AMPERSAND", JS::NumberValue(166U) },
     215             :   { "DOM_VK_UNDERSCORE", JS::NumberValue(167U) },
     216             :   { "DOM_VK_OPEN_PAREN", JS::NumberValue(168U) },
     217             :   { "DOM_VK_CLOSE_PAREN", JS::NumberValue(169U) },
     218             :   { "DOM_VK_ASTERISK", JS::NumberValue(170U) },
     219             :   { "DOM_VK_PLUS", JS::NumberValue(171U) },
     220             :   { "DOM_VK_PIPE", JS::NumberValue(172U) },
     221             :   { "DOM_VK_HYPHEN_MINUS", JS::NumberValue(173U) },
     222             :   { "DOM_VK_OPEN_CURLY_BRACKET", JS::NumberValue(174U) },
     223             :   { "DOM_VK_CLOSE_CURLY_BRACKET", JS::NumberValue(175U) },
     224             :   { "DOM_VK_TILDE", JS::NumberValue(176U) },
     225             :   { "DOM_VK_VOLUME_MUTE", JS::NumberValue(181U) },
     226             :   { "DOM_VK_VOLUME_DOWN", JS::NumberValue(182U) },
     227             :   { "DOM_VK_VOLUME_UP", JS::NumberValue(183U) },
     228             :   { "DOM_VK_COMMA", JS::NumberValue(188U) },
     229             :   { "DOM_VK_PERIOD", JS::NumberValue(190U) },
     230             :   { "DOM_VK_SLASH", JS::NumberValue(191U) },
     231             :   { "DOM_VK_BACK_QUOTE", JS::NumberValue(192U) },
     232             :   { "DOM_VK_OPEN_BRACKET", JS::NumberValue(219U) },
     233             :   { "DOM_VK_BACK_SLASH", JS::NumberValue(220U) },
     234             :   { "DOM_VK_CLOSE_BRACKET", JS::NumberValue(221U) },
     235             :   { "DOM_VK_QUOTE", JS::NumberValue(222U) },
     236             :   { "DOM_VK_META", JS::NumberValue(224U) },
     237             :   { "DOM_VK_ALTGR", JS::NumberValue(225U) },
     238             :   { "DOM_VK_WIN_ICO_HELP", JS::NumberValue(227U) },
     239             :   { "DOM_VK_WIN_ICO_00", JS::NumberValue(228U) },
     240             :   { "DOM_VK_WIN_ICO_CLEAR", JS::NumberValue(230U) },
     241             :   { "DOM_VK_WIN_OEM_RESET", JS::NumberValue(233U) },
     242             :   { "DOM_VK_WIN_OEM_JUMP", JS::NumberValue(234U) },
     243             :   { "DOM_VK_WIN_OEM_PA1", JS::NumberValue(235U) },
     244             :   { "DOM_VK_WIN_OEM_PA2", JS::NumberValue(236U) },
     245             :   { "DOM_VK_WIN_OEM_PA3", JS::NumberValue(237U) },
     246             :   { "DOM_VK_WIN_OEM_WSCTRL", JS::NumberValue(238U) },
     247             :   { "DOM_VK_WIN_OEM_CUSEL", JS::NumberValue(239U) },
     248             :   { "DOM_VK_WIN_OEM_ATTN", JS::NumberValue(240U) },
     249             :   { "DOM_VK_WIN_OEM_FINISH", JS::NumberValue(241U) },
     250             :   { "DOM_VK_WIN_OEM_COPY", JS::NumberValue(242U) },
     251             :   { "DOM_VK_WIN_OEM_AUTO", JS::NumberValue(243U) },
     252             :   { "DOM_VK_WIN_OEM_ENLW", JS::NumberValue(244U) },
     253             :   { "DOM_VK_WIN_OEM_BACKTAB", JS::NumberValue(245U) },
     254             :   { "DOM_VK_ATTN", JS::NumberValue(246U) },
     255             :   { "DOM_VK_CRSEL", JS::NumberValue(247U) },
     256             :   { "DOM_VK_EXSEL", JS::NumberValue(248U) },
     257             :   { "DOM_VK_EREOF", JS::NumberValue(249U) },
     258             :   { "DOM_VK_PLAY", JS::NumberValue(250U) },
     259             :   { "DOM_VK_ZOOM", JS::NumberValue(251U) },
     260             :   { "DOM_VK_PA1", JS::NumberValue(253U) },
     261             :   { "DOM_VK_WIN_OEM_CLEAR", JS::NumberValue(254U) },
     262             :   { 0, JS::UndefinedValue() }
     263             : };
     264             : #if defined(__clang__)
     265             : #pragma clang diagnostic pop
     266             : #endif
     267             : 
     268             : 
     269             : // Can't be const because the pref-enabled boolean needs to be writable
     270             : static Prefable<const ConstantSpec> sConstants[] = {
     271             :   { nullptr, &sConstants_specs[0] },
     272             :   { nullptr, nullptr }
     273             : };
     274             : 
     275             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     276             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     277             : static_assert(185 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     278             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     279             : 
     280             : 
     281             : static uint16_t sNativeProperties_sortedPropertyIndices[186];
     282             : static PropertyInfo sNativeProperties_propertyInfos[186];
     283             : 
     284             : static const NativePropertiesN<2> sNativeProperties = {
     285             :   true,  0 /* sStaticMethods */,
     286             :   false, 0,
     287             :   false, 0,
     288             :   false, 0,
     289             :   false, 0,
     290             :   false, 0,
     291             :   true,  1 /* sConstants */,
     292             :   -1,
     293             :   186,
     294             :   sNativeProperties_sortedPropertyIndices,
     295             :   {
     296             :     { sStaticMethods, &sNativeProperties_propertyInfos[0] },
     297             :     { sConstants, &sNativeProperties_propertyInfos[1] }
     298             :   }
     299             : };
     300             : static_assert(186 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     301             :     "We have a property info count that is oversized");
     302             : 
     303             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     304             :   {
     305             :     "Function",
     306             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     307             :     &sBoringInterfaceObjectClassClassOps,
     308             :     JS_NULL_CLASS_SPEC,
     309             :     JS_NULL_CLASS_EXT,
     310             :     &sInterfaceObjectClassObjectOps
     311             :   },
     312             :   eInterface,
     313             :   false,
     314             :   prototypes::id::_ID_Count,
     315             :   0,
     316             :   sNativePropertyHooks,
     317             :   "function KeyEvent() {\n    [native code]\n}",
     318             :   JS::GetRealmFunctionPrototype
     319             : };
     320             : 
     321             : JSObject*
     322           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     323             : {
     324           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     325             : }
     326             : 
     327             : const NativePropertyHooks sNativePropertyHooks[] = { {
     328             :   nullptr,
     329             :   nullptr,
     330             :   nullptr,
     331             :   { sNativeProperties.Upcast(), nullptr },
     332             :   prototypes::id::_ID_Count,
     333             :   constructors::id::KeyEvent,
     334             :   nullptr,
     335             :   &DefaultXrayExpandoObjectClass
     336             : } };
     337             : 
     338             : void
     339           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     340             : {
     341           0 :   JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
     342           0 :   if (!constructorProto) {
     343           0 :     return;
     344             :   }
     345             : 
     346             :   static bool sIdsInited = false;
     347           0 :   if (!sIdsInited && NS_IsMainThread()) {
     348           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     349           0 :       return;
     350             :     }
     351           0 :     sIdsInited = true;
     352             :   }
     353             : 
     354           0 :   JS::Heap<JSObject*>* protoCache = nullptr;
     355           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::KeyEvent);
     356           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, nullptr,
     357             :                               nullptr, protoCache,
     358             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     359             :                               interfaceCache,
     360             :                               sNativeProperties.Upcast(),
     361             :                               nullptr,
     362             :                               "KeyEvent", aDefineOnGlobal,
     363             :                               nullptr,
     364           0 :                               false);
     365             : }
     366             : 
     367             : JS::Handle<JSObject*>
     368           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     369             : {
     370             :   /* Get the interface object for this class.  This will create the object as
     371             :      needed. */
     372             : 
     373             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     374           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     375           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     376           0 :     return nullptr;
     377             :   }
     378             : 
     379             :   /* Check to see whether the interface objects are already installed */
     380           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     381           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::KeyEvent)) {
     382           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     383           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     384             :   }
     385             : 
     386             :   /*
     387             :    * The object might _still_ be null, but that's OK.
     388             :    *
     389             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     390             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     391             :    * changed after they have been set.
     392             :    *
     393             :    * Calling address() avoids the read read barrier that does gray
     394             :    * unmarking, but it's not possible for the object to be gray here.
     395             :    */
     396             : 
     397           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::KeyEvent);
     398           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     399           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     400             : }
     401             : 
     402             : JSObject*
     403           0 : GetConstructorObject(JSContext* aCx)
     404             : {
     405           0 :   return GetConstructorObjectHandle(aCx);
     406             : }
     407             : 
     408             : } // namespace KeyEventBinding
     409             : 
     410             : 
     411             : 
     412             : } // namespace dom
     413             : } // namespace mozilla

Generated by: LCOV version 1.13