Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / V8TestInterface.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 #if ENABLE(CONDITION)
9 #include "V8TestInterface.h"
10
11 #include "RuntimeEnabledFeatures.h"
12 #include "V8Node.h"
13 #include "V8TestImplementedAs.h"
14 #include "V8TestInterfaceEmpty.h"
15 #include "bindings/tests/idls/TestImplements2.h"
16 #include "bindings/tests/idls/TestImplements3Implementation.h"
17 #include "bindings/tests/idls/TestPartialInterface.h"
18 #include "bindings/tests/idls/TestPartialInterfaceImplementation.h"
19 #include "bindings/v8/ExceptionState.h"
20 #include "bindings/v8/ScriptValue.h"
21 #include "bindings/v8/V8AbstractEventListener.h"
22 #include "bindings/v8/V8DOMConfiguration.h"
23 #include "bindings/v8/V8EventListenerList.h"
24 #include "bindings/v8/V8HiddenValue.h"
25 #include "bindings/v8/V8ObjectConstructor.h"
26 #include "core/dom/ContextFeatures.h"
27 #include "core/dom/Document.h"
28 #include "platform/TraceEvent.h"
29 #include "wtf/GetPtr.h"
30 #include "wtf/RefPtr.h"
31
32 namespace WebCore {
33
34 static void initializeScriptWrappableForInterface(TestInterfaceImplementation* object)
35 {
36     if (ScriptWrappable::wrapperCanBeStoredInObject(object))
37         ScriptWrappable::fromObject(object)->setTypeInfo(&V8TestInterface::wrapperTypeInfo);
38     else
39         ASSERT_NOT_REACHED();
40 }
41
42 } // namespace WebCore
43
44 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceImplementation* object)
45 {
46     WebCore::initializeScriptWrappableForInterface(object);
47 }
48
49 namespace WebCore {
50 const WrapperTypeInfo V8TestInterface::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface::domTemplate, V8TestInterface::derefObject, V8TestInterface::toActiveDOMObject, 0, V8TestInterface::visitDOMWrapper, V8TestInterface::installPerContextEnabledMethods, &V8TestInterfaceEmpty::wrapperTypeInfo, WrapperTypeObjectPrototype, RefCountedObject };
51
52 namespace TestInterfaceImplementationV8Internal {
53
54 template <typename T> void V8_USE(T) { }
55
56 static void testInterfaceAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
57 {
58     v8::Handle<v8::Object> holder = info.Holder();
59     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
60     v8SetReturnValueFast(info, WTF::getPtr(impl->testInterfaceAttribute()), impl);
61 }
62
63 static void testInterfaceAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
64 {
65     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
66     TestInterfaceImplementationV8Internal::testInterfaceAttributeAttributeGetter(info);
67     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
68 }
69
70 static void testInterfaceAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
71 {
72     v8::Handle<v8::Object> holder = info.Holder();
73     ExceptionState exceptionState(ExceptionState::SetterContext, "testInterfaceAttribute", "TestInterface", holder, info.GetIsolate());
74     if (!V8TestInterface::hasInstance(v8Value, info.GetIsolate())) {
75         exceptionState.throwTypeError("The provided value is not of type 'TestInterface'.");
76         exceptionState.throwIfNeeded();
77         return;
78     }
79     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
80     TONATIVE_VOID(TestInterfaceImplementation*, cppValue, V8TestInterface::toNativeWithTypeCheck(info.GetIsolate(), v8Value));
81     impl->setTestInterfaceAttribute(WTF::getPtr(cppValue));
82 }
83
84 static void testInterfaceAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
85 {
86     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
87     TestInterfaceImplementationV8Internal::testInterfaceAttributeAttributeSetter(v8Value, info);
88     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
89 }
90
91 static void doubleAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
92 {
93     v8::Handle<v8::Object> holder = info.Holder();
94     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
95     v8SetReturnValue(info, impl->doubleAttribute());
96 }
97
98 static void doubleAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
99 {
100     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
101     TestInterfaceImplementationV8Internal::doubleAttributeAttributeGetter(info);
102     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
103 }
104
105 static void doubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
106 {
107     v8::Handle<v8::Object> holder = info.Holder();
108     ExceptionState exceptionState(ExceptionState::SetterContext, "doubleAttribute", "TestInterface", holder, info.GetIsolate());
109     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
110     TONATIVE_VOID(double, cppValue, static_cast<double>(v8Value->NumberValue()));
111     if (!std::isfinite(cppValue)) {
112         exceptionState.throwTypeError("The provided double value is non-finite.");
113         exceptionState.throwIfNeeded();
114         return;
115     }
116     impl->setDoubleAttribute(cppValue);
117 }
118
119 static void doubleAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
120 {
121     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
122     TestInterfaceImplementationV8Internal::doubleAttributeAttributeSetter(v8Value, info);
123     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
124 }
125
126 static void floatAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
127 {
128     v8::Handle<v8::Object> holder = info.Holder();
129     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
130     v8SetReturnValue(info, impl->floatAttribute());
131 }
132
133 static void floatAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
134 {
135     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
136     TestInterfaceImplementationV8Internal::floatAttributeAttributeGetter(info);
137     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
138 }
139
140 static void floatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
141 {
142     v8::Handle<v8::Object> holder = info.Holder();
143     ExceptionState exceptionState(ExceptionState::SetterContext, "floatAttribute", "TestInterface", holder, info.GetIsolate());
144     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
145     TONATIVE_VOID(float, cppValue, static_cast<float>(v8Value->NumberValue()));
146     if (!std::isfinite(cppValue)) {
147         exceptionState.throwTypeError("The provided float value is non-finite.");
148         exceptionState.throwIfNeeded();
149         return;
150     }
151     impl->setFloatAttribute(cppValue);
152 }
153
154 static void floatAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
155 {
156     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
157     TestInterfaceImplementationV8Internal::floatAttributeAttributeSetter(v8Value, info);
158     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
159 }
160
161 static void unrestrictedDoubleAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
162 {
163     v8::Handle<v8::Object> holder = info.Holder();
164     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
165     v8SetReturnValue(info, impl->unrestrictedDoubleAttribute());
166 }
167
168 static void unrestrictedDoubleAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
169 {
170     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
171     TestInterfaceImplementationV8Internal::unrestrictedDoubleAttributeAttributeGetter(info);
172     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
173 }
174
175 static void unrestrictedDoubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
176 {
177     v8::Handle<v8::Object> holder = info.Holder();
178     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
179     TONATIVE_VOID(double, cppValue, static_cast<double>(v8Value->NumberValue()));
180     impl->setUnrestrictedDoubleAttribute(cppValue);
181 }
182
183 static void unrestrictedDoubleAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
184 {
185     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
186     TestInterfaceImplementationV8Internal::unrestrictedDoubleAttributeAttributeSetter(v8Value, info);
187     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
188 }
189
190 static void unrestrictedFloatAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
191 {
192     v8::Handle<v8::Object> holder = info.Holder();
193     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
194     v8SetReturnValue(info, impl->unrestrictedFloatAttribute());
195 }
196
197 static void unrestrictedFloatAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
198 {
199     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
200     TestInterfaceImplementationV8Internal::unrestrictedFloatAttributeAttributeGetter(info);
201     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
202 }
203
204 static void unrestrictedFloatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
205 {
206     v8::Handle<v8::Object> holder = info.Holder();
207     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
208     TONATIVE_VOID(float, cppValue, static_cast<float>(v8Value->NumberValue()));
209     impl->setUnrestrictedFloatAttribute(cppValue);
210 }
211
212 static void unrestrictedFloatAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
213 {
214     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
215     TestInterfaceImplementationV8Internal::unrestrictedFloatAttributeAttributeSetter(v8Value, info);
216     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
217 }
218
219 static void staticStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
220 {
221     v8SetReturnValueString(info, TestInterfaceImplementation::staticStringAttribute(), info.GetIsolate());
222 }
223
224 static void staticStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
225 {
226     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
227     TestInterfaceImplementationV8Internal::staticStringAttributeAttributeGetter(info);
228     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
229 }
230
231 static void staticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
232 {
233     TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
234     TestInterfaceImplementation::setStaticStringAttribute(cppValue);
235 }
236
237 static void staticStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
238 {
239     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
240     TestInterfaceImplementationV8Internal::staticStringAttributeAttributeSetter(v8Value, info);
241     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
242 }
243
244 static void implementsStaticReadOnlyLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
245 {
246     v8SetReturnValueInt(info, TestInterfaceImplementation::implementsStaticReadOnlyLongAttribute());
247 }
248
249 static void implementsStaticReadOnlyLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
250 {
251     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
252     TestInterfaceImplementationV8Internal::implementsStaticReadOnlyLongAttributeAttributeGetter(info);
253     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
254 }
255
256 static void implementsStaticStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
257 {
258     v8SetReturnValueString(info, TestInterfaceImplementation::implementsStaticStringAttribute(), info.GetIsolate());
259 }
260
261 static void implementsStaticStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
262 {
263     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
264     TestInterfaceImplementationV8Internal::implementsStaticStringAttributeAttributeGetter(info);
265     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
266 }
267
268 static void implementsStaticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
269 {
270     TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
271     TestInterfaceImplementation::setImplementsStaticStringAttribute(cppValue);
272 }
273
274 static void implementsStaticStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
275 {
276     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
277     TestInterfaceImplementationV8Internal::implementsStaticStringAttributeAttributeSetter(v8Value, info);
278     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
279 }
280
281 static void implementsReadonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
282 {
283     v8::Handle<v8::Object> holder = info.Holder();
284     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
285     v8SetReturnValueString(info, impl->implementsReadonlyStringAttribute(), info.GetIsolate());
286 }
287
288 static void implementsReadonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
289 {
290     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
291     TestInterfaceImplementationV8Internal::implementsReadonlyStringAttributeAttributeGetter(info);
292     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
293 }
294
295 static void implementsStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
296 {
297     v8::Handle<v8::Object> holder = info.Holder();
298     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
299     v8SetReturnValueString(info, impl->implementsStringAttribute(), info.GetIsolate());
300 }
301
302 static void implementsStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
303 {
304     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
305     TestInterfaceImplementationV8Internal::implementsStringAttributeAttributeGetter(info);
306     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
307 }
308
309 static void implementsStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
310 {
311     v8::Handle<v8::Object> holder = info.Holder();
312     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
313     TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
314     impl->setImplementsStringAttribute(cppValue);
315 }
316
317 static void implementsStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
318 {
319     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
320     TestInterfaceImplementationV8Internal::implementsStringAttributeAttributeSetter(v8Value, info);
321     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
322 }
323
324 static void implementsNodeAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
325 {
326     v8::Handle<v8::Object> holder = info.Holder();
327     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
328     v8SetReturnValueFast(info, WTF::getPtr(impl->implementsNodeAttribute()), impl);
329 }
330
331 static void implementsNodeAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
332 {
333     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
334     TestInterfaceImplementationV8Internal::implementsNodeAttributeAttributeGetter(info);
335     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
336 }
337
338 static void implementsNodeAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
339 {
340     v8::Handle<v8::Object> holder = info.Holder();
341     ExceptionState exceptionState(ExceptionState::SetterContext, "implementsNodeAttribute", "TestInterface", holder, info.GetIsolate());
342     if (!V8Node::hasInstance(v8Value, info.GetIsolate())) {
343         exceptionState.throwTypeError("The provided value is not of type 'Node'.");
344         exceptionState.throwIfNeeded();
345         return;
346     }
347     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
348     TONATIVE_VOID(Node*, cppValue, V8Node::toNativeWithTypeCheck(info.GetIsolate(), v8Value));
349     impl->setImplementsNodeAttribute(WTF::getPtr(cppValue));
350 }
351
352 static void implementsNodeAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
353 {
354     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
355     TestInterfaceImplementationV8Internal::implementsNodeAttributeAttributeSetter(v8Value, info);
356     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
357 }
358
359 static void implementsEventHandlerAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
360 {
361     v8::Handle<v8::Object> holder = info.Holder();
362     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
363     EventListener* v8Value = impl->implementsEventHandlerAttribute();
364     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
365 }
366
367 static void implementsEventHandlerAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
368 {
369     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
370     TestInterfaceImplementationV8Internal::implementsEventHandlerAttributeAttributeGetter(info);
371     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
372 }
373
374 static void implementsEventHandlerAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
375 {
376     v8::Handle<v8::Object> holder = info.Holder();
377     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
378     moveEventListenerToNewWrapper(holder, impl->implementsEventHandlerAttribute(), v8Value, V8TestInterface::eventListenerCacheIndex, info.GetIsolate());
379     impl->setImplementsEventHandlerAttribute(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
380 }
381
382 static void implementsEventHandlerAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
383 {
384     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
385     TestInterfaceImplementationV8Internal::implementsEventHandlerAttributeAttributeSetter(v8Value, info);
386     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
387 }
388
389 static void implementsRuntimeEnabledNodeAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
390 {
391     v8::Handle<v8::Object> holder = info.Holder();
392     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
393     v8SetReturnValueFast(info, WTF::getPtr(impl->implementsRuntimeEnabledNodeAttribute()), impl);
394 }
395
396 static void implementsRuntimeEnabledNodeAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
397 {
398     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
399     TestInterfaceImplementationV8Internal::implementsRuntimeEnabledNodeAttributeAttributeGetter(info);
400     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
401 }
402
403 static void implementsRuntimeEnabledNodeAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
404 {
405     v8::Handle<v8::Object> holder = info.Holder();
406     ExceptionState exceptionState(ExceptionState::SetterContext, "implementsRuntimeEnabledNodeAttribute", "TestInterface", holder, info.GetIsolate());
407     if (!V8Node::hasInstance(v8Value, info.GetIsolate())) {
408         exceptionState.throwTypeError("The provided value is not of type 'Node'.");
409         exceptionState.throwIfNeeded();
410         return;
411     }
412     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
413     TONATIVE_VOID(Node*, cppValue, V8Node::toNativeWithTypeCheck(info.GetIsolate(), v8Value));
414     impl->setImplementsRuntimeEnabledNodeAttribute(WTF::getPtr(cppValue));
415 }
416
417 static void implementsRuntimeEnabledNodeAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
418 {
419     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
420     TestInterfaceImplementationV8Internal::implementsRuntimeEnabledNodeAttributeAttributeSetter(v8Value, info);
421     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
422 }
423
424 static void implementsPerContextEnabledNodeAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
425 {
426     v8::Handle<v8::Object> holder = info.Holder();
427     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
428     v8SetReturnValueFast(info, WTF::getPtr(impl->implementsPerContextEnabledNodeAttribute()), impl);
429 }
430
431 static void implementsPerContextEnabledNodeAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
432 {
433     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
434     TestInterfaceImplementationV8Internal::implementsPerContextEnabledNodeAttributeAttributeGetter(info);
435     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
436 }
437
438 static void implementsPerContextEnabledNodeAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
439 {
440     v8::Handle<v8::Object> holder = info.Holder();
441     ExceptionState exceptionState(ExceptionState::SetterContext, "implementsPerContextEnabledNodeAttribute", "TestInterface", holder, info.GetIsolate());
442     if (!V8Node::hasInstance(v8Value, info.GetIsolate())) {
443         exceptionState.throwTypeError("The provided value is not of type 'Node'.");
444         exceptionState.throwIfNeeded();
445         return;
446     }
447     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
448     TONATIVE_VOID(Node*, cppValue, V8Node::toNativeWithTypeCheck(info.GetIsolate(), v8Value));
449     impl->setImplementsPerContextEnabledNodeAttribute(WTF::getPtr(cppValue));
450 }
451
452 static void implementsPerContextEnabledNodeAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
453 {
454     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
455     TestInterfaceImplementationV8Internal::implementsPerContextEnabledNodeAttributeAttributeSetter(v8Value, info);
456     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
457 }
458
459 static void implements2StaticStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
460 {
461     v8SetReturnValueString(info, TestImplements2::implements2StaticStringAttribute(), info.GetIsolate());
462 }
463
464 static void implements2StaticStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
465 {
466     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
467     TestInterfaceImplementationV8Internal::implements2StaticStringAttributeAttributeGetter(info);
468     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
469 }
470
471 static void implements2StaticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
472 {
473     TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
474     TestImplements2::setImplements2StaticStringAttribute(cppValue);
475 }
476
477 static void implements2StaticStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
478 {
479     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
480     TestInterfaceImplementationV8Internal::implements2StaticStringAttributeAttributeSetter(v8Value, info);
481     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
482 }
483
484 static void implements2StringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
485 {
486     v8::Handle<v8::Object> holder = info.Holder();
487     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
488     ASSERT(impl);
489     v8SetReturnValueString(info, TestImplements2::implements2StringAttribute(*impl), info.GetIsolate());
490 }
491
492 static void implements2StringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
493 {
494     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
495     TestInterfaceImplementationV8Internal::implements2StringAttributeAttributeGetter(info);
496     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
497 }
498
499 static void implements2StringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
500 {
501     v8::Handle<v8::Object> holder = info.Holder();
502     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
503     ASSERT(impl);
504     TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
505     TestImplements2::setImplements2StringAttribute(*impl, cppValue);
506 }
507
508 static void implements2StringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
509 {
510     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
511     TestInterfaceImplementationV8Internal::implements2StringAttributeAttributeSetter(v8Value, info);
512     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
513 }
514
515 static void implements3StringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
516 {
517     v8::Handle<v8::Object> holder = info.Holder();
518     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
519     ASSERT(impl);
520     v8SetReturnValueString(info, TestImplements3Implementation::implements3StringAttribute(*impl), info.GetIsolate());
521 }
522
523 static void implements3StringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
524 {
525     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
526     TestInterfaceImplementationV8Internal::implements3StringAttributeAttributeGetter(info);
527     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
528 }
529
530 static void implements3StringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
531 {
532     v8::Handle<v8::Object> holder = info.Holder();
533     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
534     ASSERT(impl);
535     TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
536     TestImplements3Implementation::setImplements3StringAttribute(*impl, cppValue);
537 }
538
539 static void implements3StringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
540 {
541     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
542     TestInterfaceImplementationV8Internal::implements3StringAttributeAttributeSetter(v8Value, info);
543     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
544 }
545
546 static void implements3StaticStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
547 {
548     v8SetReturnValueString(info, TestImplements3Implementation::implements3StaticStringAttribute(), info.GetIsolate());
549 }
550
551 static void implements3StaticStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
552 {
553     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
554     TestInterfaceImplementationV8Internal::implements3StaticStringAttributeAttributeGetter(info);
555     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
556 }
557
558 static void implements3StaticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
559 {
560     TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
561     TestImplements3Implementation::setImplements3StaticStringAttribute(cppValue);
562 }
563
564 static void implements3StaticStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
565 {
566     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
567     TestInterfaceImplementationV8Internal::implements3StaticStringAttributeAttributeSetter(v8Value, info);
568     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
569 }
570
571 #if ENABLE(PARTIAL_CONDITION)
572 static void partialLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
573 {
574     v8::Handle<v8::Object> holder = info.Holder();
575     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
576     ASSERT(impl);
577     v8SetReturnValueInt(info, TestPartialInterface::partialLongAttribute(*impl));
578 }
579 #endif // ENABLE(PARTIAL_CONDITION)
580
581 #if ENABLE(PARTIAL_CONDITION)
582 static void partialLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
583 {
584     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
585     TestInterfaceImplementationV8Internal::partialLongAttributeAttributeGetter(info);
586     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
587 }
588 #endif // ENABLE(PARTIAL_CONDITION)
589
590 #if ENABLE(PARTIAL_CONDITION)
591 static void partialLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
592 {
593     v8::Handle<v8::Object> holder = info.Holder();
594     ExceptionState exceptionState(ExceptionState::SetterContext, "partialLongAttribute", "TestInterface", holder, info.GetIsolate());
595     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
596     ASSERT(impl);
597     TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState);
598     TestPartialInterface::setPartialLongAttribute(*impl, cppValue);
599 }
600 #endif // ENABLE(PARTIAL_CONDITION)
601
602 #if ENABLE(PARTIAL_CONDITION)
603 static void partialLongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
604 {
605     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
606     TestInterfaceImplementationV8Internal::partialLongAttributeAttributeSetter(v8Value, info);
607     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
608 }
609 #endif // ENABLE(PARTIAL_CONDITION)
610
611 #if ENABLE(PARTIAL_CONDITION)
612 static void partialStaticLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
613 {
614     v8SetReturnValueInt(info, TestPartialInterface::partialStaticLongAttribute());
615 }
616 #endif // ENABLE(PARTIAL_CONDITION)
617
618 #if ENABLE(PARTIAL_CONDITION)
619 static void partialStaticLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
620 {
621     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
622     TestInterfaceImplementationV8Internal::partialStaticLongAttributeAttributeGetter(info);
623     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
624 }
625 #endif // ENABLE(PARTIAL_CONDITION)
626
627 #if ENABLE(PARTIAL_CONDITION)
628 static void partialStaticLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
629 {
630     ExceptionState exceptionState(ExceptionState::SetterContext, "partialStaticLongAttribute", "TestInterface", holder, info.GetIsolate());
631     TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState);
632     TestPartialInterface::setPartialStaticLongAttribute(cppValue);
633 }
634 #endif // ENABLE(PARTIAL_CONDITION)
635
636 #if ENABLE(PARTIAL_CONDITION)
637 static void partialStaticLongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
638 {
639     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
640     TestInterfaceImplementationV8Internal::partialStaticLongAttributeAttributeSetter(v8Value, info);
641     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
642 }
643 #endif // ENABLE(PARTIAL_CONDITION)
644
645 #if ENABLE(PARTIAL_CONDITION)
646 static void partialCallWithExecutionContextLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
647 {
648     v8::Handle<v8::Object> holder = info.Holder();
649     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
650     ASSERT(impl);
651     ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate());
652     v8SetReturnValueInt(info, TestPartialInterface::partialCallWithExecutionContextLongAttribute(scriptContext, *impl));
653 }
654 #endif // ENABLE(PARTIAL_CONDITION)
655
656 #if ENABLE(PARTIAL_CONDITION)
657 static void partialCallWithExecutionContextLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
658 {
659     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
660     TestInterfaceImplementationV8Internal::partialCallWithExecutionContextLongAttributeAttributeGetter(info);
661     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
662 }
663 #endif // ENABLE(PARTIAL_CONDITION)
664
665 #if ENABLE(PARTIAL_CONDITION)
666 static void partialCallWithExecutionContextLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
667 {
668     v8::Handle<v8::Object> holder = info.Holder();
669     ExceptionState exceptionState(ExceptionState::SetterContext, "partialCallWithExecutionContextLongAttribute", "TestInterface", holder, info.GetIsolate());
670     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
671     ASSERT(impl);
672     TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState);
673     ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate());
674     TestPartialInterface::setPartialCallWithExecutionContextLongAttribute(scriptContext, *impl, cppValue);
675 }
676 #endif // ENABLE(PARTIAL_CONDITION)
677
678 #if ENABLE(PARTIAL_CONDITION)
679 static void partialCallWithExecutionContextLongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
680 {
681     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
682     TestInterfaceImplementationV8Internal::partialCallWithExecutionContextLongAttributeAttributeSetter(v8Value, info);
683     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
684 }
685 #endif // ENABLE(PARTIAL_CONDITION)
686
687 #if ENABLE(PARTIAL_CONDITION)
688 static void partialPartialEnumTypeAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
689 {
690     v8::Handle<v8::Object> holder = info.Holder();
691     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
692     ASSERT(impl);
693     v8SetReturnValueString(info, TestPartialInterface::partialPartialEnumTypeAttribute(*impl), info.GetIsolate());
694 }
695 #endif // ENABLE(PARTIAL_CONDITION)
696
697 #if ENABLE(PARTIAL_CONDITION)
698 static void partialPartialEnumTypeAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
699 {
700     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
701     TestInterfaceImplementationV8Internal::partialPartialEnumTypeAttributeAttributeGetter(info);
702     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
703 }
704 #endif // ENABLE(PARTIAL_CONDITION)
705
706 #if ENABLE(PARTIAL_CONDITION)
707 static void partialPartialEnumTypeAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
708 {
709     v8::Handle<v8::Object> holder = info.Holder();
710     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
711     ASSERT(impl);
712     TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
713     String string = cppValue;
714     if (!(string == "foo" || string == "bar"))
715         return;
716     TestPartialInterface::setPartialPartialEnumTypeAttribute(*impl, cppValue);
717 }
718 #endif // ENABLE(PARTIAL_CONDITION)
719
720 #if ENABLE(PARTIAL_CONDITION)
721 static void partialPartialEnumTypeAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
722 {
723     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
724     TestInterfaceImplementationV8Internal::partialPartialEnumTypeAttributeAttributeSetter(v8Value, info);
725     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
726 }
727 #endif // ENABLE(PARTIAL_CONDITION)
728
729 static void partial2LongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
730 {
731     v8::Handle<v8::Object> holder = info.Holder();
732     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
733     ASSERT(impl);
734     v8SetReturnValueInt(info, TestPartialInterfaceImplementation::partial2LongAttribute(*impl));
735 }
736
737 static void partial2LongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
738 {
739     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
740     TestInterfaceImplementationV8Internal::partial2LongAttributeAttributeGetter(info);
741     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
742 }
743
744 static void partial2LongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
745 {
746     v8::Handle<v8::Object> holder = info.Holder();
747     ExceptionState exceptionState(ExceptionState::SetterContext, "partial2LongAttribute", "TestInterface", holder, info.GetIsolate());
748     TestInterfaceImplementation* impl = V8TestInterface::toNative(holder);
749     ASSERT(impl);
750     TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState);
751     TestPartialInterfaceImplementation::setPartial2LongAttribute(*impl, cppValue);
752 }
753
754 static void partial2LongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
755 {
756     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
757     TestInterfaceImplementationV8Internal::partial2LongAttributeAttributeSetter(v8Value, info);
758     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
759 }
760
761 static void partial2StaticLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
762 {
763     v8SetReturnValueInt(info, TestPartialInterfaceImplementation::partial2StaticLongAttribute());
764 }
765
766 static void partial2StaticLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
767 {
768     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
769     TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeGetter(info);
770     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
771 }
772
773 static void partial2StaticLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
774 {
775     ExceptionState exceptionState(ExceptionState::SetterContext, "partial2StaticLongAttribute", "TestInterface", holder, info.GetIsolate());
776     TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState);
777     TestPartialInterfaceImplementation::setPartial2StaticLongAttribute(cppValue);
778 }
779
780 static void partial2StaticLongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
781 {
782     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
783     TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeSetter(v8Value, info);
784     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
785 }
786
787 static void TestInterfaceImplementationConstructorGetter(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
788 {
789     v8::Handle<v8::Value> data = info.Data();
790     ASSERT(data->IsExternal());
791     V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->CreationContext());
792     if (!perContextData)
793         return;
794     v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::unwrap(data)));
795 }
796
797 static void TestInterfaceImplementationReplaceableAttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
798 {
799     if (info.This()->IsObject())
800         v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value);
801 }
802
803 static void TestInterfaceImplementationReplaceableAttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
804 {
805     TestInterfaceImplementationV8Internal::TestInterfaceImplementationReplaceableAttributeSetter(name, v8Value, info);
806 }
807
808 static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
809 {
810     if (UNLIKELY(info.Length() < 1)) {
811         throwArityTypeErrorForMethod("voidMethodTestInterfaceEmptyArg", "TestInterface", 1, info.Length(), info.GetIsolate());
812         return;
813     }
814     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
815     if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], info.GetIsolate())) {
816         throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInterfaceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpty'."), info.GetIsolate());
817         return;
818     }
819     TONATIVE_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
820     impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg);
821 }
822
823 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
824 {
825     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
826     TestInterfaceImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethod(info);
827     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
828 }
829
830 static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
831 {
832     if (UNLIKELY(info.Length() < 2)) {
833         throwArityTypeErrorForMethod("voidMethodDoubleArgFloatArg", "TestInterface", 2, info.Length(), info.GetIsolate());
834         return;
835     }
836     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
837     TONATIVE_VOID(double, doubleArg, static_cast<double>(info[0]->NumberValue()));
838     if (!std::isfinite(doubleArg)) {
839         throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleArgFloatArg", "TestInterface", "double parameter 1 is non-finite."), info.GetIsolate());
840         return;
841     }
842     TONATIVE_VOID(float, floatArg, static_cast<float>(info[1]->NumberValue()));
843     if (!std::isfinite(floatArg)) {
844         throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleArgFloatArg", "TestInterface", "float parameter 2 is non-finite."), info.GetIsolate());
845         return;
846     }
847     impl->voidMethodDoubleArgFloatArg(doubleArg, floatArg);
848 }
849
850 static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
851 {
852     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
853     TestInterfaceImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(info);
854     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
855 }
856
857 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
858 {
859     if (UNLIKELY(info.Length() < 2)) {
860         throwArityTypeErrorForMethod("voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", "TestInterface", 2, info.Length(), info.GetIsolate());
861         return;
862     }
863     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
864     TONATIVE_VOID(double, unrestrictedDoubleArg, static_cast<double>(info[0]->NumberValue()));
865     TONATIVE_VOID(float, unrestrictedFloatArg, static_cast<float>(info[1]->NumberValue()));
866     impl->voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestrictedDoubleArg, unrestrictedFloatArg);
867 }
868
869 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
870 {
871     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
872     TestInterfaceImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(info);
873     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
874 }
875
876 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
877 {
878     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
879     impl->voidMethod();
880 }
881
882 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
883 {
884     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
885     TestInterfaceImplementationV8Internal::voidMethodMethod(info);
886     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
887 }
888
889 static void voidMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
890 {
891     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
892     impl->voidMethod();
893 }
894
895 static void voidMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
896 {
897     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
898     TestInterfaceImplementationV8Internal::voidMethodMethodForMainWorld(info);
899     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
900 }
901
902 static void implementsVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
903 {
904     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
905     impl->implementsVoidMethod();
906 }
907
908 static void implementsVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
909 {
910     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
911     TestInterfaceImplementationV8Internal::implementsVoidMethodMethod(info);
912     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
913 }
914
915 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
916 {
917     ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsComplexMethod", "TestInterface", info.Holder(), info.GetIsolate());
918     if (UNLIKELY(info.Length() < 2)) {
919         throwArityTypeError(exceptionState, 2, info.Length());
920         return;
921     }
922     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
923     TOSTRING_VOID(V8StringResource<>, strArg, info[0]);
924     if (info.Length() > 1 && !V8TestInterfaceEmpty::hasInstance(info[1], info.GetIsolate())) {
925         exceptionState.throwTypeError("parameter 2 is not of type 'TestInterfaceEmpty'.");
926         exceptionState.throwIfNeeded();
927         return;
928     }
929     TONATIVE_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[1]));
930     ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate());
931     RefPtr<TestInterfaceEmpty> result = impl->implementsComplexMethod(scriptContext, strArg, testInterfaceEmptyArg, exceptionState);
932     if (exceptionState.throwIfNeeded())
933         return;
934     v8SetReturnValue(info, result.release());
935 }
936
937 static void implementsComplexMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
938 {
939     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
940     TestInterfaceImplementationV8Internal::implementsComplexMethodMethod(info);
941     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
942 }
943
944 static void implementsCustomVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
945 {
946     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
947     V8TestInterface::implementsCustomVoidMethodMethodCustom(info);
948     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
949 }
950
951 static void implementsStaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
952 {
953     TestInterfaceImplementation::implementsStaticVoidMethod();
954 }
955
956 static void implementsStaticVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
957 {
958     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
959     TestInterfaceImplementationV8Internal::implementsStaticVoidMethodMethod(info);
960     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
961 }
962
963 static void implements2VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
964 {
965     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
966     ASSERT(impl);
967     TestImplements2::implements2VoidMethod(*impl);
968 }
969
970 static void implements2VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
971 {
972     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
973     TestInterfaceImplementationV8Internal::implements2VoidMethodMethod(info);
974     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
975 }
976
977 static void implements3VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
978 {
979     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
980     ASSERT(impl);
981     TestImplements3Implementation::implements3VoidMethod(*impl);
982 }
983
984 static void implements3VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
985 {
986     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
987     TestInterfaceImplementationV8Internal::implements3VoidMethodMethod(info);
988     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
989 }
990
991 static void implements3StaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
992 {
993     TestImplements3Implementation::implements3StaticVoidMethod();
994 }
995
996 static void implements3StaticVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
997 {
998     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
999     TestInterfaceImplementationV8Internal::implements3StaticVoidMethodMethod(info);
1000     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1001 }
1002
1003 #if ENABLE(PARTIAL_CONDITION)
1004 static void partialVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1005 {
1006     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
1007     ASSERT(impl);
1008     TestPartialInterface::partialVoidMethod(*impl);
1009 }
1010 #endif // ENABLE(PARTIAL_CONDITION)
1011
1012 #if ENABLE(PARTIAL_CONDITION)
1013 static void partialVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
1014 {
1015     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
1016     TestInterfaceImplementationV8Internal::partialVoidMethodMethod(info);
1017     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1018 }
1019 #endif // ENABLE(PARTIAL_CONDITION)
1020
1021 #if ENABLE(PARTIAL_CONDITION)
1022 static void partialStaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1023 {
1024     TestPartialInterface::partialStaticVoidMethod();
1025 }
1026 #endif // ENABLE(PARTIAL_CONDITION)
1027
1028 #if ENABLE(PARTIAL_CONDITION)
1029 static void partialStaticVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
1030 {
1031     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
1032     TestInterfaceImplementationV8Internal::partialStaticVoidMethodMethod(info);
1033     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1034 }
1035 #endif // ENABLE(PARTIAL_CONDITION)
1036
1037 #if ENABLE(PARTIAL_CONDITION)
1038 static void partialVoidMethodLongArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1039 {
1040     ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialVoidMethodLongArg", "TestInterface", info.Holder(), info.GetIsolate());
1041     if (UNLIKELY(info.Length() < 1)) {
1042         throwArityTypeError(exceptionState, 1, info.Length());
1043         return;
1044     }
1045     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
1046     TONATIVE_VOID_EXCEPTIONSTATE(int, longArg, toInt32(info[0], exceptionState), exceptionState);
1047     ASSERT(impl);
1048     TestPartialInterface::partialVoidMethodLongArg(*impl, longArg);
1049 }
1050 #endif // ENABLE(PARTIAL_CONDITION)
1051
1052 #if ENABLE(PARTIAL_CONDITION)
1053 static void partialVoidMethodLongArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
1054 {
1055     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
1056     TestInterfaceImplementationV8Internal::partialVoidMethodLongArgMethod(info);
1057     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1058 }
1059 #endif // ENABLE(PARTIAL_CONDITION)
1060
1061 #if ENABLE(PARTIAL_CONDITION)
1062 static void partialCallWithExecutionContextRaisesExceptionVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1063 {
1064     ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialCallWithExecutionContextRaisesExceptionVoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
1065     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
1066     ASSERT(impl);
1067     ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate());
1068     TestPartialInterface::partialCallWithExecutionContextRaisesExceptionVoidMethod(scriptContext, *impl, exceptionState);
1069     if (exceptionState.throwIfNeeded())
1070         return;
1071 }
1072 #endif // ENABLE(PARTIAL_CONDITION)
1073
1074 #if ENABLE(PARTIAL_CONDITION)
1075 static void partialCallWithExecutionContextRaisesExceptionVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
1076 {
1077     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
1078     TestInterfaceImplementationV8Internal::partialCallWithExecutionContextRaisesExceptionVoidMethodMethod(info);
1079     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1080 }
1081 #endif // ENABLE(PARTIAL_CONDITION)
1082
1083 #if ENABLE(PARTIAL_CONDITION)
1084 static void partialVoidMethodPartialCallbackTypeArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1085 {
1086     if (UNLIKELY(info.Length() < 1)) {
1087         throwArityTypeErrorForMethod("partialVoidMethodPartialCallbackTypeArg", "TestInterface", 1, info.Length(), info.GetIsolate());
1088         return;
1089     }
1090     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
1091     TONATIVE_VOID(ScriptValue, partialCallbackTypeArg, ScriptValue(ScriptState::current(info.GetIsolate()), info[0]));
1092     ASSERT(impl);
1093     TestPartialInterface::partialVoidMethodPartialCallbackTypeArg(*impl, partialCallbackTypeArg);
1094 }
1095 #endif // ENABLE(PARTIAL_CONDITION)
1096
1097 #if ENABLE(PARTIAL_CONDITION)
1098 static void partialVoidMethodPartialCallbackTypeArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
1099 {
1100     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
1101     TestInterfaceImplementationV8Internal::partialVoidMethodPartialCallbackTypeArgMethod(info);
1102     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1103 }
1104 #endif // ENABLE(PARTIAL_CONDITION)
1105
1106 static void partial2VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1107 {
1108     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
1109     ASSERT(impl);
1110     TestPartialInterfaceImplementation::partial2VoidMethod(*impl);
1111 }
1112
1113 static void partial2VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
1114 {
1115     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
1116     TestInterfaceImplementationV8Internal::partial2VoidMethodMethod(info);
1117     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1118 }
1119
1120 static void partial2StaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1121 {
1122     TestPartialInterfaceImplementation::partial2StaticVoidMethod();
1123 }
1124
1125 static void partial2StaticVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
1126 {
1127     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
1128     TestInterfaceImplementationV8Internal::partial2StaticVoidMethodMethod(info);
1129     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1130 }
1131
1132 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
1133 {
1134     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
1135     String result = impl->anonymousIndexedGetter(index);
1136     if (result.isNull())
1137         return;
1138     v8SetReturnValueString(info, result, info.GetIsolate());
1139 }
1140
1141 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
1142 {
1143     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
1144     TestInterfaceImplementationV8Internal::indexedPropertyGetter(index, info);
1145     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1146 }
1147
1148 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
1149 {
1150     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
1151     TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value);
1152     bool result = impl->anonymousIndexedSetter(index, propertyValue);
1153     if (!result)
1154         return;
1155     v8SetReturnValue(info, v8Value);
1156 }
1157
1158 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
1159 {
1160     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
1161     TestInterfaceImplementationV8Internal::indexedPropertySetter(index, v8Value, info);
1162     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1163 }
1164
1165 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
1166 {
1167     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
1168     DeleteResult result = impl->anonymousIndexedDeleter(index);
1169     if (result != DeleteUnknownProperty)
1170         return v8SetReturnValueBool(info, result == DeleteSuccess);
1171 }
1172
1173 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
1174 {
1175     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
1176     TestInterfaceImplementationV8Internal::indexedPropertyDeleter(index, info);
1177     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1178 }
1179
1180 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
1181 {
1182     if (info.Holder()->HasRealNamedProperty(name))
1183         return;
1184     if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
1185         return;
1186
1187     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
1188     AtomicString propertyName = toCoreAtomicString(name);
1189     String result = impl->anonymousNamedGetter(propertyName);
1190     if (result.isNull())
1191         return;
1192     v8SetReturnValueString(info, result, info.GetIsolate());
1193 }
1194
1195 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
1196 {
1197     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
1198     TestInterfaceImplementationV8Internal::namedPropertyGetter(name, info);
1199     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1200 }
1201
1202 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
1203 {
1204     if (info.Holder()->HasRealNamedProperty(name))
1205         return;
1206     if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
1207         return;
1208
1209     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
1210     TOSTRING_VOID(V8StringResource<>, propertyName, name);
1211     TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value);
1212     bool result = impl->anonymousNamedSetter(propertyName, propertyValue);
1213     if (!result)
1214         return;
1215     v8SetReturnValue(info, v8Value);
1216 }
1217
1218 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
1219 {
1220     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
1221     TestInterfaceImplementationV8Internal::namedPropertySetter(name, v8Value, info);
1222     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1223 }
1224
1225 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
1226 {
1227     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
1228     AtomicString propertyName = toCoreAtomicString(name);
1229     v8::String::Utf8Value namedProperty(name);
1230     ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface", info.Holder(), info.GetIsolate());
1231     bool result = impl->namedPropertyQuery(propertyName, exceptionState);
1232     if (exceptionState.throwIfNeeded())
1233         return;
1234     if (!result)
1235         return;
1236     v8SetReturnValueInt(info, v8::None);
1237 }
1238
1239 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
1240 {
1241     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
1242     TestInterfaceImplementationV8Internal::namedPropertyQuery(name, info);
1243     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1244 }
1245
1246 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
1247 {
1248     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
1249     AtomicString propertyName = toCoreAtomicString(name);
1250     DeleteResult result = impl->anonymousNamedDeleter(propertyName);
1251     if (result != DeleteUnknownProperty)
1252         return v8SetReturnValueBool(info, result == DeleteSuccess);
1253 }
1254
1255 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
1256 {
1257     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
1258     TestInterfaceImplementationV8Internal::namedPropertyDeleter(name, info);
1259     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1260 }
1261
1262 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info)
1263 {
1264     TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
1265     v8::Isolate* isolate = info.GetIsolate();
1266     Vector<String> names;
1267     ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestInterface", info.Holder(), isolate);
1268     impl->namedPropertyEnumerator(names, exceptionState);
1269     if (exceptionState.throwIfNeeded())
1270         return;
1271     v8::Handle<v8::Array> v8names = v8::Array::New(isolate, names.size());
1272     for (size_t i = 0; i < names.size(); ++i)
1273         v8names->Set(v8::Integer::New(isolate, i), v8String(isolate, names[i]));
1274     v8SetReturnValue(info, v8names);
1275 }
1276
1277 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info)
1278 {
1279     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
1280     TestInterfaceImplementationV8Internal::namedPropertyEnumerator(info);
1281     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1282 }
1283
1284 } // namespace TestInterfaceImplementationV8Internal
1285
1286 void V8TestInterface::visitDOMWrapper(void* object, const v8::Persistent<v8::Object>& wrapper, v8::Isolate* isolate)
1287 {
1288     TestInterfaceImplementation* impl = fromInternalPointer(object);
1289     v8::Local<v8::Object> creationContext = v8::Local<v8::Object>::New(isolate, wrapper);
1290     V8WrapperInstantiationScope scope(creationContext, isolate);
1291     TestInterfaceImplementation* referencedName = impl->referencedName();
1292     if (referencedName) {
1293         if (!DOMDataStore::containsWrapper<V8TestInterface>(referencedName, isolate))
1294             wrap(referencedName, creationContext, isolate);
1295         DOMDataStore::setWrapperReference<V8TestInterface>(wrapper, referencedName, isolate);
1296     }
1297     setObjectGroup(object, wrapper, isolate);
1298 }
1299
1300 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceAttributes[] = {
1301     {"testInterfaceAttribute", TestInterfaceImplementationV8Internal::testInterfaceAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::testInterfaceAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1302     {"testImplementedAsConstructorAttribute", TestInterfaceImplementationV8Internal::TestInterfaceImplementationConstructorGetter, TestInterfaceImplementationV8Internal::TestInterfaceImplementationReplaceableAttributeSetterCallback, 0, 0, const_cast<WrapperTypeInfo*>(&V8TestImplementedAs::wrapperTypeInfo), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::DontEnum), 0 /* on instance */},
1303     {"doubleAttribute", TestInterfaceImplementationV8Internal::doubleAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::doubleAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1304     {"floatAttribute", TestInterfaceImplementationV8Internal::floatAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::floatAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1305     {"unrestrictedDoubleAttribute", TestInterfaceImplementationV8Internal::unrestrictedDoubleAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::unrestrictedDoubleAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1306     {"unrestrictedFloatAttribute", TestInterfaceImplementationV8Internal::unrestrictedFloatAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::unrestrictedFloatAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1307     {"implementsReadonlyStringAttribute", TestInterfaceImplementationV8Internal::implementsReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1308     {"implementsStringAttribute", TestInterfaceImplementationV8Internal::implementsStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsStringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1309     {"implementsNodeAttribute", TestInterfaceImplementationV8Internal::implementsNodeAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsNodeAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1310     {"implementsEventHandlerAttribute", TestInterfaceImplementationV8Internal::implementsEventHandlerAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsEventHandlerAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1311     {"implements3StringAttribute", TestInterfaceImplementationV8Internal::implements3StringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implements3StringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1312 };
1313
1314 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceMethods[] = {
1315     {"voidMethodTestInterfaceEmptyArg", TestInterfaceImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethodCallback, 0, 1},
1316     {"voidMethodDoubleArgFloatArg", TestInterfaceImplementationV8Internal::voidMethodDoubleArgFloatArgMethodCallback, 0, 2},
1317     {"voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", TestInterfaceImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback, 0, 2},
1318     {"voidMethod", TestInterfaceImplementationV8Internal::voidMethodMethodCallback, TestInterfaceImplementationV8Internal::voidMethodMethodCallbackForMainWorld, 0},
1319     {"implementsVoidMethod", TestInterfaceImplementationV8Internal::implementsVoidMethodMethodCallback, 0, 0},
1320     {"implementsComplexMethod", TestInterfaceImplementationV8Internal::implementsComplexMethodMethodCallback, 0, 2},
1321     {"implementsCustomVoidMethod", TestInterfaceImplementationV8Internal::implementsCustomVoidMethodMethodCallback, 0, 0},
1322     {"implements3VoidMethod", TestInterfaceImplementationV8Internal::implements3VoidMethodMethodCallback, 0, 0},
1323 };
1324
1325 static void configureV8TestInterfaceTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
1326 {
1327     functionTemplate->ReadOnlyPrototype();
1328
1329     v8::Local<v8::Signature> defaultSignature;
1330     if (!RuntimeEnabledFeatures::featureNameEnabled())
1331         defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterface::internalFieldCount, 0, 0, 0, 0, 0, 0, isolate);
1332     else
1333         defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterface", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterface::internalFieldCount,
1334             V8TestInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceAttributes),
1335             0, 0,
1336             V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods),
1337             isolate);
1338     v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
1339     v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
1340     if (RuntimeEnabledFeatures::implementsFeatureNameEnabled()) {
1341         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
1342         {"implementsRuntimeEnabledNodeAttribute", TestInterfaceImplementationV8Internal::implementsRuntimeEnabledNodeAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsRuntimeEnabledNodeAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1343         V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate);
1344     }
1345     if (RuntimeEnabledFeatures::implements2FeatureNameEnabled()) {
1346         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
1347         {"implements2StringAttribute", TestInterfaceImplementationV8Internal::implements2StringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implements2StringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1348         V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate);
1349     }
1350 #if ENABLE(PARTIAL_CONDITION)
1351     if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
1352         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
1353         {"partialLongAttribute", TestInterfaceImplementationV8Internal::partialLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partialLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1354         V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate);
1355     }
1356 #endif // ENABLE(PARTIAL_CONDITION)
1357 #if ENABLE(PARTIAL_CONDITION)
1358     if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
1359         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
1360         {"partialCallWithExecutionContextLongAttribute", TestInterfaceImplementationV8Internal::partialCallWithExecutionContextLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partialCallWithExecutionContextLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1361         V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate);
1362     }
1363 #endif // ENABLE(PARTIAL_CONDITION)
1364 #if ENABLE(PARTIAL_CONDITION)
1365     if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
1366         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
1367         {"partialPartialEnumTypeAttribute", TestInterfaceImplementationV8Internal::partialPartialEnumTypeAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partialPartialEnumTypeAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1368         V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate);
1369     }
1370 #endif // ENABLE(PARTIAL_CONDITION)
1371     static const V8DOMConfiguration::ConstantConfiguration V8TestInterfaceConstants[] = {
1372         {"UNSIGNED_LONG", 0},
1373         {"CONST_JAVASCRIPT", 1},
1374         {"IMPLEMENTS_CONSTANT_1", 1},
1375         {"IMPLEMENTS_CONSTANT_2", 2},
1376         {"PARTIAL2_UNSIGNED_SHORT", 0},
1377     };
1378     V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8TestInterfaceConstants, WTF_ARRAY_LENGTH(V8TestInterfaceConstants), isolate);
1379     if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
1380         static const V8DOMConfiguration::ConstantConfiguration constantConfiguration = {"PARTIAL_UNSIGNED_SHORT", static_cast<signed int>(0)};
1381         V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, &constantConfiguration, 1, isolate);
1382     }
1383     functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestInterfaceImplementationV8Internal::indexedPropertyGetterCallback, TestInterfaceImplementationV8Internal::indexedPropertySetterCallback, 0, TestInterfaceImplementationV8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterfaceImplementation>);
1384     functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterfaceImplementationV8Internal::namedPropertyGetterCallback, TestInterfaceImplementationV8Internal::namedPropertySetterCallback, TestInterfaceImplementationV8Internal::namedPropertyQueryCallback, TestInterfaceImplementationV8Internal::namedPropertyDeleterCallback, TestInterfaceImplementationV8Internal::namedPropertyEnumeratorCallback);
1385     functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestInterface::legacyCallCustom);
1386     functionTemplate->Set(v8AtomicString(isolate, "implementsStaticVoidMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::implementsStaticVoidMethodMethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0));
1387     if (RuntimeEnabledFeatures::implements2FeatureNameEnabled())
1388         prototypeTemplate->Set(v8AtomicString(isolate, "implements2VoidMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::implements2VoidMethodMethodCallback, v8Undefined(), defaultSignature, 0));
1389     functionTemplate->Set(v8AtomicString(isolate, "implements3StaticVoidMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::implements3StaticVoidMethodMethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0));
1390 #if ENABLE(PARTIAL_CONDITION)
1391     if (RuntimeEnabledFeatures::partialFeatureNameEnabled())
1392         prototypeTemplate->Set(v8AtomicString(isolate, "partialVoidMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::partialVoidMethodMethodCallback, v8Undefined(), defaultSignature, 0));
1393 #endif // ENABLE(PARTIAL_CONDITION)
1394 #if ENABLE(PARTIAL_CONDITION)
1395     if (RuntimeEnabledFeatures::partialFeatureNameEnabled())
1396         functionTemplate->Set(v8AtomicString(isolate, "partialStaticVoidMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::partialStaticVoidMethodMethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0));
1397 #endif // ENABLE(PARTIAL_CONDITION)
1398 #if ENABLE(PARTIAL_CONDITION)
1399     if (RuntimeEnabledFeatures::partialFeatureNameEnabled())
1400         prototypeTemplate->Set(v8AtomicString(isolate, "partialVoidMethodLongArg"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::partialVoidMethodLongArgMethodCallback, v8Undefined(), defaultSignature, 1));
1401 #endif // ENABLE(PARTIAL_CONDITION)
1402 #if ENABLE(PARTIAL_CONDITION)
1403     if (RuntimeEnabledFeatures::partialFeatureNameEnabled())
1404         prototypeTemplate->Set(v8AtomicString(isolate, "partialCallWithExecutionContextRaisesExceptionVoidMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::partialCallWithExecutionContextRaisesExceptionVoidMethodMethodCallback, v8Undefined(), defaultSignature, 0));
1405 #endif // ENABLE(PARTIAL_CONDITION)
1406 #if ENABLE(PARTIAL_CONDITION)
1407     if (RuntimeEnabledFeatures::partialFeatureNameEnabled())
1408         prototypeTemplate->Set(v8AtomicString(isolate, "partialVoidMethodPartialCallbackTypeArg"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::partialVoidMethodPartialCallbackTypeArgMethodCallback, v8Undefined(), defaultSignature, 1));
1409 #endif // ENABLE(PARTIAL_CONDITION)
1410     functionTemplate->Set(v8AtomicString(isolate, "partial2StaticVoidMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::partial2StaticVoidMethodMethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0));
1411     functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "staticStringAttribute"), TestInterfaceImplementationV8Internal::staticStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::staticStringAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
1412     functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implementsStaticReadOnlyLongAttribute"), TestInterfaceImplementationV8Internal::implementsStaticReadOnlyLongAttributeAttributeGetterCallback, 0, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
1413     functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implementsStaticStringAttribute"), TestInterfaceImplementationV8Internal::implementsStaticStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsStaticStringAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
1414     functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implements2StaticStringAttribute"), TestInterfaceImplementationV8Internal::implements2StaticStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implements2StaticStringAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
1415     functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implements3StaticStringAttribute"), TestInterfaceImplementationV8Internal::implements3StaticStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implements3StaticStringAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
1416 #if ENABLE(PARTIAL_CONDITION)
1417     functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "partialStaticLongAttribute"), TestInterfaceImplementationV8Internal::partialStaticLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partialStaticLongAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
1418 #endif // ENABLE(PARTIAL_CONDITION)
1419     functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "partial2StaticLongAttribute"), TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
1420
1421     // Custom toString template
1422     functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
1423 }
1424
1425 v8::Handle<v8::FunctionTemplate> V8TestInterface::domTemplate(v8::Isolate* isolate)
1426 {
1427     V8PerIsolateData* data = V8PerIsolateData::from(isolate);
1428     v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo));
1429     if (!result.IsEmpty())
1430         return result;
1431
1432     TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
1433     result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidConstructorMode);
1434     configureV8TestInterfaceTemplate(result, isolate);
1435     data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result);
1436     return result;
1437 }
1438
1439 bool V8TestInterface::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
1440 {
1441     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
1442 }
1443
1444 v8::Handle<v8::Object> V8TestInterface::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
1445 {
1446     return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
1447 }
1448
1449 TestInterfaceImplementation* V8TestInterface::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
1450 {
1451     return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Object>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
1452 }
1453
1454 void V8TestInterface::installPerContextEnabledProperties(v8::Handle<v8::Object> instanceTemplate, TestInterfaceImplementation* impl, v8::Isolate* isolate)
1455 {
1456     v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instanceTemplate->GetPrototype());
1457     if (ContextFeatures::implementsContextNameEnabled(impl->document())) {
1458         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
1459         {"implementsPerContextEnabledNodeAttribute", TestInterfaceImplementationV8Internal::implementsPerContextEnabledNodeAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsPerContextEnabledNodeAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1460         V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate);
1461     }
1462     if (ContextFeatures::partialContextNameEnabled(impl->document())) {
1463         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
1464         {"partial2LongAttribute", TestInterfaceImplementationV8Internal::partial2LongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partial2LongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1465         V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate);
1466     }
1467     if (ContextFeatures::partialContextNameEnabled(impl->document())) {
1468         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
1469         {"partial2StaticLongAttribute", TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1470         V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate);
1471     }
1472 }
1473
1474 void V8TestInterface::installPerContextEnabledMethods(v8::Handle<v8::Object> prototypeTemplate, v8::Isolate* isolate)
1475 {
1476     v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domTemplate(isolate));
1477
1478     ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationContext());
1479     if (context && context->isDocument() && ContextFeatures::partialContextNameEnabled(toDocument(context)))
1480         prototypeTemplate->Set(v8AtomicString(isolate, "partial2VoidMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::partial2VoidMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction());
1481     if (context && context->isDocument() && ContextFeatures::partialContextNameEnabled(toDocument(context)))
1482         prototypeTemplate->Set(v8AtomicString(isolate, "partial2StaticVoidMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::partial2StaticVoidMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction());
1483 }
1484
1485 ActiveDOMObject* V8TestInterface::toActiveDOMObject(v8::Handle<v8::Object> wrapper)
1486 {
1487     return toNative(wrapper);
1488 }
1489
1490 void V8TestInterface::derefObject(void* object)
1491 {
1492     fromInternalPointer(object)->deref();
1493 }
1494
1495 template<>
1496 v8::Handle<v8::Value> toV8NoInline(TestInterfaceImplementation* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
1497 {
1498     return toV8(impl, creationContext, isolate);
1499 }
1500
1501 } // namespace WebCore
1502 #endif // ENABLE(CONDITION)