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 "JSHTMLHeadElement.h"
23
24#include "HTMLNames.h"
25#include "JSDOMAttribute.h"
26#include "JSDOMBinding.h"
27#include "JSDOMConstructorNotConstructable.h"
28#include "JSDOMConvertStrings.h"
29#include "JSDOMExceptionHandling.h"
30#include "JSDOMWrapperCache.h"
31#include "ScriptExecutionContext.h"
32#include <JavaScriptCore/HeapSnapshotBuilder.h>
33#include <JavaScriptCore/JSCInlines.h>
34#include <wtf/GetPtr.h>
35#include <wtf/PointerPreparations.h>
36#include <wtf/URL.h>
37
38
39namespace WebCore {
40using namespace JSC;
41
42// Attributes
43
44JSC::EncodedJSValue jsHTMLHeadElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
45bool setJSHTMLHeadElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
46JSC::EncodedJSValue jsHTMLHeadElementProfile(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
47bool setJSHTMLHeadElementProfile(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
48
49class JSHTMLHeadElementPrototype : public JSC::JSNonFinalObject {
50public:
51 using Base = JSC::JSNonFinalObject;
52 static JSHTMLHeadElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
53 {
54 JSHTMLHeadElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLHeadElementPrototype>(vm.heap)) JSHTMLHeadElementPrototype(vm, globalObject, structure);
55 ptr->finishCreation(vm);
56 return ptr;
57 }
58
59 DECLARE_INFO;
60 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
61 {
62 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
63 }
64
65private:
66 JSHTMLHeadElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
67 : JSC::JSNonFinalObject(vm, structure)
68 {
69 }
70
71 void finishCreation(JSC::VM&);
72};
73
74using JSHTMLHeadElementConstructor = JSDOMConstructorNotConstructable<JSHTMLHeadElement>;
75
76template<> JSValue JSHTMLHeadElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
77{
78 return JSHTMLElement::getConstructor(vm, &globalObject);
79}
80
81template<> void JSHTMLHeadElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
82{
83 putDirect(vm, vm.propertyNames->prototype, JSHTMLHeadElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
84 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLHeadElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
85 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
86}
87
88template<> const ClassInfo JSHTMLHeadElementConstructor::s_info = { "HTMLHeadElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLHeadElementConstructor) };
89
90/* Hash table for prototype */
91
92static const HashTableValue JSHTMLHeadElementPrototypeTableValues[] =
93{
94 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLHeadElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLHeadElementConstructor) } },
95 { "profile", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLHeadElementProfile), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLHeadElementProfile) } },
96};
97
98const ClassInfo JSHTMLHeadElementPrototype::s_info = { "HTMLHeadElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLHeadElementPrototype) };
99
100void JSHTMLHeadElementPrototype::finishCreation(VM& vm)
101{
102 Base::finishCreation(vm);
103 reifyStaticProperties(vm, JSHTMLHeadElement::info(), JSHTMLHeadElementPrototypeTableValues, *this);
104}
105
106const ClassInfo JSHTMLHeadElement::s_info = { "HTMLHeadElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLHeadElement) };
107
108JSHTMLHeadElement::JSHTMLHeadElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLHeadElement>&& impl)
109 : JSHTMLElement(structure, globalObject, WTFMove(impl))
110{
111}
112
113void JSHTMLHeadElement::finishCreation(VM& vm)
114{
115 Base::finishCreation(vm);
116 ASSERT(inherits(vm, info()));
117
118}
119
120JSObject* JSHTMLHeadElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
121{
122 return JSHTMLHeadElementPrototype::create(vm, &globalObject, JSHTMLHeadElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject)));
123}
124
125JSObject* JSHTMLHeadElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
126{
127 return getDOMPrototype<JSHTMLHeadElement>(vm, globalObject);
128}
129
130JSValue JSHTMLHeadElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
131{
132 return getDOMConstructor<JSHTMLHeadElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
133}
134
135template<> inline JSHTMLHeadElement* IDLAttribute<JSHTMLHeadElement>::cast(ExecState& state, EncodedJSValue thisValue)
136{
137 return jsDynamicCast<JSHTMLHeadElement*>(state.vm(), JSValue::decode(thisValue));
138}
139
140EncodedJSValue jsHTMLHeadElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
141{
142 VM& vm = state->vm();
143 auto throwScope = DECLARE_THROW_SCOPE(vm);
144 auto* prototype = jsDynamicCast<JSHTMLHeadElementPrototype*>(vm, JSValue::decode(thisValue));
145 if (UNLIKELY(!prototype))
146 return throwVMTypeError(state, throwScope);
147 return JSValue::encode(JSHTMLHeadElement::getConstructor(state->vm(), prototype->globalObject()));
148}
149
150bool setJSHTMLHeadElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
151{
152 VM& vm = state->vm();
153 auto throwScope = DECLARE_THROW_SCOPE(vm);
154 auto* prototype = jsDynamicCast<JSHTMLHeadElementPrototype*>(vm, JSValue::decode(thisValue));
155 if (UNLIKELY(!prototype)) {
156 throwVMTypeError(state, throwScope);
157 return false;
158 }
159 // Shadowing a built-in constructor
160 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
161}
162
163static inline JSValue jsHTMLHeadElementProfileGetter(ExecState& state, JSHTMLHeadElement& thisObject, ThrowScope& throwScope)
164{
165 UNUSED_PARAM(throwScope);
166 UNUSED_PARAM(state);
167 auto& impl = thisObject.wrapped();
168 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::profileAttr));
169 return result;
170}
171
172EncodedJSValue jsHTMLHeadElementProfile(ExecState* state, EncodedJSValue thisValue, PropertyName)
173{
174 return IDLAttribute<JSHTMLHeadElement>::get<jsHTMLHeadElementProfileGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "profile");
175}
176
177static inline bool setJSHTMLHeadElementProfileSetter(ExecState& state, JSHTMLHeadElement& thisObject, JSValue value, ThrowScope& throwScope)
178{
179 UNUSED_PARAM(throwScope);
180 auto& impl = thisObject.wrapped();
181 auto nativeValue = convert<IDLDOMString>(state, value);
182 RETURN_IF_EXCEPTION(throwScope, false);
183 AttributeSetter::call(state, throwScope, [&] {
184 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::profileAttr, WTFMove(nativeValue));
185 });
186 return true;
187}
188
189bool setJSHTMLHeadElementProfile(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
190{
191 return IDLAttribute<JSHTMLHeadElement>::set<setJSHTMLHeadElementProfileSetter>(*state, thisValue, encodedValue, "profile");
192}
193
194void JSHTMLHeadElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
195{
196 auto* thisObject = jsCast<JSHTMLHeadElement*>(cell);
197 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
198 if (thisObject->scriptExecutionContext())
199 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
200 Base::heapSnapshot(cell, builder);
201}
202
203
204}
205