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 "JSHTMLHtmlElement.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 jsHTMLHtmlElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
46bool setJSHTMLHtmlElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
47JSC::EncodedJSValue jsHTMLHtmlElementVersion(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
48bool setJSHTMLHtmlElementVersion(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
49JSC::EncodedJSValue jsHTMLHtmlElementManifest(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50bool setJSHTMLHtmlElementManifest(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
51
52class JSHTMLHtmlElementPrototype : public JSC::JSNonFinalObject {
53public:
54 using Base = JSC::JSNonFinalObject;
55 static JSHTMLHtmlElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
56 {
57 JSHTMLHtmlElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLHtmlElementPrototype>(vm.heap)) JSHTMLHtmlElementPrototype(vm, globalObject, structure);
58 ptr->finishCreation(vm);
59 return ptr;
60 }
61
62 DECLARE_INFO;
63 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
64 {
65 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
66 }
67
68private:
69 JSHTMLHtmlElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
70 : JSC::JSNonFinalObject(vm, structure)
71 {
72 }
73
74 void finishCreation(JSC::VM&);
75};
76
77using JSHTMLHtmlElementConstructor = JSDOMConstructorNotConstructable<JSHTMLHtmlElement>;
78
79template<> JSValue JSHTMLHtmlElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
80{
81 return JSHTMLElement::getConstructor(vm, &globalObject);
82}
83
84template<> void JSHTMLHtmlElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
85{
86 putDirect(vm, vm.propertyNames->prototype, JSHTMLHtmlElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
87 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLHtmlElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
88 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
89}
90
91template<> const ClassInfo JSHTMLHtmlElementConstructor::s_info = { "HTMLHtmlElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLHtmlElementConstructor) };
92
93/* Hash table for prototype */
94
95static const HashTableValue JSHTMLHtmlElementPrototypeTableValues[] =
96{
97 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLHtmlElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLHtmlElementConstructor) } },
98 { "version", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLHtmlElementVersion), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLHtmlElementVersion) } },
99 { "manifest", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLHtmlElementManifest), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLHtmlElementManifest) } },
100};
101
102const ClassInfo JSHTMLHtmlElementPrototype::s_info = { "HTMLHtmlElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLHtmlElementPrototype) };
103
104void JSHTMLHtmlElementPrototype::finishCreation(VM& vm)
105{
106 Base::finishCreation(vm);
107 reifyStaticProperties(vm, JSHTMLHtmlElement::info(), JSHTMLHtmlElementPrototypeTableValues, *this);
108}
109
110const ClassInfo JSHTMLHtmlElement::s_info = { "HTMLHtmlElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLHtmlElement) };
111
112JSHTMLHtmlElement::JSHTMLHtmlElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLHtmlElement>&& impl)
113 : JSHTMLElement(structure, globalObject, WTFMove(impl))
114{
115}
116
117void JSHTMLHtmlElement::finishCreation(VM& vm)
118{
119 Base::finishCreation(vm);
120 ASSERT(inherits(vm, info()));
121
122}
123
124JSObject* JSHTMLHtmlElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
125{
126 return JSHTMLHtmlElementPrototype::create(vm, &globalObject, JSHTMLHtmlElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject)));
127}
128
129JSObject* JSHTMLHtmlElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
130{
131 return getDOMPrototype<JSHTMLHtmlElement>(vm, globalObject);
132}
133
134JSValue JSHTMLHtmlElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
135{
136 return getDOMConstructor<JSHTMLHtmlElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
137}
138
139template<> inline JSHTMLHtmlElement* IDLAttribute<JSHTMLHtmlElement>::cast(ExecState& state, EncodedJSValue thisValue)
140{
141 return jsDynamicCast<JSHTMLHtmlElement*>(state.vm(), JSValue::decode(thisValue));
142}
143
144EncodedJSValue jsHTMLHtmlElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
145{
146 VM& vm = state->vm();
147 auto throwScope = DECLARE_THROW_SCOPE(vm);
148 auto* prototype = jsDynamicCast<JSHTMLHtmlElementPrototype*>(vm, JSValue::decode(thisValue));
149 if (UNLIKELY(!prototype))
150 return throwVMTypeError(state, throwScope);
151 return JSValue::encode(JSHTMLHtmlElement::getConstructor(state->vm(), prototype->globalObject()));
152}
153
154bool setJSHTMLHtmlElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
155{
156 VM& vm = state->vm();
157 auto throwScope = DECLARE_THROW_SCOPE(vm);
158 auto* prototype = jsDynamicCast<JSHTMLHtmlElementPrototype*>(vm, JSValue::decode(thisValue));
159 if (UNLIKELY(!prototype)) {
160 throwVMTypeError(state, throwScope);
161 return false;
162 }
163 // Shadowing a built-in constructor
164 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
165}
166
167static inline JSValue jsHTMLHtmlElementVersionGetter(ExecState& state, JSHTMLHtmlElement& thisObject, ThrowScope& throwScope)
168{
169 UNUSED_PARAM(throwScope);
170 UNUSED_PARAM(state);
171 auto& impl = thisObject.wrapped();
172 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::versionAttr));
173 return result;
174}
175
176EncodedJSValue jsHTMLHtmlElementVersion(ExecState* state, EncodedJSValue thisValue, PropertyName)
177{
178 return IDLAttribute<JSHTMLHtmlElement>::get<jsHTMLHtmlElementVersionGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "version");
179}
180
181static inline bool setJSHTMLHtmlElementVersionSetter(ExecState& state, JSHTMLHtmlElement& thisObject, JSValue value, ThrowScope& throwScope)
182{
183 UNUSED_PARAM(throwScope);
184 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
185 auto& impl = thisObject.wrapped();
186 auto nativeValue = convert<IDLDOMString>(state, value);
187 RETURN_IF_EXCEPTION(throwScope, false);
188 AttributeSetter::call(state, throwScope, [&] {
189 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::versionAttr, WTFMove(nativeValue));
190 });
191 return true;
192}
193
194bool setJSHTMLHtmlElementVersion(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
195{
196 return IDLAttribute<JSHTMLHtmlElement>::set<setJSHTMLHtmlElementVersionSetter>(*state, thisValue, encodedValue, "version");
197}
198
199static inline JSValue jsHTMLHtmlElementManifestGetter(ExecState& state, JSHTMLHtmlElement& thisObject, ThrowScope& throwScope)
200{
201 UNUSED_PARAM(throwScope);
202 UNUSED_PARAM(state);
203 auto& impl = thisObject.wrapped();
204 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.getURLAttribute(WebCore::HTMLNames::manifestAttr));
205 return result;
206}
207
208EncodedJSValue jsHTMLHtmlElementManifest(ExecState* state, EncodedJSValue thisValue, PropertyName)
209{
210 return IDLAttribute<JSHTMLHtmlElement>::get<jsHTMLHtmlElementManifestGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "manifest");
211}
212
213static inline bool setJSHTMLHtmlElementManifestSetter(ExecState& state, JSHTMLHtmlElement& thisObject, JSValue value, ThrowScope& throwScope)
214{
215 UNUSED_PARAM(throwScope);
216 auto& impl = thisObject.wrapped();
217 auto nativeValue = convert<IDLDOMString>(state, value);
218 RETURN_IF_EXCEPTION(throwScope, false);
219 AttributeSetter::call(state, throwScope, [&] {
220 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::manifestAttr, WTFMove(nativeValue));
221 });
222 return true;
223}
224
225bool setJSHTMLHtmlElementManifest(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
226{
227 return IDLAttribute<JSHTMLHtmlElement>::set<setJSHTMLHtmlElementManifestSetter>(*state, thisValue, encodedValue, "manifest");
228}
229
230void JSHTMLHtmlElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
231{
232 auto* thisObject = jsCast<JSHTMLHtmlElement*>(cell);
233 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
234 if (thisObject->scriptExecutionContext())
235 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
236 Base::heapSnapshot(cell, builder);
237}
238
239
240}
241