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 "JSDeprecatedCSSOMCounter.h"
23
24#include "JSDOMAttribute.h"
25#include "JSDOMBinding.h"
26#include "JSDOMConstructorNotConstructable.h"
27#include "JSDOMConvertStrings.h"
28#include "JSDOMExceptionHandling.h"
29#include "JSDOMWrapperCache.h"
30#include "ScriptExecutionContext.h"
31#include <JavaScriptCore/FunctionPrototype.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 jsDeprecatedCSSOMCounterConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
45bool setJSDeprecatedCSSOMCounterConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
46JSC::EncodedJSValue jsDeprecatedCSSOMCounterIdentifier(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
47JSC::EncodedJSValue jsDeprecatedCSSOMCounterListStyle(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
48JSC::EncodedJSValue jsDeprecatedCSSOMCounterSeparator(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49
50class JSDeprecatedCSSOMCounterPrototype : public JSC::JSNonFinalObject {
51public:
52 using Base = JSC::JSNonFinalObject;
53 static JSDeprecatedCSSOMCounterPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
54 {
55 JSDeprecatedCSSOMCounterPrototype* ptr = new (NotNull, JSC::allocateCell<JSDeprecatedCSSOMCounterPrototype>(vm.heap)) JSDeprecatedCSSOMCounterPrototype(vm, globalObject, structure);
56 ptr->finishCreation(vm);
57 return ptr;
58 }
59
60 DECLARE_INFO;
61 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
62 {
63 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
64 }
65
66private:
67 JSDeprecatedCSSOMCounterPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
68 : JSC::JSNonFinalObject(vm, structure)
69 {
70 }
71
72 void finishCreation(JSC::VM&);
73};
74
75using JSDeprecatedCSSOMCounterConstructor = JSDOMConstructorNotConstructable<JSDeprecatedCSSOMCounter>;
76
77template<> JSValue JSDeprecatedCSSOMCounterConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
78{
79 UNUSED_PARAM(vm);
80 return globalObject.functionPrototype();
81}
82
83template<> void JSDeprecatedCSSOMCounterConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
84{
85 putDirect(vm, vm.propertyNames->prototype, JSDeprecatedCSSOMCounter::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
86 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("Counter"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
87 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
88}
89
90template<> const ClassInfo JSDeprecatedCSSOMCounterConstructor::s_info = { "Counter", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDeprecatedCSSOMCounterConstructor) };
91
92/* Hash table for prototype */
93
94static const HashTableValue JSDeprecatedCSSOMCounterPrototypeTableValues[] =
95{
96 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMCounterConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDeprecatedCSSOMCounterConstructor) } },
97 { "identifier", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMCounterIdentifier), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
98 { "listStyle", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMCounterListStyle), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
99 { "separator", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMCounterSeparator), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
100};
101
102const ClassInfo JSDeprecatedCSSOMCounterPrototype::s_info = { "CounterPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDeprecatedCSSOMCounterPrototype) };
103
104void JSDeprecatedCSSOMCounterPrototype::finishCreation(VM& vm)
105{
106 Base::finishCreation(vm);
107 reifyStaticProperties(vm, JSDeprecatedCSSOMCounter::info(), JSDeprecatedCSSOMCounterPrototypeTableValues, *this);
108}
109
110const ClassInfo JSDeprecatedCSSOMCounter::s_info = { "Counter", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDeprecatedCSSOMCounter) };
111
112JSDeprecatedCSSOMCounter::JSDeprecatedCSSOMCounter(Structure* structure, JSDOMGlobalObject& globalObject, Ref<DeprecatedCSSOMCounter>&& impl)
113 : JSDOMWrapper<DeprecatedCSSOMCounter>(structure, globalObject, WTFMove(impl))
114{
115}
116
117void JSDeprecatedCSSOMCounter::finishCreation(VM& vm)
118{
119 Base::finishCreation(vm);
120 ASSERT(inherits(vm, info()));
121
122}
123
124JSObject* JSDeprecatedCSSOMCounter::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
125{
126 return JSDeprecatedCSSOMCounterPrototype::create(vm, &globalObject, JSDeprecatedCSSOMCounterPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
127}
128
129JSObject* JSDeprecatedCSSOMCounter::prototype(VM& vm, JSDOMGlobalObject& globalObject)
130{
131 return getDOMPrototype<JSDeprecatedCSSOMCounter>(vm, globalObject);
132}
133
134JSValue JSDeprecatedCSSOMCounter::getConstructor(VM& vm, const JSGlobalObject* globalObject)
135{
136 return getDOMConstructor<JSDeprecatedCSSOMCounterConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
137}
138
139void JSDeprecatedCSSOMCounter::destroy(JSC::JSCell* cell)
140{
141 JSDeprecatedCSSOMCounter* thisObject = static_cast<JSDeprecatedCSSOMCounter*>(cell);
142 thisObject->JSDeprecatedCSSOMCounter::~JSDeprecatedCSSOMCounter();
143}
144
145template<> inline JSDeprecatedCSSOMCounter* IDLAttribute<JSDeprecatedCSSOMCounter>::cast(ExecState& state, EncodedJSValue thisValue)
146{
147 return jsDynamicCast<JSDeprecatedCSSOMCounter*>(state.vm(), JSValue::decode(thisValue));
148}
149
150EncodedJSValue jsDeprecatedCSSOMCounterConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
151{
152 VM& vm = state->vm();
153 auto throwScope = DECLARE_THROW_SCOPE(vm);
154 auto* prototype = jsDynamicCast<JSDeprecatedCSSOMCounterPrototype*>(vm, JSValue::decode(thisValue));
155 if (UNLIKELY(!prototype))
156 return throwVMTypeError(state, throwScope);
157 return JSValue::encode(JSDeprecatedCSSOMCounter::getConstructor(state->vm(), prototype->globalObject()));
158}
159
160bool setJSDeprecatedCSSOMCounterConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
161{
162 VM& vm = state->vm();
163 auto throwScope = DECLARE_THROW_SCOPE(vm);
164 auto* prototype = jsDynamicCast<JSDeprecatedCSSOMCounterPrototype*>(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 jsDeprecatedCSSOMCounterIdentifierGetter(ExecState& state, JSDeprecatedCSSOMCounter& 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.identifier());
179 return result;
180}
181
182EncodedJSValue jsDeprecatedCSSOMCounterIdentifier(ExecState* state, EncodedJSValue thisValue, PropertyName)
183{
184 return IDLAttribute<JSDeprecatedCSSOMCounter>::get<jsDeprecatedCSSOMCounterIdentifierGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "identifier");
185}
186
187static inline JSValue jsDeprecatedCSSOMCounterListStyleGetter(ExecState& state, JSDeprecatedCSSOMCounter& thisObject, ThrowScope& throwScope)
188{
189 UNUSED_PARAM(throwScope);
190 UNUSED_PARAM(state);
191 auto& impl = thisObject.wrapped();
192 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.listStyle());
193 return result;
194}
195
196EncodedJSValue jsDeprecatedCSSOMCounterListStyle(ExecState* state, EncodedJSValue thisValue, PropertyName)
197{
198 return IDLAttribute<JSDeprecatedCSSOMCounter>::get<jsDeprecatedCSSOMCounterListStyleGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "listStyle");
199}
200
201static inline JSValue jsDeprecatedCSSOMCounterSeparatorGetter(ExecState& state, JSDeprecatedCSSOMCounter& thisObject, ThrowScope& throwScope)
202{
203 UNUSED_PARAM(throwScope);
204 UNUSED_PARAM(state);
205 auto& impl = thisObject.wrapped();
206 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.separator());
207 return result;
208}
209
210EncodedJSValue jsDeprecatedCSSOMCounterSeparator(ExecState* state, EncodedJSValue thisValue, PropertyName)
211{
212 return IDLAttribute<JSDeprecatedCSSOMCounter>::get<jsDeprecatedCSSOMCounterSeparatorGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "separator");
213}
214
215void JSDeprecatedCSSOMCounter::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
216{
217 auto* thisObject = jsCast<JSDeprecatedCSSOMCounter*>(cell);
218 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
219 if (thisObject->scriptExecutionContext())
220 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
221 Base::heapSnapshot(cell, builder);
222}
223
224bool JSDeprecatedCSSOMCounterOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
225{
226 UNUSED_PARAM(handle);
227 UNUSED_PARAM(visitor);
228 UNUSED_PARAM(reason);
229 return false;
230}
231
232void JSDeprecatedCSSOMCounterOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
233{
234 auto* jsDeprecatedCSSOMCounter = static_cast<JSDeprecatedCSSOMCounter*>(handle.slot()->asCell());
235 auto& world = *static_cast<DOMWrapperWorld*>(context);
236 uncacheWrapper(world, &jsDeprecatedCSSOMCounter->wrapped(), jsDeprecatedCSSOMCounter);
237}
238
239JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<DeprecatedCSSOMCounter>&& impl)
240{
241 // If you hit this failure the interface definition has the ImplementationLacksVTable
242 // attribute. You should remove that attribute. If the class has subclasses
243 // that may be passed through this toJS() function you should use the SkipVTableValidation
244 // attribute to DeprecatedCSSOMCounter.
245 static_assert(!std::is_polymorphic<DeprecatedCSSOMCounter>::value, "DeprecatedCSSOMCounter is polymorphic but the IDL claims it is not");
246 return createWrapper<DeprecatedCSSOMCounter>(globalObject, WTFMove(impl));
247}
248
249JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, DeprecatedCSSOMCounter& impl)
250{
251 return wrap(state, globalObject, impl);
252}
253
254DeprecatedCSSOMCounter* JSDeprecatedCSSOMCounter::toWrapped(JSC::VM& vm, JSC::JSValue value)
255{
256 if (auto* wrapper = jsDynamicCast<JSDeprecatedCSSOMCounter*>(vm, value))
257 return &wrapper->wrapped();
258 return nullptr;
259}
260
261}
262