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 "JSFileSystemFileEntry.h"
23
24#include "JSDOMBinding.h"
25#include "JSDOMConstructorNotConstructable.h"
26#include "JSDOMConvertCallbacks.h"
27#include "JSDOMConvertNullable.h"
28#include "JSDOMExceptionHandling.h"
29#include "JSDOMGlobalObject.h"
30#include "JSDOMOperation.h"
31#include "JSDOMWrapperCache.h"
32#include "JSErrorCallback.h"
33#include "JSFileCallback.h"
34#include "ScriptExecutionContext.h"
35#include <JavaScriptCore/HeapSnapshotBuilder.h>
36#include <JavaScriptCore/JSCInlines.h>
37#include <wtf/GetPtr.h>
38#include <wtf/PointerPreparations.h>
39#include <wtf/URL.h>
40
41
42namespace WebCore {
43using namespace JSC;
44
45// Functions
46
47JSC::EncodedJSValue JSC_HOST_CALL jsFileSystemFileEntryPrototypeFunctionFile(JSC::ExecState*);
48
49// Attributes
50
51JSC::EncodedJSValue jsFileSystemFileEntryConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52bool setJSFileSystemFileEntryConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
53
54class JSFileSystemFileEntryPrototype : public JSC::JSNonFinalObject {
55public:
56 using Base = JSC::JSNonFinalObject;
57 static JSFileSystemFileEntryPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
58 {
59 JSFileSystemFileEntryPrototype* ptr = new (NotNull, JSC::allocateCell<JSFileSystemFileEntryPrototype>(vm.heap)) JSFileSystemFileEntryPrototype(vm, globalObject, structure);
60 ptr->finishCreation(vm);
61 return ptr;
62 }
63
64 DECLARE_INFO;
65 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
66 {
67 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
68 }
69
70private:
71 JSFileSystemFileEntryPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
72 : JSC::JSNonFinalObject(vm, structure)
73 {
74 }
75
76 void finishCreation(JSC::VM&);
77};
78
79using JSFileSystemFileEntryConstructor = JSDOMConstructorNotConstructable<JSFileSystemFileEntry>;
80
81template<> JSValue JSFileSystemFileEntryConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
82{
83 return JSFileSystemEntry::getConstructor(vm, &globalObject);
84}
85
86template<> void JSFileSystemFileEntryConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
87{
88 putDirect(vm, vm.propertyNames->prototype, JSFileSystemFileEntry::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
89 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("FileSystemFileEntry"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
90 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
91}
92
93template<> const ClassInfo JSFileSystemFileEntryConstructor::s_info = { "FileSystemFileEntry", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSystemFileEntryConstructor) };
94
95/* Hash table for prototype */
96
97static const HashTableValue JSFileSystemFileEntryPrototypeTableValues[] =
98{
99 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsFileSystemFileEntryConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSFileSystemFileEntryConstructor) } },
100 { "file", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsFileSystemFileEntryPrototypeFunctionFile), (intptr_t) (1) } },
101};
102
103const ClassInfo JSFileSystemFileEntryPrototype::s_info = { "FileSystemFileEntryPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSystemFileEntryPrototype) };
104
105void JSFileSystemFileEntryPrototype::finishCreation(VM& vm)
106{
107 Base::finishCreation(vm);
108 reifyStaticProperties(vm, JSFileSystemFileEntry::info(), JSFileSystemFileEntryPrototypeTableValues, *this);
109}
110
111const ClassInfo JSFileSystemFileEntry::s_info = { "FileSystemFileEntry", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSystemFileEntry) };
112
113JSFileSystemFileEntry::JSFileSystemFileEntry(Structure* structure, JSDOMGlobalObject& globalObject, Ref<FileSystemFileEntry>&& impl)
114 : JSFileSystemEntry(structure, globalObject, WTFMove(impl))
115{
116}
117
118void JSFileSystemFileEntry::finishCreation(VM& vm)
119{
120 Base::finishCreation(vm);
121 ASSERT(inherits(vm, info()));
122
123}
124
125JSObject* JSFileSystemFileEntry::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
126{
127 return JSFileSystemFileEntryPrototype::create(vm, &globalObject, JSFileSystemFileEntryPrototype::createStructure(vm, &globalObject, JSFileSystemEntry::prototype(vm, globalObject)));
128}
129
130JSObject* JSFileSystemFileEntry::prototype(VM& vm, JSDOMGlobalObject& globalObject)
131{
132 return getDOMPrototype<JSFileSystemFileEntry>(vm, globalObject);
133}
134
135JSValue JSFileSystemFileEntry::getConstructor(VM& vm, const JSGlobalObject* globalObject)
136{
137 return getDOMConstructor<JSFileSystemFileEntryConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
138}
139
140template<> inline JSFileSystemFileEntry* IDLOperation<JSFileSystemFileEntry>::cast(ExecState& state)
141{
142 return jsDynamicCast<JSFileSystemFileEntry*>(state.vm(), state.thisValue());
143}
144
145EncodedJSValue jsFileSystemFileEntryConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
146{
147 VM& vm = state->vm();
148 auto throwScope = DECLARE_THROW_SCOPE(vm);
149 auto* prototype = jsDynamicCast<JSFileSystemFileEntryPrototype*>(vm, JSValue::decode(thisValue));
150 if (UNLIKELY(!prototype))
151 return throwVMTypeError(state, throwScope);
152 return JSValue::encode(JSFileSystemFileEntry::getConstructor(state->vm(), prototype->globalObject()));
153}
154
155bool setJSFileSystemFileEntryConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
156{
157 VM& vm = state->vm();
158 auto throwScope = DECLARE_THROW_SCOPE(vm);
159 auto* prototype = jsDynamicCast<JSFileSystemFileEntryPrototype*>(vm, JSValue::decode(thisValue));
160 if (UNLIKELY(!prototype)) {
161 throwVMTypeError(state, throwScope);
162 return false;
163 }
164 // Shadowing a built-in constructor
165 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
166}
167
168static inline JSC::EncodedJSValue jsFileSystemFileEntryPrototypeFunctionFileBody(JSC::ExecState* state, typename IDLOperation<JSFileSystemFileEntry>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
169{
170 UNUSED_PARAM(state);
171 UNUSED_PARAM(throwScope);
172 auto& impl = castedThis->wrapped();
173 if (UNLIKELY(state->argumentCount() < 1))
174 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
175 auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
176 if (UNLIKELY(!context))
177 return JSValue::encode(jsUndefined());
178 auto successCallback = convert<IDLCallbackFunction<JSFileCallback>>(*state, state->uncheckedArgument(0), *castedThis->globalObject(), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeFunctionError(state, scope, 0, "successCallback", "FileSystemFileEntry", "file"); });
179 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
180 auto errorCallback = convert<IDLNullable<IDLCallbackFunction<JSErrorCallback>>>(*state, state->argument(1), *castedThis->globalObject(), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeFunctionError(state, scope, 1, "errorCallback", "FileSystemFileEntry", "file"); });
181 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
182 impl.file(*context, successCallback.releaseNonNull(), WTFMove(errorCallback));
183 return JSValue::encode(jsUndefined());
184}
185
186EncodedJSValue JSC_HOST_CALL jsFileSystemFileEntryPrototypeFunctionFile(ExecState* state)
187{
188 return IDLOperation<JSFileSystemFileEntry>::call<jsFileSystemFileEntryPrototypeFunctionFileBody>(*state, "file");
189}
190
191void JSFileSystemFileEntry::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
192{
193 auto* thisObject = jsCast<JSFileSystemFileEntry*>(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