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