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 "JSTestDictionaryOpenPropertyType.h"
23
24#include "ExceptionCode.h"
25#include "JSDOMBinding.h"
26#include "JSDOMConstructor.h"
27#include <runtime/Error.h>
28#include <runtime/FunctionPrototype.h>
29#include <wtf/GetPtr.h>
30
31using namespace JSC;
32
33namespace WebCore {
34
35template<> Optional<TestDictionaryOpenPropertyType::Dictionary1> convertDictionary<TestDictionaryOpenPropertyType::Dictionary1>(ExecState& state, JSValue value)
36{
37 VM& vm = state.vm();
38 auto throwScope = DECLARE_THROW_SCOPE(vm);
39 bool isNullOrUndefined = value.isUndefinedOrNull();
40 auto* object = isNullOrUndefined ? nullptr : value.getObject();
41 if (UNLIKELY(!isNullOrUndefined && !object)) {
42 throwTypeError(&state, throwScope);
43 return Nullopt;
44 }
45 if (UNLIKELY(object && object->type() == RegExpObjectType)) {
46 throwTypeError(&state, throwScope);
47 return Nullopt;
48 }
49 TestDictionaryOpenPropertyType::Dictionary1 result;
50 result.properties = convertDictionaryProperties<IDLDOMString>(state, *object);
51 RETURN_IF_EXCEPTION(throwScope, Nullopt);
52 return WTFMove(result);
53}
54
55// Attributes
56
57JSC::EncodedJSValue jsTestDictionaryOpenPropertyTypeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
58bool setJSTestDictionaryOpenPropertyTypeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
59
60class JSTestDictionaryOpenPropertyTypePrototype : public JSC::JSNonFinalObject {
61public:
62 using Base = JSC::JSNonFinalObject;
63 static JSTestDictionaryOpenPropertyTypePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
64 {
65 JSTestDictionaryOpenPropertyTypePrototype* ptr = new (NotNull, JSC::allocateCell<JSTestDictionaryOpenPropertyTypePrototype>(vm.heap)) JSTestDictionaryOpenPropertyTypePrototype(vm, globalObject, structure);
66 ptr->finishCreation(vm);
67 return ptr;
68 }
69
70 DECLARE_INFO;
71 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
72 {
73 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
74 }
75
76private:
77 JSTestDictionaryOpenPropertyTypePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
78 : JSC::JSNonFinalObject(vm, structure)
79 {
80 }
81
82 void finishCreation(JSC::VM&);
83};
84
85using JSTestDictionaryOpenPropertyTypeConstructor = JSDOMConstructor<JSTestDictionaryOpenPropertyType>;
86
87template<> EncodedJSValue JSC_HOST_CALL JSTestDictionaryOpenPropertyTypeConstructor::construct(ExecState* state)
88{
89 VM& vm = state->vm();
90 auto throwScope = DECLARE_THROW_SCOPE(vm);
91 UNUSED_PARAM(throwScope);
92 auto* castedThis = jsCast<JSTestDictionaryOpenPropertyTypeConstructor*>(state->callee());
93 ASSERT(castedThis);
94 if (UNLIKELY(state->argumentCount() < 1))
95 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
96 auto test1 = convert<IDLSequence<IDLDictionary<TestDictionaryOpenPropertyType::Dictionary1>>>(*state, state->uncheckedArgument(0));
97 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
98 auto object = TestDictionaryOpenPropertyType::create(WTFMove(test1));
99 return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object)));
100}
101
102template<> JSValue JSTestDictionaryOpenPropertyTypeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
103{
104 UNUSED_PARAM(vm);
105 return globalObject.functionPrototype();
106}
107
108template<> void JSTestDictionaryOpenPropertyTypeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
109{
110 putDirect(vm, vm.propertyNames->prototype, JSTestDictionaryOpenPropertyType::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
111 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestDictionaryOpenPropertyType"))), ReadOnly | DontEnum);
112 putDirect(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum);
113}
114
115template<> const ClassInfo JSTestDictionaryOpenPropertyTypeConstructor::s_info = { "TestDictionaryOpenPropertyType", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestDictionaryOpenPropertyTypeConstructor) };
116
117/* Hash table for prototype */
118
119static const HashTableValue JSTestDictionaryOpenPropertyTypePrototypeTableValues[] =
120{
121 { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestDictionaryOpenPropertyTypeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestDictionaryOpenPropertyTypeConstructor) } },
122};
123
124const ClassInfo JSTestDictionaryOpenPropertyTypePrototype::s_info = { "TestDictionaryOpenPropertyTypePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestDictionaryOpenPropertyTypePrototype) };
125
126void JSTestDictionaryOpenPropertyTypePrototype::finishCreation(VM& vm)
127{
128 Base::finishCreation(vm);
129 reifyStaticProperties(vm, JSTestDictionaryOpenPropertyTypePrototypeTableValues, *this);
130}
131
132const ClassInfo JSTestDictionaryOpenPropertyType::s_info = { "TestDictionaryOpenPropertyType", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestDictionaryOpenPropertyType) };
133
134JSTestDictionaryOpenPropertyType::JSTestDictionaryOpenPropertyType(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestDictionaryOpenPropertyType>&& impl)
135 : JSDOMWrapper<TestDictionaryOpenPropertyType>(structure, globalObject, WTFMove(impl))
136{
137}
138
139JSObject* JSTestDictionaryOpenPropertyType::createPrototype(VM& vm, JSGlobalObject* globalObject)
140{
141 return JSTestDictionaryOpenPropertyTypePrototype::create(vm, globalObject, JSTestDictionaryOpenPropertyTypePrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
142}
143
144JSObject* JSTestDictionaryOpenPropertyType::prototype(VM& vm, JSGlobalObject* globalObject)
145{
146 return getDOMPrototype<JSTestDictionaryOpenPropertyType>(vm, globalObject);
147}
148
149void JSTestDictionaryOpenPropertyType::destroy(JSC::JSCell* cell)
150{
151 JSTestDictionaryOpenPropertyType* thisObject = static_cast<JSTestDictionaryOpenPropertyType*>(cell);
152 thisObject->JSTestDictionaryOpenPropertyType::~JSTestDictionaryOpenPropertyType();
153}
154
155EncodedJSValue jsTestDictionaryOpenPropertyTypeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
156{
157 VM& vm = state->vm();
158 auto throwScope = DECLARE_THROW_SCOPE(vm);
159 JSTestDictionaryOpenPropertyTypePrototype* domObject = jsDynamicCast<JSTestDictionaryOpenPropertyTypePrototype*>(JSValue::decode(thisValue));
160 if (UNLIKELY(!domObject))
161 return throwVMTypeError(state, throwScope);
162 return JSValue::encode(JSTestDictionaryOpenPropertyType::getConstructor(state->vm(), domObject->globalObject()));
163}
164
165bool setJSTestDictionaryOpenPropertyTypeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
166{
167 VM& vm = state->vm();
168 auto throwScope = DECLARE_THROW_SCOPE(vm);
169 JSValue value = JSValue::decode(encodedValue);
170 JSTestDictionaryOpenPropertyTypePrototype* domObject = jsDynamicCast<JSTestDictionaryOpenPropertyTypePrototype*>(JSValue::decode(thisValue));
171 if (UNLIKELY(!domObject)) {
172 throwVMTypeError(state, throwScope);
173 return false;
174 }
175 // Shadowing a built-in constructor
176 return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
177}
178
179JSValue JSTestDictionaryOpenPropertyType::getConstructor(VM& vm, const JSGlobalObject* globalObject)
180{
181 return getDOMConstructor<JSTestDictionaryOpenPropertyTypeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
182}
183
184bool JSTestDictionaryOpenPropertyTypeOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
185{
186 UNUSED_PARAM(handle);
187 UNUSED_PARAM(visitor);
188 return false;
189}
190
191void JSTestDictionaryOpenPropertyTypeOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
192{
193 auto* jsTestDictionaryOpenPropertyType = jsCast<JSTestDictionaryOpenPropertyType*>(handle.slot()->asCell());
194 auto& world = *static_cast<DOMWrapperWorld*>(context);
195 uncacheWrapper(world, &jsTestDictionaryOpenPropertyType->wrapped(), jsTestDictionaryOpenPropertyType);
196}
197
198#if ENABLE(BINDING_INTEGRITY)
199#if PLATFORM(WIN)
200#pragma warning(disable: 4483)
201extern "C" { extern void (*const __identifier("??_7TestDictionaryOpenPropertyType@WebCore@@6B@")[])(); }
202#else
203extern "C" { extern void* _ZTVN7WebCore30TestDictionaryOpenPropertyTypeE[]; }
204#endif
205#endif
206
207JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestDictionaryOpenPropertyType>&& impl)
208{
209
210#if ENABLE(BINDING_INTEGRITY)
211 void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
212#if PLATFORM(WIN)
213 void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestDictionaryOpenPropertyType@WebCore@@6B@"));
214#else
215 void* expectedVTablePointer = &_ZTVN7WebCore30TestDictionaryOpenPropertyTypeE[2];
216#if COMPILER(CLANG)
217 // If this fails TestDictionaryOpenPropertyType does not have a vtable, so you need to add the
218 // ImplementationLacksVTable attribute to the interface definition
219 static_assert(__is_polymorphic(TestDictionaryOpenPropertyType), "TestDictionaryOpenPropertyType is not polymorphic");
220#endif
221#endif
222 // If you hit this assertion you either have a use after free bug, or
223 // TestDictionaryOpenPropertyType has subclasses. If TestDictionaryOpenPropertyType has subclasses that get passed
224 // to toJS() we currently require TestDictionaryOpenPropertyType you to opt out of binding hardening
225 // by adding the SkipVTableValidation attribute to the interface IDL definition
226 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
227#endif
228 return createWrapper<TestDictionaryOpenPropertyType>(globalObject, WTFMove(impl));
229}
230
231JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestDictionaryOpenPropertyType& impl)
232{
233 return wrap(state, globalObject, impl);
234}
235
236TestDictionaryOpenPropertyType* JSTestDictionaryOpenPropertyType::toWrapped(JSC::JSValue value)
237{
238 if (auto* wrapper = jsDynamicCast<JSTestDictionaryOpenPropertyType*>(value))
239 return &wrapper->wrapped();
240 return nullptr;
241}
242
243}