Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / V8TestInterface.cpp
1 /*
2  * Copyright (C) 2013 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  *     * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer
12  * in the documentation and/or other materials provided with the
13  * distribution.
14  *     * Neither the name of Google Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30
31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY!
32
33 #include "config.h"
34 #if ENABLE(Condition1) || ENABLE(Condition2)
35 #include "V8TestInterface.h"
36
37 #include "RuntimeEnabledFeatures.h"
38 #include "V8Node.h"
39 #include "V8NodeList.h"
40 #include "V8ReferencedType.h"
41 #include "V8TestInterfaceEmpty.h"
42 #include "V8TestObject.h"
43 #include "bindings/tests/idls/TestImplements.h"
44 #include "bindings/tests/idls/TestPartialInterface.h"
45 #include "bindings/v8/ExceptionState.h"
46 #include "bindings/v8/V8AbstractEventListener.h"
47 #include "bindings/v8/V8DOMConfiguration.h"
48 #include "bindings/v8/V8EventListenerList.h"
49 #include "bindings/v8/V8ObjectConstructor.h"
50 #include "core/dom/ContextFeatures.h"
51 #include "core/dom/Document.h"
52 #include "platform/TraceEvent.h"
53 #include "wtf/GetPtr.h"
54 #include "wtf/RefPtr.h"
55
56 namespace WebCore {
57
58 static void initializeScriptWrappableForInterface(TestInterface* object)
59 {
60     if (ScriptWrappable::wrapperCanBeStoredInObject(object))
61         ScriptWrappable::setTypeInfoInObject(object, &V8TestInterface::wrapperTypeInfo);
62     else
63         ASSERT_NOT_REACHED();
64 }
65
66 } // namespace WebCore
67
68 // In ScriptWrappable::init, the use of a local function declaration has an issue on Windows:
69 // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function
70 // in the global namespace.
71 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/feedback/details/664619/the-namespace-of-local-function-declarations-in-c)
72 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterface* object)
73 {
74     WebCore::initializeScriptWrappableForInterface(object);
75 }
76
77 namespace WebCore {
78 const WrapperTypeInfo V8TestInterface::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface::domTemplate, V8TestInterface::derefObject, V8TestInterface::toActiveDOMObject, 0, V8TestInterface::visitDOMWrapper, V8TestInterface::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, false };
79
80 namespace TestInterfaceV8Internal {
81
82 template <typename T> void V8_USE(T) { }
83
84 static void implementsStaticReadOnlyLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
85 {
86     v8SetReturnValueInt(info, TestImplements::implementsStaticReadOnlyLongAttribute());
87 }
88
89 static void implementsStaticReadOnlyLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
90 {
91     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
92     TestInterfaceV8Internal::implementsStaticReadOnlyLongAttributeAttributeGetter(info);
93     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
94 }
95
96 static void implementsStaticStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
97 {
98     v8SetReturnValueString(info, TestImplements::implementsStaticStringAttribute(), info.GetIsolate());
99 }
100
101 static void implementsStaticStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
102 {
103     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
104     TestInterfaceV8Internal::implementsStaticStringAttributeAttributeGetter(info);
105     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
106 }
107
108 static void implementsStaticStringAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
109 {
110     V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
111     TestImplements::setImplementsStaticStringAttribute(cppValue);
112 }
113
114 static void implementsStaticStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
115 {
116     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
117     TestInterfaceV8Internal::implementsStaticStringAttributeAttributeSetter(jsValue, info);
118     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
119 }
120
121 static void implementsReadonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
122 {
123     TestInterface* imp = V8TestInterface::toNative(info.Holder());
124     v8SetReturnValueString(info, TestImplements::implementsReadonlyStringAttribute(imp), info.GetIsolate());
125 }
126
127 static void implementsReadonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
128 {
129     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
130     TestInterfaceV8Internal::implementsReadonlyStringAttributeAttributeGetter(info);
131     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
132 }
133
134 static void implementsStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
135 {
136     TestInterface* imp = V8TestInterface::toNative(info.Holder());
137     v8SetReturnValueString(info, TestImplements::implementsStringAttribute(imp), info.GetIsolate());
138 }
139
140 static void implementsStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
141 {
142     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
143     TestInterfaceV8Internal::implementsStringAttributeAttributeGetter(info);
144     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
145 }
146
147 static void implementsStringAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
148 {
149     TestInterface* imp = V8TestInterface::toNative(info.Holder());
150     V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
151     TestImplements::setImplementsStringAttribute(imp, cppValue);
152 }
153
154 static void implementsStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
155 {
156     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
157     TestInterfaceV8Internal::implementsStringAttributeAttributeSetter(jsValue, info);
158     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
159 }
160
161 static void implementsNodeAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
162 {
163     TestInterface* imp = V8TestInterface::toNative(info.Holder());
164     v8SetReturnValueFast(info, TestImplements::implementsNodeAttribute(imp), imp);
165 }
166
167 static void implementsNodeAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
168 {
169     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
170     TestInterfaceV8Internal::implementsNodeAttributeAttributeGetter(info);
171     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
172 }
173
174 static void implementsNodeAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
175 {
176     TestInterface* imp = V8TestInterface::toNative(info.Holder());
177     V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0);
178     TestImplements::setImplementsNodeAttribute(imp, WTF::getPtr(cppValue));
179 }
180
181 static void implementsNodeAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
182 {
183     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
184     TestInterfaceV8Internal::implementsNodeAttributeAttributeSetter(jsValue, info);
185     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
186 }
187
188 static void implementsEventHandlerAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
189 {
190     TestInterface* imp = V8TestInterface::toNative(info.Holder());
191     EventListener* jsValue = TestImplements::implementsEventHandlerAttribute(imp);
192     v8SetReturnValue(info, jsValue ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(jsValue)->getListenerObject(imp->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
193 }
194
195 static void implementsEventHandlerAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
196 {
197     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
198     TestInterfaceV8Internal::implementsEventHandlerAttributeAttributeGetter(info);
199     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
200 }
201
202 static void implementsEventHandlerAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
203 {
204     TestInterface* imp = V8TestInterface::toNative(info.Holder());
205     moveEventListenerToNewWrapper(info.Holder(), TestImplements::implementsEventHandlerAttribute(imp), jsValue, V8TestInterface::eventListenerCacheIndex, info.GetIsolate());
206     TestImplements::setImplementsEventHandlerAttribute(imp, V8EventListenerList::getEventListener(jsValue, true, ListenerFindOrCreate));
207 }
208
209 static void implementsEventHandlerAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
210 {
211     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
212     TestInterfaceV8Internal::implementsEventHandlerAttributeAttributeSetter(jsValue, info);
213     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
214 }
215
216 static void implementsRuntimeEnabledNodeAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
217 {
218     TestInterface* imp = V8TestInterface::toNative(info.Holder());
219     v8SetReturnValueFast(info, TestImplements::implementsRuntimeEnabledNodeAttribute(imp), imp);
220 }
221
222 static void implementsRuntimeEnabledNodeAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
223 {
224     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
225     TestInterfaceV8Internal::implementsRuntimeEnabledNodeAttributeAttributeGetter(info);
226     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
227 }
228
229 static void implementsRuntimeEnabledNodeAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
230 {
231     TestInterface* imp = V8TestInterface::toNative(info.Holder());
232     V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0);
233     TestImplements::setImplementsRuntimeEnabledNodeAttribute(imp, WTF::getPtr(cppValue));
234 }
235
236 static void implementsRuntimeEnabledNodeAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
237 {
238     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
239     TestInterfaceV8Internal::implementsRuntimeEnabledNodeAttributeAttributeSetter(jsValue, info);
240     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
241 }
242
243 static void implementsPerContextEnabledNodeAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
244 {
245     TestInterface* imp = V8TestInterface::toNative(info.Holder());
246     v8SetReturnValueFast(info, TestImplements::implementsPerContextEnabledNodeAttribute(imp), imp);
247 }
248
249 static void implementsPerContextEnabledNodeAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
250 {
251     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
252     TestInterfaceV8Internal::implementsPerContextEnabledNodeAttributeAttributeGetter(info);
253     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
254 }
255
256 static void implementsPerContextEnabledNodeAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
257 {
258     TestInterface* imp = V8TestInterface::toNative(info.Holder());
259     V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0);
260     TestImplements::setImplementsPerContextEnabledNodeAttribute(imp, WTF::getPtr(cppValue));
261 }
262
263 static void implementsPerContextEnabledNodeAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
264 {
265     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
266     TestInterfaceV8Internal::implementsPerContextEnabledNodeAttributeAttributeSetter(jsValue, info);
267     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
268 }
269
270 #if ENABLE(CONDITION_PARTIAL)
271 static void supplementalStaticReadOnlyAttrAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
272 {
273     v8SetReturnValueInt(info, TestPartialInterface::supplementalStaticReadOnlyAttr());
274 }
275 #endif // ENABLE(CONDITION_PARTIAL)
276
277 #if ENABLE(CONDITION_PARTIAL)
278 static void supplementalStaticReadOnlyAttrAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
279 {
280     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
281     TestInterfaceV8Internal::supplementalStaticReadOnlyAttrAttributeGetter(info);
282     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
283 }
284 #endif // ENABLE(CONDITION_PARTIAL)
285
286 #if ENABLE(CONDITION_PARTIAL)
287 static void supplementalStaticAttrAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
288 {
289     v8SetReturnValueString(info, TestPartialInterface::supplementalStaticAttr(), info.GetIsolate());
290 }
291 #endif // ENABLE(CONDITION_PARTIAL)
292
293 #if ENABLE(CONDITION_PARTIAL)
294 static void supplementalStaticAttrAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
295 {
296     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
297     TestInterfaceV8Internal::supplementalStaticAttrAttributeGetter(info);
298     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
299 }
300 #endif // ENABLE(CONDITION_PARTIAL)
301
302 #if ENABLE(CONDITION_PARTIAL)
303 static void supplementalStaticAttrAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
304 {
305     V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
306     TestPartialInterface::setSupplementalStaticAttr(cppValue);
307 }
308 #endif // ENABLE(CONDITION_PARTIAL)
309
310 #if ENABLE(CONDITION_PARTIAL)
311 static void supplementalStaticAttrAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
312 {
313     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
314     TestInterfaceV8Internal::supplementalStaticAttrAttributeSetter(jsValue, info);
315     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
316 }
317 #endif // ENABLE(CONDITION_PARTIAL)
318
319 #if ENABLE(CONDITION_PARTIAL)
320 static void supplementalStr1AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
321 {
322     TestInterface* imp = V8TestInterface::toNative(info.Holder());
323     v8SetReturnValueString(info, TestPartialInterface::supplementalStr1(imp), info.GetIsolate());
324 }
325 #endif // ENABLE(CONDITION_PARTIAL)
326
327 #if ENABLE(CONDITION_PARTIAL)
328 static void supplementalStr1AttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
329 {
330     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
331     TestInterfaceV8Internal::supplementalStr1AttributeGetter(info);
332     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
333 }
334 #endif // ENABLE(CONDITION_PARTIAL)
335
336 #if ENABLE(CONDITION_PARTIAL)
337 static void supplementalStr2AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
338 {
339     TestInterface* imp = V8TestInterface::toNative(info.Holder());
340     v8SetReturnValueString(info, TestPartialInterface::supplementalStr2(imp), info.GetIsolate());
341 }
342 #endif // ENABLE(CONDITION_PARTIAL)
343
344 #if ENABLE(CONDITION_PARTIAL)
345 static void supplementalStr2AttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
346 {
347     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
348     TestInterfaceV8Internal::supplementalStr2AttributeGetter(info);
349     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
350 }
351 #endif // ENABLE(CONDITION_PARTIAL)
352
353 #if ENABLE(CONDITION_PARTIAL)
354 static void supplementalStr2AttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
355 {
356     TestInterface* imp = V8TestInterface::toNative(info.Holder());
357     V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
358     TestPartialInterface::setSupplementalStr2(imp, cppValue);
359 }
360 #endif // ENABLE(CONDITION_PARTIAL)
361
362 #if ENABLE(CONDITION_PARTIAL)
363 static void supplementalStr2AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
364 {
365     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
366     TestInterfaceV8Internal::supplementalStr2AttributeSetter(jsValue, info);
367     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
368 }
369 #endif // ENABLE(CONDITION_PARTIAL)
370
371 #if ENABLE(CONDITION_PARTIAL)
372 static void supplementalNodeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
373 {
374     TestInterface* imp = V8TestInterface::toNative(info.Holder());
375     v8SetReturnValueFast(info, TestPartialInterface::supplementalNode(imp), imp);
376 }
377 #endif // ENABLE(CONDITION_PARTIAL)
378
379 #if ENABLE(CONDITION_PARTIAL)
380 static void supplementalNodeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
381 {
382     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
383     TestInterfaceV8Internal::supplementalNodeAttributeGetter(info);
384     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
385 }
386 #endif // ENABLE(CONDITION_PARTIAL)
387
388 #if ENABLE(CONDITION_PARTIAL)
389 static void supplementalNodeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
390 {
391     TestInterface* imp = V8TestInterface::toNative(info.Holder());
392     V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0);
393     TestPartialInterface::setSupplementalNode(imp, WTF::getPtr(cppValue));
394 }
395 #endif // ENABLE(CONDITION_PARTIAL)
396
397 #if ENABLE(CONDITION_PARTIAL)
398 static void supplementalNodeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
399 {
400     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
401     TestInterfaceV8Internal::supplementalNodeAttributeSetter(jsValue, info);
402     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
403 }
404 #endif // ENABLE(CONDITION_PARTIAL)
405
406 #if ENABLE(CONDITION_PARTIAL)
407 static void Node13AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
408 {
409     TestInterface* imp = V8TestInterface::toNative(info.Holder());
410     v8SetReturnValueFast(info, TestPartialInterface::node13(imp), imp);
411 }
412 #endif // ENABLE(CONDITION_PARTIAL)
413
414 #if ENABLE(CONDITION_PARTIAL)
415 static void Node13AttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
416 {
417     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
418     TestInterfaceV8Internal::Node13AttributeGetter(info);
419     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
420 }
421 #endif // ENABLE(CONDITION_PARTIAL)
422
423 #if ENABLE(CONDITION_PARTIAL)
424 static void Node13AttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
425 {
426     TestInterface* imp = V8TestInterface::toNative(info.Holder());
427     V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0);
428     TestPartialInterface::setNode13(imp, WTF::getPtr(cppValue));
429 }
430 #endif // ENABLE(CONDITION_PARTIAL)
431
432 #if ENABLE(CONDITION_PARTIAL)
433 static void Node13AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
434 {
435     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
436     TestInterfaceV8Internal::Node13AttributeSetter(jsValue, info);
437     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
438 }
439 #endif // ENABLE(CONDITION_PARTIAL)
440
441 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
442 {
443     if (UNLIKELY(info.Length() < 1)) {
444         throwTypeError(ExceptionMessages::failedToExecute("namedItem", "TestInterface", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate());
445         return;
446     }
447     TestInterface* imp = V8TestInterface::toNative(info.Holder());
448     V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]);
449     bool result0Enabled = false;
450     RefPtr<Node> result0;
451     bool result1Enabled = false;
452     RefPtr<NodeList> result1;
453     imp->getItem(name, result0Enabled, result0, result1Enabled, result1);
454     if (result0Enabled) {
455         v8SetReturnValue(info, result0.release());
456         return;
457     }
458     if (result1Enabled) {
459         v8SetReturnValue(info, result1.release());
460         return;
461     }
462     v8SetReturnValueNull(info);
463 }
464
465 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
466 {
467     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
468     TestInterfaceV8Internal::namedItemMethod(info);
469     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
470 }
471
472 static void implementsVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
473 {
474     TestInterface* imp = V8TestInterface::toNative(info.Holder());
475     TestImplements::implementsVoidMethod(imp);
476 }
477
478 static void implementsVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
479 {
480     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
481     TestInterfaceV8Internal::implementsVoidMethodMethod(info);
482     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
483 }
484
485 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
486 {
487     ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsComplexMethod", "TestInterface", info.Holder(), info.GetIsolate());
488     if (UNLIKELY(info.Length() < 2)) {
489         exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, info.Length()));
490         exceptionState.throwIfNeeded();
491         return;
492     }
493     TestInterface* imp = V8TestInterface::toNative(info.Holder());
494     V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
495     V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmpty::hasInstance(info[1], info.GetIsolate()) ? V8TestInterfaceEmpty::toNative(v8::Handle<v8::Object>::Cast(info[1])) : 0);
496     ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate());
497     RefPtr<TestInterfaceEmpty> result = TestImplements::implementsComplexMethod(scriptContext, imp, strArg, testInterfaceEmptyArg, exceptionState);
498     if (exceptionState.throwIfNeeded())
499         return;
500     v8SetReturnValue(info, result.release());
501 }
502
503 static void implementsComplexMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
504 {
505     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
506     TestInterfaceV8Internal::implementsComplexMethodMethod(info);
507     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
508 }
509
510 static void implementsCustomVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
511 {
512     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
513     V8TestInterface::implementsCustomVoidMethodMethodCustom(info);
514     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
515 }
516
517 static void implementsStaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
518 {
519     TestImplements::implementsStaticVoidMethod();
520 }
521
522 static void implementsStaticVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
523 {
524     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
525     TestInterfaceV8Internal::implementsStaticVoidMethodMethod(info);
526     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
527 }
528
529 #if ENABLE(CONDITION_PARTIAL)
530 static void supplementalMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
531 {
532     TestInterface* imp = V8TestInterface::toNative(info.Holder());
533     TestPartialInterface::supplementalMethod1(imp);
534 }
535 #endif // ENABLE(CONDITION_PARTIAL)
536
537 #if ENABLE(CONDITION_PARTIAL)
538 static void supplementalMethod1MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
539 {
540     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
541     TestInterfaceV8Internal::supplementalMethod1Method(info);
542     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
543 }
544 #endif // ENABLE(CONDITION_PARTIAL)
545
546 #if ENABLE(CONDITION_PARTIAL)
547 static void supplementalMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
548 {
549     ExceptionState exceptionState(ExceptionState::ExecutionContext, "supplementalMethod2", "TestInterface", info.Holder(), info.GetIsolate());
550     if (UNLIKELY(info.Length() < 2)) {
551         exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, info.Length()));
552         exceptionState.throwIfNeeded();
553         return;
554     }
555     TestInterface* imp = V8TestInterface::toNative(info.Holder());
556     V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
557     V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[1], info.GetIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(info[1])) : 0);
558     ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate());
559     RefPtr<TestObj> result = TestPartialInterface::supplementalMethod2(scriptContext, imp, strArg, objArg, exceptionState);
560     if (exceptionState.throwIfNeeded())
561         return;
562     v8SetReturnValue(info, result.release());
563 }
564 #endif // ENABLE(CONDITION_PARTIAL)
565
566 #if ENABLE(CONDITION_PARTIAL)
567 static void supplementalMethod2MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
568 {
569     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
570     TestInterfaceV8Internal::supplementalMethod2Method(info);
571     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
572 }
573 #endif // ENABLE(CONDITION_PARTIAL)
574
575 #if ENABLE(CONDITION_PARTIAL)
576 static void supplementalMethod3MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
577 {
578     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
579     V8TestInterface::supplementalMethod3MethodCustom(info);
580     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
581 }
582 #endif // ENABLE(CONDITION_PARTIAL)
583
584 #if ENABLE(CONDITION_PARTIAL)
585 static void supplementalMethod4Method(const v8::FunctionCallbackInfo<v8::Value>& info)
586 {
587     TestPartialInterface::supplementalMethod4();
588 }
589 #endif // ENABLE(CONDITION_PARTIAL)
590
591 #if ENABLE(CONDITION_PARTIAL)
592 static void supplementalMethod4MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
593 {
594     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
595     TestInterfaceV8Internal::supplementalMethod4Method(info);
596     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
597 }
598 #endif // ENABLE(CONDITION_PARTIAL)
599
600 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
601 {
602     ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterface", info.Holder(), info.GetIsolate());
603     if (UNLIKELY(info.Length() < 1)) {
604         exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
605         exceptionState.throwIfNeeded();
606         return;
607     }
608     V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str1, info[0]);
609     V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str2, info[1]);
610     ExecutionContext* context = currentExecutionContext(info.GetIsolate());
611     RefPtr<TestInterface> impl = TestInterface::create(context, str1, str2, exceptionState);
612     v8::Handle<v8::Object> wrapper = info.Holder();
613     if (exceptionState.throwIfNeeded())
614         return;
615
616     V8DOMWrapper::associateObjectWithWrapper<V8TestInterface>(impl.release(), &V8TestInterface::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent);
617     v8SetReturnValue(info, wrapper);
618 }
619
620 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
621 {
622     if (info.Holder()->HasRealNamedProperty(name))
623         return;
624     if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
625         return;
626
627     TestInterface* imp = V8TestInterface::toNative(info.Holder());
628     AtomicString propertyName = toCoreAtomicString(name);
629     bool result0Enabled = false;
630     RefPtr<Node> result0;
631     bool result1Enabled = false;
632     RefPtr<NodeList> result1;
633     imp->getItem(propertyName, result0Enabled, result0, result1Enabled, result1);
634     if (!result0Enabled && !result1Enabled)
635         return;
636     if (result0Enabled) {
637         v8SetReturnValueFast(info, result0.release(), imp);
638         return;
639     }
640     if (result1Enabled) {
641         v8SetReturnValueFast(info, result1.release(), imp);
642         return;
643     }
644     v8SetReturnValueNull(info);
645 }
646
647 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
648 {
649     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
650     TestInterfaceV8Internal::namedPropertyGetter(name, info);
651     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
652 }
653
654 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)
655 {
656     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
657     V8TestInterface::namedPropertySetterCustom(name, jsValue, info);
658     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
659 }
660
661 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
662 {
663     TestInterface* imp = V8TestInterface::toNative(info.Holder());
664     AtomicString propertyName = toCoreAtomicString(name);
665     ExceptionState exceptionState(info.Holder(), info.GetIsolate());
666     bool result = imp->namedPropertyQuery(propertyName, exceptionState);
667     if (exceptionState.throwIfNeeded())
668         return;
669     if (!result)
670         return;
671     v8SetReturnValueInt(info, v8::None);
672 }
673
674 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
675 {
676     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
677     TestInterfaceV8Internal::namedPropertyQuery(name, info);
678     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
679 }
680
681 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info)
682 {
683     TestInterface* imp = V8TestInterface::toNative(info.Holder());
684     Vector<String> names;
685     ExceptionState exceptionState(info.Holder(), info.GetIsolate());
686     imp->namedPropertyEnumerator(names, exceptionState);
687     if (exceptionState.throwIfNeeded())
688         return;
689     v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size());
690     for (size_t i = 0; i < names.size(); ++i)
691         v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIsolate(), names[i]));
692     v8SetReturnValue(info, v8names);
693 }
694
695 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info)
696 {
697     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
698     TestInterfaceV8Internal::namedPropertyEnumerator(info);
699     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
700 }
701
702 } // namespace TestInterfaceV8Internal
703
704 void V8TestInterface::visitDOMWrapper(void* object, const v8::Persistent<v8::Object>& wrapper, v8::Isolate* isolate)
705 {
706     TestInterface* impl = fromInternalPointer(object);
707     v8::Local<v8::Object> creationContext = v8::Local<v8::Object>::New(isolate, wrapper);
708     V8WrapperInstantiationScope scope(creationContext, isolate);
709     ReferencedType* referencedName = impl->referencedName();
710     if (referencedName) {
711         if (!DOMDataStore::containsWrapper<V8ReferencedType>(referencedName, isolate))
712             wrap(referencedName, creationContext, isolate);
713         DOMDataStore::setWrapperReference<V8ReferencedType>(wrapper, referencedName, isolate);
714     }
715     setObjectGroup(object, wrapper, isolate);
716 }
717
718 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceAttributes[] = {
719     {"implementsReadonlyStringAttribute", TestInterfaceV8Internal::implementsReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
720     {"implementsStringAttribute", TestInterfaceV8Internal::implementsStringAttributeAttributeGetterCallback, TestInterfaceV8Internal::implementsStringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
721     {"implementsNodeAttribute", TestInterfaceV8Internal::implementsNodeAttributeAttributeGetterCallback, TestInterfaceV8Internal::implementsNodeAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
722     {"implementsEventHandlerAttribute", TestInterfaceV8Internal::implementsEventHandlerAttributeAttributeGetterCallback, TestInterfaceV8Internal::implementsEventHandlerAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
723 #if ENABLE(CONDITION_PARTIAL)
724     {"supplementalStr1", TestInterfaceV8Internal::supplementalStr1AttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
725 #endif // ENABLE(CONDITION_PARTIAL)
726 #if ENABLE(CONDITION_PARTIAL)
727     {"supplementalStr2", TestInterfaceV8Internal::supplementalStr2AttributeGetterCallback, TestInterfaceV8Internal::supplementalStr2AttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
728 #endif // ENABLE(CONDITION_PARTIAL)
729 #if ENABLE(CONDITION_PARTIAL)
730     {"supplementalNode", TestInterfaceV8Internal::supplementalNodeAttributeGetterCallback, TestInterfaceV8Internal::supplementalNodeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
731 #endif // ENABLE(CONDITION_PARTIAL)
732 };
733
734 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceMethods[] = {
735     {"namedItem", TestInterfaceV8Internal::namedItemMethodCallback, 0, 1},
736     {"implementsVoidMethod", TestInterfaceV8Internal::implementsVoidMethodMethodCallback, 0, 0},
737     {"implementsComplexMethod", TestInterfaceV8Internal::implementsComplexMethodMethodCallback, 0, 2},
738     {"implementsCustomVoidMethod", TestInterfaceV8Internal::implementsCustomVoidMethodMethodCallback, 0, 0},
739 #if ENABLE(CONDITION_PARTIAL)
740     {"supplementalMethod1", TestInterfaceV8Internal::supplementalMethod1MethodCallback, 0, 0},
741 #endif // ENABLE(CONDITION_PARTIAL)
742 #if ENABLE(CONDITION_PARTIAL)
743     {"supplementalMethod2", TestInterfaceV8Internal::supplementalMethod2MethodCallback, 0, 2},
744 #endif // ENABLE(CONDITION_PARTIAL)
745 #if ENABLE(CONDITION_PARTIAL)
746     {"supplementalMethod3", TestInterfaceV8Internal::supplementalMethod3MethodCallback, 0, 0},
747 #endif // ENABLE(CONDITION_PARTIAL)
748 };
749
750 void V8TestInterface::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
751 {
752     TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor");
753     if (!info.IsConstructCall()) {
754         throwTypeError(ExceptionMessages::failedToConstruct("TestInterface", "Please use the 'new' operator, this DOM object constructor cannot be called as a function."), info.GetIsolate());
755         return;
756     }
757
758     if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) {
759         v8SetReturnValue(info, info.Holder());
760         return;
761     }
762
763     TestInterfaceV8Internal::constructor(info);
764 }
765
766 static void configureV8TestInterfaceTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
767 {
768     functionTemplate->ReadOnlyPrototype();
769
770     v8::Local<v8::Signature> defaultSignature;
771     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterface", v8::Local<v8::FunctionTemplate>(), V8TestInterface::internalFieldCount,
772         V8TestInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceAttributes),
773         0, 0,
774         V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods),
775         isolate, currentWorldType);
776     functionTemplate->SetCallHandler(V8TestInterface::constructorCallback);
777     functionTemplate->SetLength(1);
778     v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTemplate->InstanceTemplate();
779     v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTemplate->PrototypeTemplate();
780     if (RuntimeEnabledFeatures::implementsFeatureNameEnabled()) {
781         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
782         {"implementsRuntimeEnabledNodeAttribute", TestInterfaceV8Internal::implementsRuntimeEnabledNodeAttributeAttributeGetterCallback, TestInterfaceV8Internal::implementsRuntimeEnabledNodeAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
783         V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate, currentWorldType);
784     }
785 #if ENABLE(CONDITION_PARTIAL)
786     if (RuntimeEnabledFeatures::condition13Enabled()) {
787         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
788         {"Node13", TestInterfaceV8Internal::Node13AttributeGetterCallback, TestInterfaceV8Internal::Node13AttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
789         V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate, currentWorldType);
790     }
791 #endif // ENABLE(CONDITION_PARTIAL)
792     static const V8DOMConfiguration::ConstantConfiguration V8TestInterfaceConstants[] = {
793         {"IMPLEMENTS_CONSTANT_1", 1},
794         {"IMPLEMENTS_CONSTANT_2", 2},
795         {"SUPPLEMENTALCONSTANT1", 1},
796         {"SUPPLEMENTALCONSTANT2", 2},
797     };
798     V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8TestInterfaceConstants, WTF_ARRAY_LENGTH(V8TestInterfaceConstants), isolate);
799     COMPILE_ASSERT(1 == TestImplements::IMPLEMENTS_CONSTANT_1, TheValueOfTestInterface_IMPLEMENTS_CONSTANT_1DoesntMatchWithImplementation);
800     COMPILE_ASSERT(2 == TestImplements::IMPLEMENTS_REFLECT_CONSTANT, TheValueOfTestInterface_IMPLEMENTS_REFLECT_CONSTANTDoesntMatchWithImplementation);
801     COMPILE_ASSERT(1 == TestPartialInterface::SUPPLEMENTALCONSTANT1, TheValueOfTestInterface_SUPPLEMENTALCONSTANT1DoesntMatchWithImplementation);
802     COMPILE_ASSERT(2 == TestPartialInterface::CONST_IMPL, TheValueOfTestInterface_CONST_IMPLDoesntMatchWithImplementation);
803     functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterfaceV8Internal::namedPropertyGetterCallback, TestInterfaceV8Internal::namedPropertySetterCallback, TestInterfaceV8Internal::namedPropertyQueryCallback, 0, TestInterfaceV8Internal::namedPropertyEnumeratorCallback);
804     functionTemplate->Set(v8AtomicString(isolate, "implementsStaticVoidMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceV8Internal::implementsStaticVoidMethodMethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0));
805 #if ENABLE(CONDITION_PARTIAL)
806     functionTemplate->Set(v8AtomicString(isolate, "supplementalMethod4"), v8::FunctionTemplate::New(isolate, TestInterfaceV8Internal::supplementalMethod4MethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0));
807 #endif // ENABLE(CONDITION_PARTIAL)
808     functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implementsStaticReadOnlyLongAttribute"), TestInterfaceV8Internal::implementsStaticReadOnlyLongAttributeAttributeGetterCallback, 0, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
809     functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implementsStaticStringAttribute"), TestInterfaceV8Internal::implementsStaticStringAttributeAttributeGetterCallback, TestInterfaceV8Internal::implementsStaticStringAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
810 #if ENABLE(CONDITION_PARTIAL)
811     functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "supplementalStaticReadOnlyAttr"), TestInterfaceV8Internal::supplementalStaticReadOnlyAttrAttributeGetterCallback, 0, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
812 #endif // ENABLE(CONDITION_PARTIAL)
813 #if ENABLE(CONDITION_PARTIAL)
814     functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "supplementalStaticAttr"), TestInterfaceV8Internal::supplementalStaticAttrAttributeGetterCallback, TestInterfaceV8Internal::supplementalStaticAttrAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
815 #endif // ENABLE(CONDITION_PARTIAL)
816
817     // Custom toString template
818     functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::current()->toStringTemplate());
819 }
820
821 v8::Handle<v8::FunctionTemplate> V8TestInterface::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
822 {
823     V8PerIsolateData* data = V8PerIsolateData::from(isolate);
824     V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWorldType).find(&wrapperTypeInfo);
825     if (result != data->templateMap(currentWorldType).end())
826         return result->value.newLocal(isolate);
827
828     TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
829     v8::EscapableHandleScope handleScope(isolate);
830     v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidConstructorMode);
831     configureV8TestInterfaceTemplate(templ, isolate, currentWorldType);
832     data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTemplate>(isolate, templ));
833     return handleScope.Escape(templ);
834 }
835
836 bool V8TestInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate)
837 {
838     return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeInfo, jsValue)
839         || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTypeInfo, jsValue);
840 }
841
842 void V8TestInterface::installPerContextEnabledProperties(v8::Handle<v8::Object> instanceTemplate, TestInterface* impl, v8::Isolate* isolate)
843 {
844     v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instanceTemplate->GetPrototype());
845     if (ContextFeatures::implementsContextNameEnabled(impl->document())) {
846         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
847         {"implementsPerContextEnabledNodeAttribute", TestInterfaceV8Internal::implementsPerContextEnabledNodeAttributeAttributeGetterCallback, TestInterfaceV8Internal::implementsPerContextEnabledNodeAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
848         V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate);
849     }
850 }
851
852 ActiveDOMObject* V8TestInterface::toActiveDOMObject(v8::Handle<v8::Object> wrapper)
853 {
854     return toNative(wrapper);
855 }
856
857 v8::Handle<v8::Object> V8TestInterface::createWrapper(PassRefPtr<TestInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
858 {
859     ASSERT(impl);
860     ASSERT(!DOMDataStore::containsWrapper<V8TestInterface>(impl.get(), isolate));
861     if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
862         const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl.get());
863         // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have
864         // the same object de-ref functions, though, so use that as the basis of the check.
865         RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
866     }
867
868     v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
869     if (UNLIKELY(wrapper.IsEmpty()))
870         return wrapper;
871
872     installPerContextEnabledProperties(wrapper, impl.get(), isolate);
873     V8DOMWrapper::associateObjectWithWrapper<V8TestInterface>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
874     return wrapper;
875 }
876
877 void V8TestInterface::derefObject(void* object)
878 {
879     fromInternalPointer(object)->deref();
880 }
881
882 template<>
883 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
884 {
885     return toV8(impl, creationContext, isolate);
886 }
887
888 } // namespace WebCore
889 #endif // ENABLE(Condition1) || ENABLE(Condition2)