Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / core / V8TestInterfaceEventConstructor.cpp
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6
7 #include "config.h"
8 #include "V8TestInterfaceEventConstructor.h"
9
10 #include "bindings/core/v8/Dictionary.h"
11 #include "bindings/core/v8/ExceptionState.h"
12 #include "bindings/core/v8/ScriptValue.h"
13 #include "bindings/core/v8/SerializedScriptValue.h"
14 #include "bindings/core/v8/V8DOMConfiguration.h"
15 #include "bindings/core/v8/V8HiddenValue.h"
16 #include "bindings/core/v8/V8ObjectConstructor.h"
17 #include "bindings/core/v8/V8TestInterfaceEmpty.h"
18 #include "bindings/core/v8/V8Uint8Array.h"
19 #include "core/dom/ContextFeatures.h"
20 #include "core/dom/Document.h"
21 #include "core/frame/LocalDOMWindow.h"
22 #include "core/frame/UseCounter.h"
23 #include "platform/RuntimeEnabledFeatures.h"
24 #include "platform/TraceEvent.h"
25 #include "wtf/GetPtr.h"
26 #include "wtf/RefPtr.h"
27
28 namespace blink {
29
30 const WrapperTypeInfo V8TestInterfaceEventConstructor::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceEventConstructor::domTemplate, V8TestInterfaceEventConstructor::refObject, V8TestInterfaceEventConstructor::derefObject, V8TestInterfaceEventConstructor::trace, 0, 0, 0, V8TestInterfaceEventConstructor::installConditionallyEnabledMethods, V8TestInterfaceEventConstructor::installConditionallyEnabledProperties, &V8Event::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::WillBeGarbageCollectedObject };
31
32 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfaceEventConstructor.h.
33 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
34 // bindings/core/v8/ScriptWrappable.h.
35 const WrapperTypeInfo& TestInterfaceEventConstructor::s_wrapperTypeInfo = V8TestInterfaceEventConstructor::wrapperTypeInfo;
36
37 namespace TestInterfaceEventConstructorV8Internal {
38
39 static void readonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
40 {
41     v8::Handle<v8::Object> holder = info.Holder();
42     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
43     v8SetReturnValueString(info, impl->readonlyStringAttribute(), info.GetIsolate());
44 }
45
46 static void readonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
47 {
48     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
49     TestInterfaceEventConstructorV8Internal::readonlyStringAttributeAttributeGetter(info);
50     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
51 }
52
53 static void initializedByEventConstructorReadonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
54 {
55     v8::Handle<v8::Object> holder = info.Holder();
56     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
57     v8SetReturnValueString(info, impl->initializedByEventConstructorReadonlyStringAttribute(), info.GetIsolate());
58 }
59
60 static void initializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
61 {
62     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
63     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyStringAttributeAttributeGetter(info);
64     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
65 }
66
67 static void initializedByEventConstructorReadonlyAnyAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
68 {
69     v8::Handle<v8::Object> holder = info.Holder();
70     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
71     v8SetReturnValue(info, impl->initializedByEventConstructorReadonlyAnyAttribute().v8Value());
72 }
73
74 static void initializedByEventConstructorReadonlyAnyAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
75 {
76     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
77     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyAnyAttributeAttributeGetter(info);
78     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
79 }
80
81 static void initializedByEventConstructorReadonlyBooleanAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
82 {
83     v8::Handle<v8::Object> holder = info.Holder();
84     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
85     v8SetReturnValueBool(info, impl->initializedByEventConstructorReadonlyBooleanAttribute());
86 }
87
88 static void initializedByEventConstructorReadonlyBooleanAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
89 {
90     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
91     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyBooleanAttributeAttributeGetter(info);
92     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
93 }
94
95 static void initializedByEventConstructorReadonlyLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
96 {
97     v8::Handle<v8::Object> holder = info.Holder();
98     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
99     v8SetReturnValueInt(info, impl->initializedByEventConstructorReadonlyLongAttribute());
100 }
101
102 static void initializedByEventConstructorReadonlyLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
103 {
104     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
105     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyLongAttributeAttributeGetter(info);
106     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
107 }
108
109 static void initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
110 {
111     v8::Handle<v8::Object> holder = info.Holder();
112     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
113     RefPtr<DOMUint8Array> cppValue(impl->initializedByEventConstructorReadonlyUint8ArrayAttribute());
114     if (cppValue && DOMDataStore::setReturnValue(info.GetReturnValue(), cppValue.get()))
115         return;
116     v8::Handle<v8::Value> wrapper = toV8(cppValue.get(), holder, info.GetIsolate());
117     if (!wrapper.IsEmpty()) {
118         V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString(info.GetIsolate(), "initializedByEventConstructorReadonlyUint8ArrayAttribute"), wrapper);
119         v8SetReturnValue(info, wrapper);
120     }
121 }
122
123 static void initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
124 {
125     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
126     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGetter(info);
127     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
128 }
129
130 static void initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
131 {
132     v8::Handle<v8::Object> holder = info.Holder();
133     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
134     RefPtr<TestInterfaceEmpty> cppValue(impl->initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute());
135     if (cppValue && DOMDataStore::setReturnValue(info.GetReturnValue(), cppValue.get()))
136         return;
137     v8::Handle<v8::Value> wrapper = toV8(cppValue.get(), holder, info.GetIsolate());
138     if (!wrapper.IsEmpty()) {
139         V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString(info.GetIsolate(), "initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute"), wrapper);
140         v8SetReturnValue(info, wrapper);
141     }
142 }
143
144 static void initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
145 {
146     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
147     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttributeGetter(info);
148     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
149 }
150
151 static void initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
152 {
153     v8::Handle<v8::Object> holder = info.Holder();
154     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
155     v8SetReturnValue(info, v8Array(impl->initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute(), info.Holder(), info.GetIsolate()));
156 }
157
158 static void initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
159 {
160     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
161     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttributeAttributeGetter(info);
162     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
163 }
164
165 static void initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
166 {
167     v8::Handle<v8::Object> holder = info.Holder();
168     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
169     RefPtr<TestInterfaceEmpty> cppValue(impl->initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute());
170     if (cppValue && DOMDataStore::setReturnValue(info.GetReturnValue(), cppValue.get()))
171         return;
172     v8::Handle<v8::Value> wrapper = toV8(cppValue.get(), holder, info.GetIsolate());
173     if (!wrapper.IsEmpty()) {
174         V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString(info.GetIsolate(), "initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute"), wrapper);
175         v8SetReturnValue(info, wrapper);
176     }
177 }
178
179 static void initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
180 {
181     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
182     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttributeAttributeGetter(info);
183     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
184 }
185
186 static void deprecatedInitializedByEventConstructorReadonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
187 {
188     v8::Handle<v8::Object> holder = info.Holder();
189     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
190     v8SetReturnValueString(info, impl->deprecatedInitializedByEventConstructorReadonlyStringAttribute(), info.GetIsolate());
191 }
192
193 static void deprecatedInitializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
194 {
195     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
196     UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()), UseCounter::initializedByEventConstructorReadonlyStringAttribute);
197     TestInterfaceEventConstructorV8Internal::deprecatedInitializedByEventConstructorReadonlyStringAttributeAttributeGetter(info);
198     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
199 }
200
201 static void implementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
202 {
203     v8::Handle<v8::Object> holder = info.Holder();
204     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
205     v8SetReturnValueString(info, impl->implementedAsName(), info.GetIsolate());
206 }
207
208 static void implementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
209 {
210     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
211     TestInterfaceEventConstructorV8Internal::implementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetter(info);
212     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
213 }
214
215 static void deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
216 {
217     v8::Handle<v8::Object> holder = info.Holder();
218     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
219     v8SetReturnValueString(info, impl->deprecatedImplementedAsName(), info.GetIsolate());
220 }
221
222 static void deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
223 {
224     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
225     UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()), UseCounter::initializedByEventConstructorReadonlyStringAttribute);
226     TestInterfaceEventConstructorV8Internal::deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetter(info);
227     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
228 }
229
230 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
231 {
232     ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceEventConstructor", info.Holder(), info.GetIsolate());
233     if (info.Length() < 1) {
234         exceptionState.throwTypeError("An event name must be provided.");
235         exceptionState.throwIfNeeded();
236         return;
237     }
238
239     TOSTRING_VOID(V8StringResource<>, type, info[0]);
240     v8::Local<v8::Value> initializedByEventConstructorReadonlyAnyAttribute;
241     TestInterfaceEventConstructorInit eventInit;
242     if (info.Length() >= 2) {
243         Dictionary options(info[1], info.GetIsolate());
244         if (!initializeTestInterfaceEventConstructor(eventInit, options, exceptionState, info)) {
245             exceptionState.throwIfNeeded();
246             return;
247         }
248         options.get("initializedByEventConstructorReadonlyAnyAttribute", initializedByEventConstructorReadonlyAnyAttribute);
249         if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty())
250             V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder(), v8AtomicString(info.GetIsolate(), "initializedByEventConstructorReadonlyAnyAttribute"), initializedByEventConstructorReadonlyAnyAttribute);
251     }
252     RefPtrWillBeRawPtr<TestInterfaceEventConstructor> event = TestInterfaceEventConstructor::create(type, eventInit, exceptionState);
253     if (exceptionState.throwIfNeeded())
254         return;
255     if (DOMWrapperWorld::current(info.GetIsolate()).isIsolatedWorld()) {
256         if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty())
257             event->setSerializedInitializedByEventConstructorReadonlyAnyAttribute(SerializedScriptValue::createAndSwallowExceptions(info.GetIsolate(), initializedByEventConstructorReadonlyAnyAttribute));
258     }
259
260     v8::Handle<v8::Object> wrapper = info.Holder();
261     event->associateWithWrapper(&V8TestInterfaceEventConstructor::wrapperTypeInfo, wrapper, info.GetIsolate());
262     v8SetReturnValue(info, wrapper);
263 }
264
265 } // namespace TestInterfaceEventConstructorV8Internal
266
267 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceEventConstructorAttributes[] = {
268     {"readonlyStringAttribute", TestInterfaceEventConstructorV8Internal::readonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
269     {"initializedByEventConstructorReadonlyStringAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
270     {"initializedByEventConstructorReadonlyAnyAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyAnyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
271     {"initializedByEventConstructorReadonlyBooleanAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyBooleanAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
272     {"initializedByEventConstructorReadonlyLongAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyLongAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
273     {"initializedByEventConstructorReadonlyUint8ArrayAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
274     {"initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
275     {"initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
276     {"initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
277     {"deprecatedInitializedByEventConstructorReadonlyStringAttribute", TestInterfaceEventConstructorV8Internal::deprecatedInitializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
278     {"implementedAsInitializedByEventConstructorReadonlyStringAttribute", TestInterfaceEventConstructorV8Internal::implementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
279     {"deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttribute", TestInterfaceEventConstructorV8Internal::deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
280 };
281
282 bool initializeTestInterfaceEventConstructor(TestInterfaceEventConstructorInit& eventInit, const Dictionary& options, ExceptionState& exceptionState, const v8::FunctionCallbackInfo<v8::Value>& info, const String& forEventName)
283 {
284     Dictionary::ConversionContext conversionContext(forEventName.isEmpty() ? String("TestInterfaceEventConstructor") : forEventName, "", exceptionState);
285     if (!initializeEvent(eventInit, options, exceptionState, info, forEventName.isEmpty() ? String("TestInterfaceEventConstructor") : forEventName))
286         return false;
287
288     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("DOMString", false), "initializedByEventConstructorReadonlyStringAttribute", eventInit.initializedByEventConstructorReadonlyStringAttribute))
289         return false;
290     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("boolean", false), "initializedByEventConstructorReadonlyBooleanAttribute", eventInit.initializedByEventConstructorReadonlyBooleanAttribute))
291         return false;
292     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("long", false), "initializedByEventConstructorReadonlyLongAttribute", eventInit.initializedByEventConstructorReadonlyLongAttribute))
293         return false;
294     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("Uint8Array", false), "initializedByEventConstructorReadonlyUint8ArrayAttribute", eventInit.initializedByEventConstructorReadonlyUint8ArrayAttribute))
295         return false;
296     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("TestInterfaceEmpty", false), "initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute", eventInit.initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute))
297         return false;
298     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("TestInterfaceEmpty[]", false), "initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute", eventInit.initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute))
299         return false;
300     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("TestInterfaceEmpty", true), "initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute", eventInit.initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute))
301         return false;
302     if (DictionaryHelper::convert(options, conversionContext.setConversionType("DOMString", false), "deprecatedInitializedByEventConstructorReadonlyStringAttribute", eventInit.deprecatedInitializedByEventConstructorReadonlyStringAttribute)) {
303         if (options.hasProperty("deprecatedInitializedByEventConstructorReadonlyStringAttribute"))
304             UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()), UseCounter::initializedByEventConstructorReadonlyStringAttribute);
305     } else {
306         return false;
307     }
308     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("DOMString", false), "implementedAsInitializedByEventConstructorReadonlyStringAttribute", eventInit.implementedAsName))
309         return false;
310     if (DictionaryHelper::convert(options, conversionContext.setConversionType("DOMString", false), "deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttribute", eventInit.deprecatedImplementedAsName)) {
311         if (options.hasProperty("deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttribute"))
312             UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()), UseCounter::initializedByEventConstructorReadonlyStringAttribute);
313     } else {
314         return false;
315     }
316     return true;
317 }
318
319 void V8TestInterfaceEventConstructor::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
320 {
321     TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMConstructor");
322     if (!info.IsConstructCall()) {
323         V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::constructorNotCallableAsFunction("TestInterfaceEventConstructor"));
324         return;
325     }
326
327     if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) {
328         v8SetReturnValue(info, info.Holder());
329         return;
330     }
331
332     TestInterfaceEventConstructorV8Internal::constructor(info);
333 }
334
335 static void installV8TestInterfaceEventConstructorTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
336 {
337     functionTemplate->ReadOnlyPrototype();
338
339     v8::Local<v8::Signature> defaultSignature;
340     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceEventConstructor", V8Event::domTemplate(isolate), V8TestInterfaceEventConstructor::internalFieldCount,
341         V8TestInterfaceEventConstructorAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceEventConstructorAttributes),
342         0, 0,
343         0, 0,
344         isolate);
345     functionTemplate->SetCallHandler(V8TestInterfaceEventConstructor::constructorCallback);
346     functionTemplate->SetLength(1);
347     v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
348     ALLOW_UNUSED_LOCAL(instanceTemplate);
349     v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
350     ALLOW_UNUSED_LOCAL(prototypeTemplate);
351
352     // Custom toString template
353     functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
354 }
355
356 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEventConstructor::domTemplate(v8::Isolate* isolate)
357 {
358     return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterfaceEventConstructorTemplate);
359 }
360
361 bool V8TestInterfaceEventConstructor::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
362 {
363     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
364 }
365
366 v8::Handle<v8::Object> V8TestInterfaceEventConstructor::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
367 {
368     return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
369 }
370
371 TestInterfaceEventConstructor* V8TestInterfaceEventConstructor::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
372 {
373     return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceEventConstructor>() : 0;
374 }
375
376 void V8TestInterfaceEventConstructor::refObject(ScriptWrappableBase* scriptWrappableBase)
377 {
378 #if !ENABLE(OILPAN)
379     scriptWrappableBase->toImpl<TestInterfaceEventConstructor>()->ref();
380 #endif
381 }
382
383 void V8TestInterfaceEventConstructor::derefObject(ScriptWrappableBase* scriptWrappableBase)
384 {
385 #if !ENABLE(OILPAN)
386     scriptWrappableBase->toImpl<TestInterfaceEventConstructor>()->deref();
387 #endif
388 }
389
390 template<>
391 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
392 {
393     return toV8(impl, creationContext, isolate);
394 }
395
396 } // namespace blink