Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / V8TestInterfaceNode.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 #include "V8TestInterfaceNode.h"
35
36 #include "HTMLNames.h"
37 #include "RuntimeEnabledFeatures.h"
38 #include "V8TestInterfaceEmpty.h"
39 #include "bindings/v8/ExceptionState.h"
40 #include "bindings/v8/V8AbstractEventListener.h"
41 #include "bindings/v8/V8DOMConfiguration.h"
42 #include "bindings/v8/V8EventListenerList.h"
43 #include "bindings/v8/V8ObjectConstructor.h"
44 #include "core/dom/ContextFeatures.h"
45 #include "core/dom/Document.h"
46 #include "core/dom/custom/CustomElementCallbackDispatcher.h"
47 #include "platform/TraceEvent.h"
48 #include "wtf/GetPtr.h"
49 #include "wtf/RefPtr.h"
50
51 namespace WebCore {
52
53 static void initializeScriptWrappableForInterface(TestInterfaceNode* object)
54 {
55     if (ScriptWrappable::wrapperCanBeStoredInObject(object))
56         ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceNode::wrapperTypeInfo);
57     else
58         ASSERT_NOT_REACHED();
59 }
60
61 } // namespace WebCore
62
63 // In ScriptWrappable::init, the use of a local function declaration has an issue on Windows:
64 // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function
65 // in the global namespace.
66 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/feedback/details/664619/the-namespace-of-local-function-declarations-in-c)
67 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceNode* object)
68 {
69     WebCore::initializeScriptWrappableForInterface(object);
70 }
71
72 namespace WebCore {
73 const WrapperTypeInfo V8TestInterfaceNode::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceNode::domTemplate, V8TestInterfaceNode::derefObject, 0, V8TestInterfaceNode::toEventTarget, 0, V8TestInterfaceNode::installPerContextEnabledMethods, &V8Node::wrapperTypeInfo, WrapperTypeObjectPrototype, false };
74
75 namespace TestInterfaceNodeV8Internal {
76
77 template <typename T> void V8_USE(T) { }
78
79 static void stringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
80 {
81     TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
82     v8SetReturnValueString(info, imp->stringAttribute(), info.GetIsolate());
83 }
84
85 static void stringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
86 {
87     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
88     TestInterfaceNodeV8Internal::stringAttributeAttributeGetter(info);
89     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
90 }
91
92 static void stringAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
93 {
94     TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
95     V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
96     imp->setStringAttribute(cppValue);
97 }
98
99 static void stringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
100 {
101     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
102     TestInterfaceNodeV8Internal::stringAttributeAttributeSetter(jsValue, info);
103     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
104 }
105
106 static void readonlyTestInterfaceEmptyAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
107 {
108     TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
109     v8SetReturnValueFast(info, imp->readonlyTestInterfaceEmptyAttribute(), imp);
110 }
111
112 static void readonlyTestInterfaceEmptyAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
113 {
114     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
115     TestInterfaceNodeV8Internal::readonlyTestInterfaceEmptyAttributeAttributeGetter(info);
116     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
117 }
118
119 static void eventHandlerAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
120 {
121     TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
122     EventListener* jsValue = imp->eventHandlerAttribute();
123     v8SetReturnValue(info, jsValue ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(jsValue)->getListenerObject(imp->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
124 }
125
126 static void eventHandlerAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
127 {
128     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
129     TestInterfaceNodeV8Internal::eventHandlerAttributeAttributeGetter(info);
130     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
131 }
132
133 static void eventHandlerAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
134 {
135     TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
136     imp->setEventHandlerAttribute(V8EventListenerList::getEventListener(jsValue, true, ListenerFindOrCreate));
137 }
138
139 static void eventHandlerAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
140 {
141     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
142     TestInterfaceNodeV8Internal::eventHandlerAttributeAttributeSetter(jsValue, info);
143     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
144 }
145
146 static void perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
147 {
148     TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
149     v8SetReturnValueFast(info, imp->perWorldBindingsReadonlyTestInterfaceEmptyAttribute(), imp);
150 }
151
152 static void perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
153 {
154     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
155     TestInterfaceNodeV8Internal::perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetter(info);
156     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
157 }
158
159 static void perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
160 {
161     TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
162     v8SetReturnValueForMainWorld(info, imp->perWorldBindingsReadonlyTestInterfaceEmptyAttribute());
163 }
164
165 static void perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
166 {
167     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
168     TestInterfaceNodeV8Internal::perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterForMainWorld(info);
169     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
170 }
171
172 static void reflectStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
173 {
174     Element* imp = V8Element::toNative(info.Holder());
175     v8SetReturnValueString(info, imp->fastGetAttribute(HTMLNames::reflectstringattributeAttr), info.GetIsolate());
176 }
177
178 static void reflectStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
179 {
180     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
181     TestInterfaceNodeV8Internal::reflectStringAttributeAttributeGetter(info);
182     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
183 }
184
185 static void reflectStringAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
186 {
187     Element* imp = V8Element::toNative(info.Holder());
188     V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
189     imp->setAttribute(HTMLNames::reflectstringattributeAttr, cppValue);
190 }
191
192 static void reflectStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
193 {
194     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
195     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
196     TestInterfaceNodeV8Internal::reflectStringAttributeAttributeSetter(jsValue, info);
197     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
198 }
199
200 static void reflectUrlStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
201 {
202     TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
203     v8SetReturnValueString(info, imp->getURLAttribute(HTMLNames::reflecturlstringattributeAttr), info.GetIsolate());
204 }
205
206 static void reflectUrlStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
207 {
208     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
209     TestInterfaceNodeV8Internal::reflectUrlStringAttributeAttributeGetter(info);
210     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
211 }
212
213 static void reflectUrlStringAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
214 {
215     Element* imp = V8Element::toNative(info.Holder());
216     V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
217     imp->setAttribute(HTMLNames::reflecturlstringattributeAttr, cppValue);
218 }
219
220 static void reflectUrlStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
221 {
222     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
223     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
224     TestInterfaceNodeV8Internal::reflectUrlStringAttributeAttributeSetter(jsValue, info);
225     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
226 }
227
228 static void testInterfaceEmptyMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
229 {
230     TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
231     v8SetReturnValueFast(info, imp->testInterfaceEmptyMethod(), imp);
232 }
233
234 static void testInterfaceEmptyMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
235 {
236     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
237     TestInterfaceNodeV8Internal::testInterfaceEmptyMethodMethod(info);
238     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
239 }
240
241 static void perWorldBindingsTestInterfaceEmptyMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
242 {
243     TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
244     v8SetReturnValueFast(info, imp->perWorldBindingsTestInterfaceEmptyMethod(), imp);
245 }
246
247 static void perWorldBindingsTestInterfaceEmptyMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
248 {
249     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
250     TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodMethod(info);
251     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
252 }
253
254 static void perWorldBindingsTestInterfaceEmptyMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
255 {
256     TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
257     v8SetReturnValueForMainWorld(info, imp->perWorldBindingsTestInterfaceEmptyMethod());
258 }
259
260 static void perWorldBindingsTestInterfaceEmptyMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
261 {
262     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
263     TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodMethodForMainWorld(info);
264     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
265 }
266
267 static void perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
268 {
269     TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
270     if (UNLIKELY(info.Length() <= 0)) {
271         v8SetReturnValueFast(info, imp->perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg(), imp);
272         return;
273     }
274     V8TRYCATCH_VOID(bool, optionalBooleanArgument, info[0]->BooleanValue());
275     v8SetReturnValueFast(info, imp->perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg(optionalBooleanArgument), imp);
276 }
277
278 static void perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
279 {
280     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
281     TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethod(info);
282     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
283 }
284
285 static void perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
286 {
287     TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
288     if (UNLIKELY(info.Length() <= 0)) {
289         v8SetReturnValueForMainWorld(info, imp->perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg());
290         return;
291     }
292     V8TRYCATCH_VOID(bool, optionalBooleanArgument, info[0]->BooleanValue());
293     v8SetReturnValueForMainWorld(info, imp->perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg(optionalBooleanArgument));
294 }
295
296 static void perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
297 {
298     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
299     TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethodForMainWorld(info);
300     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
301 }
302
303 } // namespace TestInterfaceNodeV8Internal
304
305 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceNodeAttributes[] = {
306     {"stringAttribute", TestInterfaceNodeV8Internal::stringAttributeAttributeGetterCallback, TestInterfaceNodeV8Internal::stringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
307     {"readonlyTestInterfaceEmptyAttribute", TestInterfaceNodeV8Internal::readonlyTestInterfaceEmptyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
308     {"eventHandlerAttribute", TestInterfaceNodeV8Internal::eventHandlerAttributeAttributeGetterCallback, TestInterfaceNodeV8Internal::eventHandlerAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
309     {"perWorldBindingsReadonlyTestInterfaceEmptyAttribute", TestInterfaceNodeV8Internal::perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterCallback, 0, TestInterfaceNodeV8Internal::perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
310     {"reflectStringAttribute", TestInterfaceNodeV8Internal::reflectStringAttributeAttributeGetterCallback, TestInterfaceNodeV8Internal::reflectStringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
311     {"reflectUrlStringAttribute", TestInterfaceNodeV8Internal::reflectUrlStringAttributeAttributeGetterCallback, TestInterfaceNodeV8Internal::reflectUrlStringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
312 };
313
314 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceNodeMethods[] = {
315     {"testInterfaceEmptyMethod", TestInterfaceNodeV8Internal::testInterfaceEmptyMethodMethodCallback, 0, 0},
316     {"perWorldBindingsTestInterfaceEmptyMethod", TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodMethodCallback, TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodMethodCallbackForMainWorld, 0},
317     {"perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg", TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethodCallback, TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethodCallbackForMainWorld, 0},
318 };
319
320 static void configureV8TestInterfaceNodeTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
321 {
322     functionTemplate->ReadOnlyPrototype();
323
324     v8::Local<v8::Signature> defaultSignature;
325     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceNode", V8Node::domTemplate(isolate, currentWorldType), V8TestInterfaceNode::internalFieldCount,
326         V8TestInterfaceNodeAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceNodeAttributes),
327         0, 0,
328         V8TestInterfaceNodeMethods, WTF_ARRAY_LENGTH(V8TestInterfaceNodeMethods),
329         isolate, currentWorldType);
330     v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTemplate->InstanceTemplate();
331     v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTemplate->PrototypeTemplate();
332
333     // Custom toString template
334     functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::current()->toStringTemplate());
335 }
336
337 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNode::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
338 {
339     V8PerIsolateData* data = V8PerIsolateData::from(isolate);
340     V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWorldType).find(&wrapperTypeInfo);
341     if (result != data->templateMap(currentWorldType).end())
342         return result->value.newLocal(isolate);
343
344     TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
345     v8::EscapableHandleScope handleScope(isolate);
346     v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidConstructorMode);
347     configureV8TestInterfaceNodeTemplate(templ, isolate, currentWorldType);
348     data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTemplate>(isolate, templ));
349     return handleScope.Escape(templ);
350 }
351
352 bool V8TestInterfaceNode::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate)
353 {
354     return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeInfo, jsValue)
355         || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTypeInfo, jsValue);
356 }
357
358 EventTarget* V8TestInterfaceNode::toEventTarget(v8::Handle<v8::Object> object)
359 {
360     return toNative(object);
361 }
362
363 v8::Handle<v8::Object> V8TestInterfaceNode::createWrapper(PassRefPtr<TestInterfaceNode> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
364 {
365     ASSERT(impl);
366     ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceNode>(impl.get(), isolate));
367     if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
368         const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl.get());
369         // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have
370         // the same object de-ref functions, though, so use that as the basis of the check.
371         RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
372     }
373
374     v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
375     if (UNLIKELY(wrapper.IsEmpty()))
376         return wrapper;
377
378     installPerContextEnabledProperties(wrapper, impl.get(), isolate);
379     V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceNode>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
380     return wrapper;
381 }
382
383 void V8TestInterfaceNode::derefObject(void* object)
384 {
385     fromInternalPointer(object)->deref();
386 }
387
388 template<>
389 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNode* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
390 {
391     return toV8(impl, creationContext, isolate);
392 }
393
394 } // namespace WebCore