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 | |
23 | #if ENABLE(INDEXED_DATABASE) |
24 | |
25 | #include "JSIDBCursorWithValue.h" |
26 | |
27 | #include "JSDOMAttribute.h" |
28 | #include "JSDOMBinding.h" |
29 | #include "JSDOMConstructorNotConstructable.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 | |
40 | namespace WebCore { |
41 | using namespace JSC; |
42 | |
43 | // Attributes |
44 | |
45 | JSC::EncodedJSValue jsIDBCursorWithValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
46 | bool setJSIDBCursorWithValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
47 | JSC::EncodedJSValue jsIDBCursorWithValueValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
48 | |
49 | class JSIDBCursorWithValuePrototype : public JSC::JSNonFinalObject { |
50 | public: |
51 | using Base = JSC::JSNonFinalObject; |
52 | static JSIDBCursorWithValuePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
53 | { |
54 | JSIDBCursorWithValuePrototype* ptr = new (NotNull, JSC::allocateCell<JSIDBCursorWithValuePrototype>(vm.heap)) JSIDBCursorWithValuePrototype(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 | |
65 | private: |
66 | JSIDBCursorWithValuePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
67 | : JSC::JSNonFinalObject(vm, structure) |
68 | { |
69 | } |
70 | |
71 | void finishCreation(JSC::VM&); |
72 | }; |
73 | |
74 | using JSIDBCursorWithValueConstructor = JSDOMConstructorNotConstructable<JSIDBCursorWithValue>; |
75 | |
76 | template<> JSValue JSIDBCursorWithValueConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
77 | { |
78 | return JSIDBCursor::getConstructor(vm, &globalObject); |
79 | } |
80 | |
81 | template<> void JSIDBCursorWithValueConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
82 | { |
83 | putDirect(vm, vm.propertyNames->prototype, JSIDBCursorWithValue::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
84 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("IDBCursorWithValue"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
85 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
86 | } |
87 | |
88 | template<> const ClassInfo JSIDBCursorWithValueConstructor::s_info = { "IDBCursorWithValue" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSIDBCursorWithValueConstructor) }; |
89 | |
90 | /* Hash table for prototype */ |
91 | |
92 | static const HashTableValue JSIDBCursorWithValuePrototypeTableValues[] = |
93 | { |
94 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBCursorWithValueConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSIDBCursorWithValueConstructor) } }, |
95 | { "value" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBCursorWithValueValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
96 | }; |
97 | |
98 | const ClassInfo JSIDBCursorWithValuePrototype::s_info = { "IDBCursorWithValuePrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSIDBCursorWithValuePrototype) }; |
99 | |
100 | void JSIDBCursorWithValuePrototype::finishCreation(VM& vm) |
101 | { |
102 | Base::finishCreation(vm); |
103 | reifyStaticProperties(vm, JSIDBCursorWithValue::info(), JSIDBCursorWithValuePrototypeTableValues, *this); |
104 | } |
105 | |
106 | const ClassInfo JSIDBCursorWithValue::s_info = { "IDBCursorWithValue" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSIDBCursorWithValue) }; |
107 | |
108 | JSIDBCursorWithValue::JSIDBCursorWithValue(Structure* structure, JSDOMGlobalObject& globalObject, Ref<IDBCursorWithValue>&& impl) |
109 | : JSIDBCursor(structure, globalObject, WTFMove(impl)) |
110 | { |
111 | } |
112 | |
113 | void JSIDBCursorWithValue::finishCreation(VM& vm) |
114 | { |
115 | Base::finishCreation(vm); |
116 | ASSERT(inherits(vm, info())); |
117 | |
118 | } |
119 | |
120 | JSObject* JSIDBCursorWithValue::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
121 | { |
122 | return JSIDBCursorWithValuePrototype::create(vm, &globalObject, JSIDBCursorWithValuePrototype::createStructure(vm, &globalObject, JSIDBCursor::prototype(vm, globalObject))); |
123 | } |
124 | |
125 | JSObject* JSIDBCursorWithValue::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
126 | { |
127 | return getDOMPrototype<JSIDBCursorWithValue>(vm, globalObject); |
128 | } |
129 | |
130 | JSValue JSIDBCursorWithValue::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
131 | { |
132 | return getDOMConstructor<JSIDBCursorWithValueConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
133 | } |
134 | |
135 | template<> inline JSIDBCursorWithValue* IDLAttribute<JSIDBCursorWithValue>::cast(ExecState& state, EncodedJSValue thisValue) |
136 | { |
137 | return jsDynamicCast<JSIDBCursorWithValue*>(state.vm(), JSValue::decode(thisValue)); |
138 | } |
139 | |
140 | EncodedJSValue jsIDBCursorWithValueConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
141 | { |
142 | VM& vm = state->vm(); |
143 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
144 | auto* prototype = jsDynamicCast<JSIDBCursorWithValuePrototype*>(vm, JSValue::decode(thisValue)); |
145 | if (UNLIKELY(!prototype)) |
146 | return throwVMTypeError(state, throwScope); |
147 | return JSValue::encode(JSIDBCursorWithValue::getConstructor(state->vm(), prototype->globalObject())); |
148 | } |
149 | |
150 | bool setJSIDBCursorWithValueConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
151 | { |
152 | VM& vm = state->vm(); |
153 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
154 | auto* prototype = jsDynamicCast<JSIDBCursorWithValuePrototype*>(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 | |
163 | static inline JSValue jsIDBCursorWithValueValueGetter(ExecState& state, JSIDBCursorWithValue& thisObject, ThrowScope& throwScope) |
164 | { |
165 | UNUSED_PARAM(throwScope); |
166 | UNUSED_PARAM(state); |
167 | return thisObject.value(state); |
168 | } |
169 | |
170 | EncodedJSValue jsIDBCursorWithValueValue(ExecState* state, EncodedJSValue thisValue, PropertyName) |
171 | { |
172 | return IDLAttribute<JSIDBCursorWithValue>::get<jsIDBCursorWithValueValueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "value" ); |
173 | } |
174 | |
175 | void JSIDBCursorWithValue::visitChildren(JSCell* cell, SlotVisitor& visitor) |
176 | { |
177 | auto* thisObject = jsCast<JSIDBCursorWithValue*>(cell); |
178 | ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
179 | Base::visitChildren(thisObject, visitor); |
180 | thisObject->visitAdditionalChildren(visitor); |
181 | } |
182 | |
183 | void JSIDBCursorWithValue::visitOutputConstraints(JSCell* cell, SlotVisitor& visitor) |
184 | { |
185 | auto* thisObject = jsCast<JSIDBCursorWithValue*>(cell); |
186 | ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
187 | Base::visitOutputConstraints(thisObject, visitor); |
188 | thisObject->visitAdditionalChildren(visitor); |
189 | } |
190 | |
191 | void JSIDBCursorWithValue::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
192 | { |
193 | auto* thisObject = jsCast<JSIDBCursorWithValue*>(cell); |
194 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
195 | if (thisObject->scriptExecutionContext()) |
196 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
197 | Base::heapSnapshot(cell, builder); |
198 | } |
199 | |
200 | |
201 | } |
202 | |
203 | #endif // ENABLE(INDEXED_DATABASE) |
204 | |