[WTF] Add user-defined literal for ASCIILiteral
[WebKit-https.git] / Source / WebCore / bindings / scripts / test / JS / JSTestNode.cpp
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 "JSTestNode.h"
23
24 #include "JSDOMAttribute.h"
25 #include "JSDOMBinding.h"
26 #include "JSDOMConstructor.h"
27 #include "JSDOMConvertBoolean.h"
28 #include "JSDOMConvertInterface.h"
29 #include "JSDOMConvertStrings.h"
30 #include "JSDOMExceptionHandling.h"
31 #include "JSDOMIterator.h"
32 #include "JSDOMOperation.h"
33 #include "JSDOMOperationReturningPromise.h"
34 #include "JSDOMWrapperCache.h"
35 #include "RuntimeEnabledFeatures.h"
36 #include "ScriptExecutionContext.h"
37 #include <JavaScriptCore/BuiltinNames.h>
38 #include <JavaScriptCore/JSCInlines.h>
39 #include <JavaScriptCore/ObjectConstructor.h>
40 #include <wtf/GetPtr.h>
41 #include <wtf/PointerPreparations.h>
42
43
44 namespace WebCore {
45 using namespace JSC;
46
47 // Functions
48
49 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionTestWorkerPromise(JSC::ExecState*);
50 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionCalculateSecretResult(JSC::ExecState*);
51 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionGetSecretBoolean(JSC::ExecState*);
52 #if ENABLE(TEST_FEATURE)
53 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionTestFeatureGetSecretBoolean(JSC::ExecState*);
54 #endif
55 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionSymbolIterator(JSC::ExecState*);
56 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionEntries(JSC::ExecState*);
57 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionKeys(JSC::ExecState*);
58 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionValues(JSC::ExecState*);
59 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionForEach(JSC::ExecState*);
60 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionToJSON(JSC::ExecState*);
61
62 // Attributes
63
64 JSC::EncodedJSValue jsTestNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
65 bool setJSTestNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
66 JSC::EncodedJSValue jsTestNodeName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
67 bool setJSTestNodeName(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
68
69 class JSTestNodePrototype : public JSC::JSNonFinalObject {
70 public:
71     using Base = JSC::JSNonFinalObject;
72     static JSTestNodePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
73     {
74         JSTestNodePrototype* ptr = new (NotNull, JSC::allocateCell<JSTestNodePrototype>(vm.heap)) JSTestNodePrototype(vm, globalObject, structure);
75         ptr->finishCreation(vm);
76         return ptr;
77     }
78
79     DECLARE_INFO;
80     static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
81     {
82         return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
83     }
84
85 private:
86     JSTestNodePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
87         : JSC::JSNonFinalObject(vm, structure)
88     {
89     }
90
91     void finishCreation(JSC::VM&);
92 };
93
94 using JSTestNodeConstructor = JSDOMConstructor<JSTestNode>;
95
96 template<> EncodedJSValue JSC_HOST_CALL JSTestNodeConstructor::construct(ExecState* state)
97 {
98     VM& vm = state->vm();
99     auto throwScope = DECLARE_THROW_SCOPE(vm);
100     UNUSED_PARAM(throwScope);
101     auto* castedThis = jsCast<JSTestNodeConstructor*>(state->jsCallee());
102     ASSERT(castedThis);
103     auto object = TestNode::create();
104     return JSValue::encode(toJSNewlyCreated<IDLInterface<TestNode>>(*state, *castedThis->globalObject(), WTFMove(object)));
105 }
106
107 template<> JSValue JSTestNodeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
108 {
109     return JSNode::getConstructor(vm, &globalObject);
110 }
111
112 template<> void JSTestNodeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
113 {
114     putDirect(vm, vm.propertyNames->prototype, JSTestNode::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
115     putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("TestNode"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
116     putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
117 }
118
119 template<> const ClassInfo JSTestNodeConstructor::s_info = { "TestNode", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNodeConstructor) };
120
121 /* Hash table for prototype */
122
123 static const HashTableValue JSTestNodePrototypeTableValues[] =
124 {
125     { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNodeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNodeConstructor) } },
126     { "name", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNodeName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNodeName) } },
127     { "testWorkerPromise", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestNodePrototypeFunctionTestWorkerPromise), (intptr_t) (0) } },
128     { "calculateSecretResult", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestNodePrototypeFunctionCalculateSecretResult), (intptr_t) (0) } },
129     { "getSecretBoolean", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestNodePrototypeFunctionGetSecretBoolean), (intptr_t) (0) } },
130 #if ENABLE(TEST_FEATURE)
131     { "testFeatureGetSecretBoolean", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestNodePrototypeFunctionTestFeatureGetSecretBoolean), (intptr_t) (0) } },
132 #else
133     { 0, 0, NoIntrinsic, { 0, 0 } },
134 #endif
135     { "entries", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestNodePrototypeFunctionEntries), (intptr_t) (0) } },
136     { "keys", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestNodePrototypeFunctionKeys), (intptr_t) (0) } },
137     { "values", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestNodePrototypeFunctionValues), (intptr_t) (0) } },
138     { "forEach", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestNodePrototypeFunctionForEach), (intptr_t) (1) } },
139     { "toJSON", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestNodePrototypeFunctionToJSON), (intptr_t) (0) } },
140 };
141
142 const ClassInfo JSTestNodePrototype::s_info = { "TestNodePrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNodePrototype) };
143
144 void JSTestNodePrototype::finishCreation(VM& vm)
145 {
146     Base::finishCreation(vm);
147     reifyStaticProperties(vm, JSTestNode::info(), JSTestNodePrototypeTableValues, *this);
148     if (!jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext()) {
149         auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("calculateSecretResult"), strlen("calculateSecretResult"));
150         VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
151         JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
152     }
153     if (!jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext()) {
154         auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("getSecretBoolean"), strlen("getSecretBoolean"));
155         VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
156         JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
157     }
158 #if ENABLE(TEST_FEATURE)
159     if (!(jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext() && RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled())) {
160         auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("testFeatureGetSecretBoolean"), strlen("testFeatureGetSecretBoolean"));
161         VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
162         JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
163     }
164 #endif
165     if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
166         auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("entries"), strlen("entries"));
167         VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
168         JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
169     }
170     if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
171         auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("keys"), strlen("keys"));
172         VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
173         JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
174     }
175     if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
176         auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("values"), strlen("values"));
177         VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
178         JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
179     }
180     if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
181         auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("forEach"), strlen("forEach"));
182         VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
183         JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
184     }
185     putDirect(vm, vm.propertyNames->iteratorSymbol, getDirect(vm, vm.propertyNames->builtinNames().entriesPublicName()), static_cast<unsigned>(JSC::PropertyAttribute::DontEnum));
186 }
187
188 const ClassInfo JSTestNode::s_info = { "TestNode", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNode) };
189
190 JSTestNode::JSTestNode(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestNode>&& impl)
191     : JSNode(structure, globalObject, WTFMove(impl))
192 {
193 }
194
195 void JSTestNode::finishCreation(VM& vm)
196 {
197     Base::finishCreation(vm);
198     ASSERT(inherits(vm, info()));
199
200 }
201
202 JSObject* JSTestNode::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
203 {
204     return JSTestNodePrototype::create(vm, &globalObject, JSTestNodePrototype::createStructure(vm, &globalObject, JSNode::prototype(vm, globalObject)));
205 }
206
207 JSObject* JSTestNode::prototype(VM& vm, JSDOMGlobalObject& globalObject)
208 {
209     return getDOMPrototype<JSTestNode>(vm, globalObject);
210 }
211
212 JSValue JSTestNode::getConstructor(VM& vm, const JSGlobalObject* globalObject)
213 {
214     return getDOMConstructor<JSTestNodeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
215 }
216
217 template<> inline JSTestNode* IDLAttribute<JSTestNode>::cast(ExecState& state, EncodedJSValue thisValue)
218 {
219     return jsDynamicCast<JSTestNode*>(state.vm(), JSValue::decode(thisValue));
220 }
221
222 template<> inline JSTestNode* IDLOperation<JSTestNode>::cast(ExecState& state)
223 {
224     return jsDynamicCast<JSTestNode*>(state.vm(), state.thisValue());
225 }
226
227 EncodedJSValue jsTestNodeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
228 {
229     VM& vm = state->vm();
230     auto throwScope = DECLARE_THROW_SCOPE(vm);
231     auto* prototype = jsDynamicCast<JSTestNodePrototype*>(vm, JSValue::decode(thisValue));
232     if (UNLIKELY(!prototype))
233         return throwVMTypeError(state, throwScope);
234     return JSValue::encode(JSTestNode::getConstructor(state->vm(), prototype->globalObject()));
235 }
236
237 bool setJSTestNodeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
238 {
239     VM& vm = state->vm();
240     auto throwScope = DECLARE_THROW_SCOPE(vm);
241     auto* prototype = jsDynamicCast<JSTestNodePrototype*>(vm, JSValue::decode(thisValue));
242     if (UNLIKELY(!prototype)) {
243         throwVMTypeError(state, throwScope);
244         return false;
245     }
246     // Shadowing a built-in constructor
247     return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
248 }
249
250 static inline JSValue jsTestNodeNameGetter(ExecState& state, JSTestNode& thisObject, ThrowScope& throwScope)
251 {
252     UNUSED_PARAM(throwScope);
253     UNUSED_PARAM(state);
254     auto& impl = thisObject.wrapped();
255     JSValue result = toJS<IDLDOMString>(state, throwScope, impl.name());
256     return result;
257 }
258
259 EncodedJSValue jsTestNodeName(ExecState* state, EncodedJSValue thisValue, PropertyName)
260 {
261     return IDLAttribute<JSTestNode>::get<jsTestNodeNameGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "name");
262 }
263
264 static inline bool setJSTestNodeNameSetter(ExecState& state, JSTestNode& thisObject, JSValue value, ThrowScope& throwScope)
265 {
266     UNUSED_PARAM(throwScope);
267     auto& impl = thisObject.wrapped();
268     auto nativeValue = convert<IDLDOMString>(state, value);
269     RETURN_IF_EXCEPTION(throwScope, false);
270     AttributeSetter::call(state, throwScope, [&] {
271         return impl.setName(WTFMove(nativeValue));
272     });
273     return true;
274 }
275
276 bool setJSTestNodeName(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
277 {
278     return IDLAttribute<JSTestNode>::set<setJSTestNodeNameSetter>(*state, thisValue, encodedValue, "name");
279 }
280
281 static inline JSC::EncodedJSValue jsTestNodePrototypeFunctionTestWorkerPromiseBody(JSC::ExecState* state, typename IDLOperationReturningPromise<JSTestNode>::ClassParameter castedThis, Ref<DeferredPromise>&& promise, JSC::ThrowScope& throwScope)
282 {
283     UNUSED_PARAM(state);
284     UNUSED_PARAM(throwScope);
285     auto& impl = castedThis->wrapped();
286     impl.testWorkerPromise(WTFMove(promise));
287     return JSValue::encode(jsUndefined());
288 }
289
290 EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionTestWorkerPromise(ExecState* state)
291 {
292     return IDLOperationReturningPromise<JSTestNode>::call<jsTestNodePrototypeFunctionTestWorkerPromiseBody, PromiseExecutionScope::WindowOrWorker>(*state, "testWorkerPromise");
293 }
294
295 static inline JSC::EncodedJSValue jsTestNodePrototypeFunctionCalculateSecretResultBody(JSC::ExecState* state, typename IDLOperationReturningPromise<JSTestNode>::ClassParameter castedThis, Ref<DeferredPromise>&& promise, JSC::ThrowScope& throwScope)
296 {
297     UNUSED_PARAM(state);
298     UNUSED_PARAM(throwScope);
299     auto& impl = castedThis->wrapped();
300     impl.calculateSecretResult(WTFMove(promise));
301     return JSValue::encode(jsUndefined());
302 }
303
304 EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionCalculateSecretResult(ExecState* state)
305 {
306     return IDLOperationReturningPromise<JSTestNode>::call<jsTestNodePrototypeFunctionCalculateSecretResultBody, PromiseExecutionScope::WindowOrWorker>(*state, "calculateSecretResult");
307 }
308
309 static inline JSC::EncodedJSValue jsTestNodePrototypeFunctionGetSecretBooleanBody(JSC::ExecState* state, typename IDLOperation<JSTestNode>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
310 {
311     UNUSED_PARAM(state);
312     UNUSED_PARAM(throwScope);
313     auto& impl = castedThis->wrapped();
314     return JSValue::encode(toJS<IDLBoolean>(impl.getSecretBoolean()));
315 }
316
317 EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionGetSecretBoolean(ExecState* state)
318 {
319     return IDLOperation<JSTestNode>::call<jsTestNodePrototypeFunctionGetSecretBooleanBody>(*state, "getSecretBoolean");
320 }
321
322 #if ENABLE(TEST_FEATURE)
323 static inline JSC::EncodedJSValue jsTestNodePrototypeFunctionTestFeatureGetSecretBooleanBody(JSC::ExecState* state, typename IDLOperation<JSTestNode>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
324 {
325     UNUSED_PARAM(state);
326     UNUSED_PARAM(throwScope);
327     auto& impl = castedThis->wrapped();
328     return JSValue::encode(toJS<IDLBoolean>(impl.testFeatureGetSecretBoolean()));
329 }
330
331 EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionTestFeatureGetSecretBoolean(ExecState* state)
332 {
333     return IDLOperation<JSTestNode>::call<jsTestNodePrototypeFunctionTestFeatureGetSecretBooleanBody>(*state, "testFeatureGetSecretBoolean");
334 }
335
336 #endif
337
338 struct TestNodeIteratorTraits {
339     static constexpr JSDOMIteratorType type = JSDOMIteratorType::Set;
340     using KeyType = void;
341     using ValueType = IDLInterface<TestNode>;
342 };
343
344 using TestNodeIterator = JSDOMIterator<JSTestNode, TestNodeIteratorTraits>;
345 using TestNodeIteratorPrototype = JSDOMIteratorPrototype<JSTestNode, TestNodeIteratorTraits>;
346
347 template<>
348 const JSC::ClassInfo TestNodeIterator::s_info = { "TestNode Iterator", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(TestNodeIterator) };
349
350 template<>
351 const JSC::ClassInfo TestNodeIteratorPrototype::s_info = { "TestNode Iterator", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(TestNodeIteratorPrototype) };
352
353 static inline EncodedJSValue jsTestNodePrototypeFunctionEntriesCaller(ExecState*, JSTestNode* thisObject, JSC::ThrowScope&)
354 {
355     return JSValue::encode(iteratorCreate<TestNodeIterator>(*thisObject, IterationKind::Value));
356 }
357
358 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionEntries(JSC::ExecState* state)
359 {
360     return IDLOperation<JSTestNode>::call<jsTestNodePrototypeFunctionEntriesCaller>(*state, "entries");
361 }
362
363 static inline EncodedJSValue jsTestNodePrototypeFunctionKeysCaller(ExecState*, JSTestNode* thisObject, JSC::ThrowScope&)
364 {
365     return JSValue::encode(iteratorCreate<TestNodeIterator>(*thisObject, IterationKind::Key));
366 }
367
368 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionKeys(JSC::ExecState* state)
369 {
370     return IDLOperation<JSTestNode>::call<jsTestNodePrototypeFunctionKeysCaller>(*state, "keys");
371 }
372
373 static inline EncodedJSValue jsTestNodePrototypeFunctionValuesCaller(ExecState*, JSTestNode* thisObject, JSC::ThrowScope&)
374 {
375     return JSValue::encode(iteratorCreate<TestNodeIterator>(*thisObject, IterationKind::Value));
376 }
377
378 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionValues(JSC::ExecState* state)
379 {
380     return IDLOperation<JSTestNode>::call<jsTestNodePrototypeFunctionValuesCaller>(*state, "values");
381 }
382
383 static inline EncodedJSValue jsTestNodePrototypeFunctionForEachCaller(ExecState* state, JSTestNode* thisObject, JSC::ThrowScope& throwScope)
384 {
385     return JSValue::encode(iteratorForEach<TestNodeIterator>(*state, *thisObject, throwScope));
386 }
387
388 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionForEach(JSC::ExecState* state)
389 {
390     return IDLOperation<JSTestNode>::call<jsTestNodePrototypeFunctionForEachCaller>(*state, "forEach");
391 }
392
393 JSC::JSObject* JSTestNode::serialize(ExecState& state, JSTestNode& thisObject, JSDOMGlobalObject& globalObject, ThrowScope& throwScope)
394 {
395     auto& vm = state.vm();
396     auto* result = constructEmptyObject(&state, globalObject.objectPrototype());
397
398     auto nameValue = jsTestNodeNameGetter(state, thisObject, throwScope);
399     throwScope.assertNoException();
400     result->putDirect(vm, Identifier::fromString(&vm, "name"), nameValue);
401
402     return result;
403 }
404
405 static inline EncodedJSValue jsTestNodePrototypeFunctionToJSONBody(ExecState* state, JSTestNode* thisObject, JSC::ThrowScope& throwScope)
406 {
407     return JSValue::encode(JSTestNode::serialize(*state, *thisObject, *thisObject->globalObject(), throwScope));
408 }
409
410 EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionToJSON(ExecState* state)
411 {
412     return IDLOperation<JSTestNode>::call<jsTestNodePrototypeFunctionToJSONBody>(*state, "toJSON");
413 }
414
415 #if ENABLE(BINDING_INTEGRITY)
416 #if PLATFORM(WIN)
417 #pragma warning(disable: 4483)
418 extern "C" { extern void (*const __identifier("??_7TestNode@WebCore@@6B@")[])(); }
419 #else
420 extern "C" { extern void* _ZTVN7WebCore8TestNodeE[]; }
421 #endif
422 #endif
423
424 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNode>&& impl)
425 {
426
427 #if ENABLE(BINDING_INTEGRITY)
428     void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
429 #if PLATFORM(WIN)
430     void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7TestNode@WebCore@@6B@"));
431 #else
432     void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore8TestNodeE[2]);
433 #endif
434
435     // If this fails TestNode does not have a vtable, so you need to add the
436     // ImplementationLacksVTable attribute to the interface definition
437     static_assert(std::is_polymorphic<TestNode>::value, "TestNode is not polymorphic");
438
439     // If you hit this assertion you either have a use after free bug, or
440     // TestNode has subclasses. If TestNode has subclasses that get passed
441     // to toJS() we currently require TestNode you to opt out of binding hardening
442     // by adding the SkipVTableValidation attribute to the interface IDL definition
443     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
444 #endif
445     return createWrapper<TestNode>(globalObject, WTFMove(impl));
446 }
447
448 JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNode& impl)
449 {
450     return wrap(state, globalObject, impl);
451 }
452
453
454 }