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 "JSHTMLFormElement.h"
23
24#include "CustomElementReactionQueue.h"
25#include "HTMLNames.h"
26#include "JSDOMAbstractOperations.h"
27#include "JSDOMAttribute.h"
28#include "JSDOMBinding.h"
29#include "JSDOMConstructorNotConstructable.h"
30#include "JSDOMConvertBoolean.h"
31#include "JSDOMConvertInterface.h"
32#include "JSDOMConvertNullable.h"
33#include "JSDOMConvertNumbers.h"
34#include "JSDOMConvertStrings.h"
35#include "JSDOMConvertUnion.h"
36#include "JSDOMExceptionHandling.h"
37#include "JSDOMGlobalObject.h"
38#include "JSDOMOperation.h"
39#include "JSDOMWrapperCache.h"
40#include "JSElement.h"
41#include "JSHTMLFormControlsCollection.h"
42#include "JSRadioNodeList.h"
43#include "RuntimeEnabledFeatures.h"
44#include "ScriptExecutionContext.h"
45#include <JavaScriptCore/ArrayPrototype.h>
46#include <JavaScriptCore/BuiltinNames.h>
47#include <JavaScriptCore/HeapSnapshotBuilder.h>
48#include <JavaScriptCore/JSCInlines.h>
49#include <JavaScriptCore/PropertyNameArray.h>
50#include <wtf/GetPtr.h>
51#include <wtf/PointerPreparations.h>
52#include <wtf/URL.h>
53#include <wtf/Variant.h>
54
55
56namespace WebCore {
57using namespace JSC;
58
59// Functions
60
61JSC::EncodedJSValue JSC_HOST_CALL jsHTMLFormElementPrototypeFunctionSubmit(JSC::ExecState*);
62JSC::EncodedJSValue JSC_HOST_CALL jsHTMLFormElementPrototypeFunctionReset(JSC::ExecState*);
63JSC::EncodedJSValue JSC_HOST_CALL jsHTMLFormElementPrototypeFunctionCheckValidity(JSC::ExecState*);
64JSC::EncodedJSValue JSC_HOST_CALL jsHTMLFormElementPrototypeFunctionReportValidity(JSC::ExecState*);
65
66// Attributes
67
68JSC::EncodedJSValue jsHTMLFormElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
69bool setJSHTMLFormElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
70JSC::EncodedJSValue jsHTMLFormElementAcceptCharset(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
71bool setJSHTMLFormElementAcceptCharset(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
72JSC::EncodedJSValue jsHTMLFormElementAction(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
73bool setJSHTMLFormElementAction(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
74JSC::EncodedJSValue jsHTMLFormElementAutocomplete(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
75bool setJSHTMLFormElementAutocomplete(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
76JSC::EncodedJSValue jsHTMLFormElementEnctype(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
77bool setJSHTMLFormElementEnctype(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
78JSC::EncodedJSValue jsHTMLFormElementEncoding(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
79bool setJSHTMLFormElementEncoding(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
80JSC::EncodedJSValue jsHTMLFormElementMethod(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
81bool setJSHTMLFormElementMethod(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
82JSC::EncodedJSValue jsHTMLFormElementName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
83bool setJSHTMLFormElementName(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
84JSC::EncodedJSValue jsHTMLFormElementNoValidate(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
85bool setJSHTMLFormElementNoValidate(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
86JSC::EncodedJSValue jsHTMLFormElementTarget(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
87bool setJSHTMLFormElementTarget(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
88JSC::EncodedJSValue jsHTMLFormElementElements(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
89JSC::EncodedJSValue jsHTMLFormElementLength(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
90
91class JSHTMLFormElementPrototype : public JSC::JSNonFinalObject {
92public:
93 using Base = JSC::JSNonFinalObject;
94 static JSHTMLFormElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
95 {
96 JSHTMLFormElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLFormElementPrototype>(vm.heap)) JSHTMLFormElementPrototype(vm, globalObject, structure);
97 ptr->finishCreation(vm);
98 return ptr;
99 }
100
101 DECLARE_INFO;
102 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
103 {
104 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
105 }
106
107private:
108 JSHTMLFormElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
109 : JSC::JSNonFinalObject(vm, structure)
110 {
111 }
112
113 void finishCreation(JSC::VM&);
114};
115
116using JSHTMLFormElementConstructor = JSDOMConstructorNotConstructable<JSHTMLFormElement>;
117
118template<> JSValue JSHTMLFormElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
119{
120 return JSHTMLElement::getConstructor(vm, &globalObject);
121}
122
123template<> void JSHTMLFormElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
124{
125 putDirect(vm, vm.propertyNames->prototype, JSHTMLFormElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
126 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLFormElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
127 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
128}
129
130template<> const ClassInfo JSHTMLFormElementConstructor::s_info = { "HTMLFormElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLFormElementConstructor) };
131
132/* Hash table for prototype */
133
134static const HashTableValue JSHTMLFormElementPrototypeTableValues[] =
135{
136 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFormElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLFormElementConstructor) } },
137 { "acceptCharset", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFormElementAcceptCharset), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLFormElementAcceptCharset) } },
138 { "action", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFormElementAction), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLFormElementAction) } },
139 { "autocomplete", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFormElementAutocomplete), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLFormElementAutocomplete) } },
140 { "enctype", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFormElementEnctype), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLFormElementEnctype) } },
141 { "encoding", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFormElementEncoding), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLFormElementEncoding) } },
142 { "method", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFormElementMethod), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLFormElementMethod) } },
143 { "name", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFormElementName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLFormElementName) } },
144 { "noValidate", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFormElementNoValidate), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLFormElementNoValidate) } },
145 { "target", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFormElementTarget), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLFormElementTarget) } },
146 { "elements", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFormElementElements), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
147 { "length", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFormElementLength), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
148 { "submit", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLFormElementPrototypeFunctionSubmit), (intptr_t) (0) } },
149 { "reset", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLFormElementPrototypeFunctionReset), (intptr_t) (0) } },
150 { "checkValidity", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLFormElementPrototypeFunctionCheckValidity), (intptr_t) (0) } },
151 { "reportValidity", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLFormElementPrototypeFunctionReportValidity), (intptr_t) (0) } },
152};
153
154const ClassInfo JSHTMLFormElementPrototype::s_info = { "HTMLFormElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLFormElementPrototype) };
155
156void JSHTMLFormElementPrototype::finishCreation(VM& vm)
157{
158 Base::finishCreation(vm);
159 reifyStaticProperties(vm, JSHTMLFormElement::info(), JSHTMLFormElementPrototypeTableValues, *this);
160 bool hasDisabledRuntimeProperties = false;
161 if (!RuntimeEnabledFeatures::sharedFeatures().interactiveFormValidationEnabled()) {
162 hasDisabledRuntimeProperties = true;
163 auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("reportValidity"), strlen("reportValidity"));
164 VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
165 JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
166 }
167 if (hasDisabledRuntimeProperties && structure()->isDictionary())
168 flattenDictionaryObject(vm);
169 putDirect(vm, vm.propertyNames->iteratorSymbol, globalObject()->arrayPrototype()->getDirect(vm, vm.propertyNames->builtinNames().valuesPrivateName()), static_cast<unsigned>(JSC::PropertyAttribute::DontEnum));
170}
171
172const ClassInfo JSHTMLFormElement::s_info = { "HTMLFormElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLFormElement) };
173
174JSHTMLFormElement::JSHTMLFormElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLFormElement>&& impl)
175 : JSHTMLElement(structure, globalObject, WTFMove(impl))
176{
177}
178
179void JSHTMLFormElement::finishCreation(VM& vm)
180{
181 Base::finishCreation(vm);
182 ASSERT(inherits(vm, info()));
183
184}
185
186JSObject* JSHTMLFormElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
187{
188 return JSHTMLFormElementPrototype::create(vm, &globalObject, JSHTMLFormElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject)));
189}
190
191JSObject* JSHTMLFormElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
192{
193 return getDOMPrototype<JSHTMLFormElement>(vm, globalObject);
194}
195
196JSValue JSHTMLFormElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
197{
198 return getDOMConstructor<JSHTMLFormElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
199}
200
201bool JSHTMLFormElement::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
202{
203 auto* thisObject = jsCast<JSHTMLFormElement*>(object);
204 ASSERT_GC_OBJECT_INHERITS(thisObject, info());
205 if (auto index = parseIndex(propertyName)) {
206 if (index.value() < thisObject->wrapped().length()) {
207 auto value = toJS<IDLNullable<IDLInterface<Element>>>(*state, *thisObject->globalObject(), thisObject->wrapped().item(index.value()));
208 slot.setValue(thisObject, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly), value);
209 return true;
210 }
211 return JSObject::getOwnPropertySlot(object, state, propertyName, slot);
212 }
213 using GetterIDLType = IDLUnion<IDLInterface<RadioNodeList>, IDLInterface<Element>>;
214 auto getterFunctor = [] (auto& thisObject, auto propertyName) -> Optional<typename GetterIDLType::ImplementationType> {
215 auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName));
216 if (!GetterIDLType::isNullValue(result))
217 return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) };
218 return WTF::nullopt;
219 };
220 if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::Yes>(*state, *thisObject, propertyName, getterFunctor)) {
221 auto value = toJS<IDLNullable<IDLUnion<IDLInterface<RadioNodeList>, IDLInterface<Element>>>>(*state, *thisObject->globalObject(), WTFMove(namedProperty.value()));
222 slot.setValue(thisObject, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum), value);
223 return true;
224 }
225 return JSObject::getOwnPropertySlot(object, state, propertyName, slot);
226}
227
228bool JSHTMLFormElement::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
229{
230 auto* thisObject = jsCast<JSHTMLFormElement*>(object);
231 ASSERT_GC_OBJECT_INHERITS(thisObject, info());
232 if (LIKELY(index <= MAX_ARRAY_INDEX)) {
233 if (index < thisObject->wrapped().length()) {
234 auto value = toJS<IDLNullable<IDLInterface<Element>>>(*state, *thisObject->globalObject(), thisObject->wrapped().item(index));
235 slot.setValue(thisObject, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly), value);
236 return true;
237 }
238 return JSObject::getOwnPropertySlotByIndex(object, state, index, slot);
239 }
240 auto propertyName = Identifier::from(state, index);
241 using GetterIDLType = IDLUnion<IDLInterface<RadioNodeList>, IDLInterface<Element>>;
242 auto getterFunctor = [] (auto& thisObject, auto propertyName) -> Optional<typename GetterIDLType::ImplementationType> {
243 auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName));
244 if (!GetterIDLType::isNullValue(result))
245 return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) };
246 return WTF::nullopt;
247 };
248 if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::Yes>(*state, *thisObject, propertyName, getterFunctor)) {
249 auto value = toJS<IDLNullable<IDLUnion<IDLInterface<RadioNodeList>, IDLInterface<Element>>>>(*state, *thisObject->globalObject(), WTFMove(namedProperty.value()));
250 slot.setValue(thisObject, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum), value);
251 return true;
252 }
253 return JSObject::getOwnPropertySlotByIndex(object, state, index, slot);
254}
255
256void JSHTMLFormElement::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
257{
258 auto* thisObject = jsCast<JSHTMLFormElement*>(object);
259 ASSERT_GC_OBJECT_INHERITS(object, info());
260 for (unsigned i = 0, count = thisObject->wrapped().length(); i < count; ++i)
261 propertyNames.add(Identifier::from(state, i));
262 if (mode.includeDontEnumProperties()) {
263 for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())
264 propertyNames.add(Identifier::fromString(state, propertyName));
265 }
266 JSObject::getOwnPropertyNames(object, state, propertyNames, mode);
267}
268
269template<> inline JSHTMLFormElement* IDLAttribute<JSHTMLFormElement>::cast(ExecState& state, EncodedJSValue thisValue)
270{
271 return jsDynamicCast<JSHTMLFormElement*>(state.vm(), JSValue::decode(thisValue));
272}
273
274template<> inline JSHTMLFormElement* IDLOperation<JSHTMLFormElement>::cast(ExecState& state)
275{
276 return jsDynamicCast<JSHTMLFormElement*>(state.vm(), state.thisValue());
277}
278
279EncodedJSValue jsHTMLFormElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
280{
281 VM& vm = state->vm();
282 auto throwScope = DECLARE_THROW_SCOPE(vm);
283 auto* prototype = jsDynamicCast<JSHTMLFormElementPrototype*>(vm, JSValue::decode(thisValue));
284 if (UNLIKELY(!prototype))
285 return throwVMTypeError(state, throwScope);
286 return JSValue::encode(JSHTMLFormElement::getConstructor(state->vm(), prototype->globalObject()));
287}
288
289bool setJSHTMLFormElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
290{
291 VM& vm = state->vm();
292 auto throwScope = DECLARE_THROW_SCOPE(vm);
293 auto* prototype = jsDynamicCast<JSHTMLFormElementPrototype*>(vm, JSValue::decode(thisValue));
294 if (UNLIKELY(!prototype)) {
295 throwVMTypeError(state, throwScope);
296 return false;
297 }
298 // Shadowing a built-in constructor
299 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
300}
301
302static inline JSValue jsHTMLFormElementAcceptCharsetGetter(ExecState& state, JSHTMLFormElement& thisObject, ThrowScope& throwScope)
303{
304 UNUSED_PARAM(throwScope);
305 UNUSED_PARAM(state);
306 auto& impl = thisObject.wrapped();
307 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::accept_charsetAttr));
308 return result;
309}
310
311EncodedJSValue jsHTMLFormElementAcceptCharset(ExecState* state, EncodedJSValue thisValue, PropertyName)
312{
313 return IDLAttribute<JSHTMLFormElement>::get<jsHTMLFormElementAcceptCharsetGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "acceptCharset");
314}
315
316static inline bool setJSHTMLFormElementAcceptCharsetSetter(ExecState& state, JSHTMLFormElement& thisObject, JSValue value, ThrowScope& throwScope)
317{
318 UNUSED_PARAM(throwScope);
319 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
320 auto& impl = thisObject.wrapped();
321 auto nativeValue = convert<IDLDOMString>(state, value);
322 RETURN_IF_EXCEPTION(throwScope, false);
323 AttributeSetter::call(state, throwScope, [&] {
324 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::accept_charsetAttr, WTFMove(nativeValue));
325 });
326 return true;
327}
328
329bool setJSHTMLFormElementAcceptCharset(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
330{
331 return IDLAttribute<JSHTMLFormElement>::set<setJSHTMLFormElementAcceptCharsetSetter>(*state, thisValue, encodedValue, "acceptCharset");
332}
333
334static inline JSValue jsHTMLFormElementActionGetter(ExecState& state, JSHTMLFormElement& thisObject, ThrowScope& throwScope)
335{
336 UNUSED_PARAM(throwScope);
337 UNUSED_PARAM(state);
338 auto& impl = thisObject.wrapped();
339 JSValue result = toJS<IDLUSVString>(state, throwScope, impl.getURLAttribute(WebCore::HTMLNames::actionAttr));
340 return result;
341}
342
343EncodedJSValue jsHTMLFormElementAction(ExecState* state, EncodedJSValue thisValue, PropertyName)
344{
345 return IDLAttribute<JSHTMLFormElement>::get<jsHTMLFormElementActionGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "action");
346}
347
348static inline bool setJSHTMLFormElementActionSetter(ExecState& state, JSHTMLFormElement& thisObject, JSValue value, ThrowScope& throwScope)
349{
350 UNUSED_PARAM(throwScope);
351 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
352 auto& impl = thisObject.wrapped();
353 auto nativeValue = convert<IDLUSVString>(state, value);
354 RETURN_IF_EXCEPTION(throwScope, false);
355 AttributeSetter::call(state, throwScope, [&] {
356 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::actionAttr, WTFMove(nativeValue));
357 });
358 return true;
359}
360
361bool setJSHTMLFormElementAction(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
362{
363 return IDLAttribute<JSHTMLFormElement>::set<setJSHTMLFormElementActionSetter>(*state, thisValue, encodedValue, "action");
364}
365
366static inline JSValue jsHTMLFormElementAutocompleteGetter(ExecState& state, JSHTMLFormElement& thisObject, ThrowScope& throwScope)
367{
368 UNUSED_PARAM(throwScope);
369 UNUSED_PARAM(state);
370 auto& impl = thisObject.wrapped();
371 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.autocomplete());
372 return result;
373}
374
375EncodedJSValue jsHTMLFormElementAutocomplete(ExecState* state, EncodedJSValue thisValue, PropertyName)
376{
377 return IDLAttribute<JSHTMLFormElement>::get<jsHTMLFormElementAutocompleteGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "autocomplete");
378}
379
380static inline bool setJSHTMLFormElementAutocompleteSetter(ExecState& state, JSHTMLFormElement& thisObject, JSValue value, ThrowScope& throwScope)
381{
382 UNUSED_PARAM(throwScope);
383 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
384 auto& impl = thisObject.wrapped();
385 auto nativeValue = convert<IDLDOMString>(state, value);
386 RETURN_IF_EXCEPTION(throwScope, false);
387 AttributeSetter::call(state, throwScope, [&] {
388 return impl.setAutocomplete(WTFMove(nativeValue));
389 });
390 return true;
391}
392
393bool setJSHTMLFormElementAutocomplete(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
394{
395 return IDLAttribute<JSHTMLFormElement>::set<setJSHTMLFormElementAutocompleteSetter>(*state, thisValue, encodedValue, "autocomplete");
396}
397
398static inline JSValue jsHTMLFormElementEnctypeGetter(ExecState& state, JSHTMLFormElement& thisObject, ThrowScope& throwScope)
399{
400 UNUSED_PARAM(throwScope);
401 UNUSED_PARAM(state);
402 auto& impl = thisObject.wrapped();
403 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.enctype());
404 return result;
405}
406
407EncodedJSValue jsHTMLFormElementEnctype(ExecState* state, EncodedJSValue thisValue, PropertyName)
408{
409 return IDLAttribute<JSHTMLFormElement>::get<jsHTMLFormElementEnctypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "enctype");
410}
411
412static inline bool setJSHTMLFormElementEnctypeSetter(ExecState& state, JSHTMLFormElement& thisObject, JSValue value, ThrowScope& throwScope)
413{
414 UNUSED_PARAM(throwScope);
415 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
416 auto& impl = thisObject.wrapped();
417 auto nativeValue = convert<IDLDOMString>(state, value);
418 RETURN_IF_EXCEPTION(throwScope, false);
419 AttributeSetter::call(state, throwScope, [&] {
420 return impl.setEnctype(WTFMove(nativeValue));
421 });
422 return true;
423}
424
425bool setJSHTMLFormElementEnctype(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
426{
427 return IDLAttribute<JSHTMLFormElement>::set<setJSHTMLFormElementEnctypeSetter>(*state, thisValue, encodedValue, "enctype");
428}
429
430static inline JSValue jsHTMLFormElementEncodingGetter(ExecState& state, JSHTMLFormElement& thisObject, ThrowScope& throwScope)
431{
432 UNUSED_PARAM(throwScope);
433 UNUSED_PARAM(state);
434 auto& impl = thisObject.wrapped();
435 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.enctype());
436 return result;
437}
438
439EncodedJSValue jsHTMLFormElementEncoding(ExecState* state, EncodedJSValue thisValue, PropertyName)
440{
441 return IDLAttribute<JSHTMLFormElement>::get<jsHTMLFormElementEncodingGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "encoding");
442}
443
444static inline bool setJSHTMLFormElementEncodingSetter(ExecState& state, JSHTMLFormElement& thisObject, JSValue value, ThrowScope& throwScope)
445{
446 UNUSED_PARAM(throwScope);
447 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
448 auto& impl = thisObject.wrapped();
449 auto nativeValue = convert<IDLDOMString>(state, value);
450 RETURN_IF_EXCEPTION(throwScope, false);
451 AttributeSetter::call(state, throwScope, [&] {
452 return impl.setEnctype(WTFMove(nativeValue));
453 });
454 return true;
455}
456
457bool setJSHTMLFormElementEncoding(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
458{
459 return IDLAttribute<JSHTMLFormElement>::set<setJSHTMLFormElementEncodingSetter>(*state, thisValue, encodedValue, "encoding");
460}
461
462static inline JSValue jsHTMLFormElementMethodGetter(ExecState& state, JSHTMLFormElement& thisObject, ThrowScope& throwScope)
463{
464 UNUSED_PARAM(throwScope);
465 UNUSED_PARAM(state);
466 auto& impl = thisObject.wrapped();
467 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.method());
468 return result;
469}
470
471EncodedJSValue jsHTMLFormElementMethod(ExecState* state, EncodedJSValue thisValue, PropertyName)
472{
473 return IDLAttribute<JSHTMLFormElement>::get<jsHTMLFormElementMethodGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "method");
474}
475
476static inline bool setJSHTMLFormElementMethodSetter(ExecState& state, JSHTMLFormElement& thisObject, JSValue value, ThrowScope& throwScope)
477{
478 UNUSED_PARAM(throwScope);
479 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
480 auto& impl = thisObject.wrapped();
481 auto nativeValue = convert<IDLDOMString>(state, value);
482 RETURN_IF_EXCEPTION(throwScope, false);
483 AttributeSetter::call(state, throwScope, [&] {
484 return impl.setMethod(WTFMove(nativeValue));
485 });
486 return true;
487}
488
489bool setJSHTMLFormElementMethod(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
490{
491 return IDLAttribute<JSHTMLFormElement>::set<setJSHTMLFormElementMethodSetter>(*state, thisValue, encodedValue, "method");
492}
493
494static inline JSValue jsHTMLFormElementNameGetter(ExecState& state, JSHTMLFormElement& thisObject, ThrowScope& throwScope)
495{
496 UNUSED_PARAM(throwScope);
497 UNUSED_PARAM(state);
498 auto& impl = thisObject.wrapped();
499 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.getNameAttribute());
500 return result;
501}
502
503EncodedJSValue jsHTMLFormElementName(ExecState* state, EncodedJSValue thisValue, PropertyName)
504{
505 return IDLAttribute<JSHTMLFormElement>::get<jsHTMLFormElementNameGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "name");
506}
507
508static inline bool setJSHTMLFormElementNameSetter(ExecState& state, JSHTMLFormElement& thisObject, JSValue value, ThrowScope& throwScope)
509{
510 UNUSED_PARAM(throwScope);
511 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
512 auto& impl = thisObject.wrapped();
513 auto nativeValue = convert<IDLDOMString>(state, value);
514 RETURN_IF_EXCEPTION(throwScope, false);
515 AttributeSetter::call(state, throwScope, [&] {
516 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::nameAttr, WTFMove(nativeValue));
517 });
518 return true;
519}
520
521bool setJSHTMLFormElementName(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
522{
523 return IDLAttribute<JSHTMLFormElement>::set<setJSHTMLFormElementNameSetter>(*state, thisValue, encodedValue, "name");
524}
525
526static inline JSValue jsHTMLFormElementNoValidateGetter(ExecState& state, JSHTMLFormElement& thisObject, ThrowScope& throwScope)
527{
528 UNUSED_PARAM(throwScope);
529 UNUSED_PARAM(state);
530 auto& impl = thisObject.wrapped();
531 JSValue result = toJS<IDLBoolean>(state, throwScope, impl.hasAttributeWithoutSynchronization(WebCore::HTMLNames::novalidateAttr));
532 return result;
533}
534
535EncodedJSValue jsHTMLFormElementNoValidate(ExecState* state, EncodedJSValue thisValue, PropertyName)
536{
537 return IDLAttribute<JSHTMLFormElement>::get<jsHTMLFormElementNoValidateGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "noValidate");
538}
539
540static inline bool setJSHTMLFormElementNoValidateSetter(ExecState& state, JSHTMLFormElement& thisObject, JSValue value, ThrowScope& throwScope)
541{
542 UNUSED_PARAM(throwScope);
543 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
544 auto& impl = thisObject.wrapped();
545 auto nativeValue = convert<IDLBoolean>(state, value);
546 RETURN_IF_EXCEPTION(throwScope, false);
547 AttributeSetter::call(state, throwScope, [&] {
548 return impl.setBooleanAttribute(WebCore::HTMLNames::novalidateAttr, WTFMove(nativeValue));
549 });
550 return true;
551}
552
553bool setJSHTMLFormElementNoValidate(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
554{
555 return IDLAttribute<JSHTMLFormElement>::set<setJSHTMLFormElementNoValidateSetter>(*state, thisValue, encodedValue, "noValidate");
556}
557
558static inline JSValue jsHTMLFormElementTargetGetter(ExecState& state, JSHTMLFormElement& thisObject, ThrowScope& throwScope)
559{
560 UNUSED_PARAM(throwScope);
561 UNUSED_PARAM(state);
562 auto& impl = thisObject.wrapped();
563 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::targetAttr));
564 return result;
565}
566
567EncodedJSValue jsHTMLFormElementTarget(ExecState* state, EncodedJSValue thisValue, PropertyName)
568{
569 return IDLAttribute<JSHTMLFormElement>::get<jsHTMLFormElementTargetGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "target");
570}
571
572static inline bool setJSHTMLFormElementTargetSetter(ExecState& state, JSHTMLFormElement& thisObject, JSValue value, ThrowScope& throwScope)
573{
574 UNUSED_PARAM(throwScope);
575 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
576 auto& impl = thisObject.wrapped();
577 auto nativeValue = convert<IDLDOMString>(state, value);
578 RETURN_IF_EXCEPTION(throwScope, false);
579 AttributeSetter::call(state, throwScope, [&] {
580 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::targetAttr, WTFMove(nativeValue));
581 });
582 return true;
583}
584
585bool setJSHTMLFormElementTarget(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
586{
587 return IDLAttribute<JSHTMLFormElement>::set<setJSHTMLFormElementTargetSetter>(*state, thisValue, encodedValue, "target");
588}
589
590static inline JSValue jsHTMLFormElementElementsGetter(ExecState& state, JSHTMLFormElement& thisObject, ThrowScope& throwScope)
591{
592 UNUSED_PARAM(throwScope);
593 UNUSED_PARAM(state);
594 auto& impl = thisObject.wrapped();
595 JSValue result = toJS<IDLInterface<HTMLFormControlsCollection>>(state, *thisObject.globalObject(), throwScope, impl.elements());
596 return result;
597}
598
599EncodedJSValue jsHTMLFormElementElements(ExecState* state, EncodedJSValue thisValue, PropertyName)
600{
601 return IDLAttribute<JSHTMLFormElement>::get<jsHTMLFormElementElementsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "elements");
602}
603
604static inline JSValue jsHTMLFormElementLengthGetter(ExecState& state, JSHTMLFormElement& thisObject, ThrowScope& throwScope)
605{
606 UNUSED_PARAM(throwScope);
607 UNUSED_PARAM(state);
608 auto& impl = thisObject.wrapped();
609 JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.length());
610 return result;
611}
612
613EncodedJSValue jsHTMLFormElementLength(ExecState* state, EncodedJSValue thisValue, PropertyName)
614{
615 return IDLAttribute<JSHTMLFormElement>::get<jsHTMLFormElementLengthGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "length");
616}
617
618static inline JSC::EncodedJSValue jsHTMLFormElementPrototypeFunctionSubmitBody(JSC::ExecState* state, typename IDLOperation<JSHTMLFormElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
619{
620 UNUSED_PARAM(state);
621 UNUSED_PARAM(throwScope);
622 auto& impl = castedThis->wrapped();
623 impl.submitFromJavaScript();
624 return JSValue::encode(jsUndefined());
625}
626
627EncodedJSValue JSC_HOST_CALL jsHTMLFormElementPrototypeFunctionSubmit(ExecState* state)
628{
629 return IDLOperation<JSHTMLFormElement>::call<jsHTMLFormElementPrototypeFunctionSubmitBody>(*state, "submit");
630}
631
632static inline JSC::EncodedJSValue jsHTMLFormElementPrototypeFunctionResetBody(JSC::ExecState* state, typename IDLOperation<JSHTMLFormElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
633{
634 UNUSED_PARAM(state);
635 UNUSED_PARAM(throwScope);
636 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
637 auto& impl = castedThis->wrapped();
638 impl.reset();
639 return JSValue::encode(jsUndefined());
640}
641
642EncodedJSValue JSC_HOST_CALL jsHTMLFormElementPrototypeFunctionReset(ExecState* state)
643{
644 return IDLOperation<JSHTMLFormElement>::call<jsHTMLFormElementPrototypeFunctionResetBody>(*state, "reset");
645}
646
647static inline JSC::EncodedJSValue jsHTMLFormElementPrototypeFunctionCheckValidityBody(JSC::ExecState* state, typename IDLOperation<JSHTMLFormElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
648{
649 UNUSED_PARAM(state);
650 UNUSED_PARAM(throwScope);
651 auto& impl = castedThis->wrapped();
652 return JSValue::encode(toJS<IDLBoolean>(impl.checkValidity()));
653}
654
655EncodedJSValue JSC_HOST_CALL jsHTMLFormElementPrototypeFunctionCheckValidity(ExecState* state)
656{
657 return IDLOperation<JSHTMLFormElement>::call<jsHTMLFormElementPrototypeFunctionCheckValidityBody>(*state, "checkValidity");
658}
659
660static inline JSC::EncodedJSValue jsHTMLFormElementPrototypeFunctionReportValidityBody(JSC::ExecState* state, typename IDLOperation<JSHTMLFormElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
661{
662 UNUSED_PARAM(state);
663 UNUSED_PARAM(throwScope);
664 auto& impl = castedThis->wrapped();
665 return JSValue::encode(toJS<IDLBoolean>(impl.reportValidity()));
666}
667
668EncodedJSValue JSC_HOST_CALL jsHTMLFormElementPrototypeFunctionReportValidity(ExecState* state)
669{
670 return IDLOperation<JSHTMLFormElement>::call<jsHTMLFormElementPrototypeFunctionReportValidityBody>(*state, "reportValidity");
671}
672
673void JSHTMLFormElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
674{
675 auto* thisObject = jsCast<JSHTMLFormElement*>(cell);
676 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
677 if (thisObject->scriptExecutionContext())
678 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
679 Base::heapSnapshot(cell, builder);
680}
681
682HTMLFormElement* JSHTMLFormElement::toWrapped(JSC::VM& vm, JSC::JSValue value)
683{
684 if (auto* wrapper = jsDynamicCast<JSHTMLFormElement*>(vm, value))
685 return &wrapper->wrapped();
686 return nullptr;
687}
688
689}
690