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 "JSHTMLOutputElement.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 "JSDOMTokenList.h" |
36 | #include "JSDOMWrapperCache.h" |
37 | #include "JSHTMLFormElement.h" |
38 | #include "JSNodeList.h" |
39 | #include "JSValidityState.h" |
40 | #include "RuntimeEnabledFeatures.h" |
41 | #include "ScriptExecutionContext.h" |
42 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
43 | #include <JavaScriptCore/JSCInlines.h> |
44 | #include <wtf/GetPtr.h> |
45 | #include <wtf/PointerPreparations.h> |
46 | #include <wtf/URL.h> |
47 | |
48 | |
49 | namespace WebCore { |
50 | using namespace JSC; |
51 | |
52 | // Functions |
53 | |
54 | JSC::EncodedJSValue JSC_HOST_CALL jsHTMLOutputElementPrototypeFunctionCheckValidity(JSC::ExecState*); |
55 | JSC::EncodedJSValue JSC_HOST_CALL jsHTMLOutputElementPrototypeFunctionReportValidity(JSC::ExecState*); |
56 | JSC::EncodedJSValue JSC_HOST_CALL jsHTMLOutputElementPrototypeFunctionSetCustomValidity(JSC::ExecState*); |
57 | |
58 | // Attributes |
59 | |
60 | JSC::EncodedJSValue jsHTMLOutputElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
61 | bool setJSHTMLOutputElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
62 | JSC::EncodedJSValue jsHTMLOutputElementHtmlFor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
63 | bool setJSHTMLOutputElementHtmlFor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
64 | JSC::EncodedJSValue jsHTMLOutputElementForm(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
65 | JSC::EncodedJSValue jsHTMLOutputElementName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
66 | bool setJSHTMLOutputElementName(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
67 | JSC::EncodedJSValue jsHTMLOutputElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
68 | JSC::EncodedJSValue jsHTMLOutputElementDefaultValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
69 | bool setJSHTMLOutputElementDefaultValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
70 | JSC::EncodedJSValue jsHTMLOutputElementValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
71 | bool setJSHTMLOutputElementValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
72 | JSC::EncodedJSValue jsHTMLOutputElementWillValidate(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
73 | JSC::EncodedJSValue jsHTMLOutputElementValidity(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
74 | JSC::EncodedJSValue jsHTMLOutputElementValidationMessage(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
75 | JSC::EncodedJSValue jsHTMLOutputElementLabels(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
76 | |
77 | class JSHTMLOutputElementPrototype : public JSC::JSNonFinalObject { |
78 | public: |
79 | using Base = JSC::JSNonFinalObject; |
80 | static JSHTMLOutputElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
81 | { |
82 | JSHTMLOutputElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLOutputElementPrototype>(vm.heap)) JSHTMLOutputElementPrototype(vm, globalObject, structure); |
83 | ptr->finishCreation(vm); |
84 | return ptr; |
85 | } |
86 | |
87 | DECLARE_INFO; |
88 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
89 | { |
90 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
91 | } |
92 | |
93 | private: |
94 | JSHTMLOutputElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
95 | : JSC::JSNonFinalObject(vm, structure) |
96 | { |
97 | } |
98 | |
99 | void finishCreation(JSC::VM&); |
100 | }; |
101 | |
102 | using JSHTMLOutputElementConstructor = JSDOMConstructorNotConstructable<JSHTMLOutputElement>; |
103 | |
104 | template<> JSValue JSHTMLOutputElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
105 | { |
106 | return JSHTMLElement::getConstructor(vm, &globalObject); |
107 | } |
108 | |
109 | template<> void JSHTMLOutputElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
110 | { |
111 | putDirect(vm, vm.propertyNames->prototype, JSHTMLOutputElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
112 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLOutputElement"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
113 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
114 | } |
115 | |
116 | template<> const ClassInfo JSHTMLOutputElementConstructor::s_info = { "HTMLOutputElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLOutputElementConstructor) }; |
117 | |
118 | /* Hash table for prototype */ |
119 | |
120 | static const HashTableValue JSHTMLOutputElementPrototypeTableValues[] = |
121 | { |
122 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOutputElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLOutputElementConstructor) } }, |
123 | { "htmlFor" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOutputElementHtmlFor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLOutputElementHtmlFor) } }, |
124 | { "form" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOutputElementForm), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
125 | { "name" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOutputElementName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLOutputElementName) } }, |
126 | { "type" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOutputElementType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
127 | { "defaultValue" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOutputElementDefaultValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLOutputElementDefaultValue) } }, |
128 | { "value" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOutputElementValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLOutputElementValue) } }, |
129 | { "willValidate" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOutputElementWillValidate), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
130 | { "validity" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOutputElementValidity), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
131 | { "validationMessage" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOutputElementValidationMessage), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
132 | { "labels" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOutputElementLabels), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
133 | { "checkValidity" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLOutputElementPrototypeFunctionCheckValidity), (intptr_t) (0) } }, |
134 | { "reportValidity" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLOutputElementPrototypeFunctionReportValidity), (intptr_t) (0) } }, |
135 | { "setCustomValidity" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLOutputElementPrototypeFunctionSetCustomValidity), (intptr_t) (1) } }, |
136 | }; |
137 | |
138 | const ClassInfo JSHTMLOutputElementPrototype::s_info = { "HTMLOutputElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLOutputElementPrototype) }; |
139 | |
140 | void JSHTMLOutputElementPrototype::finishCreation(VM& vm) |
141 | { |
142 | Base::finishCreation(vm); |
143 | reifyStaticProperties(vm, JSHTMLOutputElement::info(), JSHTMLOutputElementPrototypeTableValues, *this); |
144 | bool hasDisabledRuntimeProperties = false; |
145 | if (!RuntimeEnabledFeatures::sharedFeatures().interactiveFormValidationEnabled()) { |
146 | hasDisabledRuntimeProperties = true; |
147 | auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("reportValidity" ), strlen("reportValidity" )); |
148 | VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); |
149 | JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); |
150 | } |
151 | if (hasDisabledRuntimeProperties && structure()->isDictionary()) |
152 | flattenDictionaryObject(vm); |
153 | } |
154 | |
155 | const ClassInfo JSHTMLOutputElement::s_info = { "HTMLOutputElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLOutputElement) }; |
156 | |
157 | JSHTMLOutputElement::JSHTMLOutputElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLOutputElement>&& impl) |
158 | : JSHTMLElement(structure, globalObject, WTFMove(impl)) |
159 | { |
160 | } |
161 | |
162 | void JSHTMLOutputElement::finishCreation(VM& vm) |
163 | { |
164 | Base::finishCreation(vm); |
165 | ASSERT(inherits(vm, info())); |
166 | |
167 | } |
168 | |
169 | JSObject* JSHTMLOutputElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
170 | { |
171 | return JSHTMLOutputElementPrototype::create(vm, &globalObject, JSHTMLOutputElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject))); |
172 | } |
173 | |
174 | JSObject* JSHTMLOutputElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
175 | { |
176 | return getDOMPrototype<JSHTMLOutputElement>(vm, globalObject); |
177 | } |
178 | |
179 | JSValue JSHTMLOutputElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
180 | { |
181 | return getDOMConstructor<JSHTMLOutputElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
182 | } |
183 | |
184 | template<> inline JSHTMLOutputElement* IDLAttribute<JSHTMLOutputElement>::cast(ExecState& state, EncodedJSValue thisValue) |
185 | { |
186 | return jsDynamicCast<JSHTMLOutputElement*>(state.vm(), JSValue::decode(thisValue)); |
187 | } |
188 | |
189 | template<> inline JSHTMLOutputElement* IDLOperation<JSHTMLOutputElement>::cast(ExecState& state) |
190 | { |
191 | return jsDynamicCast<JSHTMLOutputElement*>(state.vm(), state.thisValue()); |
192 | } |
193 | |
194 | EncodedJSValue jsHTMLOutputElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
195 | { |
196 | VM& vm = state->vm(); |
197 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
198 | auto* prototype = jsDynamicCast<JSHTMLOutputElementPrototype*>(vm, JSValue::decode(thisValue)); |
199 | if (UNLIKELY(!prototype)) |
200 | return throwVMTypeError(state, throwScope); |
201 | return JSValue::encode(JSHTMLOutputElement::getConstructor(state->vm(), prototype->globalObject())); |
202 | } |
203 | |
204 | bool setJSHTMLOutputElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
205 | { |
206 | VM& vm = state->vm(); |
207 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
208 | auto* prototype = jsDynamicCast<JSHTMLOutputElementPrototype*>(vm, JSValue::decode(thisValue)); |
209 | if (UNLIKELY(!prototype)) { |
210 | throwVMTypeError(state, throwScope); |
211 | return false; |
212 | } |
213 | // Shadowing a built-in constructor |
214 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
215 | } |
216 | |
217 | static inline JSValue jsHTMLOutputElementHtmlForGetter(ExecState& state, JSHTMLOutputElement& thisObject, ThrowScope& throwScope) |
218 | { |
219 | UNUSED_PARAM(throwScope); |
220 | UNUSED_PARAM(state); |
221 | auto& impl = thisObject.wrapped(); |
222 | JSValue result = toJS<IDLInterface<DOMTokenList>>(state, *thisObject.globalObject(), throwScope, impl.htmlFor()); |
223 | return result; |
224 | } |
225 | |
226 | EncodedJSValue jsHTMLOutputElementHtmlFor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
227 | { |
228 | return IDLAttribute<JSHTMLOutputElement>::get<jsHTMLOutputElementHtmlForGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "htmlFor" ); |
229 | } |
230 | |
231 | static inline bool setJSHTMLOutputElementHtmlForSetter(ExecState& state, JSHTMLOutputElement& thisObject, JSValue value, ThrowScope& throwScope) |
232 | { |
233 | UNUSED_PARAM(throwScope); |
234 | auto id = Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("htmlFor" ), strlen("htmlFor" )); |
235 | auto valueToForwardTo = thisObject.get(&state, id); |
236 | RETURN_IF_EXCEPTION(throwScope, false); |
237 | if (UNLIKELY(!valueToForwardTo.isObject())) { |
238 | throwTypeError(&state, throwScope); |
239 | return false; |
240 | } |
241 | auto forwardId = Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("value" ), strlen("value" )); |
242 | PutPropertySlot slot(valueToForwardTo, false); |
243 | asObject(valueToForwardTo)->methodTable(state.vm())->put(asObject(valueToForwardTo), &state, forwardId, value, slot); |
244 | RETURN_IF_EXCEPTION(throwScope, false); |
245 | return true; |
246 | } |
247 | |
248 | bool setJSHTMLOutputElementHtmlFor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
249 | { |
250 | return IDLAttribute<JSHTMLOutputElement>::set<setJSHTMLOutputElementHtmlForSetter>(*state, thisValue, encodedValue, "htmlFor" ); |
251 | } |
252 | |
253 | static inline JSValue jsHTMLOutputElementFormGetter(ExecState& state, JSHTMLOutputElement& thisObject, ThrowScope& throwScope) |
254 | { |
255 | UNUSED_PARAM(throwScope); |
256 | UNUSED_PARAM(state); |
257 | auto& impl = thisObject.wrapped(); |
258 | JSValue result = toJS<IDLInterface<HTMLFormElement>>(state, *thisObject.globalObject(), throwScope, impl.form()); |
259 | return result; |
260 | } |
261 | |
262 | EncodedJSValue jsHTMLOutputElementForm(ExecState* state, EncodedJSValue thisValue, PropertyName) |
263 | { |
264 | return IDLAttribute<JSHTMLOutputElement>::get<jsHTMLOutputElementFormGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "form" ); |
265 | } |
266 | |
267 | static inline JSValue jsHTMLOutputElementNameGetter(ExecState& state, JSHTMLOutputElement& thisObject, ThrowScope& throwScope) |
268 | { |
269 | UNUSED_PARAM(throwScope); |
270 | UNUSED_PARAM(state); |
271 | auto& impl = thisObject.wrapped(); |
272 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.getNameAttribute()); |
273 | return result; |
274 | } |
275 | |
276 | EncodedJSValue jsHTMLOutputElementName(ExecState* state, EncodedJSValue thisValue, PropertyName) |
277 | { |
278 | return IDLAttribute<JSHTMLOutputElement>::get<jsHTMLOutputElementNameGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "name" ); |
279 | } |
280 | |
281 | static inline bool setJSHTMLOutputElementNameSetter(ExecState& state, JSHTMLOutputElement& thisObject, JSValue value, ThrowScope& throwScope) |
282 | { |
283 | UNUSED_PARAM(throwScope); |
284 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
285 | auto& impl = thisObject.wrapped(); |
286 | auto nativeValue = convert<IDLDOMString>(state, value); |
287 | RETURN_IF_EXCEPTION(throwScope, false); |
288 | AttributeSetter::call(state, throwScope, [&] { |
289 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::nameAttr, WTFMove(nativeValue)); |
290 | }); |
291 | return true; |
292 | } |
293 | |
294 | bool setJSHTMLOutputElementName(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
295 | { |
296 | return IDLAttribute<JSHTMLOutputElement>::set<setJSHTMLOutputElementNameSetter>(*state, thisValue, encodedValue, "name" ); |
297 | } |
298 | |
299 | static inline JSValue jsHTMLOutputElementTypeGetter(ExecState& state, JSHTMLOutputElement& thisObject, ThrowScope& throwScope) |
300 | { |
301 | UNUSED_PARAM(throwScope); |
302 | UNUSED_PARAM(state); |
303 | auto& impl = thisObject.wrapped(); |
304 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.type()); |
305 | return result; |
306 | } |
307 | |
308 | EncodedJSValue jsHTMLOutputElementType(ExecState* state, EncodedJSValue thisValue, PropertyName) |
309 | { |
310 | return IDLAttribute<JSHTMLOutputElement>::get<jsHTMLOutputElementTypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "type" ); |
311 | } |
312 | |
313 | static inline JSValue jsHTMLOutputElementDefaultValueGetter(ExecState& state, JSHTMLOutputElement& thisObject, ThrowScope& throwScope) |
314 | { |
315 | UNUSED_PARAM(throwScope); |
316 | UNUSED_PARAM(state); |
317 | auto& impl = thisObject.wrapped(); |
318 | JSValue result = toJS<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>(state, throwScope, impl.defaultValue()); |
319 | return result; |
320 | } |
321 | |
322 | EncodedJSValue jsHTMLOutputElementDefaultValue(ExecState* state, EncodedJSValue thisValue, PropertyName) |
323 | { |
324 | return IDLAttribute<JSHTMLOutputElement>::get<jsHTMLOutputElementDefaultValueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "defaultValue" ); |
325 | } |
326 | |
327 | static inline bool setJSHTMLOutputElementDefaultValueSetter(ExecState& state, JSHTMLOutputElement& thisObject, JSValue value, ThrowScope& throwScope) |
328 | { |
329 | UNUSED_PARAM(throwScope); |
330 | CustomElementReactionStack customElementReactionStack(state); |
331 | auto& impl = thisObject.wrapped(); |
332 | auto nativeValue = convert<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>(state, value); |
333 | RETURN_IF_EXCEPTION(throwScope, false); |
334 | AttributeSetter::call(state, throwScope, [&] { |
335 | return impl.setDefaultValue(WTFMove(nativeValue)); |
336 | }); |
337 | return true; |
338 | } |
339 | |
340 | bool setJSHTMLOutputElementDefaultValue(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
341 | { |
342 | return IDLAttribute<JSHTMLOutputElement>::set<setJSHTMLOutputElementDefaultValueSetter>(*state, thisValue, encodedValue, "defaultValue" ); |
343 | } |
344 | |
345 | static inline JSValue jsHTMLOutputElementValueGetter(ExecState& state, JSHTMLOutputElement& thisObject, ThrowScope& throwScope) |
346 | { |
347 | UNUSED_PARAM(throwScope); |
348 | UNUSED_PARAM(state); |
349 | auto& impl = thisObject.wrapped(); |
350 | JSValue result = toJS<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>(state, throwScope, impl.value()); |
351 | return result; |
352 | } |
353 | |
354 | EncodedJSValue jsHTMLOutputElementValue(ExecState* state, EncodedJSValue thisValue, PropertyName) |
355 | { |
356 | return IDLAttribute<JSHTMLOutputElement>::get<jsHTMLOutputElementValueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "value" ); |
357 | } |
358 | |
359 | static inline bool setJSHTMLOutputElementValueSetter(ExecState& state, JSHTMLOutputElement& thisObject, JSValue value, ThrowScope& throwScope) |
360 | { |
361 | UNUSED_PARAM(throwScope); |
362 | CustomElementReactionStack customElementReactionStack(state); |
363 | auto& impl = thisObject.wrapped(); |
364 | auto nativeValue = convert<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>(state, value); |
365 | RETURN_IF_EXCEPTION(throwScope, false); |
366 | AttributeSetter::call(state, throwScope, [&] { |
367 | return impl.setValue(WTFMove(nativeValue)); |
368 | }); |
369 | return true; |
370 | } |
371 | |
372 | bool setJSHTMLOutputElementValue(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
373 | { |
374 | return IDLAttribute<JSHTMLOutputElement>::set<setJSHTMLOutputElementValueSetter>(*state, thisValue, encodedValue, "value" ); |
375 | } |
376 | |
377 | static inline JSValue jsHTMLOutputElementWillValidateGetter(ExecState& state, JSHTMLOutputElement& thisObject, ThrowScope& throwScope) |
378 | { |
379 | UNUSED_PARAM(throwScope); |
380 | UNUSED_PARAM(state); |
381 | auto& impl = thisObject.wrapped(); |
382 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.willValidate()); |
383 | return result; |
384 | } |
385 | |
386 | EncodedJSValue jsHTMLOutputElementWillValidate(ExecState* state, EncodedJSValue thisValue, PropertyName) |
387 | { |
388 | return IDLAttribute<JSHTMLOutputElement>::get<jsHTMLOutputElementWillValidateGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "willValidate" ); |
389 | } |
390 | |
391 | static inline JSValue jsHTMLOutputElementValidityGetter(ExecState& state, JSHTMLOutputElement& thisObject, ThrowScope& throwScope) |
392 | { |
393 | UNUSED_PARAM(throwScope); |
394 | UNUSED_PARAM(state); |
395 | auto& impl = thisObject.wrapped(); |
396 | JSValue result = toJS<IDLInterface<ValidityState>>(state, *thisObject.globalObject(), throwScope, impl.validity()); |
397 | return result; |
398 | } |
399 | |
400 | EncodedJSValue jsHTMLOutputElementValidity(ExecState* state, EncodedJSValue thisValue, PropertyName) |
401 | { |
402 | return IDLAttribute<JSHTMLOutputElement>::get<jsHTMLOutputElementValidityGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "validity" ); |
403 | } |
404 | |
405 | static inline JSValue jsHTMLOutputElementValidationMessageGetter(ExecState& state, JSHTMLOutputElement& thisObject, ThrowScope& throwScope) |
406 | { |
407 | UNUSED_PARAM(throwScope); |
408 | UNUSED_PARAM(state); |
409 | auto& impl = thisObject.wrapped(); |
410 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.validationMessage()); |
411 | return result; |
412 | } |
413 | |
414 | EncodedJSValue jsHTMLOutputElementValidationMessage(ExecState* state, EncodedJSValue thisValue, PropertyName) |
415 | { |
416 | return IDLAttribute<JSHTMLOutputElement>::get<jsHTMLOutputElementValidationMessageGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "validationMessage" ); |
417 | } |
418 | |
419 | static inline JSValue jsHTMLOutputElementLabelsGetter(ExecState& state, JSHTMLOutputElement& thisObject, ThrowScope& throwScope) |
420 | { |
421 | UNUSED_PARAM(throwScope); |
422 | UNUSED_PARAM(state); |
423 | auto& impl = thisObject.wrapped(); |
424 | JSValue result = toJS<IDLInterface<NodeList>>(state, *thisObject.globalObject(), throwScope, impl.labels()); |
425 | return result; |
426 | } |
427 | |
428 | EncodedJSValue jsHTMLOutputElementLabels(ExecState* state, EncodedJSValue thisValue, PropertyName) |
429 | { |
430 | return IDLAttribute<JSHTMLOutputElement>::get<jsHTMLOutputElementLabelsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "labels" ); |
431 | } |
432 | |
433 | static inline JSC::EncodedJSValue jsHTMLOutputElementPrototypeFunctionCheckValidityBody(JSC::ExecState* state, typename IDLOperation<JSHTMLOutputElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
434 | { |
435 | UNUSED_PARAM(state); |
436 | UNUSED_PARAM(throwScope); |
437 | auto& impl = castedThis->wrapped(); |
438 | return JSValue::encode(toJS<IDLBoolean>(impl.checkValidity())); |
439 | } |
440 | |
441 | EncodedJSValue JSC_HOST_CALL jsHTMLOutputElementPrototypeFunctionCheckValidity(ExecState* state) |
442 | { |
443 | return IDLOperation<JSHTMLOutputElement>::call<jsHTMLOutputElementPrototypeFunctionCheckValidityBody>(*state, "checkValidity" ); |
444 | } |
445 | |
446 | static inline JSC::EncodedJSValue jsHTMLOutputElementPrototypeFunctionReportValidityBody(JSC::ExecState* state, typename IDLOperation<JSHTMLOutputElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
447 | { |
448 | UNUSED_PARAM(state); |
449 | UNUSED_PARAM(throwScope); |
450 | auto& impl = castedThis->wrapped(); |
451 | return JSValue::encode(toJS<IDLBoolean>(impl.reportValidity())); |
452 | } |
453 | |
454 | EncodedJSValue JSC_HOST_CALL jsHTMLOutputElementPrototypeFunctionReportValidity(ExecState* state) |
455 | { |
456 | return IDLOperation<JSHTMLOutputElement>::call<jsHTMLOutputElementPrototypeFunctionReportValidityBody>(*state, "reportValidity" ); |
457 | } |
458 | |
459 | static inline JSC::EncodedJSValue jsHTMLOutputElementPrototypeFunctionSetCustomValidityBody(JSC::ExecState* state, typename IDLOperation<JSHTMLOutputElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
460 | { |
461 | UNUSED_PARAM(state); |
462 | UNUSED_PARAM(throwScope); |
463 | auto& impl = castedThis->wrapped(); |
464 | if (UNLIKELY(state->argumentCount() < 1)) |
465 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
466 | auto error = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
467 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
468 | impl.setCustomValidity(WTFMove(error)); |
469 | return JSValue::encode(jsUndefined()); |
470 | } |
471 | |
472 | EncodedJSValue JSC_HOST_CALL jsHTMLOutputElementPrototypeFunctionSetCustomValidity(ExecState* state) |
473 | { |
474 | return IDLOperation<JSHTMLOutputElement>::call<jsHTMLOutputElementPrototypeFunctionSetCustomValidityBody>(*state, "setCustomValidity" ); |
475 | } |
476 | |
477 | void JSHTMLOutputElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
478 | { |
479 | auto* thisObject = jsCast<JSHTMLOutputElement*>(cell); |
480 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
481 | if (thisObject->scriptExecutionContext()) |
482 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
483 | Base::heapSnapshot(cell, builder); |
484 | } |
485 | |
486 | |
487 | } |
488 | |