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