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(STREAMS_API) |
24 | |
25 | #include "JSReadableStreamBYOBRequest.h" |
26 | |
27 | #include "JSDOMAttribute.h" |
28 | #include "JSDOMBinding.h" |
29 | #include "JSDOMBuiltinConstructor.h" |
30 | #include "JSDOMExceptionHandling.h" |
31 | #include "JSDOMOperation.h" |
32 | #include "JSDOMWrapperCache.h" |
33 | #include "ReadableStreamBYOBRequestBuiltins.h" |
34 | #include <JavaScriptCore/FunctionPrototype.h> |
35 | #include <JavaScriptCore/JSCInlines.h> |
36 | #include <wtf/GetPtr.h> |
37 | #include <wtf/PointerPreparations.h> |
38 | |
39 | |
40 | namespace WebCore { |
41 | using namespace JSC; |
42 | |
43 | // Functions |
44 | |
45 | |
46 | // Attributes |
47 | |
48 | JSC::EncodedJSValue jsReadableStreamBYOBRequestConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
49 | bool setJSReadableStreamBYOBRequestConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
50 | |
51 | class JSReadableStreamBYOBRequestPrototype : public JSC::JSNonFinalObject { |
52 | public: |
53 | using Base = JSC::JSNonFinalObject; |
54 | static JSReadableStreamBYOBRequestPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
55 | { |
56 | JSReadableStreamBYOBRequestPrototype* ptr = new (NotNull, JSC::allocateCell<JSReadableStreamBYOBRequestPrototype>(vm.heap)) JSReadableStreamBYOBRequestPrototype(vm, globalObject, structure); |
57 | ptr->finishCreation(vm); |
58 | return ptr; |
59 | } |
60 | |
61 | DECLARE_INFO; |
62 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
63 | { |
64 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
65 | } |
66 | |
67 | private: |
68 | JSReadableStreamBYOBRequestPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
69 | : JSC::JSNonFinalObject(vm, structure) |
70 | { |
71 | } |
72 | |
73 | void finishCreation(JSC::VM&); |
74 | }; |
75 | |
76 | using JSReadableStreamBYOBRequestConstructor = JSDOMBuiltinConstructor<JSReadableStreamBYOBRequest>; |
77 | |
78 | template<> JSValue JSReadableStreamBYOBRequestConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
79 | { |
80 | UNUSED_PARAM(vm); |
81 | return globalObject.functionPrototype(); |
82 | } |
83 | |
84 | template<> void JSReadableStreamBYOBRequestConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
85 | { |
86 | putDirect(vm, vm.propertyNames->prototype, JSReadableStreamBYOBRequest::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
87 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("ReadableStreamBYOBRequest"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
88 | putDirect(vm, vm.propertyNames->length, jsNumber(2), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
89 | } |
90 | |
91 | template<> FunctionExecutable* JSReadableStreamBYOBRequestConstructor::initializeExecutable(VM& vm) |
92 | { |
93 | return readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeGenerator(vm); |
94 | } |
95 | |
96 | template<> const ClassInfo JSReadableStreamBYOBRequestConstructor::s_info = { "ReadableStreamBYOBRequest" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableStreamBYOBRequestConstructor) }; |
97 | |
98 | /* Hash table for prototype */ |
99 | |
100 | static const HashTableValue JSReadableStreamBYOBRequestPrototypeTableValues[] = |
101 | { |
102 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsReadableStreamBYOBRequestConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSReadableStreamBYOBRequestConstructor) } }, |
103 | { "view" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::Accessor | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(readableStreamBYOBRequestViewCodeGenerator), (intptr_t) (0) } }, |
104 | { "respond" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(readableStreamBYOBRequestRespondCodeGenerator), (intptr_t) (0) } }, |
105 | { "respondWithNewView" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(readableStreamBYOBRequestRespondWithNewViewCodeGenerator), (intptr_t) (0) } }, |
106 | }; |
107 | |
108 | const ClassInfo JSReadableStreamBYOBRequestPrototype::s_info = { "ReadableStreamBYOBRequestPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableStreamBYOBRequestPrototype) }; |
109 | |
110 | void JSReadableStreamBYOBRequestPrototype::finishCreation(VM& vm) |
111 | { |
112 | Base::finishCreation(vm); |
113 | reifyStaticProperties(vm, JSReadableStreamBYOBRequest::info(), JSReadableStreamBYOBRequestPrototypeTableValues, *this); |
114 | } |
115 | |
116 | const ClassInfo JSReadableStreamBYOBRequest::s_info = { "ReadableStreamBYOBRequest" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableStreamBYOBRequest) }; |
117 | |
118 | JSReadableStreamBYOBRequest::JSReadableStreamBYOBRequest(Structure* structure, JSDOMGlobalObject& globalObject) |
119 | : JSDOMObject(structure, globalObject) { } |
120 | |
121 | void JSReadableStreamBYOBRequest::finishCreation(VM& vm) |
122 | { |
123 | Base::finishCreation(vm); |
124 | ASSERT(inherits(vm, info())); |
125 | |
126 | } |
127 | |
128 | JSObject* JSReadableStreamBYOBRequest::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
129 | { |
130 | return JSReadableStreamBYOBRequestPrototype::create(vm, &globalObject, JSReadableStreamBYOBRequestPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
131 | } |
132 | |
133 | JSObject* JSReadableStreamBYOBRequest::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
134 | { |
135 | return getDOMPrototype<JSReadableStreamBYOBRequest>(vm, globalObject); |
136 | } |
137 | |
138 | JSValue JSReadableStreamBYOBRequest::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
139 | { |
140 | return getDOMConstructor<JSReadableStreamBYOBRequestConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
141 | } |
142 | |
143 | void JSReadableStreamBYOBRequest::destroy(JSC::JSCell* cell) |
144 | { |
145 | JSReadableStreamBYOBRequest* thisObject = static_cast<JSReadableStreamBYOBRequest*>(cell); |
146 | thisObject->JSReadableStreamBYOBRequest::~JSReadableStreamBYOBRequest(); |
147 | } |
148 | |
149 | template<> inline JSReadableStreamBYOBRequest* IDLAttribute<JSReadableStreamBYOBRequest>::cast(ExecState& state, EncodedJSValue thisValue) |
150 | { |
151 | return jsDynamicCast<JSReadableStreamBYOBRequest*>(state.vm(), JSValue::decode(thisValue)); |
152 | } |
153 | |
154 | template<> inline JSReadableStreamBYOBRequest* IDLOperation<JSReadableStreamBYOBRequest>::cast(ExecState& state) |
155 | { |
156 | return jsDynamicCast<JSReadableStreamBYOBRequest*>(state.vm(), state.thisValue()); |
157 | } |
158 | |
159 | EncodedJSValue jsReadableStreamBYOBRequestConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
160 | { |
161 | VM& vm = state->vm(); |
162 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
163 | auto* prototype = jsDynamicCast<JSReadableStreamBYOBRequestPrototype*>(vm, JSValue::decode(thisValue)); |
164 | if (UNLIKELY(!prototype)) |
165 | return throwVMTypeError(state, throwScope); |
166 | return JSValue::encode(JSReadableStreamBYOBRequest::getConstructor(state->vm(), prototype->globalObject())); |
167 | } |
168 | |
169 | bool setJSReadableStreamBYOBRequestConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
170 | { |
171 | VM& vm = state->vm(); |
172 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
173 | auto* prototype = jsDynamicCast<JSReadableStreamBYOBRequestPrototype*>(vm, JSValue::decode(thisValue)); |
174 | if (UNLIKELY(!prototype)) { |
175 | throwVMTypeError(state, throwScope); |
176 | return false; |
177 | } |
178 | // Shadowing a built-in constructor |
179 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
180 | } |
181 | |
182 | |
183 | } |
184 | |
185 | #endif // ENABLE(STREAMS_API) |
186 | |