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 "JSHTMLParamElement.h"
23
24#include "CustomElementReactionQueue.h"
25#include "HTMLNames.h"
26#include "JSDOMAttribute.h"
27#include "JSDOMBinding.h"
28#include "JSDOMConstructorNotConstructable.h"
29#include "JSDOMConvertStrings.h"
30#include "JSDOMExceptionHandling.h"
31#include "JSDOMWrapperCache.h"
32#include "ScriptExecutionContext.h"
33#include <JavaScriptCore/HeapSnapshotBuilder.h>
34#include <JavaScriptCore/JSCInlines.h>
35#include <wtf/GetPtr.h>
36#include <wtf/PointerPreparations.h>
37#include <wtf/URL.h>
38
39
40namespace WebCore {
41using namespace JSC;
42
43// Attributes
44
45JSC::EncodedJSValue jsHTMLParamElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
46bool setJSHTMLParamElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
47JSC::EncodedJSValue jsHTMLParamElementName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
48bool setJSHTMLParamElementName(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
49JSC::EncodedJSValue jsHTMLParamElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50bool setJSHTMLParamElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
51JSC::EncodedJSValue jsHTMLParamElementValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52bool setJSHTMLParamElementValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
53JSC::EncodedJSValue jsHTMLParamElementValueType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
54bool setJSHTMLParamElementValueType(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
55
56class JSHTMLParamElementPrototype : public JSC::JSNonFinalObject {
57public:
58 using Base = JSC::JSNonFinalObject;
59 static JSHTMLParamElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
60 {
61 JSHTMLParamElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLParamElementPrototype>(vm.heap)) JSHTMLParamElementPrototype(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 JSHTMLParamElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
74 : JSC::JSNonFinalObject(vm, structure)
75 {
76 }
77
78 void finishCreation(JSC::VM&);
79};
80
81using JSHTMLParamElementConstructor = JSDOMConstructorNotConstructable<JSHTMLParamElement>;
82
83template<> JSValue JSHTMLParamElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
84{
85 return JSHTMLElement::getConstructor(vm, &globalObject);
86}
87
88template<> void JSHTMLParamElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
89{
90 putDirect(vm, vm.propertyNames->prototype, JSHTMLParamElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
91 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLParamElement"_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 JSHTMLParamElementConstructor::s_info = { "HTMLParamElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLParamElementConstructor) };
96
97/* Hash table for prototype */
98
99static const HashTableValue JSHTMLParamElementPrototypeTableValues[] =
100{
101 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLParamElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLParamElementConstructor) } },
102 { "name", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLParamElementName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLParamElementName) } },
103 { "type", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLParamElementType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLParamElementType) } },
104 { "value", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLParamElementValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLParamElementValue) } },
105 { "valueType", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLParamElementValueType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLParamElementValueType) } },
106};
107
108const ClassInfo JSHTMLParamElementPrototype::s_info = { "HTMLParamElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLParamElementPrototype) };
109
110void JSHTMLParamElementPrototype::finishCreation(VM& vm)
111{
112 Base::finishCreation(vm);
113 reifyStaticProperties(vm, JSHTMLParamElement::info(), JSHTMLParamElementPrototypeTableValues, *this);
114}
115
116const ClassInfo JSHTMLParamElement::s_info = { "HTMLParamElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLParamElement) };
117
118JSHTMLParamElement::JSHTMLParamElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLParamElement>&& impl)
119 : JSHTMLElement(structure, globalObject, WTFMove(impl))
120{
121}
122
123void JSHTMLParamElement::finishCreation(VM& vm)
124{
125 Base::finishCreation(vm);
126 ASSERT(inherits(vm, info()));
127
128}
129
130JSObject* JSHTMLParamElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
131{
132 return JSHTMLParamElementPrototype::create(vm, &globalObject, JSHTMLParamElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject)));
133}
134
135JSObject* JSHTMLParamElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
136{
137 return getDOMPrototype<JSHTMLParamElement>(vm, globalObject);
138}
139
140JSValue JSHTMLParamElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
141{
142 return getDOMConstructor<JSHTMLParamElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
143}
144
145template<> inline JSHTMLParamElement* IDLAttribute<JSHTMLParamElement>::cast(ExecState& state, EncodedJSValue thisValue)
146{
147 return jsDynamicCast<JSHTMLParamElement*>(state.vm(), JSValue::decode(thisValue));
148}
149
150EncodedJSValue jsHTMLParamElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
151{
152 VM& vm = state->vm();
153 auto throwScope = DECLARE_THROW_SCOPE(vm);
154 auto* prototype = jsDynamicCast<JSHTMLParamElementPrototype*>(vm, JSValue::decode(thisValue));
155 if (UNLIKELY(!prototype))
156 return throwVMTypeError(state, throwScope);
157 return JSValue::encode(JSHTMLParamElement::getConstructor(state->vm(), prototype->globalObject()));
158}
159
160bool setJSHTMLParamElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
161{
162 VM& vm = state->vm();
163 auto throwScope = DECLARE_THROW_SCOPE(vm);
164 auto* prototype = jsDynamicCast<JSHTMLParamElementPrototype*>(vm, JSValue::decode(thisValue));
165 if (UNLIKELY(!prototype)) {
166 throwVMTypeError(state, throwScope);
167 return false;
168 }
169 // Shadowing a built-in constructor
170 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
171}
172
173static inline JSValue jsHTMLParamElementNameGetter(ExecState& state, JSHTMLParamElement& thisObject, ThrowScope& throwScope)
174{
175 UNUSED_PARAM(throwScope);
176 UNUSED_PARAM(state);
177 auto& impl = thisObject.wrapped();
178 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.getNameAttribute());
179 return result;
180}
181
182EncodedJSValue jsHTMLParamElementName(ExecState* state, EncodedJSValue thisValue, PropertyName)
183{
184 return IDLAttribute<JSHTMLParamElement>::get<jsHTMLParamElementNameGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "name");
185}
186
187static inline bool setJSHTMLParamElementNameSetter(ExecState& state, JSHTMLParamElement& thisObject, JSValue value, ThrowScope& throwScope)
188{
189 UNUSED_PARAM(throwScope);
190 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
191 auto& impl = thisObject.wrapped();
192 auto nativeValue = convert<IDLDOMString>(state, value);
193 RETURN_IF_EXCEPTION(throwScope, false);
194 AttributeSetter::call(state, throwScope, [&] {
195 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::nameAttr, WTFMove(nativeValue));
196 });
197 return true;
198}
199
200bool setJSHTMLParamElementName(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
201{
202 return IDLAttribute<JSHTMLParamElement>::set<setJSHTMLParamElementNameSetter>(*state, thisValue, encodedValue, "name");
203}
204
205static inline JSValue jsHTMLParamElementTypeGetter(ExecState& state, JSHTMLParamElement& thisObject, ThrowScope& throwScope)
206{
207 UNUSED_PARAM(throwScope);
208 UNUSED_PARAM(state);
209 auto& impl = thisObject.wrapped();
210 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::typeAttr));
211 return result;
212}
213
214EncodedJSValue jsHTMLParamElementType(ExecState* state, EncodedJSValue thisValue, PropertyName)
215{
216 return IDLAttribute<JSHTMLParamElement>::get<jsHTMLParamElementTypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "type");
217}
218
219static inline bool setJSHTMLParamElementTypeSetter(ExecState& state, JSHTMLParamElement& thisObject, JSValue value, ThrowScope& throwScope)
220{
221 UNUSED_PARAM(throwScope);
222 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
223 auto& impl = thisObject.wrapped();
224 auto nativeValue = convert<IDLDOMString>(state, value);
225 RETURN_IF_EXCEPTION(throwScope, false);
226 AttributeSetter::call(state, throwScope, [&] {
227 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::typeAttr, WTFMove(nativeValue));
228 });
229 return true;
230}
231
232bool setJSHTMLParamElementType(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
233{
234 return IDLAttribute<JSHTMLParamElement>::set<setJSHTMLParamElementTypeSetter>(*state, thisValue, encodedValue, "type");
235}
236
237static inline JSValue jsHTMLParamElementValueGetter(ExecState& state, JSHTMLParamElement& thisObject, ThrowScope& throwScope)
238{
239 UNUSED_PARAM(throwScope);
240 UNUSED_PARAM(state);
241 auto& impl = thisObject.wrapped();
242 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::valueAttr));
243 return result;
244}
245
246EncodedJSValue jsHTMLParamElementValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
247{
248 return IDLAttribute<JSHTMLParamElement>::get<jsHTMLParamElementValueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "value");
249}
250
251static inline bool setJSHTMLParamElementValueSetter(ExecState& state, JSHTMLParamElement& thisObject, JSValue value, ThrowScope& throwScope)
252{
253 UNUSED_PARAM(throwScope);
254 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
255 auto& impl = thisObject.wrapped();
256 auto nativeValue = convert<IDLDOMString>(state, value);
257 RETURN_IF_EXCEPTION(throwScope, false);
258 AttributeSetter::call(state, throwScope, [&] {
259 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::valueAttr, WTFMove(nativeValue));
260 });
261 return true;
262}
263
264bool setJSHTMLParamElementValue(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
265{
266 return IDLAttribute<JSHTMLParamElement>::set<setJSHTMLParamElementValueSetter>(*state, thisValue, encodedValue, "value");
267}
268
269static inline JSValue jsHTMLParamElementValueTypeGetter(ExecState& state, JSHTMLParamElement& thisObject, ThrowScope& throwScope)
270{
271 UNUSED_PARAM(throwScope);
272 UNUSED_PARAM(state);
273 auto& impl = thisObject.wrapped();
274 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::valuetypeAttr));
275 return result;
276}
277
278EncodedJSValue jsHTMLParamElementValueType(ExecState* state, EncodedJSValue thisValue, PropertyName)
279{
280 return IDLAttribute<JSHTMLParamElement>::get<jsHTMLParamElementValueTypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "valueType");
281}
282
283static inline bool setJSHTMLParamElementValueTypeSetter(ExecState& state, JSHTMLParamElement& thisObject, JSValue value, ThrowScope& throwScope)
284{
285 UNUSED_PARAM(throwScope);
286 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
287 auto& impl = thisObject.wrapped();
288 auto nativeValue = convert<IDLDOMString>(state, value);
289 RETURN_IF_EXCEPTION(throwScope, false);
290 AttributeSetter::call(state, throwScope, [&] {
291 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::valuetypeAttr, WTFMove(nativeValue));
292 });
293 return true;
294}
295
296bool setJSHTMLParamElementValueType(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
297{
298 return IDLAttribute<JSHTMLParamElement>::set<setJSHTMLParamElementValueTypeSetter>(*state, thisValue, encodedValue, "valueType");
299}
300
301void JSHTMLParamElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
302{
303 auto* thisObject = jsCast<JSHTMLParamElement*>(cell);
304 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
305 if (thisObject->scriptExecutionContext())
306 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
307 Base::heapSnapshot(cell, builder);
308}
309
310
311}
312