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