[WebIDL] PutForwards is not implemented to spec as illustrated by the WPT WebIDL...
[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 "JSDOMAttribute.h"
27 #include "JSDOMBinding.h"
28 #include "JSDOMConstructorNotConstructable.h"
29 #include "JSDOMConvert.h"
30 #include "JSDOMExceptionHandling.h"
31 #include "JSDOMOperation.h"
32 #include "JSDOMWrapperCache.h"
33 #include "JSTestCEReactionsStringifier.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 jsTestCEReactionsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
48 bool setJSTestCEReactionsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
49 JSC::EncodedJSValue jsTestCEReactionsAttributeWithCEReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50 bool setJSTestCEReactionsAttributeWithCEReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
51 JSC::EncodedJSValue jsTestCEReactionsReflectAttributeWithCEReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52 bool setJSTestCEReactionsReflectAttributeWithCEReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
53 JSC::EncodedJSValue jsTestCEReactionsStringifierAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
54 bool setJSTestCEReactionsStringifierAttribute(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, JSDOMGlobalObject* 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, nullptr, nullptr, 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, nullptr, nullptr, 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, nullptr, nullptr, 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, JSDOMGlobalObject& globalObject)
132 {
133     return JSTestCEReactionsPrototype::create(vm, &globalObject, JSTestCEReactionsPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
134 }
135
136 JSObject* JSTestCEReactions::prototype(VM& vm, JSDOMGlobalObject& globalObject)
137 {
138     return getDOMPrototype<JSTestCEReactions>(vm, globalObject);
139 }
140
141 JSValue JSTestCEReactions::getConstructor(VM& vm, const JSGlobalObject* globalObject)
142 {
143     return getDOMConstructor<JSTestCEReactionsConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
144 }
145
146 void JSTestCEReactions::destroy(JSC::JSCell* cell)
147 {
148     JSTestCEReactions* thisObject = static_cast<JSTestCEReactions*>(cell);
149     thisObject->JSTestCEReactions::~JSTestCEReactions();
150 }
151
152 template<> inline JSTestCEReactions* IDLAttribute<JSTestCEReactions>::cast(ExecState& state, EncodedJSValue thisValue)
153 {
154     return jsDynamicDowncast<JSTestCEReactions*>(state.vm(), JSValue::decode(thisValue));
155 }
156
157 template<> inline JSTestCEReactions* IDLOperation<JSTestCEReactions>::cast(ExecState& state)
158 {
159     return jsDynamicDowncast<JSTestCEReactions*>(state.vm(), state.thisValue());
160 }
161
162 EncodedJSValue jsTestCEReactionsConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
163 {
164     VM& vm = state->vm();
165     auto throwScope = DECLARE_THROW_SCOPE(vm);
166     auto* prototype = jsDynamicDowncast<JSTestCEReactionsPrototype*>(vm, JSValue::decode(thisValue));
167     if (UNLIKELY(!prototype))
168         return throwVMTypeError(state, throwScope);
169     return JSValue::encode(JSTestCEReactions::getConstructor(state->vm(), prototype->globalObject()));
170 }
171
172 bool setJSTestCEReactionsConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
173 {
174     VM& vm = state->vm();
175     auto throwScope = DECLARE_THROW_SCOPE(vm);
176     auto* prototype = jsDynamicDowncast<JSTestCEReactionsPrototype*>(vm, JSValue::decode(thisValue));
177     if (UNLIKELY(!prototype)) {
178         throwVMTypeError(state, throwScope);
179         return false;
180     }
181     // Shadowing a built-in constructor
182     return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
183 }
184
185 static inline JSValue jsTestCEReactionsAttributeWithCEReactionsGetter(ExecState& state, JSTestCEReactions& thisObject, ThrowScope& throwScope)
186 {
187     UNUSED_PARAM(throwScope);
188     UNUSED_PARAM(state);
189     auto& impl = thisObject.wrapped();
190     JSValue result = toJS<IDLDOMString>(state, impl.attributeWithCEReactions());
191     return result;
192 }
193
194 EncodedJSValue jsTestCEReactionsAttributeWithCEReactions(ExecState* state, EncodedJSValue thisValue, PropertyName)
195 {
196     return IDLAttribute<JSTestCEReactions>::get<jsTestCEReactionsAttributeWithCEReactionsGetter>(*state, thisValue, "attributeWithCEReactions");
197 }
198
199 static inline bool setJSTestCEReactionsAttributeWithCEReactionsSetter(ExecState& state, JSTestCEReactions& thisObject, JSValue value, ThrowScope& throwScope)
200 {
201     UNUSED_PARAM(state);
202     UNUSED_PARAM(throwScope);
203     CustomElementReactionStack customElementReactionStack;
204     auto& impl = thisObject.wrapped();
205     auto nativeValue = convert<IDLDOMString>(state, value);
206     RETURN_IF_EXCEPTION(throwScope, false);
207     impl.setAttributeWithCEReactions(WTFMove(nativeValue));
208     return true;
209 }
210
211 bool setJSTestCEReactionsAttributeWithCEReactions(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
212 {
213     return IDLAttribute<JSTestCEReactions>::set<setJSTestCEReactionsAttributeWithCEReactionsSetter>(*state, thisValue, encodedValue, "attributeWithCEReactions");
214 }
215
216 static inline JSValue jsTestCEReactionsReflectAttributeWithCEReactionsGetter(ExecState& state, JSTestCEReactions& thisObject, ThrowScope& throwScope)
217 {
218     UNUSED_PARAM(throwScope);
219     UNUSED_PARAM(state);
220     auto& impl = thisObject.wrapped();
221     JSValue result = toJS<IDLDOMString>(state, impl.attributeWithoutSynchronization(WebCore::HTMLNames::reflectattributewithcereactionsAttr));
222     return result;
223 }
224
225 EncodedJSValue jsTestCEReactionsReflectAttributeWithCEReactions(ExecState* state, EncodedJSValue thisValue, PropertyName)
226 {
227     return IDLAttribute<JSTestCEReactions>::get<jsTestCEReactionsReflectAttributeWithCEReactionsGetter>(*state, thisValue, "reflectAttributeWithCEReactions");
228 }
229
230 static inline bool setJSTestCEReactionsReflectAttributeWithCEReactionsSetter(ExecState& state, JSTestCEReactions& thisObject, JSValue value, ThrowScope& throwScope)
231 {
232     UNUSED_PARAM(state);
233     UNUSED_PARAM(throwScope);
234     CustomElementReactionStack customElementReactionStack;
235     auto& impl = thisObject.wrapped();
236     auto nativeValue = convert<IDLDOMString>(state, value);
237     RETURN_IF_EXCEPTION(throwScope, false);
238     impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::reflectattributewithcereactionsAttr, WTFMove(nativeValue));
239     return true;
240 }
241
242 bool setJSTestCEReactionsReflectAttributeWithCEReactions(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
243 {
244     return IDLAttribute<JSTestCEReactions>::set<setJSTestCEReactionsReflectAttributeWithCEReactionsSetter>(*state, thisValue, encodedValue, "reflectAttributeWithCEReactions");
245 }
246
247 static inline JSValue jsTestCEReactionsStringifierAttributeGetter(ExecState& state, JSTestCEReactions& thisObject, ThrowScope& throwScope)
248 {
249     UNUSED_PARAM(throwScope);
250     UNUSED_PARAM(state);
251     auto& impl = thisObject.wrapped();
252     JSValue result = toJS<IDLInterface<TestCEReactionsStringifier>>(state, *thisObject.globalObject(), impl.stringifierAttribute());
253     return result;
254 }
255
256 EncodedJSValue jsTestCEReactionsStringifierAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
257 {
258     return IDLAttribute<JSTestCEReactions>::get<jsTestCEReactionsStringifierAttributeGetter>(*state, thisValue, "stringifierAttribute");
259 }
260
261 static inline bool setJSTestCEReactionsStringifierAttributeSetter(ExecState& state, JSTestCEReactions& thisObject, JSValue value, ThrowScope& throwScope)
262 {
263     UNUSED_PARAM(state);
264     UNUSED_PARAM(throwScope);
265     auto id = Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("stringifierAttribute"), strlen("stringifierAttribute"));
266     auto valueToForwardTo = thisObject.get(&state, id);
267     RETURN_IF_EXCEPTION(throwScope, false);
268     if (UNLIKELY(!valueToForwardTo.isObject())) {
269         throwTypeError(&state, throwScope);
270         return false;
271     }
272     auto forwardId = Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("value"), strlen("value"));
273     PutPropertySlot slot(valueToForwardTo, false);
274     asObject(valueToForwardTo)->methodTable(state.vm())->put(asObject(valueToForwardTo), &state, forwardId, value, slot);
275     RETURN_IF_EXCEPTION(throwScope, false);
276     return true;
277 }
278
279 bool setJSTestCEReactionsStringifierAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
280 {
281     return IDLAttribute<JSTestCEReactions>::set<setJSTestCEReactionsStringifierAttributeSetter>(*state, thisValue, encodedValue, "stringifierAttribute");
282 }
283
284 static inline JSC::EncodedJSValue jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsBody(JSC::ExecState* state, typename IDLOperation<JSTestCEReactions>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
285 {
286     UNUSED_PARAM(state);
287     UNUSED_PARAM(throwScope);
288     CustomElementReactionStack customElementReactionStack;
289     auto& impl = castedThis->wrapped();
290     impl.methodWithCEReactions();
291     return JSValue::encode(jsUndefined());
292 }
293
294 EncodedJSValue JSC_HOST_CALL jsTestCEReactionsPrototypeFunctionMethodWithCEReactions(ExecState* state)
295 {
296     return IDLOperation<JSTestCEReactions>::call<jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsBody>(*state, "methodWithCEReactions");
297 }
298
299 bool JSTestCEReactionsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
300 {
301     UNUSED_PARAM(handle);
302     UNUSED_PARAM(visitor);
303     return false;
304 }
305
306 void JSTestCEReactionsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
307 {
308     auto* jsTestCEReactions = static_cast<JSTestCEReactions*>(handle.slot()->asCell());
309     auto& world = *static_cast<DOMWrapperWorld*>(context);
310     uncacheWrapper(world, &jsTestCEReactions->wrapped(), jsTestCEReactions);
311 }
312
313 #if ENABLE(BINDING_INTEGRITY)
314 #if PLATFORM(WIN)
315 #pragma warning(disable: 4483)
316 extern "C" { extern void (*const __identifier("??_7TestCEReactions@WebCore@@6B@")[])(); }
317 #else
318 extern "C" { extern void* _ZTVN7WebCore15TestCEReactionsE[]; }
319 #endif
320 #endif
321
322 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestCEReactions>&& impl)
323 {
324
325 #if ENABLE(BINDING_INTEGRITY)
326     void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
327 #if PLATFORM(WIN)
328     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestCEReactions@WebCore@@6B@"));
329 #else
330     void* expectedVTablePointer = &_ZTVN7WebCore15TestCEReactionsE[2];
331 #if COMPILER(CLANG)
332     // If this fails TestCEReactions does not have a vtable, so you need to add the
333     // ImplementationLacksVTable attribute to the interface definition
334     static_assert(__is_polymorphic(TestCEReactions), "TestCEReactions is not polymorphic");
335 #endif
336 #endif
337     // If you hit this assertion you either have a use after free bug, or
338     // TestCEReactions has subclasses. If TestCEReactions has subclasses that get passed
339     // to toJS() we currently require TestCEReactions you to opt out of binding hardening
340     // by adding the SkipVTableValidation attribute to the interface IDL definition
341     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
342 #endif
343     return createWrapper<TestCEReactions>(globalObject, WTFMove(impl));
344 }
345
346 JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestCEReactions& impl)
347 {
348     return wrap(state, globalObject, impl);
349 }
350
351 TestCEReactions* JSTestCEReactions::toWrapped(JSC::VM& vm, JSC::JSValue value)
352 {
353     if (auto* wrapper = jsDynamicDowncast<JSTestCEReactions*>(vm, value))
354         return &wrapper->wrapped();
355     return nullptr;
356 }
357
358 }