1/*
2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include "config.h"
22#include "JSKeyboardEvent.h"
23
24#include "JSDOMAttribute.h"
25#include "JSDOMBinding.h"
26#include "JSDOMConstructor.h"
27#include "JSDOMConvertBoolean.h"
28#include "JSDOMConvertInterface.h"
29#include "JSDOMConvertNullable.h"
30#include "JSDOMConvertNumbers.h"
31#include "JSDOMConvertStrings.h"
32#include "JSDOMExceptionHandling.h"
33#include "JSDOMOperation.h"
34#include "JSDOMWrapperCache.h"
35#include "JSWindowProxy.h"
36#include "ScriptExecutionContext.h"
37#include <JavaScriptCore/HeapSnapshotBuilder.h>
38#include <JavaScriptCore/JSCInlines.h>
39#include <wtf/GetPtr.h>
40#include <wtf/PointerPreparations.h>
41#include <wtf/URL.h>
42
43
44namespace WebCore {
45using namespace JSC;
46
47template<> KeyboardEvent::Init convertDictionary<KeyboardEvent::Init>(ExecState& state, JSValue value)
48{
49 VM& vm = state.vm();
50 auto throwScope = DECLARE_THROW_SCOPE(vm);
51 bool isNullOrUndefined = value.isUndefinedOrNull();
52 auto* object = isNullOrUndefined ? nullptr : value.getObject();
53 if (UNLIKELY(!isNullOrUndefined && !object)) {
54 throwTypeError(&state, throwScope);
55 return { };
56 }
57 KeyboardEvent::Init result;
58 JSValue bubblesValue;
59 if (isNullOrUndefined)
60 bubblesValue = jsUndefined();
61 else {
62 bubblesValue = object->get(&state, Identifier::fromString(&state, "bubbles"));
63 RETURN_IF_EXCEPTION(throwScope, { });
64 }
65 if (!bubblesValue.isUndefined()) {
66 result.bubbles = convert<IDLBoolean>(state, bubblesValue);
67 RETURN_IF_EXCEPTION(throwScope, { });
68 } else
69 result.bubbles = false;
70 JSValue cancelableValue;
71 if (isNullOrUndefined)
72 cancelableValue = jsUndefined();
73 else {
74 cancelableValue = object->get(&state, Identifier::fromString(&state, "cancelable"));
75 RETURN_IF_EXCEPTION(throwScope, { });
76 }
77 if (!cancelableValue.isUndefined()) {
78 result.cancelable = convert<IDLBoolean>(state, cancelableValue);
79 RETURN_IF_EXCEPTION(throwScope, { });
80 } else
81 result.cancelable = false;
82 JSValue composedValue;
83 if (isNullOrUndefined)
84 composedValue = jsUndefined();
85 else {
86 composedValue = object->get(&state, Identifier::fromString(&state, "composed"));
87 RETURN_IF_EXCEPTION(throwScope, { });
88 }
89 if (!composedValue.isUndefined()) {
90 result.composed = convert<IDLBoolean>(state, composedValue);
91 RETURN_IF_EXCEPTION(throwScope, { });
92 } else
93 result.composed = false;
94 JSValue detailValue;
95 if (isNullOrUndefined)
96 detailValue = jsUndefined();
97 else {
98 detailValue = object->get(&state, Identifier::fromString(&state, "detail"));
99 RETURN_IF_EXCEPTION(throwScope, { });
100 }
101 if (!detailValue.isUndefined()) {
102 result.detail = convert<IDLLong>(state, detailValue);
103 RETURN_IF_EXCEPTION(throwScope, { });
104 } else
105 result.detail = 0;
106 JSValue viewValue;
107 if (isNullOrUndefined)
108 viewValue = jsUndefined();
109 else {
110 viewValue = object->get(&state, Identifier::fromString(&state, "view"));
111 RETURN_IF_EXCEPTION(throwScope, { });
112 }
113 if (!viewValue.isUndefined()) {
114 result.view = convert<IDLNullable<IDLInterface<WindowProxy>>>(state, viewValue);
115 RETURN_IF_EXCEPTION(throwScope, { });
116 } else
117 result.view = nullptr;
118 JSValue altKeyValue;
119 if (isNullOrUndefined)
120 altKeyValue = jsUndefined();
121 else {
122 altKeyValue = object->get(&state, Identifier::fromString(&state, "altKey"));
123 RETURN_IF_EXCEPTION(throwScope, { });
124 }
125 if (!altKeyValue.isUndefined()) {
126 result.altKey = convert<IDLBoolean>(state, altKeyValue);
127 RETURN_IF_EXCEPTION(throwScope, { });
128 } else
129 result.altKey = false;
130 JSValue ctrlKeyValue;
131 if (isNullOrUndefined)
132 ctrlKeyValue = jsUndefined();
133 else {
134 ctrlKeyValue = object->get(&state, Identifier::fromString(&state, "ctrlKey"));
135 RETURN_IF_EXCEPTION(throwScope, { });
136 }
137 if (!ctrlKeyValue.isUndefined()) {
138 result.ctrlKey = convert<IDLBoolean>(state, ctrlKeyValue);
139 RETURN_IF_EXCEPTION(throwScope, { });
140 } else
141 result.ctrlKey = false;
142 JSValue metaKeyValue;
143 if (isNullOrUndefined)
144 metaKeyValue = jsUndefined();
145 else {
146 metaKeyValue = object->get(&state, Identifier::fromString(&state, "metaKey"));
147 RETURN_IF_EXCEPTION(throwScope, { });
148 }
149 if (!metaKeyValue.isUndefined()) {
150 result.metaKey = convert<IDLBoolean>(state, metaKeyValue);
151 RETURN_IF_EXCEPTION(throwScope, { });
152 } else
153 result.metaKey = false;
154 JSValue modifierAltGraphValue;
155 if (isNullOrUndefined)
156 modifierAltGraphValue = jsUndefined();
157 else {
158 modifierAltGraphValue = object->get(&state, Identifier::fromString(&state, "modifierAltGraph"));
159 RETURN_IF_EXCEPTION(throwScope, { });
160 }
161 if (!modifierAltGraphValue.isUndefined()) {
162 result.modifierAltGraph = convert<IDLBoolean>(state, modifierAltGraphValue);
163 RETURN_IF_EXCEPTION(throwScope, { });
164 } else
165 result.modifierAltGraph = false;
166 JSValue modifierCapsLockValue;
167 if (isNullOrUndefined)
168 modifierCapsLockValue = jsUndefined();
169 else {
170 modifierCapsLockValue = object->get(&state, Identifier::fromString(&state, "modifierCapsLock"));
171 RETURN_IF_EXCEPTION(throwScope, { });
172 }
173 if (!modifierCapsLockValue.isUndefined()) {
174 result.modifierCapsLock = convert<IDLBoolean>(state, modifierCapsLockValue);
175 RETURN_IF_EXCEPTION(throwScope, { });
176 } else
177 result.modifierCapsLock = false;
178 JSValue shiftKeyValue;
179 if (isNullOrUndefined)
180 shiftKeyValue = jsUndefined();
181 else {
182 shiftKeyValue = object->get(&state, Identifier::fromString(&state, "shiftKey"));
183 RETURN_IF_EXCEPTION(throwScope, { });
184 }
185 if (!shiftKeyValue.isUndefined()) {
186 result.shiftKey = convert<IDLBoolean>(state, shiftKeyValue);
187 RETURN_IF_EXCEPTION(throwScope, { });
188 } else
189 result.shiftKey = false;
190 JSValue charCodeValue;
191 if (isNullOrUndefined)
192 charCodeValue = jsUndefined();
193 else {
194 charCodeValue = object->get(&state, Identifier::fromString(&state, "charCode"));
195 RETURN_IF_EXCEPTION(throwScope, { });
196 }
197 if (!charCodeValue.isUndefined()) {
198 result.charCode = convert<IDLUnsignedLong>(state, charCodeValue);
199 RETURN_IF_EXCEPTION(throwScope, { });
200 } else
201 result.charCode = 0;
202 JSValue codeValue;
203 if (isNullOrUndefined)
204 codeValue = jsUndefined();
205 else {
206 codeValue = object->get(&state, Identifier::fromString(&state, "code"));
207 RETURN_IF_EXCEPTION(throwScope, { });
208 }
209 if (!codeValue.isUndefined()) {
210 result.code = convert<IDLDOMString>(state, codeValue);
211 RETURN_IF_EXCEPTION(throwScope, { });
212 } else
213 result.code = emptyString();
214 JSValue isComposingValue;
215 if (isNullOrUndefined)
216 isComposingValue = jsUndefined();
217 else {
218 isComposingValue = object->get(&state, Identifier::fromString(&state, "isComposing"));
219 RETURN_IF_EXCEPTION(throwScope, { });
220 }
221 if (!isComposingValue.isUndefined()) {
222 result.isComposing = convert<IDLBoolean>(state, isComposingValue);
223 RETURN_IF_EXCEPTION(throwScope, { });
224 } else
225 result.isComposing = false;
226 JSValue keyValue;
227 if (isNullOrUndefined)
228 keyValue = jsUndefined();
229 else {
230 keyValue = object->get(&state, Identifier::fromString(&state, "key"));
231 RETURN_IF_EXCEPTION(throwScope, { });
232 }
233 if (!keyValue.isUndefined()) {
234 result.key = convert<IDLDOMString>(state, keyValue);
235 RETURN_IF_EXCEPTION(throwScope, { });
236 } else
237 result.key = emptyString();
238 JSValue keyCodeValue;
239 if (isNullOrUndefined)
240 keyCodeValue = jsUndefined();
241 else {
242 keyCodeValue = object->get(&state, Identifier::fromString(&state, "keyCode"));
243 RETURN_IF_EXCEPTION(throwScope, { });
244 }
245 if (!keyCodeValue.isUndefined()) {
246 result.keyCode = convert<IDLUnsignedLong>(state, keyCodeValue);
247 RETURN_IF_EXCEPTION(throwScope, { });
248 } else
249 result.keyCode = 0;
250 JSValue keyIdentifierValue;
251 if (isNullOrUndefined)
252 keyIdentifierValue = jsUndefined();
253 else {
254 keyIdentifierValue = object->get(&state, Identifier::fromString(&state, "keyIdentifier"));
255 RETURN_IF_EXCEPTION(throwScope, { });
256 }
257 if (!keyIdentifierValue.isUndefined()) {
258 result.keyIdentifier = convert<IDLDOMString>(state, keyIdentifierValue);
259 RETURN_IF_EXCEPTION(throwScope, { });
260 } else
261 result.keyIdentifier = emptyString();
262 JSValue keyLocationValue;
263 if (isNullOrUndefined)
264 keyLocationValue = jsUndefined();
265 else {
266 keyLocationValue = object->get(&state, Identifier::fromString(&state, "keyLocation"));
267 RETURN_IF_EXCEPTION(throwScope, { });
268 }
269 if (!keyLocationValue.isUndefined()) {
270 result.keyLocation = convert<IDLUnsignedLong>(state, keyLocationValue);
271 RETURN_IF_EXCEPTION(throwScope, { });
272 }
273 JSValue locationValue;
274 if (isNullOrUndefined)
275 locationValue = jsUndefined();
276 else {
277 locationValue = object->get(&state, Identifier::fromString(&state, "location"));
278 RETURN_IF_EXCEPTION(throwScope, { });
279 }
280 if (!locationValue.isUndefined()) {
281 result.location = convert<IDLUnsignedLong>(state, locationValue);
282 RETURN_IF_EXCEPTION(throwScope, { });
283 } else
284 result.location = 0;
285 JSValue repeatValue;
286 if (isNullOrUndefined)
287 repeatValue = jsUndefined();
288 else {
289 repeatValue = object->get(&state, Identifier::fromString(&state, "repeat"));
290 RETURN_IF_EXCEPTION(throwScope, { });
291 }
292 if (!repeatValue.isUndefined()) {
293 result.repeat = convert<IDLBoolean>(state, repeatValue);
294 RETURN_IF_EXCEPTION(throwScope, { });
295 } else
296 result.repeat = false;
297 JSValue whichValue;
298 if (isNullOrUndefined)
299 whichValue = jsUndefined();
300 else {
301 whichValue = object->get(&state, Identifier::fromString(&state, "which"));
302 RETURN_IF_EXCEPTION(throwScope, { });
303 }
304 if (!whichValue.isUndefined()) {
305 result.which = convert<IDLUnsignedLong>(state, whichValue);
306 RETURN_IF_EXCEPTION(throwScope, { });
307 } else
308 result.which = 0;
309 return result;
310}
311
312// Functions
313
314JSC::EncodedJSValue JSC_HOST_CALL jsKeyboardEventPrototypeFunctionGetModifierState(JSC::ExecState*);
315JSC::EncodedJSValue JSC_HOST_CALL jsKeyboardEventPrototypeFunctionInitKeyboardEvent(JSC::ExecState*);
316
317// Attributes
318
319JSC::EncodedJSValue jsKeyboardEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
320bool setJSKeyboardEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
321#if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
322JSC::EncodedJSValue jsKeyboardEventKey(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
323#endif
324#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
325JSC::EncodedJSValue jsKeyboardEventCode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
326#endif
327JSC::EncodedJSValue jsKeyboardEventLocation(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
328JSC::EncodedJSValue jsKeyboardEventCtrlKey(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
329JSC::EncodedJSValue jsKeyboardEventShiftKey(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
330JSC::EncodedJSValue jsKeyboardEventAltKey(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
331JSC::EncodedJSValue jsKeyboardEventMetaKey(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
332JSC::EncodedJSValue jsKeyboardEventRepeat(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
333JSC::EncodedJSValue jsKeyboardEventIsComposing(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
334JSC::EncodedJSValue jsKeyboardEventKeyIdentifier(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
335JSC::EncodedJSValue jsKeyboardEventKeyLocation(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
336JSC::EncodedJSValue jsKeyboardEventAltGraphKey(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
337JSC::EncodedJSValue jsKeyboardEventCharCode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
338JSC::EncodedJSValue jsKeyboardEventKeyCode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
339JSC::EncodedJSValue jsKeyboardEventWhich(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
340
341class JSKeyboardEventPrototype : public JSC::JSNonFinalObject {
342public:
343 using Base = JSC::JSNonFinalObject;
344 static JSKeyboardEventPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
345 {
346 JSKeyboardEventPrototype* ptr = new (NotNull, JSC::allocateCell<JSKeyboardEventPrototype>(vm.heap)) JSKeyboardEventPrototype(vm, globalObject, structure);
347 ptr->finishCreation(vm);
348 return ptr;
349 }
350
351 DECLARE_INFO;
352 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
353 {
354 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
355 }
356
357private:
358 JSKeyboardEventPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
359 : JSC::JSNonFinalObject(vm, structure)
360 {
361 }
362
363 void finishCreation(JSC::VM&);
364};
365
366using JSKeyboardEventConstructor = JSDOMConstructor<JSKeyboardEvent>;
367
368/* Hash table for constructor */
369
370static const HashTableValue JSKeyboardEventConstructorTableValues[] =
371{
372 { "DOM_KEY_LOCATION_STANDARD", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x00) } },
373 { "DOM_KEY_LOCATION_LEFT", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x01) } },
374 { "DOM_KEY_LOCATION_RIGHT", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x02) } },
375 { "DOM_KEY_LOCATION_NUMPAD", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x03) } },
376};
377
378static_assert(KeyboardEvent::DOM_KEY_LOCATION_STANDARD == 0x00, "DOM_KEY_LOCATION_STANDARD in KeyboardEvent does not match value from IDL");
379static_assert(KeyboardEvent::DOM_KEY_LOCATION_LEFT == 0x01, "DOM_KEY_LOCATION_LEFT in KeyboardEvent does not match value from IDL");
380static_assert(KeyboardEvent::DOM_KEY_LOCATION_RIGHT == 0x02, "DOM_KEY_LOCATION_RIGHT in KeyboardEvent does not match value from IDL");
381static_assert(KeyboardEvent::DOM_KEY_LOCATION_NUMPAD == 0x03, "DOM_KEY_LOCATION_NUMPAD in KeyboardEvent does not match value from IDL");
382
383template<> EncodedJSValue JSC_HOST_CALL JSKeyboardEventConstructor::construct(ExecState* state)
384{
385 VM& vm = state->vm();
386 auto throwScope = DECLARE_THROW_SCOPE(vm);
387 UNUSED_PARAM(throwScope);
388 auto* castedThis = jsCast<JSKeyboardEventConstructor*>(state->jsCallee());
389 ASSERT(castedThis);
390 if (UNLIKELY(state->argumentCount() < 1))
391 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
392 auto type = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
393 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
394 auto eventInitDict = convert<IDLDictionary<KeyboardEvent::Init>>(*state, state->argument(1));
395 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
396 auto object = KeyboardEvent::create(WTFMove(type), WTFMove(eventInitDict));
397 return JSValue::encode(toJSNewlyCreated<IDLInterface<KeyboardEvent>>(*state, *castedThis->globalObject(), WTFMove(object)));
398}
399
400template<> JSValue JSKeyboardEventConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
401{
402 return JSUIEvent::getConstructor(vm, &globalObject);
403}
404
405template<> void JSKeyboardEventConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
406{
407 putDirect(vm, vm.propertyNames->prototype, JSKeyboardEvent::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
408 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("KeyboardEvent"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
409 putDirect(vm, vm.propertyNames->length, jsNumber(1), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
410 reifyStaticProperties(vm, JSKeyboardEvent::info(), JSKeyboardEventConstructorTableValues, *this);
411}
412
413template<> const ClassInfo JSKeyboardEventConstructor::s_info = { "KeyboardEvent", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSKeyboardEventConstructor) };
414
415/* Hash table for prototype */
416
417static const HashTableValue JSKeyboardEventPrototypeTableValues[] =
418{
419 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSKeyboardEventConstructor) } },
420#if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
421 { "key", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventKey), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
422#else
423 { 0, 0, NoIntrinsic, { 0, 0 } },
424#endif
425#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
426 { "code", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventCode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
427#else
428 { 0, 0, NoIntrinsic, { 0, 0 } },
429#endif
430 { "location", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventLocation), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
431 { "ctrlKey", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventCtrlKey), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
432 { "shiftKey", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventShiftKey), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
433 { "altKey", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventAltKey), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
434 { "metaKey", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventMetaKey), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
435 { "repeat", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventRepeat), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
436 { "isComposing", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventIsComposing), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
437 { "keyIdentifier", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventKeyIdentifier), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
438 { "keyLocation", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventKeyLocation), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
439 { "altGraphKey", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventAltGraphKey), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
440 { "charCode", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventCharCode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
441 { "keyCode", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventKeyCode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
442 { "which", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventWhich), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
443 { "getModifierState", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsKeyboardEventPrototypeFunctionGetModifierState), (intptr_t) (1) } },
444 { "initKeyboardEvent", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsKeyboardEventPrototypeFunctionInitKeyboardEvent), (intptr_t) (0) } },
445 { "DOM_KEY_LOCATION_STANDARD", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x00) } },
446 { "DOM_KEY_LOCATION_LEFT", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x01) } },
447 { "DOM_KEY_LOCATION_RIGHT", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x02) } },
448 { "DOM_KEY_LOCATION_NUMPAD", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x03) } },
449};
450
451const ClassInfo JSKeyboardEventPrototype::s_info = { "KeyboardEventPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSKeyboardEventPrototype) };
452
453void JSKeyboardEventPrototype::finishCreation(VM& vm)
454{
455 Base::finishCreation(vm);
456 reifyStaticProperties(vm, JSKeyboardEvent::info(), JSKeyboardEventPrototypeTableValues, *this);
457}
458
459const ClassInfo JSKeyboardEvent::s_info = { "KeyboardEvent", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSKeyboardEvent) };
460
461JSKeyboardEvent::JSKeyboardEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref<KeyboardEvent>&& impl)
462 : JSUIEvent(structure, globalObject, WTFMove(impl))
463{
464}
465
466void JSKeyboardEvent::finishCreation(VM& vm)
467{
468 Base::finishCreation(vm);
469 ASSERT(inherits(vm, info()));
470
471}
472
473JSObject* JSKeyboardEvent::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
474{
475 return JSKeyboardEventPrototype::create(vm, &globalObject, JSKeyboardEventPrototype::createStructure(vm, &globalObject, JSUIEvent::prototype(vm, globalObject)));
476}
477
478JSObject* JSKeyboardEvent::prototype(VM& vm, JSDOMGlobalObject& globalObject)
479{
480 return getDOMPrototype<JSKeyboardEvent>(vm, globalObject);
481}
482
483JSValue JSKeyboardEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject)
484{
485 return getDOMConstructor<JSKeyboardEventConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
486}
487
488template<> inline JSKeyboardEvent* IDLAttribute<JSKeyboardEvent>::cast(ExecState& state, EncodedJSValue thisValue)
489{
490 return jsDynamicCast<JSKeyboardEvent*>(state.vm(), JSValue::decode(thisValue));
491}
492
493template<> inline JSKeyboardEvent* IDLOperation<JSKeyboardEvent>::cast(ExecState& state)
494{
495 return jsDynamicCast<JSKeyboardEvent*>(state.vm(), state.thisValue());
496}
497
498EncodedJSValue jsKeyboardEventConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
499{
500 VM& vm = state->vm();
501 auto throwScope = DECLARE_THROW_SCOPE(vm);
502 auto* prototype = jsDynamicCast<JSKeyboardEventPrototype*>(vm, JSValue::decode(thisValue));
503 if (UNLIKELY(!prototype))
504 return throwVMTypeError(state, throwScope);
505 return JSValue::encode(JSKeyboardEvent::getConstructor(state->vm(), prototype->globalObject()));
506}
507
508bool setJSKeyboardEventConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
509{
510 VM& vm = state->vm();
511 auto throwScope = DECLARE_THROW_SCOPE(vm);
512 auto* prototype = jsDynamicCast<JSKeyboardEventPrototype*>(vm, JSValue::decode(thisValue));
513 if (UNLIKELY(!prototype)) {
514 throwVMTypeError(state, throwScope);
515 return false;
516 }
517 // Shadowing a built-in constructor
518 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
519}
520
521#if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
522static inline JSValue jsKeyboardEventKeyGetter(ExecState& state, JSKeyboardEvent& thisObject, ThrowScope& throwScope)
523{
524 UNUSED_PARAM(throwScope);
525 UNUSED_PARAM(state);
526 auto& impl = thisObject.wrapped();
527 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.key());
528 return result;
529}
530
531EncodedJSValue jsKeyboardEventKey(ExecState* state, EncodedJSValue thisValue, PropertyName)
532{
533 return IDLAttribute<JSKeyboardEvent>::get<jsKeyboardEventKeyGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "key");
534}
535
536#endif
537
538#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
539static inline JSValue jsKeyboardEventCodeGetter(ExecState& state, JSKeyboardEvent& thisObject, ThrowScope& throwScope)
540{
541 UNUSED_PARAM(throwScope);
542 UNUSED_PARAM(state);
543 auto& impl = thisObject.wrapped();
544 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.code());
545 return result;
546}
547
548EncodedJSValue jsKeyboardEventCode(ExecState* state, EncodedJSValue thisValue, PropertyName)
549{
550 return IDLAttribute<JSKeyboardEvent>::get<jsKeyboardEventCodeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "code");
551}
552
553#endif
554
555static inline JSValue jsKeyboardEventLocationGetter(ExecState& state, JSKeyboardEvent& thisObject, ThrowScope& throwScope)
556{
557 UNUSED_PARAM(throwScope);
558 UNUSED_PARAM(state);
559 auto& impl = thisObject.wrapped();
560 JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.location());
561 return result;
562}
563
564EncodedJSValue jsKeyboardEventLocation(ExecState* state, EncodedJSValue thisValue, PropertyName)
565{
566 return IDLAttribute<JSKeyboardEvent>::get<jsKeyboardEventLocationGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "location");
567}
568
569static inline JSValue jsKeyboardEventCtrlKeyGetter(ExecState& state, JSKeyboardEvent& thisObject, ThrowScope& throwScope)
570{
571 UNUSED_PARAM(throwScope);
572 UNUSED_PARAM(state);
573 auto& impl = thisObject.wrapped();
574 JSValue result = toJS<IDLBoolean>(state, throwScope, impl.ctrlKey());
575 return result;
576}
577
578EncodedJSValue jsKeyboardEventCtrlKey(ExecState* state, EncodedJSValue thisValue, PropertyName)
579{
580 return IDLAttribute<JSKeyboardEvent>::get<jsKeyboardEventCtrlKeyGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "ctrlKey");
581}
582
583static inline JSValue jsKeyboardEventShiftKeyGetter(ExecState& state, JSKeyboardEvent& thisObject, ThrowScope& throwScope)
584{
585 UNUSED_PARAM(throwScope);
586 UNUSED_PARAM(state);
587 auto& impl = thisObject.wrapped();
588 JSValue result = toJS<IDLBoolean>(state, throwScope, impl.shiftKey());
589 return result;
590}
591
592EncodedJSValue jsKeyboardEventShiftKey(ExecState* state, EncodedJSValue thisValue, PropertyName)
593{
594 return IDLAttribute<JSKeyboardEvent>::get<jsKeyboardEventShiftKeyGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "shiftKey");
595}
596
597static inline JSValue jsKeyboardEventAltKeyGetter(ExecState& state, JSKeyboardEvent& thisObject, ThrowScope& throwScope)
598{
599 UNUSED_PARAM(throwScope);
600 UNUSED_PARAM(state);
601 auto& impl = thisObject.wrapped();
602 JSValue result = toJS<IDLBoolean>(state, throwScope, impl.altKey());
603 return result;
604}
605
606EncodedJSValue jsKeyboardEventAltKey(ExecState* state, EncodedJSValue thisValue, PropertyName)
607{
608 return IDLAttribute<JSKeyboardEvent>::get<jsKeyboardEventAltKeyGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "altKey");
609}
610
611static inline JSValue jsKeyboardEventMetaKeyGetter(ExecState& state, JSKeyboardEvent& thisObject, ThrowScope& throwScope)
612{
613 UNUSED_PARAM(throwScope);
614 UNUSED_PARAM(state);
615 auto& impl = thisObject.wrapped();
616 JSValue result = toJS<IDLBoolean>(state, throwScope, impl.metaKey());
617 return result;
618}
619
620EncodedJSValue jsKeyboardEventMetaKey(ExecState* state, EncodedJSValue thisValue, PropertyName)
621{
622 return IDLAttribute<JSKeyboardEvent>::get<jsKeyboardEventMetaKeyGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "metaKey");
623}
624
625static inline JSValue jsKeyboardEventRepeatGetter(ExecState& state, JSKeyboardEvent& thisObject, ThrowScope& throwScope)
626{
627 UNUSED_PARAM(throwScope);
628 UNUSED_PARAM(state);
629 auto& impl = thisObject.wrapped();
630 JSValue result = toJS<IDLBoolean>(state, throwScope, impl.repeat());
631 return result;
632}
633
634EncodedJSValue jsKeyboardEventRepeat(ExecState* state, EncodedJSValue thisValue, PropertyName)
635{
636 return IDLAttribute<JSKeyboardEvent>::get<jsKeyboardEventRepeatGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "repeat");
637}
638
639static inline JSValue jsKeyboardEventIsComposingGetter(ExecState& state, JSKeyboardEvent& thisObject, ThrowScope& throwScope)
640{
641 UNUSED_PARAM(throwScope);
642 UNUSED_PARAM(state);
643 auto& impl = thisObject.wrapped();
644 JSValue result = toJS<IDLBoolean>(state, throwScope, impl.isComposing());
645 return result;
646}
647
648EncodedJSValue jsKeyboardEventIsComposing(ExecState* state, EncodedJSValue thisValue, PropertyName)
649{
650 return IDLAttribute<JSKeyboardEvent>::get<jsKeyboardEventIsComposingGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "isComposing");
651}
652
653static inline JSValue jsKeyboardEventKeyIdentifierGetter(ExecState& state, JSKeyboardEvent& thisObject, ThrowScope& throwScope)
654{
655 UNUSED_PARAM(throwScope);
656 UNUSED_PARAM(state);
657 auto& impl = thisObject.wrapped();
658 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.keyIdentifier());
659 return result;
660}
661
662EncodedJSValue jsKeyboardEventKeyIdentifier(ExecState* state, EncodedJSValue thisValue, PropertyName)
663{
664 return IDLAttribute<JSKeyboardEvent>::get<jsKeyboardEventKeyIdentifierGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "keyIdentifier");
665}
666
667static inline JSValue jsKeyboardEventKeyLocationGetter(ExecState& state, JSKeyboardEvent& thisObject, ThrowScope& throwScope)
668{
669 UNUSED_PARAM(throwScope);
670 UNUSED_PARAM(state);
671 auto& impl = thisObject.wrapped();
672 JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.location());
673 return result;
674}
675
676EncodedJSValue jsKeyboardEventKeyLocation(ExecState* state, EncodedJSValue thisValue, PropertyName)
677{
678 return IDLAttribute<JSKeyboardEvent>::get<jsKeyboardEventKeyLocationGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "keyLocation");
679}
680
681static inline JSValue jsKeyboardEventAltGraphKeyGetter(ExecState& state, JSKeyboardEvent& thisObject, ThrowScope& throwScope)
682{
683 UNUSED_PARAM(throwScope);
684 UNUSED_PARAM(state);
685 auto& impl = thisObject.wrapped();
686 JSValue result = toJS<IDLBoolean>(state, throwScope, impl.altGraphKey());
687 return result;
688}
689
690EncodedJSValue jsKeyboardEventAltGraphKey(ExecState* state, EncodedJSValue thisValue, PropertyName)
691{
692 return IDLAttribute<JSKeyboardEvent>::get<jsKeyboardEventAltGraphKeyGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "altGraphKey");
693}
694
695static inline JSValue jsKeyboardEventCharCodeGetter(ExecState& state, JSKeyboardEvent& thisObject, ThrowScope& throwScope)
696{
697 UNUSED_PARAM(throwScope);
698 UNUSED_PARAM(state);
699 auto& impl = thisObject.wrapped();
700 JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.charCode());
701 return result;
702}
703
704EncodedJSValue jsKeyboardEventCharCode(ExecState* state, EncodedJSValue thisValue, PropertyName)
705{
706 return IDLAttribute<JSKeyboardEvent>::get<jsKeyboardEventCharCodeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "charCode");
707}
708
709static inline JSValue jsKeyboardEventKeyCodeGetter(ExecState& state, JSKeyboardEvent& thisObject, ThrowScope& throwScope)
710{
711 UNUSED_PARAM(throwScope);
712 UNUSED_PARAM(state);
713 auto& impl = thisObject.wrapped();
714 JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.keyCode());
715 return result;
716}
717
718EncodedJSValue jsKeyboardEventKeyCode(ExecState* state, EncodedJSValue thisValue, PropertyName)
719{
720 return IDLAttribute<JSKeyboardEvent>::get<jsKeyboardEventKeyCodeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "keyCode");
721}
722
723static inline JSValue jsKeyboardEventWhichGetter(ExecState& state, JSKeyboardEvent& thisObject, ThrowScope& throwScope)
724{
725 UNUSED_PARAM(throwScope);
726 UNUSED_PARAM(state);
727 auto& impl = thisObject.wrapped();
728 JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.which());
729 return result;
730}
731
732EncodedJSValue jsKeyboardEventWhich(ExecState* state, EncodedJSValue thisValue, PropertyName)
733{
734 return IDLAttribute<JSKeyboardEvent>::get<jsKeyboardEventWhichGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "which");
735}
736
737static inline JSC::EncodedJSValue jsKeyboardEventPrototypeFunctionGetModifierStateBody(JSC::ExecState* state, typename IDLOperation<JSKeyboardEvent>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
738{
739 UNUSED_PARAM(state);
740 UNUSED_PARAM(throwScope);
741 auto& impl = castedThis->wrapped();
742 if (UNLIKELY(state->argumentCount() < 1))
743 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
744 auto keyArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
745 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
746 return JSValue::encode(toJS<IDLBoolean>(impl.getModifierState(WTFMove(keyArg))));
747}
748
749EncodedJSValue JSC_HOST_CALL jsKeyboardEventPrototypeFunctionGetModifierState(ExecState* state)
750{
751 return IDLOperation<JSKeyboardEvent>::call<jsKeyboardEventPrototypeFunctionGetModifierStateBody>(*state, "getModifierState");
752}
753
754static inline JSC::EncodedJSValue jsKeyboardEventPrototypeFunctionInitKeyboardEventBody(JSC::ExecState* state, typename IDLOperation<JSKeyboardEvent>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
755{
756 UNUSED_PARAM(state);
757 UNUSED_PARAM(throwScope);
758 auto& impl = castedThis->wrapped();
759 auto type = convert<IDLDOMString>(*state, state->argument(0));
760 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
761 auto canBubble = convert<IDLBoolean>(*state, state->argument(1));
762 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
763 auto cancelable = convert<IDLBoolean>(*state, state->argument(2));
764 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
765 auto view = convert<IDLNullable<IDLInterface<WindowProxy>>>(*state, state->argument(3), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 3, "view", "KeyboardEvent", "initKeyboardEvent", "WindowProxy"); });
766 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
767 auto keyIdentifier = convert<IDLDOMString>(*state, state->argument(4));
768 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
769 auto location = convert<IDLUnsignedLong>(*state, state->argument(5));
770 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
771 auto ctrlKey = convert<IDLBoolean>(*state, state->argument(6));
772 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
773 auto altKey = convert<IDLBoolean>(*state, state->argument(7));
774 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
775 auto shiftKey = convert<IDLBoolean>(*state, state->argument(8));
776 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
777 auto metaKey = convert<IDLBoolean>(*state, state->argument(9));
778 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
779 auto altGraphKey = convert<IDLBoolean>(*state, state->argument(10));
780 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
781 impl.initKeyboardEvent(WTFMove(type), WTFMove(canBubble), WTFMove(cancelable), WTFMove(view), WTFMove(keyIdentifier), WTFMove(location), WTFMove(ctrlKey), WTFMove(altKey), WTFMove(shiftKey), WTFMove(metaKey), WTFMove(altGraphKey));
782 return JSValue::encode(jsUndefined());
783}
784
785EncodedJSValue JSC_HOST_CALL jsKeyboardEventPrototypeFunctionInitKeyboardEvent(ExecState* state)
786{
787 return IDLOperation<JSKeyboardEvent>::call<jsKeyboardEventPrototypeFunctionInitKeyboardEventBody>(*state, "initKeyboardEvent");
788}
789
790void JSKeyboardEvent::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
791{
792 auto* thisObject = jsCast<JSKeyboardEvent*>(cell);
793 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
794 if (thisObject->scriptExecutionContext())
795 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
796 Base::heapSnapshot(cell, builder);
797}
798
799#if ENABLE(BINDING_INTEGRITY)
800#if PLATFORM(WIN)
801#pragma warning(disable: 4483)
802extern "C" { extern void (*const __identifier("??_7KeyboardEvent@WebCore@@6B@")[])(); }
803#else
804extern "C" { extern void* _ZTVN7WebCore13KeyboardEventE[]; }
805#endif
806#endif
807
808JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<KeyboardEvent>&& impl)
809{
810
811#if ENABLE(BINDING_INTEGRITY)
812 void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
813#if PLATFORM(WIN)
814 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7KeyboardEvent@WebCore@@6B@"));
815#else
816 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore13KeyboardEventE[2]);
817#endif
818
819 // If this fails KeyboardEvent does not have a vtable, so you need to add the
820 // ImplementationLacksVTable attribute to the interface definition
821 static_assert(std::is_polymorphic<KeyboardEvent>::value, "KeyboardEvent is not polymorphic");
822
823 // If you hit this assertion you either have a use after free bug, or
824 // KeyboardEvent has subclasses. If KeyboardEvent has subclasses that get passed
825 // to toJS() we currently require KeyboardEvent you to opt out of binding hardening
826 // by adding the SkipVTableValidation attribute to the interface IDL definition
827 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
828#endif
829 return createWrapper<KeyboardEvent>(globalObject, WTFMove(impl));
830}
831
832JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, KeyboardEvent& impl)
833{
834 return wrap(state, globalObject, impl);
835}
836
837
838}
839