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