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