Rename ExceptionCode-based exception handling to "legacy"
[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 EncodedJSValue jsTestNondeterministicNondeterministicReadonlyAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
147 {
148     VM& vm = state->vm();
149     auto throwScope = DECLARE_THROW_SCOPE(vm);
150     UNUSED_PARAM(throwScope);
151     UNUSED_PARAM(thisValue);
152     JSValue decodedThisValue = JSValue::decode(thisValue);
153     auto* castedThis = jsDynamicCast<JSTestNondeterministic*>(decodedThisValue);
154     if (UNLIKELY(!castedThis)) {
155         return throwGetterTypeError(*state, throwScope, "TestNondeterministic", "nondeterministicReadonlyAttr");
156     }
157 #if ENABLE(WEB_REPLAY)
158     JSGlobalObject* globalObject = state->lexicalGlobalObject();
159     InputCursor& cursor = globalObject->inputCursor();
160     static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicReadonlyAttr", AtomicString::ConstructFromLiteral);
161     if (cursor.isCapturing()) {
162         int32_t memoizedResult = castedThis->wrapped().nondeterministicReadonlyAttr();
163         cursor.appendInput<MemoizedDOMResult<int32_t>>(bindingName.get().string(), memoizedResult, 0);
164         JSValue result = jsNumber(memoizedResult);
165         return JSValue::encode(result);
166     }
167
168     if (cursor.isReplaying()) {
169         int32_t memoizedResult;
170         MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
171         if (input && input->convertTo<int32_t>(memoizedResult)) {
172             JSValue result = jsNumber(memoizedResult);
173             return JSValue::encode(result);
174         }
175     }
176 #endif
177     auto& impl = castedThis->wrapped();
178     JSValue result = jsNumber(impl.nondeterministicReadonlyAttr());
179     return JSValue::encode(result);
180 }
181
182
183 EncodedJSValue jsTestNondeterministicNondeterministicWriteableAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
184 {
185     VM& vm = state->vm();
186     auto throwScope = DECLARE_THROW_SCOPE(vm);
187     UNUSED_PARAM(throwScope);
188     UNUSED_PARAM(thisValue);
189     JSValue decodedThisValue = JSValue::decode(thisValue);
190     auto* castedThis = jsDynamicCast<JSTestNondeterministic*>(decodedThisValue);
191     if (UNLIKELY(!castedThis)) {
192         return throwGetterTypeError(*state, throwScope, "TestNondeterministic", "nondeterministicWriteableAttr");
193     }
194 #if ENABLE(WEB_REPLAY)
195     JSGlobalObject* globalObject = state->lexicalGlobalObject();
196     InputCursor& cursor = globalObject->inputCursor();
197     static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicWriteableAttr", AtomicString::ConstructFromLiteral);
198     if (cursor.isCapturing()) {
199         String memoizedResult = castedThis->wrapped().nondeterministicWriteableAttr();
200         cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
201         JSValue result = jsStringWithCache(state, memoizedResult);
202         return JSValue::encode(result);
203     }
204
205     if (cursor.isReplaying()) {
206         String memoizedResult;
207         MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
208         if (input && input->convertTo<String>(memoizedResult)) {
209             JSValue result = jsStringWithCache(state, memoizedResult);
210             return JSValue::encode(result);
211         }
212     }
213 #endif
214     auto& impl = castedThis->wrapped();
215     JSValue result = jsStringWithCache(state, impl.nondeterministicWriteableAttr());
216     return JSValue::encode(result);
217 }
218
219
220 EncodedJSValue jsTestNondeterministicNondeterministicExceptionAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
221 {
222     VM& vm = state->vm();
223     auto throwScope = DECLARE_THROW_SCOPE(vm);
224     UNUSED_PARAM(throwScope);
225     UNUSED_PARAM(thisValue);
226     JSValue decodedThisValue = JSValue::decode(thisValue);
227     auto* castedThis = jsDynamicCast<JSTestNondeterministic*>(decodedThisValue);
228     if (UNLIKELY(!castedThis)) {
229         return throwGetterTypeError(*state, throwScope, "TestNondeterministic", "nondeterministicExceptionAttr");
230     }
231 #if ENABLE(WEB_REPLAY)
232     JSGlobalObject* globalObject = state->lexicalGlobalObject();
233     InputCursor& cursor = globalObject->inputCursor();
234     static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicExceptionAttr", AtomicString::ConstructFromLiteral);
235     if (cursor.isCapturing()) {
236         String memoizedResult = castedThis->wrapped().nondeterministicExceptionAttr();
237         cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
238         JSValue result = jsStringWithCache(state, memoizedResult);
239         return JSValue::encode(result);
240     }
241
242     if (cursor.isReplaying()) {
243         String memoizedResult;
244         MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
245         if (input && input->convertTo<String>(memoizedResult)) {
246             JSValue result = jsStringWithCache(state, memoizedResult);
247             return JSValue::encode(result);
248         }
249     }
250 #endif
251     auto& impl = castedThis->wrapped();
252     JSValue result = jsStringWithCache(state, impl.nondeterministicExceptionAttr());
253     return JSValue::encode(result);
254 }
255
256
257 EncodedJSValue jsTestNondeterministicNondeterministicGetterExceptionAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
258 {
259     VM& vm = state->vm();
260     auto throwScope = DECLARE_THROW_SCOPE(vm);
261     UNUSED_PARAM(throwScope);
262     UNUSED_PARAM(thisValue);
263     JSValue decodedThisValue = JSValue::decode(thisValue);
264     auto* castedThis = jsDynamicCast<JSTestNondeterministic*>(decodedThisValue);
265     if (UNLIKELY(!castedThis)) {
266         return throwGetterTypeError(*state, throwScope, "TestNondeterministic", "nondeterministicGetterExceptionAttr");
267     }
268     ExceptionCode ec = 0;
269 #if ENABLE(WEB_REPLAY)
270     JSGlobalObject* globalObject = state->lexicalGlobalObject();
271     InputCursor& cursor = globalObject->inputCursor();
272     static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicGetterExceptionAttr", AtomicString::ConstructFromLiteral);
273     if (cursor.isCapturing()) {
274         String memoizedResult = castedThis->wrapped().nondeterministicGetterExceptionAttr(ec);
275         cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, ec);
276         JSValue result = jsStringWithCache(state, memoizedResult);
277         setDOMException(state, throwScope, ec);
278         return JSValue::encode(result);
279     }
280
281     if (cursor.isReplaying()) {
282         String memoizedResult;
283         MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
284         if (input && input->convertTo<String>(memoizedResult)) {
285             JSValue result = jsStringWithCache(state, memoizedResult);
286             setDOMException(state, throwScope, input->exceptionCode());
287             return JSValue::encode(result);
288         }
289     }
290 #endif
291     auto& impl = castedThis->wrapped();
292     JSValue result = jsStringWithCache(state, impl.nondeterministicGetterExceptionAttr(ec));
293     setDOMException(state, throwScope, ec);
294     return JSValue::encode(result);
295 }
296
297
298 EncodedJSValue jsTestNondeterministicNondeterministicSetterExceptionAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
299 {
300     VM& vm = state->vm();
301     auto throwScope = DECLARE_THROW_SCOPE(vm);
302     UNUSED_PARAM(throwScope);
303     UNUSED_PARAM(thisValue);
304     JSValue decodedThisValue = JSValue::decode(thisValue);
305     auto* castedThis = jsDynamicCast<JSTestNondeterministic*>(decodedThisValue);
306     if (UNLIKELY(!castedThis)) {
307         return throwGetterTypeError(*state, throwScope, "TestNondeterministic", "nondeterministicSetterExceptionAttr");
308     }
309 #if ENABLE(WEB_REPLAY)
310     JSGlobalObject* globalObject = state->lexicalGlobalObject();
311     InputCursor& cursor = globalObject->inputCursor();
312     static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicSetterExceptionAttr", AtomicString::ConstructFromLiteral);
313     if (cursor.isCapturing()) {
314         String memoizedResult = castedThis->wrapped().nondeterministicSetterExceptionAttr();
315         cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
316         JSValue result = jsStringWithCache(state, memoizedResult);
317         return JSValue::encode(result);
318     }
319
320     if (cursor.isReplaying()) {
321         String memoizedResult;
322         MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
323         if (input && input->convertTo<String>(memoizedResult)) {
324             JSValue result = jsStringWithCache(state, memoizedResult);
325             return JSValue::encode(result);
326         }
327     }
328 #endif
329     auto& impl = castedThis->wrapped();
330     JSValue result = jsStringWithCache(state, impl.nondeterministicSetterExceptionAttr());
331     return JSValue::encode(result);
332 }
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 }