/* THIS FILE IS AUTOGENERATED FROM KeyEvent.webidl BY Codegen.py - DO NOT EDIT */

#include <type_traits>
#include "KeyEventBinding.h"
#include "KeyboardEvent.h"
#include "MainThreadUtils.h"
#include "WrapperFactory.h"
#include "js/CallAndConstruct.h"
#include "js/Exception.h"
#include "js/MapAndSet.h"
#include "js/Object.h"
#include "js/PropertyAndElement.h"
#include "js/PropertyDescriptor.h"
#include "js/experimental/JitInfo.h"
#include "mozilla/Atomics.h"
#include "mozilla/OwningNonNull.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/BindingCallContext.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/DOMJSClass.h"
#include "mozilla/dom/NonRefcountedDOMObject.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrimitiveConversions.h"
#include "mozilla/dom/WebIDLPrefs.h"
#include "mozilla/dom/XrayExpandoClass.h"
#include "nsGlobalWindowInner.h"

namespace mozilla::dom {

namespace binding_detail {}; // Just to make sure it's known as a namespace
using namespace mozilla::dom::binding_detail;


namespace KeyEvent_Binding {

MOZ_GLOBINIT static const ConstantSpec sConstants_specs[] = {
  { "DOM_VK_CANCEL", JS::NumberValue(3U) },
  { "DOM_VK_HELP", JS::NumberValue(6U) },
  { "DOM_VK_BACK_SPACE", JS::NumberValue(8U) },
  { "DOM_VK_TAB", JS::NumberValue(9U) },
  { "DOM_VK_CLEAR", JS::NumberValue(12U) },
  { "DOM_VK_RETURN", JS::NumberValue(13U) },
  { "DOM_VK_SHIFT", JS::NumberValue(16U) },
  { "DOM_VK_CONTROL", JS::NumberValue(17U) },
  { "DOM_VK_ALT", JS::NumberValue(18U) },
  { "DOM_VK_PAUSE", JS::NumberValue(19U) },
  { "DOM_VK_CAPS_LOCK", JS::NumberValue(20U) },
  { "DOM_VK_KANA", JS::NumberValue(21U) },
  { "DOM_VK_HANGUL", JS::NumberValue(21U) },
  { "DOM_VK_EISU", JS::NumberValue(22U) },
  { "DOM_VK_JUNJA", JS::NumberValue(23U) },
  { "DOM_VK_FINAL", JS::NumberValue(24U) },
  { "DOM_VK_HANJA", JS::NumberValue(25U) },
  { "DOM_VK_KANJI", JS::NumberValue(25U) },
  { "DOM_VK_ESCAPE", JS::NumberValue(27U) },
  { "DOM_VK_CONVERT", JS::NumberValue(28U) },
  { "DOM_VK_NONCONVERT", JS::NumberValue(29U) },
  { "DOM_VK_ACCEPT", JS::NumberValue(30U) },
  { "DOM_VK_MODECHANGE", JS::NumberValue(31U) },
  { "DOM_VK_SPACE", JS::NumberValue(32U) },
  { "DOM_VK_PAGE_UP", JS::NumberValue(33U) },
  { "DOM_VK_PAGE_DOWN", JS::NumberValue(34U) },
  { "DOM_VK_END", JS::NumberValue(35U) },
  { "DOM_VK_HOME", JS::NumberValue(36U) },
  { "DOM_VK_LEFT", JS::NumberValue(37U) },
  { "DOM_VK_UP", JS::NumberValue(38U) },
  { "DOM_VK_RIGHT", JS::NumberValue(39U) },
  { "DOM_VK_DOWN", JS::NumberValue(40U) },
  { "DOM_VK_SELECT", JS::NumberValue(41U) },
  { "DOM_VK_PRINT", JS::NumberValue(42U) },
  { "DOM_VK_EXECUTE", JS::NumberValue(43U) },
  { "DOM_VK_PRINTSCREEN", JS::NumberValue(44U) },
  { "DOM_VK_INSERT", JS::NumberValue(45U) },
  { "DOM_VK_DELETE", JS::NumberValue(46U) },
  { "DOM_VK_0", JS::NumberValue(48U) },
  { "DOM_VK_1", JS::NumberValue(49U) },
  { "DOM_VK_2", JS::NumberValue(50U) },
  { "DOM_VK_3", JS::NumberValue(51U) },
  { "DOM_VK_4", JS::NumberValue(52U) },
  { "DOM_VK_5", JS::NumberValue(53U) },
  { "DOM_VK_6", JS::NumberValue(54U) },
  { "DOM_VK_7", JS::NumberValue(55U) },
  { "DOM_VK_8", JS::NumberValue(56U) },
  { "DOM_VK_9", JS::NumberValue(57U) },
  { "DOM_VK_COLON", JS::NumberValue(58U) },
  { "DOM_VK_SEMICOLON", JS::NumberValue(59U) },
  { "DOM_VK_LESS_THAN", JS::NumberValue(60U) },
  { "DOM_VK_EQUALS", JS::NumberValue(61U) },
  { "DOM_VK_GREATER_THAN", JS::NumberValue(62U) },
  { "DOM_VK_QUESTION_MARK", JS::NumberValue(63U) },
  { "DOM_VK_AT", JS::NumberValue(64U) },
  { "DOM_VK_A", JS::NumberValue(65U) },
  { "DOM_VK_B", JS::NumberValue(66U) },
  { "DOM_VK_C", JS::NumberValue(67U) },
  { "DOM_VK_D", JS::NumberValue(68U) },
  { "DOM_VK_E", JS::NumberValue(69U) },
  { "DOM_VK_F", JS::NumberValue(70U) },
  { "DOM_VK_G", JS::NumberValue(71U) },
  { "DOM_VK_H", JS::NumberValue(72U) },
  { "DOM_VK_I", JS::NumberValue(73U) },
  { "DOM_VK_J", JS::NumberValue(74U) },
  { "DOM_VK_K", JS::NumberValue(75U) },
  { "DOM_VK_L", JS::NumberValue(76U) },
  { "DOM_VK_M", JS::NumberValue(77U) },
  { "DOM_VK_N", JS::NumberValue(78U) },
  { "DOM_VK_O", JS::NumberValue(79U) },
  { "DOM_VK_P", JS::NumberValue(80U) },
  { "DOM_VK_Q", JS::NumberValue(81U) },
  { "DOM_VK_R", JS::NumberValue(82U) },
  { "DOM_VK_S", JS::NumberValue(83U) },
  { "DOM_VK_T", JS::NumberValue(84U) },
  { "DOM_VK_U", JS::NumberValue(85U) },
  { "DOM_VK_V", JS::NumberValue(86U) },
  { "DOM_VK_W", JS::NumberValue(87U) },
  { "DOM_VK_X", JS::NumberValue(88U) },
  { "DOM_VK_Y", JS::NumberValue(89U) },
  { "DOM_VK_Z", JS::NumberValue(90U) },
  { "DOM_VK_WIN", JS::NumberValue(91U) },
  { "DOM_VK_CONTEXT_MENU", JS::NumberValue(93U) },
  { "DOM_VK_SLEEP", JS::NumberValue(95U) },
  { "DOM_VK_NUMPAD0", JS::NumberValue(96U) },
  { "DOM_VK_NUMPAD1", JS::NumberValue(97U) },
  { "DOM_VK_NUMPAD2", JS::NumberValue(98U) },
  { "DOM_VK_NUMPAD3", JS::NumberValue(99U) },
  { "DOM_VK_NUMPAD4", JS::NumberValue(100U) },
  { "DOM_VK_NUMPAD5", JS::NumberValue(101U) },
  { "DOM_VK_NUMPAD6", JS::NumberValue(102U) },
  { "DOM_VK_NUMPAD7", JS::NumberValue(103U) },
  { "DOM_VK_NUMPAD8", JS::NumberValue(104U) },
  { "DOM_VK_NUMPAD9", JS::NumberValue(105U) },
  { "DOM_VK_MULTIPLY", JS::NumberValue(106U) },
  { "DOM_VK_ADD", JS::NumberValue(107U) },
  { "DOM_VK_SEPARATOR", JS::NumberValue(108U) },
  { "DOM_VK_SUBTRACT", JS::NumberValue(109U) },
  { "DOM_VK_DECIMAL", JS::NumberValue(110U) },
  { "DOM_VK_DIVIDE", JS::NumberValue(111U) },
  { "DOM_VK_F1", JS::NumberValue(112U) },
  { "DOM_VK_F2", JS::NumberValue(113U) },
  { "DOM_VK_F3", JS::NumberValue(114U) },
  { "DOM_VK_F4", JS::NumberValue(115U) },
  { "DOM_VK_F5", JS::NumberValue(116U) },
  { "DOM_VK_F6", JS::NumberValue(117U) },
  { "DOM_VK_F7", JS::NumberValue(118U) },
  { "DOM_VK_F8", JS::NumberValue(119U) },
  { "DOM_VK_F9", JS::NumberValue(120U) },
  { "DOM_VK_F10", JS::NumberValue(121U) },
  { "DOM_VK_F11", JS::NumberValue(122U) },
  { "DOM_VK_F12", JS::NumberValue(123U) },
  { "DOM_VK_F13", JS::NumberValue(124U) },
  { "DOM_VK_F14", JS::NumberValue(125U) },
  { "DOM_VK_F15", JS::NumberValue(126U) },
  { "DOM_VK_F16", JS::NumberValue(127U) },
  { "DOM_VK_F17", JS::NumberValue(128U) },
  { "DOM_VK_F18", JS::NumberValue(129U) },
  { "DOM_VK_F19", JS::NumberValue(130U) },
  { "DOM_VK_F20", JS::NumberValue(131U) },
  { "DOM_VK_F21", JS::NumberValue(132U) },
  { "DOM_VK_F22", JS::NumberValue(133U) },
  { "DOM_VK_F23", JS::NumberValue(134U) },
  { "DOM_VK_F24", JS::NumberValue(135U) },
  { "DOM_VK_NUM_LOCK", JS::NumberValue(144U) },
  { "DOM_VK_SCROLL_LOCK", JS::NumberValue(145U) },
  { "DOM_VK_WIN_OEM_FJ_JISHO", JS::NumberValue(146U) },
  { "DOM_VK_WIN_OEM_FJ_MASSHOU", JS::NumberValue(147U) },
  { "DOM_VK_WIN_OEM_FJ_TOUROKU", JS::NumberValue(148U) },
  { "DOM_VK_WIN_OEM_FJ_LOYA", JS::NumberValue(149U) },
  { "DOM_VK_WIN_OEM_FJ_ROYA", JS::NumberValue(150U) },
  { "DOM_VK_CIRCUMFLEX", JS::NumberValue(160U) },
  { "DOM_VK_EXCLAMATION", JS::NumberValue(161U) },
  { "DOM_VK_DOUBLE_QUOTE", JS::NumberValue(162U) },
  { "DOM_VK_HASH", JS::NumberValue(163U) },
  { "DOM_VK_DOLLAR", JS::NumberValue(164U) },
  { "DOM_VK_PERCENT", JS::NumberValue(165U) },
  { "DOM_VK_AMPERSAND", JS::NumberValue(166U) },
  { "DOM_VK_UNDERSCORE", JS::NumberValue(167U) },
  { "DOM_VK_OPEN_PAREN", JS::NumberValue(168U) },
  { "DOM_VK_CLOSE_PAREN", JS::NumberValue(169U) },
  { "DOM_VK_ASTERISK", JS::NumberValue(170U) },
  { "DOM_VK_PLUS", JS::NumberValue(171U) },
  { "DOM_VK_PIPE", JS::NumberValue(172U) },
  { "DOM_VK_HYPHEN_MINUS", JS::NumberValue(173U) },
  { "DOM_VK_OPEN_CURLY_BRACKET", JS::NumberValue(174U) },
  { "DOM_VK_CLOSE_CURLY_BRACKET", JS::NumberValue(175U) },
  { "DOM_VK_TILDE", JS::NumberValue(176U) },
  { "DOM_VK_VOLUME_MUTE", JS::NumberValue(181U) },
  { "DOM_VK_VOLUME_DOWN", JS::NumberValue(182U) },
  { "DOM_VK_VOLUME_UP", JS::NumberValue(183U) },
  { "DOM_VK_COMMA", JS::NumberValue(188U) },
  { "DOM_VK_PERIOD", JS::NumberValue(190U) },
  { "DOM_VK_SLASH", JS::NumberValue(191U) },
  { "DOM_VK_BACK_QUOTE", JS::NumberValue(192U) },
  { "DOM_VK_OPEN_BRACKET", JS::NumberValue(219U) },
  { "DOM_VK_BACK_SLASH", JS::NumberValue(220U) },
  { "DOM_VK_CLOSE_BRACKET", JS::NumberValue(221U) },
  { "DOM_VK_QUOTE", JS::NumberValue(222U) },
  { "DOM_VK_META", JS::NumberValue(224U) },
  { "DOM_VK_ALTGR", JS::NumberValue(225U) },
  { "DOM_VK_WIN_ICO_HELP", JS::NumberValue(227U) },
  { "DOM_VK_WIN_ICO_00", JS::NumberValue(228U) },
  { "DOM_VK_PROCESSKEY", JS::NumberValue(229U) },
  { "DOM_VK_WIN_ICO_CLEAR", JS::NumberValue(230U) },
  { "DOM_VK_WIN_OEM_RESET", JS::NumberValue(233U) },
  { "DOM_VK_WIN_OEM_JUMP", JS::NumberValue(234U) },
  { "DOM_VK_WIN_OEM_PA1", JS::NumberValue(235U) },
  { "DOM_VK_WIN_OEM_PA2", JS::NumberValue(236U) },
  { "DOM_VK_WIN_OEM_PA3", JS::NumberValue(237U) },
  { "DOM_VK_WIN_OEM_WSCTRL", JS::NumberValue(238U) },
  { "DOM_VK_WIN_OEM_CUSEL", JS::NumberValue(239U) },
  { "DOM_VK_WIN_OEM_ATTN", JS::NumberValue(240U) },
  { "DOM_VK_WIN_OEM_FINISH", JS::NumberValue(241U) },
  { "DOM_VK_WIN_OEM_COPY", JS::NumberValue(242U) },
  { "DOM_VK_WIN_OEM_AUTO", JS::NumberValue(243U) },
  { "DOM_VK_WIN_OEM_ENLW", JS::NumberValue(244U) },
  { "DOM_VK_WIN_OEM_BACKTAB", JS::NumberValue(245U) },
  { "DOM_VK_ATTN", JS::NumberValue(246U) },
  { "DOM_VK_CRSEL", JS::NumberValue(247U) },
  { "DOM_VK_EXSEL", JS::NumberValue(248U) },
  { "DOM_VK_EREOF", JS::NumberValue(249U) },
  { "DOM_VK_PLAY", JS::NumberValue(250U) },
  { "DOM_VK_ZOOM", JS::NumberValue(251U) },
  { "DOM_VK_PA1", JS::NumberValue(253U) },
  { "DOM_VK_WIN_OEM_CLEAR", JS::NumberValue(254U) },
  { 0, JS::UndefinedValue() }
};


static const Prefable<const ConstantSpec> sConstants[] = {
  { nullptr, &sConstants_specs[0] },
  { nullptr, nullptr }
};

static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
    "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
static_assert(186 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
    "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");


static uint16_t sNativeProperties_sortedPropertyIndices[186];
static PropertyInfo sNativeProperties_propertyInfos[186];

static const NativePropertiesN<1> sNativeProperties = {
  false, 0,
  false, 0,
  false, 0,
  false, 0,
  false, 0,
  false, 0,
  true,  0 /* sConstants */,
  -1,
  186,
  sNativeProperties_sortedPropertyIndices,
  {
    { sConstants, &sNativeProperties_propertyInfos[0] }
  }
};
static_assert(186 < 1ull << (CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount)),
    "We have a property info count that is oversized");

bool sNativePropertiesInited = false;
const NativePropertyHooks sNativePropertyHooks = {
  nullptr,
  { sNativeProperties.Upcast(), nullptr, &sNativePropertiesInited },
  prototypes::id::_ID_Count,
  constructors::id::KeyEvent,
  &DefaultXrayExpandoObjectClass
};

static const DOMInterfaceInfo sInterfaceObjectInfo = {
  { ThrowingConstructor, &sNativePropertyHooks },
  JS::GetRealmFunctionPrototypeHandle,
  0,
  prototypes::id::_ID_Count,
  false,
  0,
  "KeyEvent",
};

void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, DefineInterfaceProperty aDefineOnGlobal)
{
  JS::Heap<JSObject*>* protoCache = nullptr;
  JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::KeyEvent);

  JS::Handle<JSObject*> constructorProto(JS::GetRealmFunctionPrototypeHandle(aCx));
  if (!constructorProto) {
    return;
  }

  dom::CreateInterfaceObjects(aCx, aGlobal, nullptr,
                              nullptr, protoCache,
                              constructorProto, &sInterfaceObjectInfo, 0, false, Span<const LegacyFactoryFunction, 0>{},
                              interfaceCache,
                              sNativeProperties.Upcast(),
                              nullptr,
                              "KeyEvent",
                              aDefineOnGlobal != DefineInterfaceProperty::No,
                              nullptr,
                              false,
                              nullptr);
}

JS::Handle<JSObject*>
GetConstructorObjectHandle(JSContext* aCx)
{
  /* Get the interface object for this class.  This will create the object as
     needed. */

  return GetPerInterfaceObjectHandle(aCx, constructors::id::KeyEvent,
                                     &CreateInterfaceObjects,
                                     DefineInterfaceProperty::CheckExposure);
}

} // namespace KeyEvent_Binding



} // namespace mozilla::dom
