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 "JSHTMLButtonElement.h"
23
24#include "CustomElementReactionQueue.h"
25#include "HTMLNames.h"
26#include "JSDOMAttribute.h"
27#include "JSDOMBinding.h"
28#include "JSDOMConstructorNotConstructable.h"
29#include "JSDOMConvertBoolean.h"
30#include "JSDOMConvertInterface.h"
31#include "JSDOMConvertStrings.h"
32#include "JSDOMExceptionHandling.h"
33#include "JSDOMGlobalObject.h"
34#include "JSDOMOperation.h"
35#include "JSDOMWrapperCache.h"
36#include "JSHTMLFormElement.h"
37#include "JSNodeList.h"
38#include "JSValidityState.h"
39#include "RuntimeEnabledFeatures.h"
40#include "ScriptExecutionContext.h"
41#include <JavaScriptCore/HeapSnapshotBuilder.h>
42#include <JavaScriptCore/JSCInlines.h>
43#include <wtf/GetPtr.h>
44#include <wtf/PointerPreparations.h>
45#include <wtf/URL.h>
46
47
48namespace WebCore {
49using namespace JSC;
50
51// Functions
52
53JSC::EncodedJSValue JSC_HOST_CALL jsHTMLButtonElementPrototypeFunctionCheckValidity(JSC::ExecState*);
54JSC::EncodedJSValue JSC_HOST_CALL jsHTMLButtonElementPrototypeFunctionReportValidity(JSC::ExecState*);
55JSC::EncodedJSValue JSC_HOST_CALL jsHTMLButtonElementPrototypeFunctionSetCustomValidity(JSC::ExecState*);
56
57// Attributes
58
59JSC::EncodedJSValue jsHTMLButtonElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
60bool setJSHTMLButtonElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
61JSC::EncodedJSValue jsHTMLButtonElementAutofocus(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
62bool setJSHTMLButtonElementAutofocus(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
63JSC::EncodedJSValue jsHTMLButtonElementDisabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
64bool setJSHTMLButtonElementDisabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
65JSC::EncodedJSValue jsHTMLButtonElementForm(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
66JSC::EncodedJSValue jsHTMLButtonElementFormAction(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
67bool setJSHTMLButtonElementFormAction(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
68JSC::EncodedJSValue jsHTMLButtonElementFormEnctype(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
69bool setJSHTMLButtonElementFormEnctype(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
70JSC::EncodedJSValue jsHTMLButtonElementFormMethod(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
71bool setJSHTMLButtonElementFormMethod(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
72JSC::EncodedJSValue jsHTMLButtonElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
73bool setJSHTMLButtonElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
74JSC::EncodedJSValue jsHTMLButtonElementFormNoValidate(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
75bool setJSHTMLButtonElementFormNoValidate(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
76JSC::EncodedJSValue jsHTMLButtonElementFormTarget(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
77bool setJSHTMLButtonElementFormTarget(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
78JSC::EncodedJSValue jsHTMLButtonElementName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
79bool setJSHTMLButtonElementName(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
80JSC::EncodedJSValue jsHTMLButtonElementValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
81bool setJSHTMLButtonElementValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
82JSC::EncodedJSValue jsHTMLButtonElementWillValidate(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
83JSC::EncodedJSValue jsHTMLButtonElementValidity(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
84JSC::EncodedJSValue jsHTMLButtonElementValidationMessage(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
85JSC::EncodedJSValue jsHTMLButtonElementLabels(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
86
87class JSHTMLButtonElementPrototype : public JSC::JSNonFinalObject {
88public:
89 using Base = JSC::JSNonFinalObject;
90 static JSHTMLButtonElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
91 {
92 JSHTMLButtonElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLButtonElementPrototype>(vm.heap)) JSHTMLButtonElementPrototype(vm, globalObject, structure);
93 ptr->finishCreation(vm);
94 return ptr;
95 }
96
97 DECLARE_INFO;
98 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
99 {
100 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
101 }
102
103private:
104 JSHTMLButtonElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
105 : JSC::JSNonFinalObject(vm, structure)
106 {
107 }
108
109 void finishCreation(JSC::VM&);
110};
111
112using JSHTMLButtonElementConstructor = JSDOMConstructorNotConstructable<JSHTMLButtonElement>;
113
114template<> JSValue JSHTMLButtonElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
115{
116 return JSHTMLElement::getConstructor(vm, &globalObject);
117}
118
119template<> void JSHTMLButtonElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
120{
121 putDirect(vm, vm.propertyNames->prototype, JSHTMLButtonElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
122 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLButtonElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
123 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
124}
125
126template<> const ClassInfo JSHTMLButtonElementConstructor::s_info = { "HTMLButtonElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLButtonElementConstructor) };
127
128/* Hash table for prototype */
129
130static const HashTableValue JSHTMLButtonElementPrototypeTableValues[] =
131{
132 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLButtonElementConstructor) } },
133 { "autofocus", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementAutofocus), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLButtonElementAutofocus) } },
134 { "disabled", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementDisabled), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLButtonElementDisabled) } },
135 { "form", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementForm), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
136 { "formAction", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementFormAction), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLButtonElementFormAction) } },
137 { "formEnctype", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementFormEnctype), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLButtonElementFormEnctype) } },
138 { "formMethod", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementFormMethod), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLButtonElementFormMethod) } },
139 { "type", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLButtonElementType) } },
140 { "formNoValidate", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementFormNoValidate), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLButtonElementFormNoValidate) } },
141 { "formTarget", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementFormTarget), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLButtonElementFormTarget) } },
142 { "name", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLButtonElementName) } },
143 { "value", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLButtonElementValue) } },
144 { "willValidate", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementWillValidate), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
145 { "validity", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementValidity), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
146 { "validationMessage", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementValidationMessage), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
147 { "labels", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLButtonElementLabels), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
148 { "checkValidity", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLButtonElementPrototypeFunctionCheckValidity), (intptr_t) (0) } },
149 { "reportValidity", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLButtonElementPrototypeFunctionReportValidity), (intptr_t) (0) } },
150 { "setCustomValidity", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLButtonElementPrototypeFunctionSetCustomValidity), (intptr_t) (1) } },
151};
152
153const ClassInfo JSHTMLButtonElementPrototype::s_info = { "HTMLButtonElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLButtonElementPrototype) };
154
155void JSHTMLButtonElementPrototype::finishCreation(VM& vm)
156{
157 Base::finishCreation(vm);
158 reifyStaticProperties(vm, JSHTMLButtonElement::info(), JSHTMLButtonElementPrototypeTableValues, *this);
159 bool hasDisabledRuntimeProperties = false;
160 if (!RuntimeEnabledFeatures::sharedFeatures().interactiveFormValidationEnabled()) {
161 hasDisabledRuntimeProperties = true;
162 auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("reportValidity"), strlen("reportValidity"));
163 VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
164 JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
165 }
166 if (hasDisabledRuntimeProperties && structure()->isDictionary())
167 flattenDictionaryObject(vm);
168}
169
170const ClassInfo JSHTMLButtonElement::s_info = { "HTMLButtonElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLButtonElement) };
171
172JSHTMLButtonElement::JSHTMLButtonElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLButtonElement>&& impl)
173 : JSHTMLElement(structure, globalObject, WTFMove(impl))
174{
175}
176
177void JSHTMLButtonElement::finishCreation(VM& vm)
178{
179 Base::finishCreation(vm);
180 ASSERT(inherits(vm, info()));
181
182}
183
184JSObject* JSHTMLButtonElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
185{
186 return JSHTMLButtonElementPrototype::create(vm, &globalObject, JSHTMLButtonElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject)));
187}
188
189JSObject* JSHTMLButtonElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
190{
191 return getDOMPrototype<JSHTMLButtonElement>(vm, globalObject);
192}
193
194JSValue JSHTMLButtonElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
195{
196 return getDOMConstructor<JSHTMLButtonElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
197}
198
199template<> inline JSHTMLButtonElement* IDLAttribute<JSHTMLButtonElement>::cast(ExecState& state, EncodedJSValue thisValue)
200{
201 return jsDynamicCast<JSHTMLButtonElement*>(state.vm(), JSValue::decode(thisValue));
202}
203
204template<> inline JSHTMLButtonElement* IDLOperation<JSHTMLButtonElement>::cast(ExecState& state)
205{
206 return jsDynamicCast<JSHTMLButtonElement*>(state.vm(), state.thisValue());
207}
208
209EncodedJSValue jsHTMLButtonElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
210{
211 VM& vm = state->vm();
212 auto throwScope = DECLARE_THROW_SCOPE(vm);
213 auto* prototype = jsDynamicCast<JSHTMLButtonElementPrototype*>(vm, JSValue::decode(thisValue));
214 if (UNLIKELY(!prototype))
215 return throwVMTypeError(state, throwScope);
216 return JSValue::encode(JSHTMLButtonElement::getConstructor(state->vm(), prototype->globalObject()));
217}
218
219bool setJSHTMLButtonElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
220{
221 VM& vm = state->vm();
222 auto throwScope = DECLARE_THROW_SCOPE(vm);
223 auto* prototype = jsDynamicCast<JSHTMLButtonElementPrototype*>(vm, JSValue::decode(thisValue));
224 if (UNLIKELY(!prototype)) {
225 throwVMTypeError(state, throwScope);
226 return false;
227 }
228 // Shadowing a built-in constructor
229 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
230}
231
232static inline JSValue jsHTMLButtonElementAutofocusGetter(ExecState& state, JSHTMLButtonElement& thisObject, ThrowScope& throwScope)
233{
234 UNUSED_PARAM(throwScope);
235 UNUSED_PARAM(state);
236 auto& impl = thisObject.wrapped();
237 JSValue result = toJS<IDLBoolean>(state, throwScope, impl.hasAttributeWithoutSynchronization(WebCore::HTMLNames::autofocusAttr));
238 return result;
239}
240
241EncodedJSValue jsHTMLButtonElementAutofocus(ExecState* state, EncodedJSValue thisValue, PropertyName)
242{
243 return IDLAttribute<JSHTMLButtonElement>::get<jsHTMLButtonElementAutofocusGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "autofocus");
244}
245
246static inline bool setJSHTMLButtonElementAutofocusSetter(ExecState& state, JSHTMLButtonElement& thisObject, JSValue value, ThrowScope& throwScope)
247{
248 UNUSED_PARAM(throwScope);
249 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
250 auto& impl = thisObject.wrapped();
251 auto nativeValue = convert<IDLBoolean>(state, value);
252 RETURN_IF_EXCEPTION(throwScope, false);
253 AttributeSetter::call(state, throwScope, [&] {
254 return impl.setBooleanAttribute(WebCore::HTMLNames::autofocusAttr, WTFMove(nativeValue));
255 });
256 return true;
257}
258
259bool setJSHTMLButtonElementAutofocus(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
260{
261 return IDLAttribute<JSHTMLButtonElement>::set<setJSHTMLButtonElementAutofocusSetter>(*state, thisValue, encodedValue, "autofocus");
262}
263
264static inline JSValue jsHTMLButtonElementDisabledGetter(ExecState& state, JSHTMLButtonElement& thisObject, ThrowScope& throwScope)
265{
266 UNUSED_PARAM(throwScope);
267 UNUSED_PARAM(state);
268 auto& impl = thisObject.wrapped();
269 JSValue result = toJS<IDLBoolean>(state, throwScope, impl.hasAttributeWithoutSynchronization(WebCore::HTMLNames::disabledAttr));
270 return result;
271}
272
273EncodedJSValue jsHTMLButtonElementDisabled(ExecState* state, EncodedJSValue thisValue, PropertyName)
274{
275 return IDLAttribute<JSHTMLButtonElement>::get<jsHTMLButtonElementDisabledGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "disabled");
276}
277
278static inline bool setJSHTMLButtonElementDisabledSetter(ExecState& state, JSHTMLButtonElement& thisObject, JSValue value, ThrowScope& throwScope)
279{
280 UNUSED_PARAM(throwScope);
281 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
282 auto& impl = thisObject.wrapped();
283 auto nativeValue = convert<IDLBoolean>(state, value);
284 RETURN_IF_EXCEPTION(throwScope, false);
285 AttributeSetter::call(state, throwScope, [&] {
286 return impl.setBooleanAttribute(WebCore::HTMLNames::disabledAttr, WTFMove(nativeValue));
287 });
288 return true;
289}
290
291bool setJSHTMLButtonElementDisabled(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
292{
293 return IDLAttribute<JSHTMLButtonElement>::set<setJSHTMLButtonElementDisabledSetter>(*state, thisValue, encodedValue, "disabled");
294}
295
296static inline JSValue jsHTMLButtonElementFormGetter(ExecState& state, JSHTMLButtonElement& thisObject, ThrowScope& throwScope)
297{
298 UNUSED_PARAM(throwScope);
299 UNUSED_PARAM(state);
300 auto& impl = thisObject.wrapped();
301 JSValue result = toJS<IDLInterface<HTMLFormElement>>(state, *thisObject.globalObject(), throwScope, impl.form());
302 return result;
303}
304
305EncodedJSValue jsHTMLButtonElementForm(ExecState* state, EncodedJSValue thisValue, PropertyName)
306{
307 return IDLAttribute<JSHTMLButtonElement>::get<jsHTMLButtonElementFormGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "form");
308}
309
310static inline JSValue jsHTMLButtonElementFormActionGetter(ExecState& state, JSHTMLButtonElement& thisObject, ThrowScope& throwScope)
311{
312 UNUSED_PARAM(throwScope);
313 UNUSED_PARAM(state);
314 auto& impl = thisObject.wrapped();
315 JSValue result = toJS<IDLUSVString>(state, throwScope, impl.formAction());
316 return result;
317}
318
319EncodedJSValue jsHTMLButtonElementFormAction(ExecState* state, EncodedJSValue thisValue, PropertyName)
320{
321 return IDLAttribute<JSHTMLButtonElement>::get<jsHTMLButtonElementFormActionGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "formAction");
322}
323
324static inline bool setJSHTMLButtonElementFormActionSetter(ExecState& state, JSHTMLButtonElement& thisObject, JSValue value, ThrowScope& throwScope)
325{
326 UNUSED_PARAM(throwScope);
327 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
328 auto& impl = thisObject.wrapped();
329 auto nativeValue = convert<IDLUSVString>(state, value);
330 RETURN_IF_EXCEPTION(throwScope, false);
331 AttributeSetter::call(state, throwScope, [&] {
332 return impl.setFormAction(WTFMove(nativeValue));
333 });
334 return true;
335}
336
337bool setJSHTMLButtonElementFormAction(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
338{
339 return IDLAttribute<JSHTMLButtonElement>::set<setJSHTMLButtonElementFormActionSetter>(*state, thisValue, encodedValue, "formAction");
340}
341
342static inline JSValue jsHTMLButtonElementFormEnctypeGetter(ExecState& state, JSHTMLButtonElement& thisObject, ThrowScope& throwScope)
343{
344 UNUSED_PARAM(throwScope);
345 UNUSED_PARAM(state);
346 auto& impl = thisObject.wrapped();
347 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.formEnctype());
348 return result;
349}
350
351EncodedJSValue jsHTMLButtonElementFormEnctype(ExecState* state, EncodedJSValue thisValue, PropertyName)
352{
353 return IDLAttribute<JSHTMLButtonElement>::get<jsHTMLButtonElementFormEnctypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "formEnctype");
354}
355
356static inline bool setJSHTMLButtonElementFormEnctypeSetter(ExecState& state, JSHTMLButtonElement& thisObject, JSValue value, ThrowScope& throwScope)
357{
358 UNUSED_PARAM(throwScope);
359 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
360 auto& impl = thisObject.wrapped();
361 auto nativeValue = convert<IDLDOMString>(state, value);
362 RETURN_IF_EXCEPTION(throwScope, false);
363 AttributeSetter::call(state, throwScope, [&] {
364 return impl.setFormEnctype(WTFMove(nativeValue));
365 });
366 return true;
367}
368
369bool setJSHTMLButtonElementFormEnctype(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
370{
371 return IDLAttribute<JSHTMLButtonElement>::set<setJSHTMLButtonElementFormEnctypeSetter>(*state, thisValue, encodedValue, "formEnctype");
372}
373
374static inline JSValue jsHTMLButtonElementFormMethodGetter(ExecState& state, JSHTMLButtonElement& thisObject, ThrowScope& throwScope)
375{
376 UNUSED_PARAM(throwScope);
377 UNUSED_PARAM(state);
378 auto& impl = thisObject.wrapped();
379 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.formMethod());
380 return result;
381}
382
383EncodedJSValue jsHTMLButtonElementFormMethod(ExecState* state, EncodedJSValue thisValue, PropertyName)
384{
385 return IDLAttribute<JSHTMLButtonElement>::get<jsHTMLButtonElementFormMethodGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "formMethod");
386}
387
388static inline bool setJSHTMLButtonElementFormMethodSetter(ExecState& state, JSHTMLButtonElement& thisObject, JSValue value, ThrowScope& throwScope)
389{
390 UNUSED_PARAM(throwScope);
391 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
392 auto& impl = thisObject.wrapped();
393 auto nativeValue = convert<IDLDOMString>(state, value);
394 RETURN_IF_EXCEPTION(throwScope, false);
395 AttributeSetter::call(state, throwScope, [&] {
396 return impl.setFormMethod(WTFMove(nativeValue));
397 });
398 return true;
399}
400
401bool setJSHTMLButtonElementFormMethod(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
402{
403 return IDLAttribute<JSHTMLButtonElement>::set<setJSHTMLButtonElementFormMethodSetter>(*state, thisValue, encodedValue, "formMethod");
404}
405
406static inline JSValue jsHTMLButtonElementTypeGetter(ExecState& state, JSHTMLButtonElement& thisObject, ThrowScope& throwScope)
407{
408 UNUSED_PARAM(throwScope);
409 UNUSED_PARAM(state);
410 auto& impl = thisObject.wrapped();
411 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.type());
412 return result;
413}
414
415EncodedJSValue jsHTMLButtonElementType(ExecState* state, EncodedJSValue thisValue, PropertyName)
416{
417 return IDLAttribute<JSHTMLButtonElement>::get<jsHTMLButtonElementTypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "type");
418}
419
420static inline bool setJSHTMLButtonElementTypeSetter(ExecState& state, JSHTMLButtonElement& thisObject, JSValue value, ThrowScope& throwScope)
421{
422 UNUSED_PARAM(throwScope);
423 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
424 auto& impl = thisObject.wrapped();
425 auto nativeValue = convert<IDLDOMString>(state, value);
426 RETURN_IF_EXCEPTION(throwScope, false);
427 AttributeSetter::call(state, throwScope, [&] {
428 return impl.setType(WTFMove(nativeValue));
429 });
430 return true;
431}
432
433bool setJSHTMLButtonElementType(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
434{
435 return IDLAttribute<JSHTMLButtonElement>::set<setJSHTMLButtonElementTypeSetter>(*state, thisValue, encodedValue, "type");
436}
437
438static inline JSValue jsHTMLButtonElementFormNoValidateGetter(ExecState& state, JSHTMLButtonElement& thisObject, ThrowScope& throwScope)
439{
440 UNUSED_PARAM(throwScope);
441 UNUSED_PARAM(state);
442 auto& impl = thisObject.wrapped();
443 JSValue result = toJS<IDLBoolean>(state, throwScope, impl.hasAttributeWithoutSynchronization(WebCore::HTMLNames::formnovalidateAttr));
444 return result;
445}
446
447EncodedJSValue jsHTMLButtonElementFormNoValidate(ExecState* state, EncodedJSValue thisValue, PropertyName)
448{
449 return IDLAttribute<JSHTMLButtonElement>::get<jsHTMLButtonElementFormNoValidateGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "formNoValidate");
450}
451
452static inline bool setJSHTMLButtonElementFormNoValidateSetter(ExecState& state, JSHTMLButtonElement& thisObject, JSValue value, ThrowScope& throwScope)
453{
454 UNUSED_PARAM(throwScope);
455 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
456 auto& impl = thisObject.wrapped();
457 auto nativeValue = convert<IDLBoolean>(state, value);
458 RETURN_IF_EXCEPTION(throwScope, false);
459 AttributeSetter::call(state, throwScope, [&] {
460 return impl.setBooleanAttribute(WebCore::HTMLNames::formnovalidateAttr, WTFMove(nativeValue));
461 });
462 return true;
463}
464
465bool setJSHTMLButtonElementFormNoValidate(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
466{
467 return IDLAttribute<JSHTMLButtonElement>::set<setJSHTMLButtonElementFormNoValidateSetter>(*state, thisValue, encodedValue, "formNoValidate");
468}
469
470static inline JSValue jsHTMLButtonElementFormTargetGetter(ExecState& state, JSHTMLButtonElement& thisObject, ThrowScope& throwScope)
471{
472 UNUSED_PARAM(throwScope);
473 UNUSED_PARAM(state);
474 auto& impl = thisObject.wrapped();
475 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::formtargetAttr));
476 return result;
477}
478
479EncodedJSValue jsHTMLButtonElementFormTarget(ExecState* state, EncodedJSValue thisValue, PropertyName)
480{
481 return IDLAttribute<JSHTMLButtonElement>::get<jsHTMLButtonElementFormTargetGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "formTarget");
482}
483
484static inline bool setJSHTMLButtonElementFormTargetSetter(ExecState& state, JSHTMLButtonElement& thisObject, JSValue value, ThrowScope& throwScope)
485{
486 UNUSED_PARAM(throwScope);
487 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
488 auto& impl = thisObject.wrapped();
489 auto nativeValue = convert<IDLDOMString>(state, value);
490 RETURN_IF_EXCEPTION(throwScope, false);
491 AttributeSetter::call(state, throwScope, [&] {
492 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::formtargetAttr, WTFMove(nativeValue));
493 });
494 return true;
495}
496
497bool setJSHTMLButtonElementFormTarget(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
498{
499 return IDLAttribute<JSHTMLButtonElement>::set<setJSHTMLButtonElementFormTargetSetter>(*state, thisValue, encodedValue, "formTarget");
500}
501
502static inline JSValue jsHTMLButtonElementNameGetter(ExecState& state, JSHTMLButtonElement& thisObject, ThrowScope& throwScope)
503{
504 UNUSED_PARAM(throwScope);
505 UNUSED_PARAM(state);
506 auto& impl = thisObject.wrapped();
507 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.getNameAttribute());
508 return result;
509}
510
511EncodedJSValue jsHTMLButtonElementName(ExecState* state, EncodedJSValue thisValue, PropertyName)
512{
513 return IDLAttribute<JSHTMLButtonElement>::get<jsHTMLButtonElementNameGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "name");
514}
515
516static inline bool setJSHTMLButtonElementNameSetter(ExecState& state, JSHTMLButtonElement& thisObject, JSValue value, ThrowScope& throwScope)
517{
518 UNUSED_PARAM(throwScope);
519 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
520 auto& impl = thisObject.wrapped();
521 auto nativeValue = convert<IDLDOMString>(state, value);
522 RETURN_IF_EXCEPTION(throwScope, false);
523 AttributeSetter::call(state, throwScope, [&] {
524 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::nameAttr, WTFMove(nativeValue));
525 });
526 return true;
527}
528
529bool setJSHTMLButtonElementName(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
530{
531 return IDLAttribute<JSHTMLButtonElement>::set<setJSHTMLButtonElementNameSetter>(*state, thisValue, encodedValue, "name");
532}
533
534static inline JSValue jsHTMLButtonElementValueGetter(ExecState& state, JSHTMLButtonElement& thisObject, ThrowScope& throwScope)
535{
536 UNUSED_PARAM(throwScope);
537 UNUSED_PARAM(state);
538 auto& impl = thisObject.wrapped();
539 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::valueAttr));
540 return result;
541}
542
543EncodedJSValue jsHTMLButtonElementValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
544{
545 return IDLAttribute<JSHTMLButtonElement>::get<jsHTMLButtonElementValueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "value");
546}
547
548static inline bool setJSHTMLButtonElementValueSetter(ExecState& state, JSHTMLButtonElement& thisObject, JSValue value, ThrowScope& throwScope)
549{
550 UNUSED_PARAM(throwScope);
551 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
552 auto& impl = thisObject.wrapped();
553 auto nativeValue = convert<IDLDOMString>(state, value);
554 RETURN_IF_EXCEPTION(throwScope, false);
555 AttributeSetter::call(state, throwScope, [&] {
556 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::valueAttr, WTFMove(nativeValue));
557 });
558 return true;
559}
560
561bool setJSHTMLButtonElementValue(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
562{
563 return IDLAttribute<JSHTMLButtonElement>::set<setJSHTMLButtonElementValueSetter>(*state, thisValue, encodedValue, "value");
564}
565
566static inline JSValue jsHTMLButtonElementWillValidateGetter(ExecState& state, JSHTMLButtonElement& thisObject, ThrowScope& throwScope)
567{
568 UNUSED_PARAM(throwScope);
569 UNUSED_PARAM(state);
570 auto& impl = thisObject.wrapped();
571 JSValue result = toJS<IDLBoolean>(state, throwScope, impl.willValidate());
572 return result;
573}
574
575EncodedJSValue jsHTMLButtonElementWillValidate(ExecState* state, EncodedJSValue thisValue, PropertyName)
576{
577 return IDLAttribute<JSHTMLButtonElement>::get<jsHTMLButtonElementWillValidateGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "willValidate");
578}
579
580static inline JSValue jsHTMLButtonElementValidityGetter(ExecState& state, JSHTMLButtonElement& thisObject, ThrowScope& throwScope)
581{
582 UNUSED_PARAM(throwScope);
583 UNUSED_PARAM(state);
584 auto& impl = thisObject.wrapped();
585 JSValue result = toJS<IDLInterface<ValidityState>>(state, *thisObject.globalObject(), throwScope, impl.validity());
586 return result;
587}
588
589EncodedJSValue jsHTMLButtonElementValidity(ExecState* state, EncodedJSValue thisValue, PropertyName)
590{
591 return IDLAttribute<JSHTMLButtonElement>::get<jsHTMLButtonElementValidityGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "validity");
592}
593
594static inline JSValue jsHTMLButtonElementValidationMessageGetter(ExecState& state, JSHTMLButtonElement& thisObject, ThrowScope& throwScope)
595{
596 UNUSED_PARAM(throwScope);
597 UNUSED_PARAM(state);
598 auto& impl = thisObject.wrapped();
599 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.validationMessage());
600 return result;
601}
602
603EncodedJSValue jsHTMLButtonElementValidationMessage(ExecState* state, EncodedJSValue thisValue, PropertyName)
604{
605 return IDLAttribute<JSHTMLButtonElement>::get<jsHTMLButtonElementValidationMessageGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "validationMessage");
606}
607
608static inline JSValue jsHTMLButtonElementLabelsGetter(ExecState& state, JSHTMLButtonElement& thisObject, ThrowScope& throwScope)
609{
610 UNUSED_PARAM(throwScope);
611 UNUSED_PARAM(state);
612 auto& impl = thisObject.wrapped();
613 JSValue result = toJS<IDLInterface<NodeList>>(state, *thisObject.globalObject(), throwScope, impl.labels());
614 return result;
615}
616
617EncodedJSValue jsHTMLButtonElementLabels(ExecState* state, EncodedJSValue thisValue, PropertyName)
618{
619 return IDLAttribute<JSHTMLButtonElement>::get<jsHTMLButtonElementLabelsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "labels");
620}
621
622static inline JSC::EncodedJSValue jsHTMLButtonElementPrototypeFunctionCheckValidityBody(JSC::ExecState* state, typename IDLOperation<JSHTMLButtonElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
623{
624 UNUSED_PARAM(state);
625 UNUSED_PARAM(throwScope);
626 auto& impl = castedThis->wrapped();
627 return JSValue::encode(toJS<IDLBoolean>(impl.checkValidity()));
628}
629
630EncodedJSValue JSC_HOST_CALL jsHTMLButtonElementPrototypeFunctionCheckValidity(ExecState* state)
631{
632 return IDLOperation<JSHTMLButtonElement>::call<jsHTMLButtonElementPrototypeFunctionCheckValidityBody>(*state, "checkValidity");
633}
634
635static inline JSC::EncodedJSValue jsHTMLButtonElementPrototypeFunctionReportValidityBody(JSC::ExecState* state, typename IDLOperation<JSHTMLButtonElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
636{
637 UNUSED_PARAM(state);
638 UNUSED_PARAM(throwScope);
639 auto& impl = castedThis->wrapped();
640 return JSValue::encode(toJS<IDLBoolean>(impl.reportValidity()));
641}
642
643EncodedJSValue JSC_HOST_CALL jsHTMLButtonElementPrototypeFunctionReportValidity(ExecState* state)
644{
645 return IDLOperation<JSHTMLButtonElement>::call<jsHTMLButtonElementPrototypeFunctionReportValidityBody>(*state, "reportValidity");
646}
647
648static inline JSC::EncodedJSValue jsHTMLButtonElementPrototypeFunctionSetCustomValidityBody(JSC::ExecState* state, typename IDLOperation<JSHTMLButtonElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
649{
650 UNUSED_PARAM(state);
651 UNUSED_PARAM(throwScope);
652 auto& impl = castedThis->wrapped();
653 if (UNLIKELY(state->argumentCount() < 1))
654 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
655 auto error = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
656 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
657 impl.setCustomValidity(WTFMove(error));
658 return JSValue::encode(jsUndefined());
659}
660
661EncodedJSValue JSC_HOST_CALL jsHTMLButtonElementPrototypeFunctionSetCustomValidity(ExecState* state)
662{
663 return IDLOperation<JSHTMLButtonElement>::call<jsHTMLButtonElementPrototypeFunctionSetCustomValidityBody>(*state, "setCustomValidity");
664}
665
666void JSHTMLButtonElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
667{
668 auto* thisObject = jsCast<JSHTMLButtonElement*>(cell);
669 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
670 if (thisObject->scriptExecutionContext())
671 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
672 Base::heapSnapshot(cell, builder);
673}
674
675
676}
677