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 "JSMockPageOverlay.h"
23
24#include "JSDOMBinding.h"
25#include "JSDOMConvertNumbers.h"
26#include "JSDOMExceptionHandling.h"
27#include "JSDOMOperation.h"
28#include "JSDOMWrapperCache.h"
29#include "ScriptExecutionContext.h"
30#include <JavaScriptCore/HeapSnapshotBuilder.h>
31#include <JavaScriptCore/JSCInlines.h>
32#include <wtf/GetPtr.h>
33#include <wtf/PointerPreparations.h>
34#include <wtf/URL.h>
35
36
37namespace WebCore {
38using namespace JSC;
39
40// Functions
41
42JSC::EncodedJSValue JSC_HOST_CALL jsMockPageOverlayPrototypeFunctionSetFrame(JSC::ExecState*);
43
44class JSMockPageOverlayPrototype : public JSC::JSNonFinalObject {
45public:
46 using Base = JSC::JSNonFinalObject;
47 static JSMockPageOverlayPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
48 {
49 JSMockPageOverlayPrototype* ptr = new (NotNull, JSC::allocateCell<JSMockPageOverlayPrototype>(vm.heap)) JSMockPageOverlayPrototype(vm, globalObject, structure);
50 ptr->finishCreation(vm);
51 return ptr;
52 }
53
54 DECLARE_INFO;
55 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
56 {
57 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
58 }
59
60private:
61 JSMockPageOverlayPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
62 : JSC::JSNonFinalObject(vm, structure)
63 {
64 }
65
66 void finishCreation(JSC::VM&);
67};
68
69/* Hash table for prototype */
70
71static const HashTableValue JSMockPageOverlayPrototypeTableValues[] =
72{
73 { "setFrame", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsMockPageOverlayPrototypeFunctionSetFrame), (intptr_t) (4) } },
74};
75
76const ClassInfo JSMockPageOverlayPrototype::s_info = { "MockPageOverlayPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMockPageOverlayPrototype) };
77
78void JSMockPageOverlayPrototype::finishCreation(VM& vm)
79{
80 Base::finishCreation(vm);
81 reifyStaticProperties(vm, JSMockPageOverlay::info(), JSMockPageOverlayPrototypeTableValues, *this);
82}
83
84const ClassInfo JSMockPageOverlay::s_info = { "MockPageOverlay", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMockPageOverlay) };
85
86JSMockPageOverlay::JSMockPageOverlay(Structure* structure, JSDOMGlobalObject& globalObject, Ref<MockPageOverlay>&& impl)
87 : JSDOMWrapper<MockPageOverlay>(structure, globalObject, WTFMove(impl))
88{
89}
90
91void JSMockPageOverlay::finishCreation(VM& vm)
92{
93 Base::finishCreation(vm);
94 ASSERT(inherits(vm, info()));
95
96}
97
98JSObject* JSMockPageOverlay::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
99{
100 return JSMockPageOverlayPrototype::create(vm, &globalObject, JSMockPageOverlayPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
101}
102
103JSObject* JSMockPageOverlay::prototype(VM& vm, JSDOMGlobalObject& globalObject)
104{
105 return getDOMPrototype<JSMockPageOverlay>(vm, globalObject);
106}
107
108void JSMockPageOverlay::destroy(JSC::JSCell* cell)
109{
110 JSMockPageOverlay* thisObject = static_cast<JSMockPageOverlay*>(cell);
111 thisObject->JSMockPageOverlay::~JSMockPageOverlay();
112}
113
114template<> inline JSMockPageOverlay* IDLOperation<JSMockPageOverlay>::cast(ExecState& state)
115{
116 return jsDynamicCast<JSMockPageOverlay*>(state.vm(), state.thisValue());
117}
118
119static inline JSC::EncodedJSValue jsMockPageOverlayPrototypeFunctionSetFrameBody(JSC::ExecState* state, typename IDLOperation<JSMockPageOverlay>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
120{
121 UNUSED_PARAM(state);
122 UNUSED_PARAM(throwScope);
123 auto& impl = castedThis->wrapped();
124 if (UNLIKELY(state->argumentCount() < 4))
125 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
126 auto x = convert<IDLDouble>(*state, state->uncheckedArgument(0));
127 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
128 auto y = convert<IDLDouble>(*state, state->uncheckedArgument(1));
129 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
130 auto width = convert<IDLDouble>(*state, state->uncheckedArgument(2));
131 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
132 auto height = convert<IDLDouble>(*state, state->uncheckedArgument(3));
133 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
134 impl.setFrame(WTFMove(x), WTFMove(y), WTFMove(width), WTFMove(height));
135 return JSValue::encode(jsUndefined());
136}
137
138EncodedJSValue JSC_HOST_CALL jsMockPageOverlayPrototypeFunctionSetFrame(ExecState* state)
139{
140 return IDLOperation<JSMockPageOverlay>::call<jsMockPageOverlayPrototypeFunctionSetFrameBody>(*state, "setFrame");
141}
142
143void JSMockPageOverlay::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
144{
145 auto* thisObject = jsCast<JSMockPageOverlay*>(cell);
146 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
147 if (thisObject->scriptExecutionContext())
148 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
149 Base::heapSnapshot(cell, builder);
150}
151
152bool JSMockPageOverlayOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
153{
154 UNUSED_PARAM(handle);
155 UNUSED_PARAM(visitor);
156 UNUSED_PARAM(reason);
157 return false;
158}
159
160void JSMockPageOverlayOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
161{
162 auto* jsMockPageOverlay = static_cast<JSMockPageOverlay*>(handle.slot()->asCell());
163 auto& world = *static_cast<DOMWrapperWorld*>(context);
164 uncacheWrapper(world, &jsMockPageOverlay->wrapped(), jsMockPageOverlay);
165}
166
167JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<MockPageOverlay>&& impl)
168{
169 // If you hit this failure the interface definition has the ImplementationLacksVTable
170 // attribute. You should remove that attribute. If the class has subclasses
171 // that may be passed through this toJS() function you should use the SkipVTableValidation
172 // attribute to MockPageOverlay.
173 static_assert(!std::is_polymorphic<MockPageOverlay>::value, "MockPageOverlay is polymorphic but the IDL claims it is not");
174 return createWrapper<MockPageOverlay>(globalObject, WTFMove(impl));
175}
176
177JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, MockPageOverlay& impl)
178{
179 return wrap(state, globalObject, impl);
180}
181
182MockPageOverlay* JSMockPageOverlay::toWrapped(JSC::VM& vm, JSC::JSValue value)
183{
184 if (auto* wrapper = jsDynamicCast<JSMockPageOverlay*>(vm, value))
185 return &wrapper->wrapped();
186 return nullptr;
187}
188
189}
190