Remove CUSTOM_ELEMENTS build flag
[WebKit-https.git] / Source / WebCore / bindings / scripts / test / JS / JSTestCEReactions.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 "JSTestCEReactions.h"
23
24 #include "CustomElementReactionQueue.h"
25 #include "ExceptionCode.h"
26 #include "HTMLNames.h"
27 #include "JSDOMBinding.h"
28 #include "JSDOMConstructor.h"
29 #include "JSDOMConvert.h"
30 #include "JSTestCEReactionsStringifier.h"
31 #include <runtime/Error.h>
32 #include <runtime/FunctionPrototype.h>
33 #include <wtf/GetPtr.h>
34
35 using namespace JSC;
36
37 namespace WebCore {
38
39 // Functions
40
41 JSC::EncodedJSValue JSC_HOST_CALL jsTestCEReactionsPrototypeFunctionMethodWithCEReactions(JSC::ExecState*);
42
43 // Attributes
44
45 JSC::EncodedJSValue jsTestCEReactionsAttributeWithCEReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
46 bool setJSTestCEReactionsAttributeWithCEReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
47 JSC::EncodedJSValue jsTestCEReactionsReflectAttributeWithCEReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
48 bool setJSTestCEReactionsReflectAttributeWithCEReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
49 JSC::EncodedJSValue jsTestCEReactionsStringifierAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50 bool setJSTestCEReactionsStringifierAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
51 JSC::EncodedJSValue jsTestCEReactionsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52 bool setJSTestCEReactionsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
53
54 class JSTestCEReactionsPrototype : public JSC::JSNonFinalObject {
55 public:
56     using Base = JSC::JSNonFinalObject;
57     static JSTestCEReactionsPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
58     {
59         JSTestCEReactionsPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestCEReactionsPrototype>(vm.heap)) JSTestCEReactionsPrototype(vm, globalObject, structure);
60         ptr->finishCreation(vm);
61         return ptr;
62     }
63
64     DECLARE_INFO;
65     static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
66     {
67         return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
68     }
69
70 private:
71     JSTestCEReactionsPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
72         : JSC::JSNonFinalObject(vm, structure)
73     {
74     }
75
76     void finishCreation(JSC::VM&);
77 };
78
79 using JSTestCEReactionsConstructor = JSDOMConstructorNotConstructable<JSTestCEReactions>;
80
81 template<> JSValue JSTestCEReactionsConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
82 {
83     UNUSED_PARAM(vm);
84     return globalObject.functionPrototype();
85 }
86
87 template<> void JSTestCEReactionsConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
88 {
89     putDirect(vm, vm.propertyNames->prototype, JSTestCEReactions::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
90     putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestCEReactions"))), ReadOnly | DontEnum);
91     putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
92 }
93
94 template<> const ClassInfo JSTestCEReactionsConstructor::s_info = { "TestCEReactions", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestCEReactionsConstructor) };
95
96 /* Hash table for prototype */
97
98 static const HashTableValue JSTestCEReactionsPrototypeTableValues[] =
99 {
100     { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsConstructor) } },
101     { "attributeWithCEReactions", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsAttributeWithCEReactions), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsAttributeWithCEReactions) } },
102     { "reflectAttributeWithCEReactions", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsReflectAttributeWithCEReactions), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsReflectAttributeWithCEReactions) } },
103     { "stringifierAttribute", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsStringifierAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsStringifierAttribute) } },
104     { "methodWithCEReactions", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestCEReactionsPrototypeFunctionMethodWithCEReactions), (intptr_t) (0) } },
105 };
106
107 const ClassInfo JSTestCEReactionsPrototype::s_info = { "TestCEReactionsPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestCEReactionsPrototype) };
108
109 void JSTestCEReactionsPrototype::finishCreation(VM& vm)
110 {
111     Base::finishCreation(vm);
112     reifyStaticProperties(vm, JSTestCEReactionsPrototypeTableValues, *this);
113 }
114
115 const ClassInfo JSTestCEReactions::s_info = { "TestCEReactions", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestCEReactions) };
116
117 JSTestCEReactions::JSTestCEReactions(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestCEReactions>&& impl)
118     : JSDOMWrapper<TestCEReactions>(structure, globalObject, WTFMove(impl))
119 {
120 }
121
122 JSObject* JSTestCEReactions::createPrototype(VM& vm, JSGlobalObject* globalObject)
123 {
124     return JSTestCEReactionsPrototype::create(vm, globalObject, JSTestCEReactionsPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
125 }
126
127 JSObject* JSTestCEReactions::prototype(VM& vm, JSGlobalObject* globalObject)
128 {
129     return getDOMPrototype<JSTestCEReactions>(vm, globalObject);
130 }
131
132 void JSTestCEReactions::destroy(JSC::JSCell* cell)
133 {
134     JSTestCEReactions* thisObject = static_cast<JSTestCEReactions*>(cell);
135     thisObject->JSTestCEReactions::~JSTestCEReactions();
136 }
137
138 template<> inline JSTestCEReactions* BindingCaller<JSTestCEReactions>::castForAttribute(ExecState&, EncodedJSValue thisValue)
139 {
140     return jsDynamicDowncast<JSTestCEReactions*>(JSValue::decode(thisValue));
141 }
142
143 template<> inline JSTestCEReactions* BindingCaller<JSTestCEReactions>::castForOperation(ExecState& state)
144 {
145     return jsDynamicDowncast<JSTestCEReactions*>(state.thisValue());
146 }
147
148 static inline JSValue jsTestCEReactionsAttributeWithCEReactionsGetter(ExecState&, JSTestCEReactions&, ThrowScope& throwScope);
149
150 EncodedJSValue jsTestCEReactionsAttributeWithCEReactions(ExecState* state, EncodedJSValue thisValue, PropertyName)
151 {
152     return BindingCaller<JSTestCEReactions>::attribute<jsTestCEReactionsAttributeWithCEReactionsGetter>(state, thisValue, "attributeWithCEReactions");
153 }
154
155 static inline JSValue jsTestCEReactionsAttributeWithCEReactionsGetter(ExecState& state, JSTestCEReactions& thisObject, ThrowScope& throwScope)
156 {
157     UNUSED_PARAM(throwScope);
158     UNUSED_PARAM(state);
159     auto& impl = thisObject.wrapped();
160     JSValue result = toJS<IDLDOMString>(state, impl.attributeWithCEReactions());
161     return result;
162 }
163
164 static inline JSValue jsTestCEReactionsReflectAttributeWithCEReactionsGetter(ExecState&, JSTestCEReactions&, ThrowScope& throwScope);
165
166 EncodedJSValue jsTestCEReactionsReflectAttributeWithCEReactions(ExecState* state, EncodedJSValue thisValue, PropertyName)
167 {
168     return BindingCaller<JSTestCEReactions>::attribute<jsTestCEReactionsReflectAttributeWithCEReactionsGetter>(state, thisValue, "reflectAttributeWithCEReactions");
169 }
170
171 static inline JSValue jsTestCEReactionsReflectAttributeWithCEReactionsGetter(ExecState& state, JSTestCEReactions& thisObject, ThrowScope& throwScope)
172 {
173     UNUSED_PARAM(throwScope);
174     UNUSED_PARAM(state);
175     auto& impl = thisObject.wrapped();
176     JSValue result = toJS<IDLDOMString>(state, impl.attributeWithoutSynchronization(WebCore::HTMLNames::reflectattributewithcereactionsAttr));
177     return result;
178 }
179
180 static inline JSValue jsTestCEReactionsStringifierAttributeGetter(ExecState&, JSTestCEReactions&, ThrowScope& throwScope);
181
182 EncodedJSValue jsTestCEReactionsStringifierAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
183 {
184     return BindingCaller<JSTestCEReactions>::attribute<jsTestCEReactionsStringifierAttributeGetter>(state, thisValue, "stringifierAttribute");
185 }
186
187 static inline JSValue jsTestCEReactionsStringifierAttributeGetter(ExecState& state, JSTestCEReactions& thisObject, ThrowScope& throwScope)
188 {
189     UNUSED_PARAM(throwScope);
190     UNUSED_PARAM(state);
191     auto& impl = thisObject.wrapped();
192     JSValue result = toJS(&state, thisObject.globalObject(), impl.stringifierAttribute());
193     return result;
194 }
195
196 EncodedJSValue jsTestCEReactionsConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
197 {
198     VM& vm = state->vm();
199     auto throwScope = DECLARE_THROW_SCOPE(vm);
200     JSTestCEReactionsPrototype* domObject = jsDynamicDowncast<JSTestCEReactionsPrototype*>(JSValue::decode(thisValue));
201     if (UNLIKELY(!domObject))
202         return throwVMTypeError(state, throwScope);
203     return JSValue::encode(JSTestCEReactions::getConstructor(state->vm(), domObject->globalObject()));
204 }
205
206 bool setJSTestCEReactionsConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
207 {
208     VM& vm = state->vm();
209     auto throwScope = DECLARE_THROW_SCOPE(vm);
210     JSValue value = JSValue::decode(encodedValue);
211     JSTestCEReactionsPrototype* domObject = jsDynamicDowncast<JSTestCEReactionsPrototype*>(JSValue::decode(thisValue));
212     if (UNLIKELY(!domObject)) {
213         throwVMTypeError(state, throwScope);
214         return false;
215     }
216     // Shadowing a built-in constructor
217     return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
218 }
219
220 static inline bool setJSTestCEReactionsAttributeWithCEReactionsFunction(ExecState&, JSTestCEReactions&, JSValue, ThrowScope&);
221
222 bool setJSTestCEReactionsAttributeWithCEReactions(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
223 {
224     return BindingCaller<JSTestCEReactions>::setAttribute<setJSTestCEReactionsAttributeWithCEReactionsFunction>(state, thisValue, encodedValue, "attributeWithCEReactions");
225 }
226
227 static inline bool setJSTestCEReactionsAttributeWithCEReactionsFunction(ExecState& state, JSTestCEReactions& thisObject, JSValue value, ThrowScope& throwScope)
228 {
229     UNUSED_PARAM(state);
230     UNUSED_PARAM(throwScope);
231     CustomElementReactionStack customElementReactionStack;
232     auto& impl = thisObject.wrapped();
233     auto nativeValue = convert<IDLDOMString>(state, value, StringConversionConfiguration::Normal);
234     RETURN_IF_EXCEPTION(throwScope, false);
235     impl.setAttributeWithCEReactions(WTFMove(nativeValue));
236     return true;
237 }
238
239
240 static inline bool setJSTestCEReactionsReflectAttributeWithCEReactionsFunction(ExecState&, JSTestCEReactions&, JSValue, ThrowScope&);
241
242 bool setJSTestCEReactionsReflectAttributeWithCEReactions(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
243 {
244     return BindingCaller<JSTestCEReactions>::setAttribute<setJSTestCEReactionsReflectAttributeWithCEReactionsFunction>(state, thisValue, encodedValue, "reflectAttributeWithCEReactions");
245 }
246
247 static inline bool setJSTestCEReactionsReflectAttributeWithCEReactionsFunction(ExecState& state, JSTestCEReactions& thisObject, JSValue value, ThrowScope& throwScope)
248 {
249     UNUSED_PARAM(state);
250     UNUSED_PARAM(throwScope);
251     CustomElementReactionStack customElementReactionStack;
252     auto& impl = thisObject.wrapped();
253     auto nativeValue = convert<IDLDOMString>(state, value, StringConversionConfiguration::Normal);
254     RETURN_IF_EXCEPTION(throwScope, false);
255     impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::reflectattributewithcereactionsAttr, WTFMove(nativeValue));
256     return true;
257 }
258
259
260 static inline bool setJSTestCEReactionsStringifierAttributeFunction(ExecState&, JSTestCEReactions&, JSValue, ThrowScope&);
261
262 bool setJSTestCEReactionsStringifierAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
263 {
264     return BindingCaller<JSTestCEReactions>::setAttribute<setJSTestCEReactionsStringifierAttributeFunction>(state, thisValue, encodedValue, "stringifierAttribute");
265 }
266
267 static inline bool setJSTestCEReactionsStringifierAttributeFunction(ExecState& state, JSTestCEReactions& thisObject, JSValue value, ThrowScope& throwScope)
268 {
269     UNUSED_PARAM(state);
270     UNUSED_PARAM(throwScope);
271     CustomElementReactionStack customElementReactionStack;
272     Ref<TestCEReactionsStringifier> forwardedImpl = thisObject.wrapped().stringifierAttribute();
273     auto& impl = forwardedImpl.get();
274     auto nativeValue = convert<IDLDOMString>(state, value, StringConversionConfiguration::Normal);
275     RETURN_IF_EXCEPTION(throwScope, false);
276     impl.setValue(WTFMove(nativeValue));
277     return true;
278 }
279
280
281 JSValue JSTestCEReactions::getConstructor(VM& vm, const JSGlobalObject* globalObject)
282 {
283     return getDOMConstructor<JSTestCEReactionsConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
284 }
285
286 static inline JSC::EncodedJSValue jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsCaller(JSC::ExecState*, JSTestCEReactions*, JSC::ThrowScope&);
287
288 EncodedJSValue JSC_HOST_CALL jsTestCEReactionsPrototypeFunctionMethodWithCEReactions(ExecState* state)
289 {
290     CustomElementReactionStack customElementReactionStack;
291     return BindingCaller<JSTestCEReactions>::callOperation<jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsCaller>(state, "methodWithCEReactions");
292 }
293
294 static inline JSC::EncodedJSValue jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsCaller(JSC::ExecState* state, JSTestCEReactions* castedThis, JSC::ThrowScope& throwScope)
295 {
296     UNUSED_PARAM(state);
297     UNUSED_PARAM(throwScope);
298     auto& impl = castedThis->wrapped();
299     impl.methodWithCEReactions();
300     return JSValue::encode(jsUndefined());
301 }
302
303 bool JSTestCEReactionsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
304 {
305     UNUSED_PARAM(handle);
306     UNUSED_PARAM(visitor);
307     return false;
308 }
309
310 void JSTestCEReactionsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
311 {
312     auto* jsTestCEReactions = jsCast<JSTestCEReactions*>(handle.slot()->asCell());
313     auto& world = *static_cast<DOMWrapperWorld*>(context);
314     uncacheWrapper(world, &jsTestCEReactions->wrapped(), jsTestCEReactions);
315 }
316
317 #if ENABLE(BINDING_INTEGRITY)
318 #if PLATFORM(WIN)
319 #pragma warning(disable: 4483)
320 extern "C" { extern void (*const __identifier("??_7TestCEReactions@WebCore@@6B@")[])(); }
321 #else
322 extern "C" { extern void* _ZTVN7WebCore15TestCEReactionsE[]; }
323 #endif
324 #endif
325
326 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestCEReactions>&& impl)
327 {
328
329 #if ENABLE(BINDING_INTEGRITY)
330     void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
331 #if PLATFORM(WIN)
332     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestCEReactions@WebCore@@6B@"));
333 #else
334     void* expectedVTablePointer = &_ZTVN7WebCore15TestCEReactionsE[2];
335 #if COMPILER(CLANG)
336     // If this fails TestCEReactions does not have a vtable, so you need to add the
337     // ImplementationLacksVTable attribute to the interface definition
338     static_assert(__is_polymorphic(TestCEReactions), "TestCEReactions is not polymorphic");
339 #endif
340 #endif
341     // If you hit this assertion you either have a use after free bug, or
342     // TestCEReactions has subclasses. If TestCEReactions has subclasses that get passed
343     // to toJS() we currently require TestCEReactions you to opt out of binding hardening
344     // by adding the SkipVTableValidation attribute to the interface IDL definition
345     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
346 #endif
347     return createWrapper<TestCEReactions>(globalObject, WTFMove(impl));
348 }
349
350 JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestCEReactions& impl)
351 {
352     return wrap(state, globalObject, impl);
353 }
354
355 TestCEReactions* JSTestCEReactions::toWrapped(JSC::JSValue value)
356 {
357     if (auto* wrapper = jsDynamicDowncast<JSTestCEReactions*>(value))
358         return &wrapper->wrapped();
359     return nullptr;
360 }
361
362 }