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 "JSHistory.h"
23
24#include "Document.h"
25#include "JSDOMAttribute.h"
26#include "JSDOMBinding.h"
27#include "JSDOMConstructorNotConstructable.h"
28#include "JSDOMConvertNullable.h"
29#include "JSDOMConvertNumbers.h"
30#include "JSDOMConvertSerializedScriptValue.h"
31#include "JSDOMConvertStrings.h"
32#include "JSDOMExceptionHandling.h"
33#include "JSDOMOperation.h"
34#include "JSDOMWrapperCache.h"
35#include "ScriptExecutionContext.h"
36#include "SerializedScriptValue.h"
37#include <JavaScriptCore/FunctionPrototype.h>
38#include <JavaScriptCore/HeapSnapshotBuilder.h>
39#include <JavaScriptCore/JSCInlines.h>
40#include <JavaScriptCore/JSString.h>
41#include <wtf/GetPtr.h>
42#include <wtf/PointerPreparations.h>
43#include <wtf/URL.h>
44
45
46namespace WebCore {
47using namespace JSC;
48
49String convertEnumerationToString(History::ScrollRestoration enumerationValue)
50{
51 static const NeverDestroyed<String> values[] = {
52 MAKE_STATIC_STRING_IMPL("auto"),
53 MAKE_STATIC_STRING_IMPL("manual"),
54 };
55 static_assert(static_cast<size_t>(History::ScrollRestoration::Auto) == 0, "History::ScrollRestoration::Auto is not 0 as expected");
56 static_assert(static_cast<size_t>(History::ScrollRestoration::Manual) == 1, "History::ScrollRestoration::Manual is not 1 as expected");
57 ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
58 return values[static_cast<size_t>(enumerationValue)];
59}
60
61template<> JSString* convertEnumerationToJS(ExecState& state, History::ScrollRestoration enumerationValue)
62{
63 return jsStringWithCache(&state, convertEnumerationToString(enumerationValue));
64}
65
66template<> Optional<History::ScrollRestoration> parseEnumeration<History::ScrollRestoration>(ExecState& state, JSValue value)
67{
68 auto stringValue = value.toWTFString(&state);
69 if (stringValue == "auto")
70 return History::ScrollRestoration::Auto;
71 if (stringValue == "manual")
72 return History::ScrollRestoration::Manual;
73 return WTF::nullopt;
74}
75
76template<> const char* expectedEnumerationValues<History::ScrollRestoration>()
77{
78 return "\"auto\", \"manual\"";
79}
80
81// Functions
82
83JSC::EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionPushState(JSC::ExecState*);
84JSC::EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionReplaceState(JSC::ExecState*);
85
86// Attributes
87
88JSC::EncodedJSValue jsHistoryConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
89bool setJSHistoryConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
90JSC::EncodedJSValue jsHistoryLength(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
91JSC::EncodedJSValue jsHistoryScrollRestoration(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
92bool setJSHistoryScrollRestoration(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
93JSC::EncodedJSValue jsHistoryState(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
94
95class JSHistoryPrototype : public JSC::JSNonFinalObject {
96public:
97 using Base = JSC::JSNonFinalObject;
98 static JSHistoryPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
99 {
100 JSHistoryPrototype* ptr = new (NotNull, JSC::allocateCell<JSHistoryPrototype>(vm.heap)) JSHistoryPrototype(vm, globalObject, structure);
101 ptr->finishCreation(vm);
102 return ptr;
103 }
104
105 DECLARE_INFO;
106 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
107 {
108 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
109 }
110
111private:
112 JSHistoryPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
113 : JSC::JSNonFinalObject(vm, structure)
114 {
115 }
116
117 void finishCreation(JSC::VM&);
118};
119
120using JSHistoryConstructor = JSDOMConstructorNotConstructable<JSHistory>;
121
122template<> JSValue JSHistoryConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
123{
124 UNUSED_PARAM(vm);
125 return globalObject.functionPrototype();
126}
127
128template<> void JSHistoryConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
129{
130 putDirect(vm, vm.propertyNames->prototype, JSHistory::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
131 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("History"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
132 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
133}
134
135template<> const ClassInfo JSHistoryConstructor::s_info = { "History", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHistoryConstructor) };
136
137/* Hash table for prototype */
138
139static const HashTableValue JSHistoryPrototypeTableValues[] =
140{
141 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHistoryConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHistoryConstructor) } },
142 { "length", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHistoryLength), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
143 { "scrollRestoration", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHistoryScrollRestoration), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHistoryScrollRestoration) } },
144 { "state", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHistoryState), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
145 { "back", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHistoryPrototypeFunctionBack), (intptr_t) (0) } },
146 { "forward", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHistoryPrototypeFunctionForward), (intptr_t) (0) } },
147 { "go", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHistoryPrototypeFunctionGo), (intptr_t) (0) } },
148 { "pushState", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHistoryPrototypeFunctionPushState), (intptr_t) (2) } },
149 { "replaceState", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHistoryPrototypeFunctionReplaceState), (intptr_t) (2) } },
150};
151
152const ClassInfo JSHistoryPrototype::s_info = { "HistoryPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHistoryPrototype) };
153
154void JSHistoryPrototype::finishCreation(VM& vm)
155{
156 Base::finishCreation(vm);
157 reifyStaticProperties(vm, JSHistory::info(), JSHistoryPrototypeTableValues, *this);
158}
159
160const ClassInfo JSHistory::s_info = { "History", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHistory) };
161
162JSHistory::JSHistory(Structure* structure, JSDOMGlobalObject& globalObject, Ref<History>&& impl)
163 : JSDOMWrapper<History>(structure, globalObject, WTFMove(impl))
164{
165}
166
167void JSHistory::finishCreation(VM& vm)
168{
169 Base::finishCreation(vm);
170 ASSERT(inherits(vm, info()));
171
172}
173
174JSObject* JSHistory::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
175{
176 return JSHistoryPrototype::create(vm, &globalObject, JSHistoryPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
177}
178
179JSObject* JSHistory::prototype(VM& vm, JSDOMGlobalObject& globalObject)
180{
181 return getDOMPrototype<JSHistory>(vm, globalObject);
182}
183
184JSValue JSHistory::getConstructor(VM& vm, const JSGlobalObject* globalObject)
185{
186 return getDOMConstructor<JSHistoryConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
187}
188
189void JSHistory::destroy(JSC::JSCell* cell)
190{
191 JSHistory* thisObject = static_cast<JSHistory*>(cell);
192 thisObject->JSHistory::~JSHistory();
193}
194
195template<> inline JSHistory* IDLAttribute<JSHistory>::cast(ExecState& state, EncodedJSValue thisValue)
196{
197 return jsDynamicCast<JSHistory*>(state.vm(), JSValue::decode(thisValue));
198}
199
200template<> inline JSHistory* IDLOperation<JSHistory>::cast(ExecState& state)
201{
202 return jsDynamicCast<JSHistory*>(state.vm(), state.thisValue());
203}
204
205EncodedJSValue jsHistoryConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
206{
207 VM& vm = state->vm();
208 auto throwScope = DECLARE_THROW_SCOPE(vm);
209 auto* prototype = jsDynamicCast<JSHistoryPrototype*>(vm, JSValue::decode(thisValue));
210 if (UNLIKELY(!prototype))
211 return throwVMTypeError(state, throwScope);
212 return JSValue::encode(JSHistory::getConstructor(state->vm(), prototype->globalObject()));
213}
214
215bool setJSHistoryConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
216{
217 VM& vm = state->vm();
218 auto throwScope = DECLARE_THROW_SCOPE(vm);
219 auto* prototype = jsDynamicCast<JSHistoryPrototype*>(vm, JSValue::decode(thisValue));
220 if (UNLIKELY(!prototype)) {
221 throwVMTypeError(state, throwScope);
222 return false;
223 }
224 // Shadowing a built-in constructor
225 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
226}
227
228static inline JSValue jsHistoryLengthGetter(ExecState& state, JSHistory& thisObject, ThrowScope& throwScope)
229{
230 UNUSED_PARAM(throwScope);
231 UNUSED_PARAM(state);
232 auto& impl = thisObject.wrapped();
233 JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.length());
234 return result;
235}
236
237EncodedJSValue jsHistoryLength(ExecState* state, EncodedJSValue thisValue, PropertyName)
238{
239 return IDLAttribute<JSHistory>::get<jsHistoryLengthGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "length");
240}
241
242static inline JSValue jsHistoryScrollRestorationGetter(ExecState& state, JSHistory& thisObject, ThrowScope& throwScope)
243{
244 UNUSED_PARAM(throwScope);
245 UNUSED_PARAM(state);
246 auto& impl = thisObject.wrapped();
247 JSValue result = toJS<IDLEnumeration<History::ScrollRestoration>>(state, throwScope, impl.scrollRestoration());
248 return result;
249}
250
251EncodedJSValue jsHistoryScrollRestoration(ExecState* state, EncodedJSValue thisValue, PropertyName)
252{
253 return IDLAttribute<JSHistory>::get<jsHistoryScrollRestorationGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "scrollRestoration");
254}
255
256static inline bool setJSHistoryScrollRestorationSetter(ExecState& state, JSHistory& thisObject, JSValue value, ThrowScope& throwScope)
257{
258 UNUSED_PARAM(throwScope);
259 auto& impl = thisObject.wrapped();
260 auto optionalNativeValue = parseEnumeration<History::ScrollRestoration>(state, value);
261 RETURN_IF_EXCEPTION(throwScope, false);
262 if (UNLIKELY(!optionalNativeValue))
263 return false;
264 auto nativeValue = optionalNativeValue.value();
265 AttributeSetter::call(state, throwScope, [&] {
266 return impl.setScrollRestoration(WTFMove(nativeValue));
267 });
268 return true;
269}
270
271bool setJSHistoryScrollRestoration(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
272{
273 return IDLAttribute<JSHistory>::set<setJSHistoryScrollRestorationSetter>(*state, thisValue, encodedValue, "scrollRestoration");
274}
275
276static inline JSValue jsHistoryStateGetter(ExecState& state, JSHistory& thisObject, ThrowScope& throwScope)
277{
278 UNUSED_PARAM(throwScope);
279 UNUSED_PARAM(state);
280 return thisObject.state(state);
281}
282
283EncodedJSValue jsHistoryState(ExecState* state, EncodedJSValue thisValue, PropertyName)
284{
285 return IDLAttribute<JSHistory>::get<jsHistoryStateGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "state");
286}
287
288static inline JSC::EncodedJSValue jsHistoryPrototypeFunctionBackBody(JSC::ExecState* state, typename IDLOperation<JSHistory>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
289{
290 UNUSED_PARAM(state);
291 UNUSED_PARAM(throwScope);
292 auto& impl = castedThis->wrapped();
293 auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
294 if (UNLIKELY(!context))
295 return JSValue::encode(jsUndefined());
296 ASSERT(context->isDocument());
297 auto& document = downcast<Document>(*context);
298 impl.back(document);
299 return JSValue::encode(jsUndefined());
300}
301
302EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionBack(ExecState* state)
303{
304 return IDLOperation<JSHistory>::call<jsHistoryPrototypeFunctionBackBody>(*state, "back");
305}
306
307static inline JSC::EncodedJSValue jsHistoryPrototypeFunctionForwardBody(JSC::ExecState* state, typename IDLOperation<JSHistory>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
308{
309 UNUSED_PARAM(state);
310 UNUSED_PARAM(throwScope);
311 auto& impl = castedThis->wrapped();
312 auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
313 if (UNLIKELY(!context))
314 return JSValue::encode(jsUndefined());
315 ASSERT(context->isDocument());
316 auto& document = downcast<Document>(*context);
317 impl.forward(document);
318 return JSValue::encode(jsUndefined());
319}
320
321EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionForward(ExecState* state)
322{
323 return IDLOperation<JSHistory>::call<jsHistoryPrototypeFunctionForwardBody>(*state, "forward");
324}
325
326static inline JSC::EncodedJSValue jsHistoryPrototypeFunctionGoBody(JSC::ExecState* state, typename IDLOperation<JSHistory>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
327{
328 UNUSED_PARAM(state);
329 UNUSED_PARAM(throwScope);
330 auto& impl = castedThis->wrapped();
331 auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
332 if (UNLIKELY(!context))
333 return JSValue::encode(jsUndefined());
334 ASSERT(context->isDocument());
335 auto& document = downcast<Document>(*context);
336 auto delta = convert<IDLLong>(*state, state->argument(0));
337 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
338 impl.go(document, WTFMove(delta));
339 return JSValue::encode(jsUndefined());
340}
341
342EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionGo(ExecState* state)
343{
344 return IDLOperation<JSHistory>::call<jsHistoryPrototypeFunctionGoBody>(*state, "go");
345}
346
347static inline JSC::EncodedJSValue jsHistoryPrototypeFunctionPushStateBody(JSC::ExecState* state, typename IDLOperation<JSHistory>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
348{
349 UNUSED_PARAM(state);
350 UNUSED_PARAM(throwScope);
351 auto& impl = castedThis->wrapped();
352 if (UNLIKELY(state->argumentCount() < 2))
353 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
354 auto data = convert<IDLSerializedScriptValue<SerializedScriptValue>>(*state, state->uncheckedArgument(0));
355 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
356 auto title = convert<IDLNullable<IDLDOMString>>(*state, state->uncheckedArgument(1));
357 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
358 auto url = state->argument(2).isUndefined() ? String() : convert<IDLNullable<IDLUSVString>>(*state, state->uncheckedArgument(2));
359 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
360 propagateException(*state, throwScope, impl.pushState(WTFMove(data), WTFMove(title), WTFMove(url)));
361 return JSValue::encode(jsUndefined());
362}
363
364EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionPushState(ExecState* state)
365{
366 return IDLOperation<JSHistory>::call<jsHistoryPrototypeFunctionPushStateBody>(*state, "pushState");
367}
368
369static inline JSC::EncodedJSValue jsHistoryPrototypeFunctionReplaceStateBody(JSC::ExecState* state, typename IDLOperation<JSHistory>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
370{
371 UNUSED_PARAM(state);
372 UNUSED_PARAM(throwScope);
373 auto& impl = castedThis->wrapped();
374 if (UNLIKELY(state->argumentCount() < 2))
375 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
376 auto data = convert<IDLSerializedScriptValue<SerializedScriptValue>>(*state, state->uncheckedArgument(0));
377 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
378 auto title = convert<IDLNullable<IDLDOMString>>(*state, state->uncheckedArgument(1));
379 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
380 auto url = state->argument(2).isUndefined() ? String() : convert<IDLNullable<IDLUSVString>>(*state, state->uncheckedArgument(2));
381 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
382 propagateException(*state, throwScope, impl.replaceState(WTFMove(data), WTFMove(title), WTFMove(url)));
383 return JSValue::encode(jsUndefined());
384}
385
386EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionReplaceState(ExecState* state)
387{
388 return IDLOperation<JSHistory>::call<jsHistoryPrototypeFunctionReplaceStateBody>(*state, "replaceState");
389}
390
391void JSHistory::visitChildren(JSCell* cell, SlotVisitor& visitor)
392{
393 auto* thisObject = jsCast<JSHistory*>(cell);
394 ASSERT_GC_OBJECT_INHERITS(thisObject, info());
395 Base::visitChildren(thisObject, visitor);
396 thisObject->visitAdditionalChildren(visitor);
397}
398
399void JSHistory::visitOutputConstraints(JSCell* cell, SlotVisitor& visitor)
400{
401 auto* thisObject = jsCast<JSHistory*>(cell);
402 ASSERT_GC_OBJECT_INHERITS(thisObject, info());
403 Base::visitOutputConstraints(thisObject, visitor);
404 thisObject->visitAdditionalChildren(visitor);
405}
406
407void JSHistory::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
408{
409 auto* thisObject = jsCast<JSHistory*>(cell);
410 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
411 if (thisObject->scriptExecutionContext())
412 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
413 Base::heapSnapshot(cell, builder);
414}
415
416bool JSHistoryOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
417{
418 auto* jsHistory = jsCast<JSHistory*>(handle.slot()->asCell());
419 Frame* root = WTF::getPtr(jsHistory->wrapped().frame());
420 if (!root)
421 return false;
422 if (UNLIKELY(reason))
423 *reason = "Reachable from Frame";
424 return visitor.containsOpaqueRoot(root);
425}
426
427void JSHistoryOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
428{
429 auto* jsHistory = static_cast<JSHistory*>(handle.slot()->asCell());
430 auto& world = *static_cast<DOMWrapperWorld*>(context);
431 uncacheWrapper(world, &jsHistory->wrapped(), jsHistory);
432}
433
434JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<History>&& impl)
435{
436 // If you hit this failure the interface definition has the ImplementationLacksVTable
437 // attribute. You should remove that attribute. If the class has subclasses
438 // that may be passed through this toJS() function you should use the SkipVTableValidation
439 // attribute to History.
440 static_assert(!std::is_polymorphic<History>::value, "History is polymorphic but the IDL claims it is not");
441 return createWrapper<History>(globalObject, WTFMove(impl));
442}
443
444JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, History& impl)
445{
446 return wrap(state, globalObject, impl);
447}
448
449History* JSHistory::toWrapped(JSC::VM& vm, JSC::JSValue value)
450{
451 if (auto* wrapper = jsDynamicCast<JSHistory*>(vm, value))
452 return &wrapper->wrapped();
453 return nullptr;
454}
455
456}
457