Move URL from WebCore to WTF
[WebKit-https.git] / Source / WebCore / bindings / scripts / test / JS / JSTestInterface.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
23 #if ENABLE(Condition1) || ENABLE(Condition2)
24
25 #include "JSTestInterface.h"
26
27 #include "HTMLNames.h"
28 #include "JSDOMAttribute.h"
29 #include "JSDOMBinding.h"
30 #include "JSDOMConstructor.h"
31 #include "JSDOMConvertInterface.h"
32 #include "JSDOMExceptionHandling.h"
33 #include "JSDOMOperation.h"
34 #include "JSDOMWrapperCache.h"
35 #include "ScriptExecutionContext.h"
36 #include "TestSupplemental.h"
37 #include <JavaScriptCore/FunctionPrototype.h>
38 #include <JavaScriptCore/HeapSnapshotBuilder.h>
39 #include <JavaScriptCore/JSCInlines.h>
40 #include <wtf/GetPtr.h>
41 #include <wtf/PointerPreparations.h>
42 #include <wtf/URL.h>
43
44 #if ENABLE(Condition1) || ENABLE(Condition11) || ENABLE(Condition12) || ENABLE(Condition2) || ENABLE(Condition22) || ENABLE(Condition23)
45 #include "JSDOMConvertStrings.h"
46 #endif
47
48 #if ENABLE(Condition11) || ENABLE(Condition12)
49 #include "TestSupplementalBuiltins.h"
50 #endif
51
52 #if ENABLE(Condition11) || ENABLE(Condition12) || ENABLE(Condition22) || ENABLE(Condition23)
53 #include "JSDOMConvertNumbers.h"
54 #include "JSDOMGlobalObject.h"
55 #include "JSNode.h"
56 #include "JSTestObj.h"
57 #endif
58
59 #if ENABLE(Condition22) || ENABLE(Condition23)
60 #include "JSDOMConvertSequences.h"
61 #include <JavaScriptCore/JSArray.h>
62 #endif
63
64
65 namespace WebCore {
66 using namespace JSC;
67
68 // Functions
69
70 #if ENABLE(Condition22) || ENABLE(Condition23)
71 JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionImplementsMethod1(JSC::ExecState*);
72 #endif
73 #if ENABLE(Condition22) || ENABLE(Condition23)
74 JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionImplementsMethod2(JSC::ExecState*);
75 #endif
76 #if ENABLE(Condition22) || ENABLE(Condition23)
77 JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionImplementsMethod3(JSC::ExecState*);
78 #endif
79 #if ENABLE(Condition22) || ENABLE(Condition23)
80 JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfaceConstructorFunctionImplementsMethod4(JSC::ExecState*);
81 #endif
82 #if ENABLE(Condition22) || ENABLE(Condition23)
83 JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionTakeNodes(JSC::ExecState*);
84 #endif
85 #if ENABLE(Condition11) || ENABLE(Condition12)
86 JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod1(JSC::ExecState*);
87 #endif
88 #if ENABLE(Condition11) || ENABLE(Condition12)
89 JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod2(JSC::ExecState*);
90 #endif
91 #if ENABLE(Condition11) || ENABLE(Condition12)
92 JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod3(JSC::ExecState*);
93 #endif
94 #if ENABLE(Condition11) || ENABLE(Condition12)
95 JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfaceConstructorFunctionSupplementalMethod4(JSC::ExecState*);
96 #endif
97
98 // Attributes
99
100 JSC::EncodedJSValue jsTestInterfaceConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
101 bool setJSTestInterfaceConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
102 #if ENABLE(Condition22) || ENABLE(Condition23)
103 JSC::EncodedJSValue jsTestInterfaceConstructorImplementsStaticReadOnlyAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
104 #endif
105 #if ENABLE(Condition22) || ENABLE(Condition23)
106 JSC::EncodedJSValue jsTestInterfaceConstructorImplementsStaticAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
107 bool setJSTestInterfaceConstructorImplementsStaticAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
108 #endif
109 #if ENABLE(Condition22) || ENABLE(Condition23)
110 JSC::EncodedJSValue jsTestInterfaceImplementsStr1(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
111 #endif
112 #if ENABLE(Condition22) || ENABLE(Condition23)
113 JSC::EncodedJSValue jsTestInterfaceImplementsStr2(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
114 bool setJSTestInterfaceImplementsStr2(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
115 #endif
116 #if ENABLE(Condition22) || ENABLE(Condition23)
117 JSC::EncodedJSValue jsTestInterfaceImplementsStr3(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
118 bool setJSTestInterfaceImplementsStr3(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
119 #endif
120 #if ENABLE(Condition22) || ENABLE(Condition23)
121 JSC::EncodedJSValue jsTestInterfaceImplementsNode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
122 bool setJSTestInterfaceImplementsNode(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
123 #endif
124 #if ENABLE(Condition11) || ENABLE(Condition12)
125 JSC::EncodedJSValue jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
126 #endif
127 #if ENABLE(Condition11) || ENABLE(Condition12)
128 JSC::EncodedJSValue jsTestInterfaceConstructorSupplementalStaticAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
129 bool setJSTestInterfaceConstructorSupplementalStaticAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
130 #endif
131 #if ENABLE(Condition11) || ENABLE(Condition12)
132 JSC::EncodedJSValue jsTestInterfaceSupplementalStr1(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
133 #endif
134 #if ENABLE(Condition11) || ENABLE(Condition12)
135 JSC::EncodedJSValue jsTestInterfaceSupplementalStr2(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
136 bool setJSTestInterfaceSupplementalStr2(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
137 #endif
138 #if ENABLE(Condition11) || ENABLE(Condition12)
139 JSC::EncodedJSValue jsTestInterfaceSupplementalStr3(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
140 bool setJSTestInterfaceSupplementalStr3(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
141 #endif
142 #if ENABLE(Condition11) || ENABLE(Condition12)
143 JSC::EncodedJSValue jsTestInterfaceSupplementalNode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
144 bool setJSTestInterfaceSupplementalNode(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
145 #endif
146 #if ENABLE(Condition11) || ENABLE(Condition12)
147 JSC::EncodedJSValue jsTestInterfaceReflectAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
148 bool setJSTestInterfaceReflectAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
149 #endif
150
151 class JSTestInterfacePrototype : public JSC::JSNonFinalObject {
152 public:
153     using Base = JSC::JSNonFinalObject;
154     static JSTestInterfacePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
155     {
156         JSTestInterfacePrototype* ptr = new (NotNull, JSC::allocateCell<JSTestInterfacePrototype>(vm.heap)) JSTestInterfacePrototype(vm, globalObject, structure);
157         ptr->finishCreation(vm);
158         return ptr;
159     }
160
161     DECLARE_INFO;
162     static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
163     {
164         return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
165     }
166
167 private:
168     JSTestInterfacePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
169         : JSC::JSNonFinalObject(vm, structure)
170     {
171     }
172
173     void finishCreation(JSC::VM&);
174 };
175
176 using JSTestInterfaceConstructor = JSDOMConstructor<JSTestInterface>;
177
178 /* Hash table for constructor */
179
180 static const HashTableValue JSTestInterfaceConstructorTableValues[] =
181 {
182 #if ENABLE(Condition22) || ENABLE(Condition23)
183     { "IMPLEMENTSCONSTANT1", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
184 #else
185     { 0, 0, NoIntrinsic, { 0, 0 } },
186 #endif
187 #if ENABLE(Condition22) || ENABLE(Condition23)
188     { "IMPLEMENTSCONSTANT2", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
189 #else
190     { 0, 0, NoIntrinsic, { 0, 0 } },
191 #endif
192 #if ENABLE(Condition11) || ENABLE(Condition12)
193     { "SUPPLEMENTALCONSTANT1", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
194 #else
195     { 0, 0, NoIntrinsic, { 0, 0 } },
196 #endif
197 #if ENABLE(Condition11) || ENABLE(Condition12)
198     { "SUPPLEMENTALCONSTANT2", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
199 #else
200     { 0, 0, NoIntrinsic, { 0, 0 } },
201 #endif
202 #if ENABLE(Condition22) || ENABLE(Condition23)
203     { "implementsStaticReadOnlyAttr", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceConstructorImplementsStaticReadOnlyAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
204 #else
205     { 0, 0, NoIntrinsic, { 0, 0 } },
206 #endif
207 #if ENABLE(Condition22) || ENABLE(Condition23)
208     { "implementsStaticAttr", static_cast<unsigned>(0), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceConstructorImplementsStaticAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestInterfaceConstructorImplementsStaticAttr) } },
209 #else
210     { 0, 0, NoIntrinsic, { 0, 0 } },
211 #endif
212 #if ENABLE(Condition11) || ENABLE(Condition12)
213     { "supplementalStaticReadOnlyAttr", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
214 #else
215     { 0, 0, NoIntrinsic, { 0, 0 } },
216 #endif
217 #if ENABLE(Condition11) || ENABLE(Condition12)
218     { "supplementalStaticAttr", static_cast<unsigned>(0), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceConstructorSupplementalStaticAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestInterfaceConstructorSupplementalStaticAttr) } },
219 #else
220     { 0, 0, NoIntrinsic, { 0, 0 } },
221 #endif
222 #if ENABLE(Condition22) || ENABLE(Condition23)
223     { "implementsMethod4", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfaceConstructorFunctionImplementsMethod4), (intptr_t) (0) } },
224 #else
225     { 0, 0, NoIntrinsic, { 0, 0 } },
226 #endif
227 #if ENABLE(Condition11) || ENABLE(Condition12)
228     { "supplementalMethod4", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfaceConstructorFunctionSupplementalMethod4), (intptr_t) (0) } },
229 #else
230     { 0, 0, NoIntrinsic, { 0, 0 } },
231 #endif
232 };
233
234 #if ENABLE(Condition22) || ENABLE(Condition23)
235 static_assert(TestInterface::IMPLEMENTSCONSTANT1 == 1, "IMPLEMENTSCONSTANT1 in TestInterface does not match value from IDL");
236 #endif
237 #if ENABLE(Condition22) || ENABLE(Condition23)
238 static_assert(TestInterface::CONST_IMPL == 2, "CONST_IMPL in TestInterface does not match value from IDL");
239 #endif
240 #if ENABLE(Condition11) || ENABLE(Condition12)
241 static_assert(TestSupplemental::SUPPLEMENTALCONSTANT1 == 1, "SUPPLEMENTALCONSTANT1 in TestSupplemental does not match value from IDL");
242 #endif
243 #if ENABLE(Condition11) || ENABLE(Condition12)
244 static_assert(TestSupplemental::CONST_IMPL == 2, "CONST_IMPL in TestSupplemental does not match value from IDL");
245 #endif
246
247 template<> EncodedJSValue JSC_HOST_CALL JSTestInterfaceConstructor::construct(ExecState* state)
248 {
249     VM& vm = state->vm();
250     auto throwScope = DECLARE_THROW_SCOPE(vm);
251     UNUSED_PARAM(throwScope);
252     auto* castedThis = jsCast<JSTestInterfaceConstructor*>(state->jsCallee());
253     ASSERT(castedThis);
254     if (UNLIKELY(state->argumentCount() < 1))
255         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
256     auto* context = castedThis->scriptExecutionContext();
257     if (UNLIKELY(!context))
258         return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "TestInterface");
259     auto str1 = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
260     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
261     auto str2 = state->argument(1).isUndefined() ? "defaultString"_s : convert<IDLDOMString>(*state, state->uncheckedArgument(1));
262     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
263     auto object = TestInterface::create(*context, WTFMove(str1), WTFMove(str2));
264     return JSValue::encode(toJSNewlyCreated<IDLInterface<TestInterface>>(*state, *castedThis->globalObject(), throwScope, WTFMove(object)));
265 }
266
267 template<> JSValue JSTestInterfaceConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
268 {
269     UNUSED_PARAM(vm);
270     return globalObject.functionPrototype();
271 }
272
273 template<> void JSTestInterfaceConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
274 {
275     putDirect(vm, vm.propertyNames->prototype, JSTestInterface::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
276     putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("TestInterface"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
277     putDirect(vm, vm.propertyNames->length, jsNumber(1), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
278     reifyStaticProperties(vm, JSTestInterface::info(), JSTestInterfaceConstructorTableValues, *this);
279 }
280
281 template<> const ClassInfo JSTestInterfaceConstructor::s_info = { "TestInterface", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestInterfaceConstructor) };
282
283 /* Hash table for prototype */
284
285 static const HashTableValue JSTestInterfacePrototypeTableValues[] =
286 {
287     { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestInterfaceConstructor) } },
288 #if ENABLE(Condition22) || ENABLE(Condition23)
289     { "implementsStr1", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceImplementsStr1), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
290 #else
291     { 0, 0, NoIntrinsic, { 0, 0 } },
292 #endif
293 #if ENABLE(Condition22) || ENABLE(Condition23)
294     { "implementsStr2", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceImplementsStr2), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestInterfaceImplementsStr2) } },
295 #else
296     { 0, 0, NoIntrinsic, { 0, 0 } },
297 #endif
298 #if ENABLE(Condition22) || ENABLE(Condition23)
299     { "implementsStr3", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceImplementsStr3), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestInterfaceImplementsStr3) } },
300 #else
301     { 0, 0, NoIntrinsic, { 0, 0 } },
302 #endif
303 #if ENABLE(Condition22) || ENABLE(Condition23)
304     { "implementsNode", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceImplementsNode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestInterfaceImplementsNode) } },
305 #else
306     { 0, 0, NoIntrinsic, { 0, 0 } },
307 #endif
308 #if ENABLE(Condition11) || ENABLE(Condition12)
309     { "supplementalStr1", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSupplementalStr1), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
310 #else
311     { 0, 0, NoIntrinsic, { 0, 0 } },
312 #endif
313 #if ENABLE(Condition11) || ENABLE(Condition12)
314     { "supplementalStr2", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSupplementalStr2), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestInterfaceSupplementalStr2) } },
315 #else
316     { 0, 0, NoIntrinsic, { 0, 0 } },
317 #endif
318 #if ENABLE(Condition11) || ENABLE(Condition12)
319     { "supplementalStr3", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSupplementalStr3), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestInterfaceSupplementalStr3) } },
320 #else
321     { 0, 0, NoIntrinsic, { 0, 0 } },
322 #endif
323 #if ENABLE(Condition11) || ENABLE(Condition12)
324     { "supplementalNode", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSupplementalNode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestInterfaceSupplementalNode) } },
325 #else
326     { 0, 0, NoIntrinsic, { 0, 0 } },
327 #endif
328 #if ENABLE(Condition11) || ENABLE(Condition12)
329     { "reflectAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceReflectAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestInterfaceReflectAttribute) } },
330 #else
331     { 0, 0, NoIntrinsic, { 0, 0 } },
332 #endif
333 #if ENABLE(Condition11) || ENABLE(Condition12)
334     { "builtinAttribute", static_cast<unsigned>(JSC::PropertyAttribute::Accessor | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(testSupplementalBuiltinAttributeCodeGenerator), (intptr_t) (setTestSupplementalBuiltinAttributeCodeGenerator) } },
335 #else
336     { 0, 0, NoIntrinsic, { 0, 0 } },
337 #endif
338 #if ENABLE(Condition22) || ENABLE(Condition23)
339     { "implementsMethod1", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfacePrototypeFunctionImplementsMethod1), (intptr_t) (0) } },
340 #else
341     { 0, 0, NoIntrinsic, { 0, 0 } },
342 #endif
343 #if ENABLE(Condition22) || ENABLE(Condition23)
344     { "implementsMethod2", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfacePrototypeFunctionImplementsMethod2), (intptr_t) (2) } },
345 #else
346     { 0, 0, NoIntrinsic, { 0, 0 } },
347 #endif
348 #if ENABLE(Condition22) || ENABLE(Condition23)
349     { "implementsMethod3", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfacePrototypeFunctionImplementsMethod3), (intptr_t) (0) } },
350 #else
351     { 0, 0, NoIntrinsic, { 0, 0 } },
352 #endif
353 #if ENABLE(Condition22) || ENABLE(Condition23)
354     { "takeNodes", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfacePrototypeFunctionTakeNodes), (intptr_t) (0) } },
355 #else
356     { 0, 0, NoIntrinsic, { 0, 0 } },
357 #endif
358 #if ENABLE(Condition11) || ENABLE(Condition12)
359     { "supplementalMethod1", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod1), (intptr_t) (0) } },
360 #else
361     { 0, 0, NoIntrinsic, { 0, 0 } },
362 #endif
363 #if ENABLE(Condition11) || ENABLE(Condition12)
364     { "supplementalMethod2", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod2), (intptr_t) (2) } },
365 #else
366     { 0, 0, NoIntrinsic, { 0, 0 } },
367 #endif
368 #if ENABLE(Condition11) || ENABLE(Condition12)
369     { "supplementalMethod3", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod3), (intptr_t) (0) } },
370 #else
371     { 0, 0, NoIntrinsic, { 0, 0 } },
372 #endif
373 #if ENABLE(Condition11) || ENABLE(Condition12)
374     { "builtinFunction", static_cast<unsigned>(JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(testSupplementalBuiltinFunctionCodeGenerator), (intptr_t) (0) } },
375 #else
376     { 0, 0, NoIntrinsic, { 0, 0 } },
377 #endif
378 #if ENABLE(Condition22) || ENABLE(Condition23)
379     { "IMPLEMENTSCONSTANT1", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
380 #else
381     { 0, 0, NoIntrinsic, { 0, 0 } },
382 #endif
383 #if ENABLE(Condition22) || ENABLE(Condition23)
384     { "IMPLEMENTSCONSTANT2", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
385 #else
386     { 0, 0, NoIntrinsic, { 0, 0 } },
387 #endif
388 #if ENABLE(Condition11) || ENABLE(Condition12)
389     { "SUPPLEMENTALCONSTANT1", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
390 #else
391     { 0, 0, NoIntrinsic, { 0, 0 } },
392 #endif
393 #if ENABLE(Condition11) || ENABLE(Condition12)
394     { "SUPPLEMENTALCONSTANT2", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
395 #else
396     { 0, 0, NoIntrinsic, { 0, 0 } },
397 #endif
398 };
399
400 const ClassInfo JSTestInterfacePrototype::s_info = { "TestInterfacePrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestInterfacePrototype) };
401
402 void JSTestInterfacePrototype::finishCreation(VM& vm)
403 {
404     Base::finishCreation(vm);
405     reifyStaticProperties(vm, JSTestInterface::info(), JSTestInterfacePrototypeTableValues, *this);
406 }
407
408 const ClassInfo JSTestInterface::s_info = { "TestInterface", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestInterface) };
409
410 JSTestInterface::JSTestInterface(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestInterface>&& impl)
411     : JSDOMWrapper<TestInterface>(structure, globalObject, WTFMove(impl))
412 {
413 }
414
415 void JSTestInterface::finishCreation(VM& vm)
416 {
417     Base::finishCreation(vm);
418     ASSERT(inherits(vm, info()));
419
420 }
421
422 JSObject* JSTestInterface::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
423 {
424     return JSTestInterfacePrototype::create(vm, &globalObject, JSTestInterfacePrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
425 }
426
427 JSObject* JSTestInterface::prototype(VM& vm, JSDOMGlobalObject& globalObject)
428 {
429     return getDOMPrototype<JSTestInterface>(vm, globalObject);
430 }
431
432 JSValue JSTestInterface::getConstructor(VM& vm, const JSGlobalObject* globalObject)
433 {
434     return getDOMConstructor<JSTestInterfaceConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
435 }
436
437 void JSTestInterface::destroy(JSC::JSCell* cell)
438 {
439     JSTestInterface* thisObject = static_cast<JSTestInterface*>(cell);
440     thisObject->JSTestInterface::~JSTestInterface();
441 }
442
443 template<> inline JSTestInterface* IDLAttribute<JSTestInterface>::cast(ExecState& state, EncodedJSValue thisValue)
444 {
445     return jsDynamicCast<JSTestInterface*>(state.vm(), JSValue::decode(thisValue));
446 }
447
448 template<> inline JSTestInterface* IDLOperation<JSTestInterface>::cast(ExecState& state)
449 {
450     return jsDynamicCast<JSTestInterface*>(state.vm(), state.thisValue());
451 }
452
453 EncodedJSValue jsTestInterfaceConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
454 {
455     VM& vm = state->vm();
456     auto throwScope = DECLARE_THROW_SCOPE(vm);
457     auto* prototype = jsDynamicCast<JSTestInterfacePrototype*>(vm, JSValue::decode(thisValue));
458     if (UNLIKELY(!prototype))
459         return throwVMTypeError(state, throwScope);
460     return JSValue::encode(JSTestInterface::getConstructor(state->vm(), prototype->globalObject()));
461 }
462
463 bool setJSTestInterfaceConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
464 {
465     VM& vm = state->vm();
466     auto throwScope = DECLARE_THROW_SCOPE(vm);
467     auto* prototype = jsDynamicCast<JSTestInterfacePrototype*>(vm, JSValue::decode(thisValue));
468     if (UNLIKELY(!prototype)) {
469         throwVMTypeError(state, throwScope);
470         return false;
471     }
472     // Shadowing a built-in constructor
473     return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
474 }
475
476 #if ENABLE(Condition22) || ENABLE(Condition23)
477 static inline JSValue jsTestInterfaceConstructorImplementsStaticReadOnlyAttrGetter(ExecState& state, ThrowScope& throwScope)
478 {
479     UNUSED_PARAM(throwScope);
480     UNUSED_PARAM(state);
481     JSValue result = toJS<IDLLong>(state, throwScope, TestInterface::implementsStaticReadOnlyAttr());
482     return result;
483 }
484
485 EncodedJSValue jsTestInterfaceConstructorImplementsStaticReadOnlyAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
486 {
487     return IDLAttribute<JSTestInterface>::getStatic<jsTestInterfaceConstructorImplementsStaticReadOnlyAttrGetter>(*state, thisValue, "implementsStaticReadOnlyAttr");
488 }
489
490 #endif
491
492 #if ENABLE(Condition22) || ENABLE(Condition23)
493 static inline JSValue jsTestInterfaceConstructorImplementsStaticAttrGetter(ExecState& state, ThrowScope& throwScope)
494 {
495     UNUSED_PARAM(throwScope);
496     UNUSED_PARAM(state);
497     JSValue result = toJS<IDLDOMString>(state, throwScope, TestInterface::implementsStaticAttr());
498     return result;
499 }
500
501 EncodedJSValue jsTestInterfaceConstructorImplementsStaticAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
502 {
503     return IDLAttribute<JSTestInterface>::getStatic<jsTestInterfaceConstructorImplementsStaticAttrGetter>(*state, thisValue, "implementsStaticAttr");
504 }
505
506 #endif
507
508 #if ENABLE(Condition22) || ENABLE(Condition23)
509 static inline bool setJSTestInterfaceConstructorImplementsStaticAttrSetter(ExecState& state, JSValue value, ThrowScope& throwScope)
510 {
511     UNUSED_PARAM(throwScope);
512     auto nativeValue = convert<IDLDOMString>(state, value);
513     RETURN_IF_EXCEPTION(throwScope, false);
514     AttributeSetter::call(state, throwScope, [&] {
515         return TestInterface::setImplementsStaticAttr(WTFMove(nativeValue));
516     });
517     return true;
518 }
519
520 bool setJSTestInterfaceConstructorImplementsStaticAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
521 {
522     return IDLAttribute<JSTestInterface>::setStatic<setJSTestInterfaceConstructorImplementsStaticAttrSetter>(*state, thisValue, encodedValue, "implementsStaticAttr");
523 }
524
525 #endif
526
527 #if ENABLE(Condition22) || ENABLE(Condition23)
528 static inline JSValue jsTestInterfaceImplementsStr1Getter(ExecState& state, JSTestInterface& thisObject, ThrowScope& throwScope)
529 {
530     UNUSED_PARAM(throwScope);
531     UNUSED_PARAM(state);
532     auto& impl = thisObject.wrapped();
533     JSValue result = toJS<IDLDOMString>(state, throwScope, impl.implementsStr1());
534     return result;
535 }
536
537 EncodedJSValue jsTestInterfaceImplementsStr1(ExecState* state, EncodedJSValue thisValue, PropertyName)
538 {
539     return IDLAttribute<JSTestInterface>::get<jsTestInterfaceImplementsStr1Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "implementsStr1");
540 }
541
542 #endif
543
544 #if ENABLE(Condition22) || ENABLE(Condition23)
545 static inline JSValue jsTestInterfaceImplementsStr2Getter(ExecState& state, JSTestInterface& thisObject, ThrowScope& throwScope)
546 {
547     UNUSED_PARAM(throwScope);
548     UNUSED_PARAM(state);
549     auto& impl = thisObject.wrapped();
550     JSValue result = toJS<IDLDOMString>(state, throwScope, impl.implementsStr2());
551     return result;
552 }
553
554 EncodedJSValue jsTestInterfaceImplementsStr2(ExecState* state, EncodedJSValue thisValue, PropertyName)
555 {
556     return IDLAttribute<JSTestInterface>::get<jsTestInterfaceImplementsStr2Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "implementsStr2");
557 }
558
559 #endif
560
561 #if ENABLE(Condition22) || ENABLE(Condition23)
562 static inline bool setJSTestInterfaceImplementsStr2Setter(ExecState& state, JSTestInterface& thisObject, JSValue value, ThrowScope& throwScope)
563 {
564     UNUSED_PARAM(throwScope);
565     auto& impl = thisObject.wrapped();
566     auto nativeValue = convert<IDLDOMString>(state, value);
567     RETURN_IF_EXCEPTION(throwScope, false);
568     AttributeSetter::call(state, throwScope, [&] {
569         return impl.setImplementsStr2(WTFMove(nativeValue));
570     });
571     return true;
572 }
573
574 bool setJSTestInterfaceImplementsStr2(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
575 {
576     return IDLAttribute<JSTestInterface>::set<setJSTestInterfaceImplementsStr2Setter>(*state, thisValue, encodedValue, "implementsStr2");
577 }
578
579 #endif
580
581 #if ENABLE(Condition22) || ENABLE(Condition23)
582 static inline JSValue jsTestInterfaceImplementsStr3Getter(ExecState& state, JSTestInterface& thisObject, ThrowScope& throwScope)
583 {
584     UNUSED_PARAM(throwScope);
585     UNUSED_PARAM(state);
586     return thisObject.implementsStr3(state);
587 }
588
589 EncodedJSValue jsTestInterfaceImplementsStr3(ExecState* state, EncodedJSValue thisValue, PropertyName)
590 {
591     return IDLAttribute<JSTestInterface>::get<jsTestInterfaceImplementsStr3Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "implementsStr3");
592 }
593
594 #endif
595
596 #if ENABLE(Condition22) || ENABLE(Condition23)
597 static inline bool setJSTestInterfaceImplementsStr3Setter(ExecState& state, JSTestInterface& thisObject, JSValue value, ThrowScope& throwScope)
598 {
599     UNUSED_PARAM(throwScope);
600     thisObject.setImplementsStr3(state, value);
601     return true;
602 }
603
604 bool setJSTestInterfaceImplementsStr3(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
605 {
606     return IDLAttribute<JSTestInterface>::set<setJSTestInterfaceImplementsStr3Setter>(*state, thisValue, encodedValue, "implementsStr3");
607 }
608
609 #endif
610
611 #if ENABLE(Condition22) || ENABLE(Condition23)
612 static inline JSValue jsTestInterfaceImplementsNodeGetter(ExecState& state, JSTestInterface& thisObject, ThrowScope& throwScope)
613 {
614     UNUSED_PARAM(throwScope);
615     UNUSED_PARAM(state);
616     auto& impl = thisObject.wrapped();
617     JSValue result = toJS<IDLInterface<Node>>(state, *thisObject.globalObject(), throwScope, impl.implementsNode());
618     return result;
619 }
620
621 EncodedJSValue jsTestInterfaceImplementsNode(ExecState* state, EncodedJSValue thisValue, PropertyName)
622 {
623     return IDLAttribute<JSTestInterface>::get<jsTestInterfaceImplementsNodeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "implementsNode");
624 }
625
626 #endif
627
628 #if ENABLE(Condition22) || ENABLE(Condition23)
629 static inline bool setJSTestInterfaceImplementsNodeSetter(ExecState& state, JSTestInterface& thisObject, JSValue value, ThrowScope& throwScope)
630 {
631     UNUSED_PARAM(throwScope);
632     auto& impl = thisObject.wrapped();
633     auto nativeValue = convert<IDLInterface<Node>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestInterface", "implementsNode", "Node"); });
634     RETURN_IF_EXCEPTION(throwScope, false);
635     AttributeSetter::call(state, throwScope, [&] {
636         return impl.setImplementsNode(*nativeValue);
637     });
638     return true;
639 }
640
641 bool setJSTestInterfaceImplementsNode(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
642 {
643     return IDLAttribute<JSTestInterface>::set<setJSTestInterfaceImplementsNodeSetter>(*state, thisValue, encodedValue, "implementsNode");
644 }
645
646 #endif
647
648 #if ENABLE(Condition11) || ENABLE(Condition12)
649 static inline JSValue jsTestInterfaceConstructorSupplementalStaticReadOnlyAttrGetter(ExecState& state, ThrowScope& throwScope)
650 {
651     UNUSED_PARAM(throwScope);
652     UNUSED_PARAM(state);
653     JSValue result = toJS<IDLLong>(state, throwScope, WebCore::TestSupplemental::supplementalStaticReadOnlyAttr());
654     return result;
655 }
656
657 EncodedJSValue jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
658 {
659     return IDLAttribute<JSTestInterface>::getStatic<jsTestInterfaceConstructorSupplementalStaticReadOnlyAttrGetter>(*state, thisValue, "supplementalStaticReadOnlyAttr");
660 }
661
662 #endif
663
664 #if ENABLE(Condition11) || ENABLE(Condition12)
665 static inline JSValue jsTestInterfaceConstructorSupplementalStaticAttrGetter(ExecState& state, ThrowScope& throwScope)
666 {
667     UNUSED_PARAM(throwScope);
668     UNUSED_PARAM(state);
669     JSValue result = toJS<IDLDOMString>(state, throwScope, WebCore::TestSupplemental::supplementalStaticAttr());
670     return result;
671 }
672
673 EncodedJSValue jsTestInterfaceConstructorSupplementalStaticAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
674 {
675     return IDLAttribute<JSTestInterface>::getStatic<jsTestInterfaceConstructorSupplementalStaticAttrGetter>(*state, thisValue, "supplementalStaticAttr");
676 }
677
678 #endif
679
680 #if ENABLE(Condition11) || ENABLE(Condition12)
681 static inline bool setJSTestInterfaceConstructorSupplementalStaticAttrSetter(ExecState& state, JSValue value, ThrowScope& throwScope)
682 {
683     UNUSED_PARAM(throwScope);
684     auto nativeValue = convert<IDLDOMString>(state, value);
685     RETURN_IF_EXCEPTION(throwScope, false);
686     AttributeSetter::call(state, throwScope, [&] {
687         return WebCore::TestSupplemental::setSupplementalStaticAttr(WTFMove(nativeValue));
688     });
689     return true;
690 }
691
692 bool setJSTestInterfaceConstructorSupplementalStaticAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
693 {
694     return IDLAttribute<JSTestInterface>::setStatic<setJSTestInterfaceConstructorSupplementalStaticAttrSetter>(*state, thisValue, encodedValue, "supplementalStaticAttr");
695 }
696
697 #endif
698
699 #if ENABLE(Condition11) || ENABLE(Condition12)
700 static inline JSValue jsTestInterfaceSupplementalStr1Getter(ExecState& state, JSTestInterface& thisObject, ThrowScope& throwScope)
701 {
702     UNUSED_PARAM(throwScope);
703     UNUSED_PARAM(state);
704     auto& impl = thisObject.wrapped();
705     JSValue result = toJS<IDLDOMString>(state, throwScope, WebCore::TestSupplemental::supplementalStr1(impl));
706     return result;
707 }
708
709 EncodedJSValue jsTestInterfaceSupplementalStr1(ExecState* state, EncodedJSValue thisValue, PropertyName)
710 {
711     return IDLAttribute<JSTestInterface>::get<jsTestInterfaceSupplementalStr1Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "supplementalStr1");
712 }
713
714 #endif
715
716 #if ENABLE(Condition11) || ENABLE(Condition12)
717 static inline JSValue jsTestInterfaceSupplementalStr2Getter(ExecState& state, JSTestInterface& thisObject, ThrowScope& throwScope)
718 {
719     UNUSED_PARAM(throwScope);
720     UNUSED_PARAM(state);
721     auto& impl = thisObject.wrapped();
722     JSValue result = toJS<IDLDOMString>(state, throwScope, WebCore::TestSupplemental::supplementalStr2(impl));
723     return result;
724 }
725
726 EncodedJSValue jsTestInterfaceSupplementalStr2(ExecState* state, EncodedJSValue thisValue, PropertyName)
727 {
728     return IDLAttribute<JSTestInterface>::get<jsTestInterfaceSupplementalStr2Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "supplementalStr2");
729 }
730
731 #endif
732
733 #if ENABLE(Condition11) || ENABLE(Condition12)
734 static inline bool setJSTestInterfaceSupplementalStr2Setter(ExecState& state, JSTestInterface& thisObject, JSValue value, ThrowScope& throwScope)
735 {
736     UNUSED_PARAM(throwScope);
737     auto& impl = thisObject.wrapped();
738     auto nativeValue = convert<IDLDOMString>(state, value);
739     RETURN_IF_EXCEPTION(throwScope, false);
740     AttributeSetter::call(state, throwScope, [&] {
741         return WebCore::TestSupplemental::setSupplementalStr2(impl, WTFMove(nativeValue));
742     });
743     return true;
744 }
745
746 bool setJSTestInterfaceSupplementalStr2(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
747 {
748     return IDLAttribute<JSTestInterface>::set<setJSTestInterfaceSupplementalStr2Setter>(*state, thisValue, encodedValue, "supplementalStr2");
749 }
750
751 #endif
752
753 #if ENABLE(Condition11) || ENABLE(Condition12)
754 static inline JSValue jsTestInterfaceSupplementalStr3Getter(ExecState& state, JSTestInterface& thisObject, ThrowScope& throwScope)
755 {
756     UNUSED_PARAM(throwScope);
757     UNUSED_PARAM(state);
758     return thisObject.supplementalStr3(state);
759 }
760
761 EncodedJSValue jsTestInterfaceSupplementalStr3(ExecState* state, EncodedJSValue thisValue, PropertyName)
762 {
763     return IDLAttribute<JSTestInterface>::get<jsTestInterfaceSupplementalStr3Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "supplementalStr3");
764 }
765
766 #endif
767
768 #if ENABLE(Condition11) || ENABLE(Condition12)
769 static inline bool setJSTestInterfaceSupplementalStr3Setter(ExecState& state, JSTestInterface& thisObject, JSValue value, ThrowScope& throwScope)
770 {
771     UNUSED_PARAM(throwScope);
772     thisObject.setSupplementalStr3(state, value);
773     return true;
774 }
775
776 bool setJSTestInterfaceSupplementalStr3(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
777 {
778     return IDLAttribute<JSTestInterface>::set<setJSTestInterfaceSupplementalStr3Setter>(*state, thisValue, encodedValue, "supplementalStr3");
779 }
780
781 #endif
782
783 #if ENABLE(Condition11) || ENABLE(Condition12)
784 static inline JSValue jsTestInterfaceSupplementalNodeGetter(ExecState& state, JSTestInterface& thisObject, ThrowScope& throwScope)
785 {
786     UNUSED_PARAM(throwScope);
787     UNUSED_PARAM(state);
788     auto& impl = thisObject.wrapped();
789     JSValue result = toJS<IDLInterface<Node>>(state, *thisObject.globalObject(), throwScope, WebCore::TestSupplemental::supplementalNode(impl));
790     return result;
791 }
792
793 EncodedJSValue jsTestInterfaceSupplementalNode(ExecState* state, EncodedJSValue thisValue, PropertyName)
794 {
795     return IDLAttribute<JSTestInterface>::get<jsTestInterfaceSupplementalNodeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "supplementalNode");
796 }
797
798 #endif
799
800 #if ENABLE(Condition11) || ENABLE(Condition12)
801 static inline bool setJSTestInterfaceSupplementalNodeSetter(ExecState& state, JSTestInterface& thisObject, JSValue value, ThrowScope& throwScope)
802 {
803     UNUSED_PARAM(throwScope);
804     auto& impl = thisObject.wrapped();
805     auto nativeValue = convert<IDLInterface<Node>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestInterface", "supplementalNode", "Node"); });
806     RETURN_IF_EXCEPTION(throwScope, false);
807     AttributeSetter::call(state, throwScope, [&] {
808         return WebCore::TestSupplemental::setSupplementalNode(impl, *nativeValue);
809     });
810     return true;
811 }
812
813 bool setJSTestInterfaceSupplementalNode(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
814 {
815     return IDLAttribute<JSTestInterface>::set<setJSTestInterfaceSupplementalNodeSetter>(*state, thisValue, encodedValue, "supplementalNode");
816 }
817
818 #endif
819
820 #if ENABLE(Condition11) || ENABLE(Condition12)
821 static inline JSValue jsTestInterfaceReflectAttributeGetter(ExecState& state, JSTestInterface& thisObject, ThrowScope& throwScope)
822 {
823     UNUSED_PARAM(throwScope);
824     UNUSED_PARAM(state);
825     auto& impl = thisObject.wrapped();
826     JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::reflectattributeAttr));
827     return result;
828 }
829
830 EncodedJSValue jsTestInterfaceReflectAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
831 {
832     return IDLAttribute<JSTestInterface>::get<jsTestInterfaceReflectAttributeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "reflectAttribute");
833 }
834
835 #endif
836
837 #if ENABLE(Condition11) || ENABLE(Condition12)
838 static inline bool setJSTestInterfaceReflectAttributeSetter(ExecState& state, JSTestInterface& thisObject, JSValue value, ThrowScope& throwScope)
839 {
840     UNUSED_PARAM(throwScope);
841     auto& impl = thisObject.wrapped();
842     auto nativeValue = convert<IDLDOMString>(state, value);
843     RETURN_IF_EXCEPTION(throwScope, false);
844     AttributeSetter::call(state, throwScope, [&] {
845         return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::reflectattributeAttr, WTFMove(nativeValue));
846     });
847     return true;
848 }
849
850 bool setJSTestInterfaceReflectAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
851 {
852     return IDLAttribute<JSTestInterface>::set<setJSTestInterfaceReflectAttributeSetter>(*state, thisValue, encodedValue, "reflectAttribute");
853 }
854
855 #endif
856
857 #if ENABLE(Condition22) || ENABLE(Condition23)
858 static inline JSC::EncodedJSValue jsTestInterfacePrototypeFunctionImplementsMethod1Body(JSC::ExecState* state, typename IDLOperation<JSTestInterface>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
859 {
860     UNUSED_PARAM(state);
861     UNUSED_PARAM(throwScope);
862     auto& impl = castedThis->wrapped();
863     impl.implementsMethod1();
864     return JSValue::encode(jsUndefined());
865 }
866
867 EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionImplementsMethod1(ExecState* state)
868 {
869     return IDLOperation<JSTestInterface>::call<jsTestInterfacePrototypeFunctionImplementsMethod1Body>(*state, "implementsMethod1");
870 }
871
872 #endif
873
874 #if ENABLE(Condition22) || ENABLE(Condition23)
875 static inline JSC::EncodedJSValue jsTestInterfacePrototypeFunctionImplementsMethod2Body(JSC::ExecState* state, typename IDLOperation<JSTestInterface>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
876 {
877     UNUSED_PARAM(state);
878     UNUSED_PARAM(throwScope);
879     auto& impl = castedThis->wrapped();
880     if (UNLIKELY(state->argumentCount() < 2))
881         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
882     auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
883     if (UNLIKELY(!context))
884         return JSValue::encode(jsUndefined());
885     auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
886     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
887     auto objArg = convert<IDLInterface<TestObj>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 1, "objArg", "TestInterface", "implementsMethod2", "TestObj"); });
888     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
889     return JSValue::encode(toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), throwScope, impl.implementsMethod2(*context, WTFMove(strArg), *objArg)));
890 }
891
892 EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionImplementsMethod2(ExecState* state)
893 {
894     return IDLOperation<JSTestInterface>::call<jsTestInterfacePrototypeFunctionImplementsMethod2Body>(*state, "implementsMethod2");
895 }
896
897 #endif
898
899 #if ENABLE(Condition22) || ENABLE(Condition23)
900 static inline JSC::EncodedJSValue jsTestInterfacePrototypeFunctionImplementsMethod3Body(JSC::ExecState* state, typename IDLOperation<JSTestInterface>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
901 {
902     UNUSED_PARAM(state);
903     UNUSED_PARAM(throwScope);
904     return JSValue::encode(castedThis->implementsMethod3(*state));
905 }
906
907 EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionImplementsMethod3(ExecState* state)
908 {
909     return IDLOperation<JSTestInterface>::call<jsTestInterfacePrototypeFunctionImplementsMethod3Body>(*state, "implementsMethod3");
910 }
911
912 #endif
913
914 #if ENABLE(Condition22) || ENABLE(Condition23)
915 static inline JSC::EncodedJSValue jsTestInterfaceConstructorFunctionImplementsMethod4Body(JSC::ExecState* state, JSC::ThrowScope& throwScope)
916 {
917     UNUSED_PARAM(state);
918     UNUSED_PARAM(throwScope);
919     TestInterface::implementsMethod4();
920     return JSValue::encode(jsUndefined());
921 }
922
923 EncodedJSValue JSC_HOST_CALL jsTestInterfaceConstructorFunctionImplementsMethod4(ExecState* state)
924 {
925     return IDLOperation<JSTestInterface>::callStatic<jsTestInterfaceConstructorFunctionImplementsMethod4Body>(*state, "implementsMethod4");
926 }
927
928 #endif
929
930 #if ENABLE(Condition22) || ENABLE(Condition23)
931 static inline JSC::EncodedJSValue jsTestInterfacePrototypeFunctionTakeNodesBody(JSC::ExecState* state, typename IDLOperation<JSTestInterface>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
932 {
933     UNUSED_PARAM(state);
934     UNUSED_PARAM(throwScope);
935     auto& impl = castedThis->wrapped();
936     auto implResult = impl.takeNodes();
937     return JSValue::encode(toJS<IDLSequence<IDLInterface<Node>>>(*state, *castedThis->globalObject(), WTFMove(implResult.nodes)));
938 }
939
940 EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionTakeNodes(ExecState* state)
941 {
942     return IDLOperation<JSTestInterface>::call<jsTestInterfacePrototypeFunctionTakeNodesBody>(*state, "takeNodes");
943 }
944
945 #endif
946
947 #if ENABLE(Condition11) || ENABLE(Condition12)
948 static inline JSC::EncodedJSValue jsTestInterfacePrototypeFunctionSupplementalMethod1Body(JSC::ExecState* state, typename IDLOperation<JSTestInterface>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
949 {
950     UNUSED_PARAM(state);
951     UNUSED_PARAM(throwScope);
952     auto& impl = castedThis->wrapped();
953     WebCore::TestSupplemental::supplementalMethod1(impl);
954     return JSValue::encode(jsUndefined());
955 }
956
957 EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod1(ExecState* state)
958 {
959     return IDLOperation<JSTestInterface>::call<jsTestInterfacePrototypeFunctionSupplementalMethod1Body>(*state, "supplementalMethod1");
960 }
961
962 #endif
963
964 #if ENABLE(Condition11) || ENABLE(Condition12)
965 static inline JSC::EncodedJSValue jsTestInterfacePrototypeFunctionSupplementalMethod2Body(JSC::ExecState* state, typename IDLOperation<JSTestInterface>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
966 {
967     UNUSED_PARAM(state);
968     UNUSED_PARAM(throwScope);
969     auto& impl = castedThis->wrapped();
970     if (UNLIKELY(state->argumentCount() < 2))
971         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
972     auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
973     if (UNLIKELY(!context))
974         return JSValue::encode(jsUndefined());
975     auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
976     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
977     auto objArg = convert<IDLInterface<TestObj>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 1, "objArg", "TestInterface", "supplementalMethod2", "TestObj"); });
978     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
979     return JSValue::encode(toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), throwScope, WebCore::TestSupplemental::supplementalMethod2(impl, *context, WTFMove(strArg), *objArg)));
980 }
981
982 EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod2(ExecState* state)
983 {
984     return IDLOperation<JSTestInterface>::call<jsTestInterfacePrototypeFunctionSupplementalMethod2Body>(*state, "supplementalMethod2");
985 }
986
987 #endif
988
989 #if ENABLE(Condition11) || ENABLE(Condition12)
990 static inline JSC::EncodedJSValue jsTestInterfacePrototypeFunctionSupplementalMethod3Body(JSC::ExecState* state, typename IDLOperation<JSTestInterface>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
991 {
992     UNUSED_PARAM(state);
993     UNUSED_PARAM(throwScope);
994     return JSValue::encode(castedThis->supplementalMethod3(*state));
995 }
996
997 EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod3(ExecState* state)
998 {
999     return IDLOperation<JSTestInterface>::call<jsTestInterfacePrototypeFunctionSupplementalMethod3Body>(*state, "supplementalMethod3");
1000 }
1001
1002 #endif
1003
1004 #if ENABLE(Condition11) || ENABLE(Condition12)
1005 static inline JSC::EncodedJSValue jsTestInterfaceConstructorFunctionSupplementalMethod4Body(JSC::ExecState* state, JSC::ThrowScope& throwScope)
1006 {
1007     UNUSED_PARAM(state);
1008     UNUSED_PARAM(throwScope);
1009     WebCore::TestSupplemental::supplementalMethod4();
1010     return JSValue::encode(jsUndefined());
1011 }
1012
1013 EncodedJSValue JSC_HOST_CALL jsTestInterfaceConstructorFunctionSupplementalMethod4(ExecState* state)
1014 {
1015     return IDLOperation<JSTestInterface>::callStatic<jsTestInterfaceConstructorFunctionSupplementalMethod4Body>(*state, "supplementalMethod4");
1016 }
1017
1018 #endif
1019
1020 void JSTestInterface::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
1021 {
1022     auto* thisObject = jsCast<JSTestInterface*>(cell);
1023     builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
1024     if (thisObject->scriptExecutionContext())
1025         builder.setLabelForCell(cell, String::format("url %s", thisObject->scriptExecutionContext()->url().string().utf8().data()));
1026     Base::heapSnapshot(cell, builder);
1027 }
1028
1029 bool JSTestInterfaceOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
1030 {
1031     auto* jsTestInterface = jsCast<JSTestInterface*>(handle.slot()->asCell());
1032     if (jsTestInterface->wrapped().hasPendingActivity()) {
1033         if (UNLIKELY(reason))
1034             *reason = "ActiveDOMObject with pending activity";
1035         return true;
1036      }
1037     UNUSED_PARAM(visitor);
1038     UNUSED_PARAM(reason);
1039     return false;
1040 }
1041
1042 void JSTestInterfaceOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
1043 {
1044     auto* jsTestInterface = static_cast<JSTestInterface*>(handle.slot()->asCell());
1045     auto& world = *static_cast<DOMWrapperWorld*>(context);
1046     uncacheWrapper(world, &jsTestInterface->wrapped(), jsTestInterface);
1047 }
1048
1049 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestInterface>&& impl)
1050 {
1051     // If you hit this failure the interface definition has the ImplementationLacksVTable
1052     // attribute. You should remove that attribute. If the class has subclasses
1053     // that may be passed through this toJS() function you should use the SkipVTableValidation
1054     // attribute to TestInterface.
1055     static_assert(!std::is_polymorphic<TestInterface>::value, "TestInterface is polymorphic but the IDL claims it is not");
1056     return createWrapper<TestInterface>(globalObject, WTFMove(impl));
1057 }
1058
1059 JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestInterface& impl)
1060 {
1061     return wrap(state, globalObject, impl);
1062 }
1063
1064 TestInterface* JSTestInterface::toWrapped(JSC::VM& vm, JSC::JSValue value)
1065 {
1066     if (auto* wrapper = jsDynamicCast<JSTestInterface*>(vm, value))
1067         return &wrapper->wrapped();
1068     return nullptr;
1069 }
1070
1071 }
1072
1073 #endif // ENABLE(Condition1) || ENABLE(Condition2)