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 "JSCommandLineAPIHost.h" |
23 | |
24 | #include "JSDOMBinding.h" |
25 | #include "JSDOMConvertAny.h" |
26 | #include "JSDOMConvertBoolean.h" |
27 | #include "JSDOMConvertInterface.h" |
28 | #include "JSDOMConvertObject.h" |
29 | #include "JSDOMConvertRecord.h" |
30 | #include "JSDOMConvertSequences.h" |
31 | #include "JSDOMConvertStrings.h" |
32 | #include "JSDOMExceptionHandling.h" |
33 | #include "JSDOMGlobalObject.h" |
34 | #include "JSDOMOperation.h" |
35 | #include "JSDOMWrapperCache.h" |
36 | #include "JSDatabase.h" |
37 | #include "JSEventTarget.h" |
38 | #include "JSStorage.h" |
39 | #include "ScriptExecutionContext.h" |
40 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
41 | #include <JavaScriptCore/JSArray.h> |
42 | #include <JavaScriptCore/JSCInlines.h> |
43 | #include <JavaScriptCore/ObjectConstructor.h> |
44 | #include <wtf/GetPtr.h> |
45 | #include <wtf/PointerPreparations.h> |
46 | #include <wtf/URL.h> |
47 | #include <wtf/Vector.h> |
48 | |
49 | |
50 | namespace WebCore { |
51 | using namespace JSC; |
52 | |
53 | template<> CommandLineAPIHost::ListenerEntry convertDictionary<CommandLineAPIHost::ListenerEntry>(ExecState& state, JSValue value) |
54 | { |
55 | VM& vm = state.vm(); |
56 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
57 | bool isNullOrUndefined = value.isUndefinedOrNull(); |
58 | auto* object = isNullOrUndefined ? nullptr : value.getObject(); |
59 | if (UNLIKELY(!isNullOrUndefined && !object)) { |
60 | throwTypeError(&state, throwScope); |
61 | return { }; |
62 | } |
63 | CommandLineAPIHost::ListenerEntry result; |
64 | JSValue listenerValue; |
65 | if (isNullOrUndefined) |
66 | listenerValue = jsUndefined(); |
67 | else { |
68 | listenerValue = object->get(&state, Identifier::fromString(&state, "listener" )); |
69 | RETURN_IF_EXCEPTION(throwScope, { }); |
70 | } |
71 | if (!listenerValue.isUndefined()) { |
72 | result.listener = convert<IDLObject>(state, listenerValue); |
73 | RETURN_IF_EXCEPTION(throwScope, { }); |
74 | } else { |
75 | throwRequiredMemberTypeError(state, throwScope, "listener" , "ListenerEntry" , "object" ); |
76 | return { }; |
77 | } |
78 | JSValue onceValue; |
79 | if (isNullOrUndefined) |
80 | onceValue = jsUndefined(); |
81 | else { |
82 | onceValue = object->get(&state, Identifier::fromString(&state, "once" )); |
83 | RETURN_IF_EXCEPTION(throwScope, { }); |
84 | } |
85 | if (!onceValue.isUndefined()) { |
86 | result.once = convert<IDLBoolean>(state, onceValue); |
87 | RETURN_IF_EXCEPTION(throwScope, { }); |
88 | } else { |
89 | throwRequiredMemberTypeError(state, throwScope, "once" , "ListenerEntry" , "boolean" ); |
90 | return { }; |
91 | } |
92 | JSValue passiveValue; |
93 | if (isNullOrUndefined) |
94 | passiveValue = jsUndefined(); |
95 | else { |
96 | passiveValue = object->get(&state, Identifier::fromString(&state, "passive" )); |
97 | RETURN_IF_EXCEPTION(throwScope, { }); |
98 | } |
99 | if (!passiveValue.isUndefined()) { |
100 | result.passive = convert<IDLBoolean>(state, passiveValue); |
101 | RETURN_IF_EXCEPTION(throwScope, { }); |
102 | } else { |
103 | throwRequiredMemberTypeError(state, throwScope, "passive" , "ListenerEntry" , "boolean" ); |
104 | return { }; |
105 | } |
106 | JSValue useCaptureValue; |
107 | if (isNullOrUndefined) |
108 | useCaptureValue = jsUndefined(); |
109 | else { |
110 | useCaptureValue = object->get(&state, Identifier::fromString(&state, "useCapture" )); |
111 | RETURN_IF_EXCEPTION(throwScope, { }); |
112 | } |
113 | if (!useCaptureValue.isUndefined()) { |
114 | result.useCapture = convert<IDLBoolean>(state, useCaptureValue); |
115 | RETURN_IF_EXCEPTION(throwScope, { }); |
116 | } else { |
117 | throwRequiredMemberTypeError(state, throwScope, "useCapture" , "ListenerEntry" , "boolean" ); |
118 | return { }; |
119 | } |
120 | return result; |
121 | } |
122 | |
123 | JSC::JSObject* convertDictionaryToJS(JSC::ExecState& state, JSDOMGlobalObject& globalObject, const CommandLineAPIHost::ListenerEntry& dictionary) |
124 | { |
125 | auto& vm = state.vm(); |
126 | |
127 | auto result = constructEmptyObject(&state, globalObject.objectPrototype()); |
128 | |
129 | auto listenerValue = toJS<IDLObject>(dictionary.listener); |
130 | result->putDirect(vm, JSC::Identifier::fromString(&vm, "listener" ), listenerValue); |
131 | auto onceValue = toJS<IDLBoolean>(dictionary.once); |
132 | result->putDirect(vm, JSC::Identifier::fromString(&vm, "once" ), onceValue); |
133 | auto passiveValue = toJS<IDLBoolean>(dictionary.passive); |
134 | result->putDirect(vm, JSC::Identifier::fromString(&vm, "passive" ), passiveValue); |
135 | auto useCaptureValue = toJS<IDLBoolean>(dictionary.useCapture); |
136 | result->putDirect(vm, JSC::Identifier::fromString(&vm, "useCapture" ), useCaptureValue); |
137 | return result; |
138 | } |
139 | |
140 | // Functions |
141 | |
142 | JSC::EncodedJSValue JSC_HOST_CALL jsCommandLineAPIHostPrototypeFunctionClearConsoleMessages(JSC::ExecState*); |
143 | JSC::EncodedJSValue JSC_HOST_CALL jsCommandLineAPIHostPrototypeFunctionCopyText(JSC::ExecState*); |
144 | JSC::EncodedJSValue JSC_HOST_CALL jsCommandLineAPIHostPrototypeFunctionInspect(JSC::ExecState*); |
145 | JSC::EncodedJSValue JSC_HOST_CALL jsCommandLineAPIHostPrototypeFunctionInspectedObject(JSC::ExecState*); |
146 | JSC::EncodedJSValue JSC_HOST_CALL jsCommandLineAPIHostPrototypeFunctionGetEventListeners(JSC::ExecState*); |
147 | JSC::EncodedJSValue JSC_HOST_CALL jsCommandLineAPIHostPrototypeFunctionDatabaseId(JSC::ExecState*); |
148 | JSC::EncodedJSValue JSC_HOST_CALL jsCommandLineAPIHostPrototypeFunctionStorageId(JSC::ExecState*); |
149 | |
150 | class JSCommandLineAPIHostPrototype : public JSC::JSNonFinalObject { |
151 | public: |
152 | using Base = JSC::JSNonFinalObject; |
153 | static JSCommandLineAPIHostPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
154 | { |
155 | JSCommandLineAPIHostPrototype* ptr = new (NotNull, JSC::allocateCell<JSCommandLineAPIHostPrototype>(vm.heap)) JSCommandLineAPIHostPrototype(vm, globalObject, structure); |
156 | ptr->finishCreation(vm); |
157 | return ptr; |
158 | } |
159 | |
160 | DECLARE_INFO; |
161 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
162 | { |
163 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
164 | } |
165 | |
166 | private: |
167 | JSCommandLineAPIHostPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
168 | : JSC::JSNonFinalObject(vm, structure) |
169 | { |
170 | } |
171 | |
172 | void finishCreation(JSC::VM&); |
173 | }; |
174 | |
175 | /* Hash table for prototype */ |
176 | |
177 | static const HashTableValue JSCommandLineAPIHostPrototypeTableValues[] = |
178 | { |
179 | { "clearConsoleMessages" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCommandLineAPIHostPrototypeFunctionClearConsoleMessages), (intptr_t) (0) } }, |
180 | { "copyText" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCommandLineAPIHostPrototypeFunctionCopyText), (intptr_t) (1) } }, |
181 | { "inspect" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCommandLineAPIHostPrototypeFunctionInspect), (intptr_t) (2) } }, |
182 | { "inspectedObject" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCommandLineAPIHostPrototypeFunctionInspectedObject), (intptr_t) (0) } }, |
183 | { "getEventListeners" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCommandLineAPIHostPrototypeFunctionGetEventListeners), (intptr_t) (1) } }, |
184 | { "databaseId" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCommandLineAPIHostPrototypeFunctionDatabaseId), (intptr_t) (1) } }, |
185 | { "storageId" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCommandLineAPIHostPrototypeFunctionStorageId), (intptr_t) (1) } }, |
186 | }; |
187 | |
188 | const ClassInfo JSCommandLineAPIHostPrototype::s_info = { "CommandLineAPIHostPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCommandLineAPIHostPrototype) }; |
189 | |
190 | void JSCommandLineAPIHostPrototype::finishCreation(VM& vm) |
191 | { |
192 | Base::finishCreation(vm); |
193 | reifyStaticProperties(vm, JSCommandLineAPIHost::info(), JSCommandLineAPIHostPrototypeTableValues, *this); |
194 | } |
195 | |
196 | const ClassInfo JSCommandLineAPIHost::s_info = { "CommandLineAPIHost" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCommandLineAPIHost) }; |
197 | |
198 | JSCommandLineAPIHost::JSCommandLineAPIHost(Structure* structure, JSDOMGlobalObject& globalObject, Ref<CommandLineAPIHost>&& impl) |
199 | : JSDOMWrapper<CommandLineAPIHost>(structure, globalObject, WTFMove(impl)) |
200 | { |
201 | } |
202 | |
203 | void JSCommandLineAPIHost::finishCreation(VM& vm) |
204 | { |
205 | Base::finishCreation(vm); |
206 | ASSERT(inherits(vm, info())); |
207 | |
208 | } |
209 | |
210 | JSObject* JSCommandLineAPIHost::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
211 | { |
212 | return JSCommandLineAPIHostPrototype::create(vm, &globalObject, JSCommandLineAPIHostPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
213 | } |
214 | |
215 | JSObject* JSCommandLineAPIHost::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
216 | { |
217 | return getDOMPrototype<JSCommandLineAPIHost>(vm, globalObject); |
218 | } |
219 | |
220 | void JSCommandLineAPIHost::destroy(JSC::JSCell* cell) |
221 | { |
222 | JSCommandLineAPIHost* thisObject = static_cast<JSCommandLineAPIHost*>(cell); |
223 | thisObject->JSCommandLineAPIHost::~JSCommandLineAPIHost(); |
224 | } |
225 | |
226 | template<> inline JSCommandLineAPIHost* IDLOperation<JSCommandLineAPIHost>::cast(ExecState& state) |
227 | { |
228 | return jsDynamicCast<JSCommandLineAPIHost*>(state.vm(), state.thisValue()); |
229 | } |
230 | |
231 | static inline JSC::EncodedJSValue jsCommandLineAPIHostPrototypeFunctionClearConsoleMessagesBody(JSC::ExecState* state, typename IDLOperation<JSCommandLineAPIHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
232 | { |
233 | UNUSED_PARAM(state); |
234 | UNUSED_PARAM(throwScope); |
235 | auto& impl = castedThis->wrapped(); |
236 | impl.clearConsoleMessages(); |
237 | return JSValue::encode(jsUndefined()); |
238 | } |
239 | |
240 | EncodedJSValue JSC_HOST_CALL jsCommandLineAPIHostPrototypeFunctionClearConsoleMessages(ExecState* state) |
241 | { |
242 | return IDLOperation<JSCommandLineAPIHost>::call<jsCommandLineAPIHostPrototypeFunctionClearConsoleMessagesBody>(*state, "clearConsoleMessages" ); |
243 | } |
244 | |
245 | static inline JSC::EncodedJSValue jsCommandLineAPIHostPrototypeFunctionCopyTextBody(JSC::ExecState* state, typename IDLOperation<JSCommandLineAPIHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
246 | { |
247 | UNUSED_PARAM(state); |
248 | UNUSED_PARAM(throwScope); |
249 | auto& impl = castedThis->wrapped(); |
250 | if (UNLIKELY(state->argumentCount() < 1)) |
251 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
252 | auto text = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
253 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
254 | impl.copyText(WTFMove(text)); |
255 | return JSValue::encode(jsUndefined()); |
256 | } |
257 | |
258 | EncodedJSValue JSC_HOST_CALL jsCommandLineAPIHostPrototypeFunctionCopyText(ExecState* state) |
259 | { |
260 | return IDLOperation<JSCommandLineAPIHost>::call<jsCommandLineAPIHostPrototypeFunctionCopyTextBody>(*state, "copyText" ); |
261 | } |
262 | |
263 | static inline JSC::EncodedJSValue jsCommandLineAPIHostPrototypeFunctionInspectBody(JSC::ExecState* state, typename IDLOperation<JSCommandLineAPIHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
264 | { |
265 | UNUSED_PARAM(state); |
266 | UNUSED_PARAM(throwScope); |
267 | auto& impl = castedThis->wrapped(); |
268 | if (UNLIKELY(state->argumentCount() < 2)) |
269 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
270 | auto objectToInspect = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
271 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
272 | auto hints = convert<IDLAny>(*state, state->uncheckedArgument(1)); |
273 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
274 | impl.inspect(*state, WTFMove(objectToInspect), WTFMove(hints)); |
275 | return JSValue::encode(jsUndefined()); |
276 | } |
277 | |
278 | EncodedJSValue JSC_HOST_CALL jsCommandLineAPIHostPrototypeFunctionInspect(ExecState* state) |
279 | { |
280 | return IDLOperation<JSCommandLineAPIHost>::call<jsCommandLineAPIHostPrototypeFunctionInspectBody>(*state, "inspect" ); |
281 | } |
282 | |
283 | static inline JSC::EncodedJSValue jsCommandLineAPIHostPrototypeFunctionInspectedObjectBody(JSC::ExecState* state, typename IDLOperation<JSCommandLineAPIHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
284 | { |
285 | UNUSED_PARAM(state); |
286 | UNUSED_PARAM(throwScope); |
287 | auto& impl = castedThis->wrapped(); |
288 | return JSValue::encode(toJS<IDLAny>(impl.inspectedObject(*state))); |
289 | } |
290 | |
291 | EncodedJSValue JSC_HOST_CALL jsCommandLineAPIHostPrototypeFunctionInspectedObject(ExecState* state) |
292 | { |
293 | return IDLOperation<JSCommandLineAPIHost>::call<jsCommandLineAPIHostPrototypeFunctionInspectedObjectBody>(*state, "inspectedObject" ); |
294 | } |
295 | |
296 | static inline JSC::EncodedJSValue jsCommandLineAPIHostPrototypeFunctionGetEventListenersBody(JSC::ExecState* state, typename IDLOperation<JSCommandLineAPIHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
297 | { |
298 | UNUSED_PARAM(state); |
299 | UNUSED_PARAM(throwScope); |
300 | auto& impl = castedThis->wrapped(); |
301 | if (UNLIKELY(state->argumentCount() < 1)) |
302 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
303 | auto target = convert<IDLInterface<EventTarget>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "target" , "CommandLineAPIHost" , "getEventListeners" , "EventTarget" ); }); |
304 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
305 | return JSValue::encode(toJS<IDLRecord<IDLDOMString, IDLSequence<IDLDictionary<CommandLineAPIHost::ListenerEntry>>>>(*state, *castedThis->globalObject(), impl.getEventListeners(*state, *target))); |
306 | } |
307 | |
308 | EncodedJSValue JSC_HOST_CALL jsCommandLineAPIHostPrototypeFunctionGetEventListeners(ExecState* state) |
309 | { |
310 | return IDLOperation<JSCommandLineAPIHost>::call<jsCommandLineAPIHostPrototypeFunctionGetEventListenersBody>(*state, "getEventListeners" ); |
311 | } |
312 | |
313 | static inline JSC::EncodedJSValue jsCommandLineAPIHostPrototypeFunctionDatabaseIdBody(JSC::ExecState* state, typename IDLOperation<JSCommandLineAPIHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
314 | { |
315 | UNUSED_PARAM(state); |
316 | UNUSED_PARAM(throwScope); |
317 | auto& impl = castedThis->wrapped(); |
318 | if (UNLIKELY(state->argumentCount() < 1)) |
319 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
320 | auto database = convert<IDLInterface<Database>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "database" , "CommandLineAPIHost" , "databaseId" , "Database" ); }); |
321 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
322 | return JSValue::encode(toJS<IDLDOMString>(*state, impl.databaseId(*database))); |
323 | } |
324 | |
325 | EncodedJSValue JSC_HOST_CALL jsCommandLineAPIHostPrototypeFunctionDatabaseId(ExecState* state) |
326 | { |
327 | return IDLOperation<JSCommandLineAPIHost>::call<jsCommandLineAPIHostPrototypeFunctionDatabaseIdBody>(*state, "databaseId" ); |
328 | } |
329 | |
330 | static inline JSC::EncodedJSValue jsCommandLineAPIHostPrototypeFunctionStorageIdBody(JSC::ExecState* state, typename IDLOperation<JSCommandLineAPIHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
331 | { |
332 | UNUSED_PARAM(state); |
333 | UNUSED_PARAM(throwScope); |
334 | auto& impl = castedThis->wrapped(); |
335 | if (UNLIKELY(state->argumentCount() < 1)) |
336 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
337 | auto storage = convert<IDLInterface<Storage>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "storage" , "CommandLineAPIHost" , "storageId" , "Storage" ); }); |
338 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
339 | return JSValue::encode(toJS<IDLDOMString>(*state, impl.storageId(*storage))); |
340 | } |
341 | |
342 | EncodedJSValue JSC_HOST_CALL jsCommandLineAPIHostPrototypeFunctionStorageId(ExecState* state) |
343 | { |
344 | return IDLOperation<JSCommandLineAPIHost>::call<jsCommandLineAPIHostPrototypeFunctionStorageIdBody>(*state, "storageId" ); |
345 | } |
346 | |
347 | void JSCommandLineAPIHost::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
348 | { |
349 | auto* thisObject = jsCast<JSCommandLineAPIHost*>(cell); |
350 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
351 | if (thisObject->scriptExecutionContext()) |
352 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
353 | Base::heapSnapshot(cell, builder); |
354 | } |
355 | |
356 | bool JSCommandLineAPIHostOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
357 | { |
358 | UNUSED_PARAM(handle); |
359 | UNUSED_PARAM(visitor); |
360 | UNUSED_PARAM(reason); |
361 | return false; |
362 | } |
363 | |
364 | void JSCommandLineAPIHostOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
365 | { |
366 | auto* jsCommandLineAPIHost = static_cast<JSCommandLineAPIHost*>(handle.slot()->asCell()); |
367 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
368 | uncacheWrapper(world, &jsCommandLineAPIHost->wrapped(), jsCommandLineAPIHost); |
369 | } |
370 | |
371 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<CommandLineAPIHost>&& impl) |
372 | { |
373 | // If you hit this failure the interface definition has the ImplementationLacksVTable |
374 | // attribute. You should remove that attribute. If the class has subclasses |
375 | // that may be passed through this toJS() function you should use the SkipVTableValidation |
376 | // attribute to CommandLineAPIHost. |
377 | static_assert(!std::is_polymorphic<CommandLineAPIHost>::value, "CommandLineAPIHost is polymorphic but the IDL claims it is not" ); |
378 | return createWrapper<CommandLineAPIHost>(globalObject, WTFMove(impl)); |
379 | } |
380 | |
381 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, CommandLineAPIHost& impl) |
382 | { |
383 | return wrap(state, globalObject, impl); |
384 | } |
385 | |
386 | CommandLineAPIHost* JSCommandLineAPIHost::toWrapped(JSC::VM& vm, JSC::JSValue value) |
387 | { |
388 | if (auto* wrapper = jsDynamicCast<JSCommandLineAPIHost*>(vm, value)) |
389 | return &wrapper->wrapped(); |
390 | return nullptr; |
391 | } |
392 | |
393 | } |
394 | |