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 "JSTextEvent.h"
23
24#include "JSDOMAttribute.h"
25#include "JSDOMBinding.h"
26#include "JSDOMConstructorNotConstructable.h"
27#include "JSDOMConvertBoolean.h"
28#include "JSDOMConvertInterface.h"
29#include "JSDOMConvertNullable.h"
30#include "JSDOMConvertStrings.h"
31#include "JSDOMExceptionHandling.h"
32#include "JSDOMOperation.h"
33#include "JSDOMWrapperCache.h"
34#include "JSWindowProxy.h"
35#include "ScriptExecutionContext.h"
36#include <JavaScriptCore/HeapSnapshotBuilder.h>
37#include <JavaScriptCore/JSCInlines.h>
38#include <wtf/GetPtr.h>
39#include <wtf/PointerPreparations.h>
40#include <wtf/URL.h>
41
42
43namespace WebCore {
44using namespace JSC;
45
46// Functions
47
48JSC::EncodedJSValue JSC_HOST_CALL jsTextEventPrototypeFunctionInitTextEvent(JSC::ExecState*);
49
50// Attributes
51
52JSC::EncodedJSValue jsTextEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
53bool setJSTextEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
54JSC::EncodedJSValue jsTextEventData(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
55
56class JSTextEventPrototype : public JSC::JSNonFinalObject {
57public:
58 using Base = JSC::JSNonFinalObject;
59 static JSTextEventPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
60 {
61 JSTextEventPrototype* ptr = new (NotNull, JSC::allocateCell<JSTextEventPrototype>(vm.heap)) JSTextEventPrototype(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
72private:
73 JSTextEventPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
74 : JSC::JSNonFinalObject(vm, structure)
75 {
76 }
77
78 void finishCreation(JSC::VM&);
79};
80
81using JSTextEventConstructor = JSDOMConstructorNotConstructable<JSTextEvent>;
82
83template<> JSValue JSTextEventConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
84{
85 return JSUIEvent::getConstructor(vm, &globalObject);
86}
87
88template<> void JSTextEventConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
89{
90 putDirect(vm, vm.propertyNames->prototype, JSTextEvent::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
91 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("TextEvent"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
92 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
93}
94
95template<> const ClassInfo JSTextEventConstructor::s_info = { "TextEvent", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextEventConstructor) };
96
97/* Hash table for prototype */
98
99static const HashTableValue JSTextEventPrototypeTableValues[] =
100{
101 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextEventConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTextEventConstructor) } },
102 { "data", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextEventData), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
103 { "initTextEvent", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTextEventPrototypeFunctionInitTextEvent), (intptr_t) (0) } },
104};
105
106const ClassInfo JSTextEventPrototype::s_info = { "TextEventPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextEventPrototype) };
107
108void JSTextEventPrototype::finishCreation(VM& vm)
109{
110 Base::finishCreation(vm);
111 reifyStaticProperties(vm, JSTextEvent::info(), JSTextEventPrototypeTableValues, *this);
112}
113
114const ClassInfo JSTextEvent::s_info = { "TextEvent", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextEvent) };
115
116JSTextEvent::JSTextEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TextEvent>&& impl)
117 : JSUIEvent(structure, globalObject, WTFMove(impl))
118{
119}
120
121void JSTextEvent::finishCreation(VM& vm)
122{
123 Base::finishCreation(vm);
124 ASSERT(inherits(vm, info()));
125
126}
127
128JSObject* JSTextEvent::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
129{
130 return JSTextEventPrototype::create(vm, &globalObject, JSTextEventPrototype::createStructure(vm, &globalObject, JSUIEvent::prototype(vm, globalObject)));
131}
132
133JSObject* JSTextEvent::prototype(VM& vm, JSDOMGlobalObject& globalObject)
134{
135 return getDOMPrototype<JSTextEvent>(vm, globalObject);
136}
137
138JSValue JSTextEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject)
139{
140 return getDOMConstructor<JSTextEventConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
141}
142
143template<> inline JSTextEvent* IDLAttribute<JSTextEvent>::cast(ExecState& state, EncodedJSValue thisValue)
144{
145 return jsDynamicCast<JSTextEvent*>(state.vm(), JSValue::decode(thisValue));
146}
147
148template<> inline JSTextEvent* IDLOperation<JSTextEvent>::cast(ExecState& state)
149{
150 return jsDynamicCast<JSTextEvent*>(state.vm(), state.thisValue());
151}
152
153EncodedJSValue jsTextEventConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
154{
155 VM& vm = state->vm();
156 auto throwScope = DECLARE_THROW_SCOPE(vm);
157 auto* prototype = jsDynamicCast<JSTextEventPrototype*>(vm, JSValue::decode(thisValue));
158 if (UNLIKELY(!prototype))
159 return throwVMTypeError(state, throwScope);
160 return JSValue::encode(JSTextEvent::getConstructor(state->vm(), prototype->globalObject()));
161}
162
163bool setJSTextEventConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
164{
165 VM& vm = state->vm();
166 auto throwScope = DECLARE_THROW_SCOPE(vm);
167 auto* prototype = jsDynamicCast<JSTextEventPrototype*>(vm, JSValue::decode(thisValue));
168 if (UNLIKELY(!prototype)) {
169 throwVMTypeError(state, throwScope);
170 return false;
171 }
172 // Shadowing a built-in constructor
173 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
174}
175
176static inline JSValue jsTextEventDataGetter(ExecState& state, JSTextEvent& thisObject, ThrowScope& throwScope)
177{
178 UNUSED_PARAM(throwScope);
179 UNUSED_PARAM(state);
180 auto& impl = thisObject.wrapped();
181 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.data());
182 return result;
183}
184
185EncodedJSValue jsTextEventData(ExecState* state, EncodedJSValue thisValue, PropertyName)
186{
187 return IDLAttribute<JSTextEvent>::get<jsTextEventDataGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "data");
188}
189
190static inline JSC::EncodedJSValue jsTextEventPrototypeFunctionInitTextEventBody(JSC::ExecState* state, typename IDLOperation<JSTextEvent>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
191{
192 UNUSED_PARAM(state);
193 UNUSED_PARAM(throwScope);
194 auto& impl = castedThis->wrapped();
195 auto typeArg = convert<IDLDOMString>(*state, state->argument(0));
196 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
197 auto canBubbleArg = convert<IDLBoolean>(*state, state->argument(1));
198 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
199 auto cancelableArg = convert<IDLBoolean>(*state, state->argument(2));
200 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
201 auto viewArg = convert<IDLNullable<IDLInterface<WindowProxy>>>(*state, state->argument(3), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 3, "viewArg", "TextEvent", "initTextEvent", "WindowProxy"); });
202 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
203 auto dataArg = convert<IDLDOMString>(*state, state->argument(4));
204 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
205 impl.initTextEvent(WTFMove(typeArg), WTFMove(canBubbleArg), WTFMove(cancelableArg), WTFMove(viewArg), WTFMove(dataArg));
206 return JSValue::encode(jsUndefined());
207}
208
209EncodedJSValue JSC_HOST_CALL jsTextEventPrototypeFunctionInitTextEvent(ExecState* state)
210{
211 return IDLOperation<JSTextEvent>::call<jsTextEventPrototypeFunctionInitTextEventBody>(*state, "initTextEvent");
212}
213
214void JSTextEvent::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
215{
216 auto* thisObject = jsCast<JSTextEvent*>(cell);
217 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
218 if (thisObject->scriptExecutionContext())
219 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
220 Base::heapSnapshot(cell, builder);
221}
222
223
224}
225