26ac58e9d07b998498eb4c542947bbad988081dd
[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     auto& impl = castedThis->wrapped();
370     auto nativeValue = value.toWTFString(state);
371     RETURN_IF_EXCEPTION(throwScope, false);
372     impl.setNondeterministicWriteableAttr(WTFMove(nativeValue));
373     return true;
374 }
375
376
377 bool setJSTestNondeterministicNondeterministicExceptionAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
378 {
379     VM& vm = state->vm();
380     auto throwScope = DECLARE_THROW_SCOPE(vm);
381     UNUSED_PARAM(throwScope);
382     JSValue value = JSValue::decode(encodedValue);
383     UNUSED_PARAM(thisValue);
384     JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue));
385     if (UNLIKELY(!castedThis))
386         return throwSetterTypeError(*state, throwScope, "TestNondeterministic", "nondeterministicExceptionAttr");
387     auto& impl = castedThis->wrapped();
388     auto nativeValue = value.toWTFString(state);
389     RETURN_IF_EXCEPTION(throwScope, false);
390     impl.setNondeterministicExceptionAttr(WTFMove(nativeValue));
391     return true;
392 }
393
394
395 bool setJSTestNondeterministicNondeterministicGetterExceptionAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
396 {
397     VM& vm = state->vm();
398     auto throwScope = DECLARE_THROW_SCOPE(vm);
399     UNUSED_PARAM(throwScope);
400     JSValue value = JSValue::decode(encodedValue);
401     UNUSED_PARAM(thisValue);
402     JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue));
403     if (UNLIKELY(!castedThis))
404         return throwSetterTypeError(*state, throwScope, "TestNondeterministic", "nondeterministicGetterExceptionAttr");
405     auto& impl = castedThis->wrapped();
406     auto nativeValue = value.toWTFString(state);
407     RETURN_IF_EXCEPTION(throwScope, false);
408     impl.setNondeterministicGetterExceptionAttr(WTFMove(nativeValue));
409     return true;
410 }
411
412
413 bool setJSTestNondeterministicNondeterministicSetterExceptionAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
414 {
415     VM& vm = state->vm();
416     auto throwScope = DECLARE_THROW_SCOPE(vm);
417     UNUSED_PARAM(throwScope);
418     JSValue value = JSValue::decode(encodedValue);
419     UNUSED_PARAM(thisValue);
420     JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue));
421     if (UNLIKELY(!castedThis))
422         return throwSetterTypeError(*state, throwScope, "TestNondeterministic", "nondeterministicSetterExceptionAttr");
423     auto& impl = castedThis->wrapped();
424     ExceptionCode ec = 0;
425     auto nativeValue = value.toWTFString(state);
426     RETURN_IF_EXCEPTION(throwScope, false);
427     impl.setNondeterministicSetterExceptionAttr(WTFMove(nativeValue), ec);
428     setDOMException(state, throwScope, ec);
429     return true;
430 }
431
432
433 JSValue JSTestNondeterministic::getConstructor(VM& vm, const JSGlobalObject* globalObject)
434 {
435     return getDOMConstructor<JSTestNondeterministicConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
436 }
437
438 EncodedJSValue JSC_HOST_CALL jsTestNondeterministicPrototypeFunctionNondeterministicZeroArgFunction(ExecState* state)
439 {
440     VM& vm = state->vm();
441     auto throwScope = DECLARE_THROW_SCOPE(vm);
442     UNUSED_PARAM(throwScope);
443     JSValue thisValue = state->thisValue();
444     auto castedThis = jsDynamicCast<JSTestNondeterministic*>(thisValue);
445     if (UNLIKELY(!castedThis))
446         return throwThisTypeError(*state, throwScope, "TestNondeterministic", "nondeterministicZeroArgFunction");
447     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestNondeterministic::info());
448     auto& impl = castedThis->wrapped();
449     JSValue result;
450 #if ENABLE(WEB_REPLAY)
451     InputCursor& cursor = state->lexicalGlobalObject()->inputCursor();
452     static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicZeroArgFunction", AtomicString::ConstructFromLiteral);
453     if (cursor.isCapturing()) {
454         bool memoizedResult = impl.nondeterministicZeroArgFunction();
455         cursor.appendInput<MemoizedDOMResult<bool>>(bindingName.get().string(), memoizedResult, 0);
456         result = jsBoolean(memoizedResult);
457     } else if (cursor.isReplaying()) {
458         MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
459         bool memoizedResult;
460         if (input && input->convertTo<bool>(memoizedResult)) {
461             result = jsBoolean(memoizedResult);
462         } else
463             result = jsBoolean(impl.nondeterministicZeroArgFunction());
464     } else
465         result = jsBoolean(impl.nondeterministicZeroArgFunction());
466 #else
467     result = jsBoolean(impl.nondeterministicZeroArgFunction());
468 #endif
469     return JSValue::encode(result);
470 }
471
472 bool JSTestNondeterministicOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
473 {
474     UNUSED_PARAM(handle);
475     UNUSED_PARAM(visitor);
476     return false;
477 }
478
479 void JSTestNondeterministicOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
480 {
481     auto* jsTestNondeterministic = jsCast<JSTestNondeterministic*>(handle.slot()->asCell());
482     auto& world = *static_cast<DOMWrapperWorld*>(context);
483     uncacheWrapper(world, &jsTestNondeterministic->wrapped(), jsTestNondeterministic);
484 }
485
486 #if ENABLE(BINDING_INTEGRITY)
487 #if PLATFORM(WIN)
488 #pragma warning(disable: 4483)
489 extern "C" { extern void (*const __identifier("??_7TestNondeterministic@WebCore@@6B@")[])(); }
490 #else
491 extern "C" { extern void* _ZTVN7WebCore20TestNondeterministicE[]; }
492 #endif
493 #endif
494
495 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNondeterministic>&& impl)
496 {
497
498 #if ENABLE(BINDING_INTEGRITY)
499     void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
500 #if PLATFORM(WIN)
501     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestNondeterministic@WebCore@@6B@"));
502 #else
503     void* expectedVTablePointer = &_ZTVN7WebCore20TestNondeterministicE[2];
504 #if COMPILER(CLANG)
505     // If this fails TestNondeterministic does not have a vtable, so you need to add the
506     // ImplementationLacksVTable attribute to the interface definition
507     static_assert(__is_polymorphic(TestNondeterministic), "TestNondeterministic is not polymorphic");
508 #endif
509 #endif
510     // If you hit this assertion you either have a use after free bug, or
511     // TestNondeterministic has subclasses. If TestNondeterministic has subclasses that get passed
512     // to toJS() we currently require TestNondeterministic you to opt out of binding hardening
513     // by adding the SkipVTableValidation attribute to the interface IDL definition
514     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
515 #endif
516     return createWrapper<TestNondeterministic>(globalObject, WTFMove(impl));
517 }
518
519 JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNondeterministic& impl)
520 {
521     return wrap(state, globalObject, impl);
522 }
523
524 TestNondeterministic* JSTestNondeterministic::toWrapped(JSC::JSValue value)
525 {
526     if (auto* wrapper = jsDynamicCast<JSTestNondeterministic*>(value))
527         return &wrapper->wrapped();
528     return nullptr;
529 }
530
531 }