Add [ActiveDOMObject] to IDLs of ActiveDOMObjects
[WebKit-https.git] / Source / WebCore / bindings / scripts / test / JS / JSTestCEReactionsStringifier.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 "JSTestCEReactionsStringifier.h"
23
24 #include "ActiveDOMObject.h"
25 #include "CustomElementReactionQueue.h"
26 #include "JSDOMAttribute.h"
27 #include "JSDOMBinding.h"
28 #include "JSDOMConstructorNotConstructable.h"
29 #include "JSDOMConvertStrings.h"
30 #include "JSDOMExceptionHandling.h"
31 #include "JSDOMOperation.h"
32 #include "JSDOMWrapperCache.h"
33 #include "ScriptExecutionContext.h"
34 #include <JavaScriptCore/FunctionPrototype.h>
35 #include <JavaScriptCore/HeapAnalyzer.h>
36 #include <JavaScriptCore/JSCInlines.h>
37 #include <wtf/GetPtr.h>
38 #include <wtf/PointerPreparations.h>
39 #include <wtf/URL.h>
40
41
42 namespace WebCore {
43 using namespace JSC;
44
45 // Functions
46
47 JSC::EncodedJSValue JSC_HOST_CALL jsTestCEReactionsStringifierPrototypeFunctionToString(JSC::JSGlobalObject*, JSC::CallFrame*);
48
49 // Attributes
50
51 JSC::EncodedJSValue jsTestCEReactionsStringifierConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52 bool setJSTestCEReactionsStringifierConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
53 JSC::EncodedJSValue jsTestCEReactionsStringifierValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
54 bool setJSTestCEReactionsStringifierValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
55 JSC::EncodedJSValue jsTestCEReactionsStringifierValueWithoutReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
56 bool setJSTestCEReactionsStringifierValueWithoutReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
57
58 class JSTestCEReactionsStringifierPrototype : public JSC::JSNonFinalObject {
59 public:
60     using Base = JSC::JSNonFinalObject;
61     static JSTestCEReactionsStringifierPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
62     {
63         JSTestCEReactionsStringifierPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestCEReactionsStringifierPrototype>(vm.heap)) JSTestCEReactionsStringifierPrototype(vm, globalObject, structure);
64         ptr->finishCreation(vm);
65         return ptr;
66     }
67
68     DECLARE_INFO;
69     static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
70     {
71         return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
72     }
73
74 private:
75     JSTestCEReactionsStringifierPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
76         : JSC::JSNonFinalObject(vm, structure)
77     {
78     }
79
80     void finishCreation(JSC::VM&);
81 };
82
83 using JSTestCEReactionsStringifierConstructor = JSDOMConstructorNotConstructable<JSTestCEReactionsStringifier>;
84
85 template<> JSValue JSTestCEReactionsStringifierConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
86 {
87     UNUSED_PARAM(vm);
88     return globalObject.functionPrototype();
89 }
90
91 template<> void JSTestCEReactionsStringifierConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
92 {
93     putDirect(vm, vm.propertyNames->prototype, JSTestCEReactionsStringifier::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
94     putDirect(vm, vm.propertyNames->name, jsNontrivialString(vm, String("TestCEReactionsStringifier"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
95     putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
96 }
97
98 template<> const ClassInfo JSTestCEReactionsStringifierConstructor::s_info = { "TestCEReactionsStringifier", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestCEReactionsStringifierConstructor) };
99
100 /* Hash table for prototype */
101
102 static const HashTableValue JSTestCEReactionsStringifierPrototypeTableValues[] =
103 {
104     { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsStringifierConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsStringifierConstructor) } },
105     { "value", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsStringifierValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsStringifierValue) } },
106     { "valueWithoutReactions", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsStringifierValueWithoutReactions), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsStringifierValueWithoutReactions) } },
107     { "toString", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestCEReactionsStringifierPrototypeFunctionToString), (intptr_t) (0) } },
108 };
109
110 const ClassInfo JSTestCEReactionsStringifierPrototype::s_info = { "TestCEReactionsStringifierPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestCEReactionsStringifierPrototype) };
111
112 void JSTestCEReactionsStringifierPrototype::finishCreation(VM& vm)
113 {
114     Base::finishCreation(vm);
115     reifyStaticProperties(vm, JSTestCEReactionsStringifier::info(), JSTestCEReactionsStringifierPrototypeTableValues, *this);
116 }
117
118 const ClassInfo JSTestCEReactionsStringifier::s_info = { "TestCEReactionsStringifier", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestCEReactionsStringifier) };
119
120 JSTestCEReactionsStringifier::JSTestCEReactionsStringifier(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestCEReactionsStringifier>&& impl)
121     : JSDOMWrapper<TestCEReactionsStringifier>(structure, globalObject, WTFMove(impl))
122 {
123 }
124
125 void JSTestCEReactionsStringifier::finishCreation(VM& vm)
126 {
127     Base::finishCreation(vm);
128     ASSERT(inherits(vm, info()));
129
130     static_assert(!std::is_base_of<ActiveDOMObject, TestCEReactionsStringifier>::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject.");
131
132 }
133
134 JSObject* JSTestCEReactionsStringifier::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
135 {
136     return JSTestCEReactionsStringifierPrototype::create(vm, &globalObject, JSTestCEReactionsStringifierPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
137 }
138
139 JSObject* JSTestCEReactionsStringifier::prototype(VM& vm, JSDOMGlobalObject& globalObject)
140 {
141     return getDOMPrototype<JSTestCEReactionsStringifier>(vm, globalObject);
142 }
143
144 JSValue JSTestCEReactionsStringifier::getConstructor(VM& vm, const JSGlobalObject* globalObject)
145 {
146     return getDOMConstructor<JSTestCEReactionsStringifierConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
147 }
148
149 void JSTestCEReactionsStringifier::destroy(JSC::JSCell* cell)
150 {
151     JSTestCEReactionsStringifier* thisObject = static_cast<JSTestCEReactionsStringifier*>(cell);
152     thisObject->JSTestCEReactionsStringifier::~JSTestCEReactionsStringifier();
153 }
154
155 template<> inline JSTestCEReactionsStringifier* IDLAttribute<JSTestCEReactionsStringifier>::cast(ExecState& state, EncodedJSValue thisValue)
156 {
157     return jsDynamicCast<JSTestCEReactionsStringifier*>(state.vm(), JSValue::decode(thisValue));
158 }
159
160 template<> inline JSTestCEReactionsStringifier* IDLOperation<JSTestCEReactionsStringifier>::cast(ExecState& state)
161 {
162     return jsDynamicCast<JSTestCEReactionsStringifier*>(state.vm(), state.thisValue());
163 }
164
165 EncodedJSValue jsTestCEReactionsStringifierConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
166 {
167     VM& vm = state->vm();
168     auto throwScope = DECLARE_THROW_SCOPE(vm);
169     auto* prototype = jsDynamicCast<JSTestCEReactionsStringifierPrototype*>(vm, JSValue::decode(thisValue));
170     if (UNLIKELY(!prototype))
171         return throwVMTypeError(state, throwScope);
172     return JSValue::encode(JSTestCEReactionsStringifier::getConstructor(state->vm(), prototype->globalObject()));
173 }
174
175 bool setJSTestCEReactionsStringifierConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
176 {
177     VM& vm = state->vm();
178     auto throwScope = DECLARE_THROW_SCOPE(vm);
179     auto* prototype = jsDynamicCast<JSTestCEReactionsStringifierPrototype*>(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 jsTestCEReactionsStringifierValueGetter(ExecState& state, JSTestCEReactionsStringifier& 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.value());
194     return result;
195 }
196
197 EncodedJSValue jsTestCEReactionsStringifierValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
198 {
199     return IDLAttribute<JSTestCEReactionsStringifier>::get<jsTestCEReactionsStringifierValueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "value");
200 }
201
202 static inline bool setJSTestCEReactionsStringifierValueSetter(ExecState& state, JSTestCEReactionsStringifier& thisObject, JSValue value, ThrowScope& throwScope)
203 {
204     UNUSED_PARAM(state);
205     UNUSED_PARAM(throwScope);
206     CustomElementReactionStack customElementReactionStack(state);
207     auto& impl = thisObject.wrapped();
208     auto nativeValue = convert<IDLDOMString>(state, value);
209     RETURN_IF_EXCEPTION(throwScope, false);
210     AttributeSetter::call(state, throwScope, [&] {
211         return impl.setValue(WTFMove(nativeValue));
212     });
213     return true;
214 }
215
216 bool setJSTestCEReactionsStringifierValue(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
217 {
218     return IDLAttribute<JSTestCEReactionsStringifier>::set<setJSTestCEReactionsStringifierValueSetter>(*state, thisValue, encodedValue, "value");
219 }
220
221 static inline JSValue jsTestCEReactionsStringifierValueWithoutReactionsGetter(ExecState& state, JSTestCEReactionsStringifier& thisObject, ThrowScope& throwScope)
222 {
223     UNUSED_PARAM(throwScope);
224     UNUSED_PARAM(state);
225     auto& impl = thisObject.wrapped();
226     JSValue result = toJS<IDLDOMString>(state, throwScope, impl.valueWithoutReactions());
227     return result;
228 }
229
230 EncodedJSValue jsTestCEReactionsStringifierValueWithoutReactions(ExecState* state, EncodedJSValue thisValue, PropertyName)
231 {
232     return IDLAttribute<JSTestCEReactionsStringifier>::get<jsTestCEReactionsStringifierValueWithoutReactionsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "valueWithoutReactions");
233 }
234
235 static inline bool setJSTestCEReactionsStringifierValueWithoutReactionsSetter(ExecState& state, JSTestCEReactionsStringifier& thisObject, JSValue value, ThrowScope& throwScope)
236 {
237     UNUSED_PARAM(state);
238     UNUSED_PARAM(throwScope);
239     CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
240     auto& impl = thisObject.wrapped();
241     auto nativeValue = convert<IDLDOMString>(state, value);
242     RETURN_IF_EXCEPTION(throwScope, false);
243     AttributeSetter::call(state, throwScope, [&] {
244         return impl.setValueWithoutReactions(WTFMove(nativeValue));
245     });
246     return true;
247 }
248
249 bool setJSTestCEReactionsStringifierValueWithoutReactions(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
250 {
251     return IDLAttribute<JSTestCEReactionsStringifier>::set<setJSTestCEReactionsStringifierValueWithoutReactionsSetter>(*state, thisValue, encodedValue, "valueWithoutReactions");
252 }
253
254 static inline JSC::EncodedJSValue jsTestCEReactionsStringifierPrototypeFunctionToStringBody(JSC::ExecState* state, typename IDLOperation<JSTestCEReactionsStringifier>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
255 {
256     UNUSED_PARAM(state);
257     UNUSED_PARAM(throwScope);
258     auto& impl = castedThis->wrapped();
259     return JSValue::encode(toJS<IDLDOMString>(*state, impl.value()));
260 }
261
262 EncodedJSValue JSC_HOST_CALL jsTestCEReactionsStringifierPrototypeFunctionToString(JSGlobalObject* globalObject, CallFrame* state)
263 {
264     UNUSED_PARAM(globalObject);
265     return IDLOperation<JSTestCEReactionsStringifier>::call<jsTestCEReactionsStringifierPrototypeFunctionToStringBody>(*state, "toString");
266 }
267
268 void JSTestCEReactionsStringifier::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
269 {
270     auto* thisObject = jsCast<JSTestCEReactionsStringifier*>(cell);
271     analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped());
272     if (thisObject->scriptExecutionContext())
273         analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
274     Base::analyzeHeap(cell, analyzer);
275 }
276
277 bool JSTestCEReactionsStringifierOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
278 {
279     UNUSED_PARAM(handle);
280     UNUSED_PARAM(visitor);
281     UNUSED_PARAM(reason);
282     return false;
283 }
284
285 void JSTestCEReactionsStringifierOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
286 {
287     auto* jsTestCEReactionsStringifier = static_cast<JSTestCEReactionsStringifier*>(handle.slot()->asCell());
288     auto& world = *static_cast<DOMWrapperWorld*>(context);
289     uncacheWrapper(world, &jsTestCEReactionsStringifier->wrapped(), jsTestCEReactionsStringifier);
290 }
291
292 #if ENABLE(BINDING_INTEGRITY)
293 #if PLATFORM(WIN)
294 #pragma warning(disable: 4483)
295 extern "C" { extern void (*const __identifier("??_7TestCEReactionsStringifier@WebCore@@6B@")[])(); }
296 #else
297 extern "C" { extern void* _ZTVN7WebCore26TestCEReactionsStringifierE[]; }
298 #endif
299 #endif
300
301 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestCEReactionsStringifier>&& impl)
302 {
303
304 #if ENABLE(BINDING_INTEGRITY)
305     void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
306 #if PLATFORM(WIN)
307     void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7TestCEReactionsStringifier@WebCore@@6B@"));
308 #else
309     void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore26TestCEReactionsStringifierE[2]);
310 #endif
311
312     // If this fails TestCEReactionsStringifier does not have a vtable, so you need to add the
313     // ImplementationLacksVTable attribute to the interface definition
314     static_assert(std::is_polymorphic<TestCEReactionsStringifier>::value, "TestCEReactionsStringifier is not polymorphic");
315
316     // If you hit this assertion you either have a use after free bug, or
317     // TestCEReactionsStringifier has subclasses. If TestCEReactionsStringifier has subclasses that get passed
318     // to toJS() we currently require TestCEReactionsStringifier you to opt out of binding hardening
319     // by adding the SkipVTableValidation attribute to the interface IDL definition
320     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
321 #endif
322     return createWrapper<TestCEReactionsStringifier>(globalObject, WTFMove(impl));
323 }
324
325 JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestCEReactionsStringifier& impl)
326 {
327     return wrap(state, globalObject, impl);
328 }
329
330 TestCEReactionsStringifier* JSTestCEReactionsStringifier::toWrapped(JSC::VM& vm, JSC::JSValue value)
331 {
332     if (auto* wrapper = jsDynamicCast<JSTestCEReactionsStringifier*>(vm, value))
333         return &wrapper->wrapped();
334     return nullptr;
335 }
336
337 }