Refactor binding generated casted-this checks
[WebKit-https.git] / Source / WebCore / bindings / scripts / test / JS / JSTestNondeterministic.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 "JSTestNondeterministic.h"
23
24 #include "ExceptionCode.h"
25 #include "JSDOMBinding.h"
26 #include "JSDOMConstructor.h"
27 #include "URL.h"
28 #include <runtime/Error.h>
29 #include <runtime/FunctionPrototype.h>
30 #include <runtime/JSString.h>
31 #include <wtf/GetPtr.h>
32
33 #if ENABLE(WEB_REPLAY)
34 #include "MemoizedDOMResult.h"
35 #include <replay/InputCursor.h>
36 #endif
37
38 using namespace JSC;
39
40 namespace WebCore {
41
42 // Functions
43
44 JSC::EncodedJSValue JSC_HOST_CALL jsTestNondeterministicPrototypeFunctionNondeterministicZeroArgFunction(JSC::ExecState*);
45
46 // Attributes
47
48 JSC::EncodedJSValue jsTestNondeterministicNondeterministicReadonlyAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49 JSC::EncodedJSValue jsTestNondeterministicNondeterministicWriteableAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50 bool setJSTestNondeterministicNondeterministicWriteableAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
51 JSC::EncodedJSValue jsTestNondeterministicNondeterministicExceptionAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52 bool setJSTestNondeterministicNondeterministicExceptionAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
53 JSC::EncodedJSValue jsTestNondeterministicNondeterministicGetterExceptionAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
54 bool setJSTestNondeterministicNondeterministicGetterExceptionAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
55 JSC::EncodedJSValue jsTestNondeterministicNondeterministicSetterExceptionAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
56 bool setJSTestNondeterministicNondeterministicSetterExceptionAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
57 JSC::EncodedJSValue jsTestNondeterministicConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
58 bool setJSTestNondeterministicConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
59
60 class JSTestNondeterministicPrototype : public JSC::JSNonFinalObject {
61 public:
62     using Base = JSC::JSNonFinalObject;
63     static JSTestNondeterministicPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
64     {
65         JSTestNondeterministicPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestNondeterministicPrototype>(vm.heap)) JSTestNondeterministicPrototype(vm, globalObject, structure);
66         ptr->finishCreation(vm);
67         return ptr;
68     }
69
70     DECLARE_INFO;
71     static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
72     {
73         return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
74     }
75
76 private:
77     JSTestNondeterministicPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
78         : JSC::JSNonFinalObject(vm, structure)
79     {
80     }
81
82     void finishCreation(JSC::VM&);
83 };
84
85 using JSTestNondeterministicConstructor = JSDOMConstructorNotConstructable<JSTestNondeterministic>;
86
87 template<> JSValue JSTestNondeterministicConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
88 {
89     UNUSED_PARAM(vm);
90     return globalObject.functionPrototype();
91 }
92
93 template<> void JSTestNondeterministicConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
94 {
95     putDirect(vm, vm.propertyNames->prototype, JSTestNondeterministic::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
96     putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestNondeterministic"))), ReadOnly | DontEnum);
97     putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
98 }
99
100 template<> const ClassInfo JSTestNondeterministicConstructor::s_info = { "TestNondeterministic", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestNondeterministicConstructor) };
101
102 /* Hash table for prototype */
103
104 static const HashTableValue JSTestNondeterministicPrototypeTableValues[] =
105 {
106     { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNondeterministicConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNondeterministicConstructor) } },
107     { "nondeterministicReadonlyAttr", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNondeterministicNondeterministicReadonlyAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
108     { "nondeterministicWriteableAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNondeterministicNondeterministicWriteableAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNondeterministicNondeterministicWriteableAttr) } },
109     { "nondeterministicExceptionAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNondeterministicNondeterministicExceptionAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNondeterministicNondeterministicExceptionAttr) } },
110     { "nondeterministicGetterExceptionAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNondeterministicNondeterministicGetterExceptionAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNondeterministicNondeterministicGetterExceptionAttr) } },
111     { "nondeterministicSetterExceptionAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNondeterministicNondeterministicSetterExceptionAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNondeterministicNondeterministicSetterExceptionAttr) } },
112     { "nondeterministicZeroArgFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNondeterministicPrototypeFunctionNondeterministicZeroArgFunction), (intptr_t) (0) } },
113 };
114
115 const ClassInfo JSTestNondeterministicPrototype::s_info = { "TestNondeterministicPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestNondeterministicPrototype) };
116
117 void JSTestNondeterministicPrototype::finishCreation(VM& vm)
118 {
119     Base::finishCreation(vm);
120     reifyStaticProperties(vm, JSTestNondeterministicPrototypeTableValues, *this);
121 }
122
123 const ClassInfo JSTestNondeterministic::s_info = { "TestNondeterministic", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestNondeterministic) };
124
125 JSTestNondeterministic::JSTestNondeterministic(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestNondeterministic>&& impl)
126     : JSDOMWrapper<TestNondeterministic>(structure, globalObject, WTFMove(impl))
127 {
128 }
129
130 JSObject* JSTestNondeterministic::createPrototype(VM& vm, JSGlobalObject* globalObject)
131 {
132     return JSTestNondeterministicPrototype::create(vm, globalObject, JSTestNondeterministicPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
133 }
134
135 JSObject* JSTestNondeterministic::prototype(VM& vm, JSGlobalObject* globalObject)
136 {
137     return getDOMPrototype<JSTestNondeterministic>(vm, globalObject);
138 }
139
140 void JSTestNondeterministic::destroy(JSC::JSCell* cell)
141 {
142     JSTestNondeterministic* thisObject = static_cast<JSTestNondeterministic*>(cell);
143     thisObject->JSTestNondeterministic::~JSTestNondeterministic();
144 }
145
146 inline JSTestNondeterministic* JSTestNondeterministic::castForAttribute(JSC::ExecState*, EncodedJSValue thisValue)
147 {
148     return jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue));
149 }
150
151 static inline JSValue jsTestNondeterministicNondeterministicReadonlyAttrGetter(ExecState*, JSTestNondeterministic*, ThrowScope& throwScope);
152
153 EncodedJSValue jsTestNondeterministicNondeterministicReadonlyAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
154 {
155     return BindingCaller<JSTestNondeterministic>::attribute<jsTestNondeterministicNondeterministicReadonlyAttrGetter>(state, thisValue, "nondeterministicReadonlyAttr");
156 }
157
158 static inline JSValue jsTestNondeterministicNondeterministicReadonlyAttrGetter(ExecState* state, JSTestNondeterministic* thisObject, ThrowScope& throwScope)
159 {
160     UNUSED_PARAM(throwScope);
161     UNUSED_PARAM(state);
162 #if ENABLE(WEB_REPLAY)
163     JSGlobalObject* globalObject = state->lexicalGlobalObject();
164     InputCursor& cursor = globalObject->inputCursor();
165     static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicReadonlyAttr", AtomicString::ConstructFromLiteral);
166     if (cursor.isCapturing()) {
167         int32_t memoizedResult = thisObject->wrapped().nondeterministicReadonlyAttr();
168         cursor.appendInput<MemoizedDOMResult<int32_t>>(bindingName.get().string(), memoizedResult, 0);
169         JSValue result = jsNumber(memoizedResult);
170         return result;
171     }
172
173     if (cursor.isReplaying()) {
174         int32_t memoizedResult;
175         MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
176         if (input && input->convertTo<int32_t>(memoizedResult)) {
177             JSValue result = jsNumber(memoizedResult);
178             return result;
179         }
180     }
181 #endif
182     auto& impl = thisObject->wrapped();
183     JSValue result = jsNumber(impl.nondeterministicReadonlyAttr());
184     return result;
185 }
186
187 static inline JSValue jsTestNondeterministicNondeterministicWriteableAttrGetter(ExecState*, JSTestNondeterministic*, ThrowScope& throwScope);
188
189 EncodedJSValue jsTestNondeterministicNondeterministicWriteableAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
190 {
191     return BindingCaller<JSTestNondeterministic>::attribute<jsTestNondeterministicNondeterministicWriteableAttrGetter>(state, thisValue, "nondeterministicWriteableAttr");
192 }
193
194 static inline JSValue jsTestNondeterministicNondeterministicWriteableAttrGetter(ExecState* state, JSTestNondeterministic* thisObject, ThrowScope& throwScope)
195 {
196     UNUSED_PARAM(throwScope);
197     UNUSED_PARAM(state);
198 #if ENABLE(WEB_REPLAY)
199     JSGlobalObject* globalObject = state->lexicalGlobalObject();
200     InputCursor& cursor = globalObject->inputCursor();
201     static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicWriteableAttr", AtomicString::ConstructFromLiteral);
202     if (cursor.isCapturing()) {
203         String memoizedResult = thisObject->wrapped().nondeterministicWriteableAttr();
204         cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
205         JSValue result = jsStringWithCache(state, memoizedResult);
206         return result;
207     }
208
209     if (cursor.isReplaying()) {
210         String memoizedResult;
211         MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
212         if (input && input->convertTo<String>(memoizedResult)) {
213             JSValue result = jsStringWithCache(state, memoizedResult);
214             return result;
215         }
216     }
217 #endif
218     auto& impl = thisObject->wrapped();
219     JSValue result = jsStringWithCache(state, impl.nondeterministicWriteableAttr());
220     return result;
221 }
222
223 static inline JSValue jsTestNondeterministicNondeterministicExceptionAttrGetter(ExecState*, JSTestNondeterministic*, ThrowScope& throwScope);
224
225 EncodedJSValue jsTestNondeterministicNondeterministicExceptionAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
226 {
227     return BindingCaller<JSTestNondeterministic>::attribute<jsTestNondeterministicNondeterministicExceptionAttrGetter>(state, thisValue, "nondeterministicExceptionAttr");
228 }
229
230 static inline JSValue jsTestNondeterministicNondeterministicExceptionAttrGetter(ExecState* state, JSTestNondeterministic* thisObject, ThrowScope& throwScope)
231 {
232     UNUSED_PARAM(throwScope);
233     UNUSED_PARAM(state);
234 #if ENABLE(WEB_REPLAY)
235     JSGlobalObject* globalObject = state->lexicalGlobalObject();
236     InputCursor& cursor = globalObject->inputCursor();
237     static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicExceptionAttr", AtomicString::ConstructFromLiteral);
238     if (cursor.isCapturing()) {
239         String memoizedResult = thisObject->wrapped().nondeterministicExceptionAttr();
240         cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
241         JSValue result = jsStringWithCache(state, memoizedResult);
242         return result;
243     }
244
245     if (cursor.isReplaying()) {
246         String memoizedResult;
247         MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
248         if (input && input->convertTo<String>(memoizedResult)) {
249             JSValue result = jsStringWithCache(state, memoizedResult);
250             return result;
251         }
252     }
253 #endif
254     auto& impl = thisObject->wrapped();
255     JSValue result = jsStringWithCache(state, impl.nondeterministicExceptionAttr());
256     return result;
257 }
258
259 static inline JSValue jsTestNondeterministicNondeterministicGetterExceptionAttrGetter(ExecState*, JSTestNondeterministic*, ThrowScope& throwScope);
260
261 EncodedJSValue jsTestNondeterministicNondeterministicGetterExceptionAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
262 {
263     return BindingCaller<JSTestNondeterministic>::attribute<jsTestNondeterministicNondeterministicGetterExceptionAttrGetter>(state, thisValue, "nondeterministicGetterExceptionAttr");
264 }
265
266 static inline JSValue jsTestNondeterministicNondeterministicGetterExceptionAttrGetter(ExecState* state, JSTestNondeterministic* thisObject, ThrowScope& throwScope)
267 {
268     UNUSED_PARAM(throwScope);
269     UNUSED_PARAM(state);
270     ExceptionCode ec = 0;
271 #if ENABLE(WEB_REPLAY)
272     JSGlobalObject* globalObject = state->lexicalGlobalObject();
273     InputCursor& cursor = globalObject->inputCursor();
274     static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicGetterExceptionAttr", AtomicString::ConstructFromLiteral);
275     if (cursor.isCapturing()) {
276         String memoizedResult = thisObject->wrapped().nondeterministicGetterExceptionAttr(ec);
277         cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, ec);
278         JSValue result = jsStringWithCache(state, memoizedResult);
279         setDOMException(state, throwScope, ec);
280         return result;
281     }
282
283     if (cursor.isReplaying()) {
284         String memoizedResult;
285         MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
286         if (input && input->convertTo<String>(memoizedResult)) {
287             JSValue result = jsStringWithCache(state, memoizedResult);
288             setDOMException(state, throwScope, input->exceptionCode());
289             return result;
290         }
291     }
292 #endif
293     auto& impl = thisObject->wrapped();
294     JSValue result = jsStringWithCache(state, impl.nondeterministicGetterExceptionAttr(ec));
295     setDOMException(state, throwScope, ec);
296     return result;
297 }
298
299 static inline JSValue jsTestNondeterministicNondeterministicSetterExceptionAttrGetter(ExecState*, JSTestNondeterministic*, ThrowScope& throwScope);
300
301 EncodedJSValue jsTestNondeterministicNondeterministicSetterExceptionAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
302 {
303     return BindingCaller<JSTestNondeterministic>::attribute<jsTestNondeterministicNondeterministicSetterExceptionAttrGetter>(state, thisValue, "nondeterministicSetterExceptionAttr");
304 }
305
306 static inline JSValue jsTestNondeterministicNondeterministicSetterExceptionAttrGetter(ExecState* state, JSTestNondeterministic* thisObject, ThrowScope& throwScope)
307 {
308     UNUSED_PARAM(throwScope);
309     UNUSED_PARAM(state);
310 #if ENABLE(WEB_REPLAY)
311     JSGlobalObject* globalObject = state->lexicalGlobalObject();
312     InputCursor& cursor = globalObject->inputCursor();
313     static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicSetterExceptionAttr", AtomicString::ConstructFromLiteral);
314     if (cursor.isCapturing()) {
315         String memoizedResult = thisObject->wrapped().nondeterministicSetterExceptionAttr();
316         cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
317         JSValue result = jsStringWithCache(state, memoizedResult);
318         return result;
319     }
320
321     if (cursor.isReplaying()) {
322         String memoizedResult;
323         MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
324         if (input && input->convertTo<String>(memoizedResult)) {
325             JSValue result = jsStringWithCache(state, memoizedResult);
326             return result;
327         }
328     }
329 #endif
330     auto& impl = thisObject->wrapped();
331     JSValue result = jsStringWithCache(state, impl.nondeterministicSetterExceptionAttr());
332     return result;
333 }
334
335 EncodedJSValue jsTestNondeterministicConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
336 {
337     VM& vm = state->vm();
338     auto throwScope = DECLARE_THROW_SCOPE(vm);
339     JSTestNondeterministicPrototype* domObject = jsDynamicCast<JSTestNondeterministicPrototype*>(JSValue::decode(thisValue));
340     if (UNLIKELY(!domObject))
341         return throwVMTypeError(state, throwScope);
342     return JSValue::encode(JSTestNondeterministic::getConstructor(state->vm(), domObject->globalObject()));
343 }
344
345 bool setJSTestNondeterministicConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
346 {
347     VM& vm = state->vm();
348     auto throwScope = DECLARE_THROW_SCOPE(vm);
349     JSValue value = JSValue::decode(encodedValue);
350     JSTestNondeterministicPrototype* domObject = jsDynamicCast<JSTestNondeterministicPrototype*>(JSValue::decode(thisValue));
351     if (UNLIKELY(!domObject)) {
352         throwVMTypeError(state, throwScope);
353         return false;
354     }
355     // Shadowing a built-in constructor
356     return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
357 }
358
359 bool setJSTestNondeterministicNondeterministicWriteableAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
360 {
361     VM& vm = state->vm();
362     auto throwScope = DECLARE_THROW_SCOPE(vm);
363     UNUSED_PARAM(throwScope);
364     JSValue value = JSValue::decode(encodedValue);
365     UNUSED_PARAM(thisValue);
366     JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue));
367     if (UNLIKELY(!castedThis)) {
368         return throwSetterTypeError(*state, throwScope, "TestNondeterministic", "nondeterministicWriteableAttr");
369     }
370     auto& impl = castedThis->wrapped();
371     auto nativeValue = value.toWTFString(state);
372     RETURN_IF_EXCEPTION(throwScope, false);
373     impl.setNondeterministicWriteableAttr(WTFMove(nativeValue));
374     return true;
375 }
376
377
378 bool setJSTestNondeterministicNondeterministicExceptionAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
379 {
380     VM& vm = state->vm();
381     auto throwScope = DECLARE_THROW_SCOPE(vm);
382     UNUSED_PARAM(throwScope);
383     JSValue value = JSValue::decode(encodedValue);
384     UNUSED_PARAM(thisValue);
385     JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue));
386     if (UNLIKELY(!castedThis)) {
387         return throwSetterTypeError(*state, throwScope, "TestNondeterministic", "nondeterministicExceptionAttr");
388     }
389     auto& impl = castedThis->wrapped();
390     auto nativeValue = value.toWTFString(state);
391     RETURN_IF_EXCEPTION(throwScope, false);
392     impl.setNondeterministicExceptionAttr(WTFMove(nativeValue));
393     return true;
394 }
395
396
397 bool setJSTestNondeterministicNondeterministicGetterExceptionAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
398 {
399     VM& vm = state->vm();
400     auto throwScope = DECLARE_THROW_SCOPE(vm);
401     UNUSED_PARAM(throwScope);
402     JSValue value = JSValue::decode(encodedValue);
403     UNUSED_PARAM(thisValue);
404     JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue));
405     if (UNLIKELY(!castedThis)) {
406         return throwSetterTypeError(*state, throwScope, "TestNondeterministic", "nondeterministicGetterExceptionAttr");
407     }
408     auto& impl = castedThis->wrapped();
409     auto nativeValue = value.toWTFString(state);
410     RETURN_IF_EXCEPTION(throwScope, false);
411     impl.setNondeterministicGetterExceptionAttr(WTFMove(nativeValue));
412     return true;
413 }
414
415
416 bool setJSTestNondeterministicNondeterministicSetterExceptionAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
417 {
418     VM& vm = state->vm();
419     auto throwScope = DECLARE_THROW_SCOPE(vm);
420     UNUSED_PARAM(throwScope);
421     JSValue value = JSValue::decode(encodedValue);
422     UNUSED_PARAM(thisValue);
423     JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue));
424     if (UNLIKELY(!castedThis)) {
425         return throwSetterTypeError(*state, throwScope, "TestNondeterministic", "nondeterministicSetterExceptionAttr");
426     }
427     auto& impl = castedThis->wrapped();
428     ExceptionCode ec = 0;
429     auto nativeValue = value.toWTFString(state);
430     RETURN_IF_EXCEPTION(throwScope, false);
431     impl.setNondeterministicSetterExceptionAttr(WTFMove(nativeValue), ec);
432     setDOMException(state, throwScope, ec);
433     return true;
434 }
435
436
437 JSValue JSTestNondeterministic::getConstructor(VM& vm, const JSGlobalObject* globalObject)
438 {
439     return getDOMConstructor<JSTestNondeterministicConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
440 }
441
442 EncodedJSValue JSC_HOST_CALL jsTestNondeterministicPrototypeFunctionNondeterministicZeroArgFunction(ExecState* state)
443 {
444     VM& vm = state->vm();
445     auto throwScope = DECLARE_THROW_SCOPE(vm);
446     UNUSED_PARAM(throwScope);
447     JSValue thisValue = state->thisValue();
448     auto castedThis = jsDynamicCast<JSTestNondeterministic*>(thisValue);
449     if (UNLIKELY(!castedThis))
450         return throwThisTypeError(*state, throwScope, "TestNondeterministic", "nondeterministicZeroArgFunction");
451     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestNondeterministic::info());
452     auto& impl = castedThis->wrapped();
453     JSValue result;
454 #if ENABLE(WEB_REPLAY)
455     InputCursor& cursor = state->lexicalGlobalObject()->inputCursor();
456     static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicZeroArgFunction", AtomicString::ConstructFromLiteral);
457     if (cursor.isCapturing()) {
458         bool memoizedResult = impl.nondeterministicZeroArgFunction();
459         cursor.appendInput<MemoizedDOMResult<bool>>(bindingName.get().string(), memoizedResult, 0);
460         result = jsBoolean(memoizedResult);
461     } else if (cursor.isReplaying()) {
462         MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
463         bool memoizedResult;
464         if (input && input->convertTo<bool>(memoizedResult)) {
465             result = jsBoolean(memoizedResult);
466         } else
467             result = jsBoolean(impl.nondeterministicZeroArgFunction());
468     } else
469         result = jsBoolean(impl.nondeterministicZeroArgFunction());
470 #else
471     result = jsBoolean(impl.nondeterministicZeroArgFunction());
472 #endif
473     return JSValue::encode(result);
474 }
475
476 bool JSTestNondeterministicOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
477 {
478     UNUSED_PARAM(handle);
479     UNUSED_PARAM(visitor);
480     return false;
481 }
482
483 void JSTestNondeterministicOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
484 {
485     auto* jsTestNondeterministic = jsCast<JSTestNondeterministic*>(handle.slot()->asCell());
486     auto& world = *static_cast<DOMWrapperWorld*>(context);
487     uncacheWrapper(world, &jsTestNondeterministic->wrapped(), jsTestNondeterministic);
488 }
489
490 #if ENABLE(BINDING_INTEGRITY)
491 #if PLATFORM(WIN)
492 #pragma warning(disable: 4483)
493 extern "C" { extern void (*const __identifier("??_7TestNondeterministic@WebCore@@6B@")[])(); }
494 #else
495 extern "C" { extern void* _ZTVN7WebCore20TestNondeterministicE[]; }
496 #endif
497 #endif
498
499 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNondeterministic>&& impl)
500 {
501
502 #if ENABLE(BINDING_INTEGRITY)
503     void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
504 #if PLATFORM(WIN)
505     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestNondeterministic@WebCore@@6B@"));
506 #else
507     void* expectedVTablePointer = &_ZTVN7WebCore20TestNondeterministicE[2];
508 #if COMPILER(CLANG)
509     // If this fails TestNondeterministic does not have a vtable, so you need to add the
510     // ImplementationLacksVTable attribute to the interface definition
511     static_assert(__is_polymorphic(TestNondeterministic), "TestNondeterministic is not polymorphic");
512 #endif
513 #endif
514     // If you hit this assertion you either have a use after free bug, or
515     // TestNondeterministic has subclasses. If TestNondeterministic has subclasses that get passed
516     // to toJS() we currently require TestNondeterministic you to opt out of binding hardening
517     // by adding the SkipVTableValidation attribute to the interface IDL definition
518     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
519 #endif
520     return createWrapper<TestNondeterministic>(globalObject, WTFMove(impl));
521 }
522
523 JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNondeterministic& impl)
524 {
525     return wrap(state, globalObject, impl);
526 }
527
528 TestNondeterministic* JSTestNondeterministic::toWrapped(JSC::JSValue value)
529 {
530     if (auto* wrapper = jsDynamicCast<JSTestNondeterministic*>(value))
531         return &wrapper->wrapped();
532     return nullptr;
533 }
534
535 }