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