[WebIDL] Remove GetterMayThrowException
[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 "JSDOMConvertInterface.h"
30 #include "JSDOMConvertStrings.h"
31 #include "JSDOMExceptionHandling.h"
32 #include "JSDOMGlobalObject.h"
33 #include "JSDOMOperation.h"
34 #include "JSDOMWrapperCache.h"
35 #include "JSTestCEReactionsStringifier.h"
36 #include <runtime/FunctionPrototype.h>
37 #include <runtime/JSCInlines.h>
38 #include <wtf/GetPtr.h>
39
40 using namespace JSC;
41
42 namespace WebCore {
43
44 // Functions
45
46 JSC::EncodedJSValue JSC_HOST_CALL jsTestCEReactionsPrototypeFunctionMethodWithCEReactions(JSC::ExecState*);
47
48 // Attributes
49
50 JSC::EncodedJSValue jsTestCEReactionsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51 bool setJSTestCEReactionsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
52 JSC::EncodedJSValue jsTestCEReactionsAttributeWithCEReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
53 bool setJSTestCEReactionsAttributeWithCEReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
54 JSC::EncodedJSValue jsTestCEReactionsReflectAttributeWithCEReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
55 bool setJSTestCEReactionsReflectAttributeWithCEReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
56 JSC::EncodedJSValue jsTestCEReactionsStringifierAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
57 bool setJSTestCEReactionsStringifierAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
58
59 class JSTestCEReactionsPrototype : public JSC::JSNonFinalObject {
60 public:
61     using Base = JSC::JSNonFinalObject;
62     static JSTestCEReactionsPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
63     {
64         JSTestCEReactionsPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestCEReactionsPrototype>(vm.heap)) JSTestCEReactionsPrototype(vm, globalObject, structure);
65         ptr->finishCreation(vm);
66         return ptr;
67     }
68
69     DECLARE_INFO;
70     static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
71     {
72         return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
73     }
74
75 private:
76     JSTestCEReactionsPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
77         : JSC::JSNonFinalObject(vm, structure)
78     {
79     }
80
81     void finishCreation(JSC::VM&);
82 };
83
84 using JSTestCEReactionsConstructor = JSDOMConstructorNotConstructable<JSTestCEReactions>;
85
86 template<> JSValue JSTestCEReactionsConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
87 {
88     UNUSED_PARAM(vm);
89     return globalObject.functionPrototype();
90 }
91
92 template<> void JSTestCEReactionsConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
93 {
94     putDirect(vm, vm.propertyNames->prototype, JSTestCEReactions::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
95     putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestCEReactions"))), ReadOnly | DontEnum);
96     putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
97 }
98
99 template<> const ClassInfo JSTestCEReactionsConstructor::s_info = { "TestCEReactions", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestCEReactionsConstructor) };
100
101 /* Hash table for prototype */
102
103 static const HashTableValue JSTestCEReactionsPrototypeTableValues[] =
104 {
105     { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsConstructor) } },
106     { "attributeWithCEReactions", CustomAccessor | DOMAttribute, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsAttributeWithCEReactions), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsAttributeWithCEReactions) } },
107     { "reflectAttributeWithCEReactions", CustomAccessor | DOMAttribute, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsReflectAttributeWithCEReactions), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsReflectAttributeWithCEReactions) } },
108     { "stringifierAttribute", CustomAccessor | DOMAttribute, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsStringifierAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsStringifierAttribute) } },
109     { "methodWithCEReactions", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestCEReactionsPrototypeFunctionMethodWithCEReactions), (intptr_t) (0) } },
110 };
111
112 const ClassInfo JSTestCEReactionsPrototype::s_info = { "TestCEReactionsPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestCEReactionsPrototype) };
113
114 void JSTestCEReactionsPrototype::finishCreation(VM& vm)
115 {
116     Base::finishCreation(vm);
117     reifyStaticProperties(vm, JSTestCEReactions::info(), JSTestCEReactionsPrototypeTableValues, *this);
118 }
119
120 const ClassInfo JSTestCEReactions::s_info = { "TestCEReactions", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestCEReactions) };
121
122 JSTestCEReactions::JSTestCEReactions(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestCEReactions>&& impl)
123     : JSDOMWrapper<TestCEReactions>(structure, globalObject, WTFMove(impl))
124 {
125 }
126
127 void JSTestCEReactions::finishCreation(VM& vm)
128 {
129     Base::finishCreation(vm);
130     ASSERT(inherits(vm, info()));
131
132 }
133
134 JSObject* JSTestCEReactions::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
135 {
136     return JSTestCEReactionsPrototype::create(vm, &globalObject, JSTestCEReactionsPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
137 }
138
139 JSObject* JSTestCEReactions::prototype(VM& vm, JSDOMGlobalObject& globalObject)
140 {
141     return getDOMPrototype<JSTestCEReactions>(vm, globalObject);
142 }
143
144 JSValue JSTestCEReactions::getConstructor(VM& vm, const JSGlobalObject* globalObject)
145 {
146     return getDOMConstructor<JSTestCEReactionsConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
147 }
148
149 void JSTestCEReactions::destroy(JSC::JSCell* cell)
150 {
151     JSTestCEReactions* thisObject = static_cast<JSTestCEReactions*>(cell);
152     thisObject->JSTestCEReactions::~JSTestCEReactions();
153 }
154
155 template<> inline JSTestCEReactions* IDLAttribute<JSTestCEReactions>::cast(ExecState& state, EncodedJSValue thisValue)
156 {
157     return jsDynamicDowncast<JSTestCEReactions*>(state.vm(), JSValue::decode(thisValue));
158 }
159
160 template<> inline JSTestCEReactions* IDLOperation<JSTestCEReactions>::cast(ExecState& state)
161 {
162     return jsDynamicDowncast<JSTestCEReactions*>(state.vm(), state.thisValue());
163 }
164
165 EncodedJSValue jsTestCEReactionsConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
166 {
167     VM& vm = state->vm();
168     auto throwScope = DECLARE_THROW_SCOPE(vm);
169     auto* prototype = jsDynamicDowncast<JSTestCEReactionsPrototype*>(vm, JSValue::decode(thisValue));
170     if (UNLIKELY(!prototype))
171         return throwVMTypeError(state, throwScope);
172     return JSValue::encode(JSTestCEReactions::getConstructor(state->vm(), prototype->globalObject()));
173 }
174
175 bool setJSTestCEReactionsConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
176 {
177     VM& vm = state->vm();
178     auto throwScope = DECLARE_THROW_SCOPE(vm);
179     auto* prototype = jsDynamicDowncast<JSTestCEReactionsPrototype*>(vm, JSValue::decode(thisValue));
180     if (UNLIKELY(!prototype)) {
181         throwVMTypeError(state, throwScope);
182         return false;
183     }
184     // Shadowing a built-in constructor
185     return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
186 }
187
188 static inline JSValue jsTestCEReactionsAttributeWithCEReactionsGetter(ExecState& state, JSTestCEReactions& thisObject, ThrowScope& throwScope)
189 {
190     UNUSED_PARAM(throwScope);
191     UNUSED_PARAM(state);
192     auto& impl = thisObject.wrapped();
193     JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithCEReactions());
194     return result;
195 }
196
197 EncodedJSValue jsTestCEReactionsAttributeWithCEReactions(ExecState* state, EncodedJSValue thisValue, PropertyName)
198 {
199     return IDLAttribute<JSTestCEReactions>::get<jsTestCEReactionsAttributeWithCEReactionsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "attributeWithCEReactions");
200 }
201
202 static inline bool setJSTestCEReactionsAttributeWithCEReactionsSetter(ExecState& state, JSTestCEReactions& thisObject, JSValue value, ThrowScope& throwScope)
203 {
204     UNUSED_PARAM(throwScope);
205     CustomElementReactionStack customElementReactionStack;
206     auto& impl = thisObject.wrapped();
207     auto nativeValue = convert<IDLDOMString>(state, value);
208     RETURN_IF_EXCEPTION(throwScope, false);
209     AttributeSetter::call(state, throwScope, [&] {
210         return impl.setAttributeWithCEReactions(WTFMove(nativeValue));
211     });
212     return true;
213 }
214
215 bool setJSTestCEReactionsAttributeWithCEReactions(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
216 {
217     return IDLAttribute<JSTestCEReactions>::set<setJSTestCEReactionsAttributeWithCEReactionsSetter>(*state, thisValue, encodedValue, "attributeWithCEReactions");
218 }
219
220 static inline JSValue jsTestCEReactionsReflectAttributeWithCEReactionsGetter(ExecState& state, JSTestCEReactions& thisObject, ThrowScope& throwScope)
221 {
222     UNUSED_PARAM(throwScope);
223     UNUSED_PARAM(state);
224     auto& impl = thisObject.wrapped();
225     JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::reflectattributewithcereactionsAttr));
226     return result;
227 }
228
229 EncodedJSValue jsTestCEReactionsReflectAttributeWithCEReactions(ExecState* state, EncodedJSValue thisValue, PropertyName)
230 {
231     return IDLAttribute<JSTestCEReactions>::get<jsTestCEReactionsReflectAttributeWithCEReactionsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "reflectAttributeWithCEReactions");
232 }
233
234 static inline bool setJSTestCEReactionsReflectAttributeWithCEReactionsSetter(ExecState& state, JSTestCEReactions& thisObject, JSValue value, ThrowScope& throwScope)
235 {
236     UNUSED_PARAM(throwScope);
237     CustomElementReactionStack customElementReactionStack;
238     auto& impl = thisObject.wrapped();
239     auto nativeValue = convert<IDLDOMString>(state, value);
240     RETURN_IF_EXCEPTION(throwScope, false);
241     AttributeSetter::call(state, throwScope, [&] {
242         return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::reflectattributewithcereactionsAttr, WTFMove(nativeValue));
243     });
244     return true;
245 }
246
247 bool setJSTestCEReactionsReflectAttributeWithCEReactions(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
248 {
249     return IDLAttribute<JSTestCEReactions>::set<setJSTestCEReactionsReflectAttributeWithCEReactionsSetter>(*state, thisValue, encodedValue, "reflectAttributeWithCEReactions");
250 }
251
252 static inline JSValue jsTestCEReactionsStringifierAttributeGetter(ExecState& state, JSTestCEReactions& thisObject, ThrowScope& throwScope)
253 {
254     UNUSED_PARAM(throwScope);
255     UNUSED_PARAM(state);
256     auto& impl = thisObject.wrapped();
257     JSValue result = toJS<IDLInterface<TestCEReactionsStringifier>>(state, *thisObject.globalObject(), throwScope, impl.stringifierAttribute());
258     return result;
259 }
260
261 EncodedJSValue jsTestCEReactionsStringifierAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
262 {
263     return IDLAttribute<JSTestCEReactions>::get<jsTestCEReactionsStringifierAttributeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "stringifierAttribute");
264 }
265
266 static inline bool setJSTestCEReactionsStringifierAttributeSetter(ExecState& state, JSTestCEReactions& thisObject, JSValue value, ThrowScope& throwScope)
267 {
268     UNUSED_PARAM(throwScope);
269     auto id = Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("stringifierAttribute"), strlen("stringifierAttribute"));
270     auto valueToForwardTo = thisObject.get(&state, id);
271     RETURN_IF_EXCEPTION(throwScope, false);
272     if (UNLIKELY(!valueToForwardTo.isObject())) {
273         throwTypeError(&state, throwScope);
274         return false;
275     }
276     auto forwardId = Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("value"), strlen("value"));
277     PutPropertySlot slot(valueToForwardTo, false);
278     asObject(valueToForwardTo)->methodTable(state.vm())->put(asObject(valueToForwardTo), &state, forwardId, value, slot);
279     RETURN_IF_EXCEPTION(throwScope, false);
280     return true;
281 }
282
283 bool setJSTestCEReactionsStringifierAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
284 {
285     return IDLAttribute<JSTestCEReactions>::set<setJSTestCEReactionsStringifierAttributeSetter>(*state, thisValue, encodedValue, "stringifierAttribute");
286 }
287
288 static inline JSC::EncodedJSValue jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsBody(JSC::ExecState* state, typename IDLOperation<JSTestCEReactions>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
289 {
290     UNUSED_PARAM(state);
291     UNUSED_PARAM(throwScope);
292     CustomElementReactionStack customElementReactionStack;
293     auto& impl = castedThis->wrapped();
294     impl.methodWithCEReactions();
295     return JSValue::encode(jsUndefined());
296 }
297
298 EncodedJSValue JSC_HOST_CALL jsTestCEReactionsPrototypeFunctionMethodWithCEReactions(ExecState* state)
299 {
300     return IDLOperation<JSTestCEReactions>::call<jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsBody>(*state, "methodWithCEReactions");
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 = static_cast<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 #endif
336
337     // If this fails TestCEReactions does not have a vtable, so you need to add the
338     // ImplementationLacksVTable attribute to the interface definition
339     static_assert(std::is_polymorphic<TestCEReactions>::value, "TestCEReactions is not polymorphic");
340
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::VM& vm, JSC::JSValue value)
356 {
357     if (auto* wrapper = jsDynamicDowncast<JSTestCEReactions*>(vm, value))
358         return &wrapper->wrapped();
359     return nullptr;
360 }
361
362 }