Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / modules / V8TestInterface5.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 "V8TestInterface5.h"
10
11 #include "bindings/core/v8/ExceptionState.h"
12 #include "bindings/core/v8/ScriptState.h"
13 #include "bindings/core/v8/V8DOMConfiguration.h"
14 #include "bindings/core/v8/V8HiddenValue.h"
15 #include "bindings/core/v8/V8Iterator.h"
16 #include "bindings/core/v8/V8ObjectConstructor.h"
17 #include "bindings/core/v8/V8TestInterfaceEmpty.h"
18 #include "bindings/modules/v8/V8TestInterface5.h"
19 #include "core/dom/ContextFeatures.h"
20 #include "core/dom/Document.h"
21 #include "platform/RuntimeEnabledFeatures.h"
22 #include "platform/TraceEvent.h"
23 #include "wtf/GetPtr.h"
24 #include "wtf/RefPtr.h"
25
26 namespace blink {
27
28 const WrapperTypeInfo V8TestInterface5::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface5::domTemplate, V8TestInterface5::refObject, V8TestInterface5::derefObject, V8TestInterface5::trace, V8TestInterface5::toActiveDOMObject, 0, V8TestInterface5::visitDOMWrapper, V8TestInterface5::installConditionallyEnabledMethods, V8TestInterface5::installConditionallyEnabledProperties, &V8TestInterfaceEmpty::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Dependent, WrapperTypeInfo::RefCountedObject };
29
30 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterface5Implementation.h.
31 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
32 // bindings/core/v8/ScriptWrappable.h.
33 const WrapperTypeInfo& TestInterface5Implementation::s_wrapperTypeInfo = V8TestInterface5::wrapperTypeInfo;
34
35 namespace TestInterface5ImplementationV8Internal {
36
37 static void testInterfaceAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
38 {
39     v8::Handle<v8::Object> holder = info.Holder();
40     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
41     v8SetReturnValueFast(info, WTF::getPtr(impl->testInterfaceAttribute()), impl);
42 }
43
44 static void testInterfaceAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
45 {
46     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
47     TestInterface5ImplementationV8Internal::testInterfaceAttributeAttributeGetter(info);
48     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
49 }
50
51 static void testInterfaceAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
52 {
53     v8::Handle<v8::Object> holder = info.Holder();
54     ExceptionState exceptionState(ExceptionState::SetterContext, "testInterfaceAttribute", "TestInterface5", holder, info.GetIsolate());
55     if (!V8TestInterface5::hasInstance(v8Value, info.GetIsolate())) {
56         exceptionState.throwTypeError("The provided value is not of type 'TestInterface5'.");
57         exceptionState.throwIfNeeded();
58         return;
59     }
60     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
61     TestInterface5Implementation* cppValue = V8TestInterface5::toImpl(v8::Handle<v8::Object>::Cast(v8Value));
62     impl->setTestInterfaceAttribute(WTF::getPtr(cppValue));
63 }
64
65 static void testInterfaceAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
66 {
67     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
68     TestInterface5ImplementationV8Internal::testInterfaceAttributeAttributeSetter(v8Value, info);
69     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
70 }
71
72 static void doubleAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
73 {
74     v8::Handle<v8::Object> holder = info.Holder();
75     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
76     v8SetReturnValue(info, impl->doubleAttribute());
77 }
78
79 static void doubleAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
80 {
81     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
82     TestInterface5ImplementationV8Internal::doubleAttributeAttributeGetter(info);
83     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
84 }
85
86 static void doubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
87 {
88     v8::Handle<v8::Object> holder = info.Holder();
89     ExceptionState exceptionState(ExceptionState::SetterContext, "doubleAttribute", "TestInterface5", holder, info.GetIsolate());
90     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
91     TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, exceptionState), exceptionState);
92     if (!std::isfinite(cppValue)) {
93         exceptionState.throwTypeError("The provided double value is non-finite.");
94         exceptionState.throwIfNeeded();
95         return;
96     }
97     impl->setDoubleAttribute(cppValue);
98 }
99
100 static void doubleAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
101 {
102     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
103     TestInterface5ImplementationV8Internal::doubleAttributeAttributeSetter(v8Value, info);
104     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
105 }
106
107 static void floatAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
108 {
109     v8::Handle<v8::Object> holder = info.Holder();
110     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
111     v8SetReturnValue(info, impl->floatAttribute());
112 }
113
114 static void floatAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
115 {
116     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
117     TestInterface5ImplementationV8Internal::floatAttributeAttributeGetter(info);
118     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
119 }
120
121 static void floatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
122 {
123     v8::Handle<v8::Object> holder = info.Holder();
124     ExceptionState exceptionState(ExceptionState::SetterContext, "floatAttribute", "TestInterface5", holder, info.GetIsolate());
125     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
126     TONATIVE_VOID_EXCEPTIONSTATE(float, cppValue, toFloat(v8Value, exceptionState), exceptionState);
127     if (!std::isfinite(cppValue)) {
128         exceptionState.throwTypeError("The provided float value is non-finite.");
129         exceptionState.throwIfNeeded();
130         return;
131     }
132     impl->setFloatAttribute(cppValue);
133 }
134
135 static void floatAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
136 {
137     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
138     TestInterface5ImplementationV8Internal::floatAttributeAttributeSetter(v8Value, info);
139     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
140 }
141
142 static void unrestrictedDoubleAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
143 {
144     v8::Handle<v8::Object> holder = info.Holder();
145     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
146     v8SetReturnValue(info, impl->unrestrictedDoubleAttribute());
147 }
148
149 static void unrestrictedDoubleAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
150 {
151     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
152     TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttributeGetter(info);
153     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
154 }
155
156 static void unrestrictedDoubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
157 {
158     v8::Handle<v8::Object> holder = info.Holder();
159     ExceptionState exceptionState(ExceptionState::SetterContext, "unrestrictedDoubleAttribute", "TestInterface5", holder, info.GetIsolate());
160     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
161     TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, exceptionState), exceptionState);
162     impl->setUnrestrictedDoubleAttribute(cppValue);
163 }
164
165 static void unrestrictedDoubleAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
166 {
167     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
168     TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttributeSetter(v8Value, info);
169     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
170 }
171
172 static void unrestrictedFloatAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
173 {
174     v8::Handle<v8::Object> holder = info.Holder();
175     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
176     v8SetReturnValue(info, impl->unrestrictedFloatAttribute());
177 }
178
179 static void unrestrictedFloatAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
180 {
181     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
182     TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeGetter(info);
183     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
184 }
185
186 static void unrestrictedFloatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
187 {
188     v8::Handle<v8::Object> holder = info.Holder();
189     ExceptionState exceptionState(ExceptionState::SetterContext, "unrestrictedFloatAttribute", "TestInterface5", holder, info.GetIsolate());
190     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
191     TONATIVE_VOID_EXCEPTIONSTATE(float, cppValue, toFloat(v8Value, exceptionState), exceptionState);
192     impl->setUnrestrictedFloatAttribute(cppValue);
193 }
194
195 static void unrestrictedFloatAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
196 {
197     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
198     TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeSetter(v8Value, info);
199     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
200 }
201
202 static void staticStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
203 {
204     v8SetReturnValueString(info, TestInterface5Implementation::staticStringAttribute(), info.GetIsolate());
205 }
206
207 static void staticStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
208 {
209     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
210     TestInterface5ImplementationV8Internal::staticStringAttributeAttributeGetter(info);
211     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
212 }
213
214 static void staticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
215 {
216     TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
217     TestInterface5Implementation::setStaticStringAttribute(cppValue);
218 }
219
220 static void staticStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
221 {
222     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
223     TestInterface5ImplementationV8Internal::staticStringAttributeAttributeSetter(v8Value, info);
224     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
225 }
226
227 static void alwaysExposedAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
228 {
229     v8::Handle<v8::Object> holder = info.Holder();
230     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
231     v8SetReturnValueInt(info, impl->alwaysExposedAttribute());
232 }
233
234 static void alwaysExposedAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
235 {
236     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
237     TestInterface5ImplementationV8Internal::alwaysExposedAttributeAttributeGetter(info);
238     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
239 }
240
241 static void alwaysExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
242 {
243     v8::Handle<v8::Object> holder = info.Holder();
244     ExceptionState exceptionState(ExceptionState::SetterContext, "alwaysExposedAttribute", "TestInterface5", holder, info.GetIsolate());
245     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
246     TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState);
247     impl->setAlwaysExposedAttribute(cppValue);
248 }
249
250 static void alwaysExposedAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
251 {
252     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
253     TestInterface5ImplementationV8Internal::alwaysExposedAttributeAttributeSetter(v8Value, info);
254     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
255 }
256
257 static void workerExposedAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
258 {
259     v8::Handle<v8::Object> holder = info.Holder();
260     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
261     v8SetReturnValueInt(info, impl->workerExposedAttribute());
262 }
263
264 static void workerExposedAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
265 {
266     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
267     TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeGetter(info);
268     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
269 }
270
271 static void workerExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
272 {
273     v8::Handle<v8::Object> holder = info.Holder();
274     ExceptionState exceptionState(ExceptionState::SetterContext, "workerExposedAttribute", "TestInterface5", holder, info.GetIsolate());
275     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
276     TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState);
277     impl->setWorkerExposedAttribute(cppValue);
278 }
279
280 static void workerExposedAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
281 {
282     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
283     TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeSetter(v8Value, info);
284     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
285 }
286
287 static void windowExposedAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
288 {
289     v8::Handle<v8::Object> holder = info.Holder();
290     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
291     v8SetReturnValueInt(info, impl->windowExposedAttribute());
292 }
293
294 static void windowExposedAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
295 {
296     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
297     TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeGetter(info);
298     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
299 }
300
301 static void windowExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
302 {
303     v8::Handle<v8::Object> holder = info.Holder();
304     ExceptionState exceptionState(ExceptionState::SetterContext, "windowExposedAttribute", "TestInterface5", holder, info.GetIsolate());
305     TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
306     TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState);
307     impl->setWindowExposedAttribute(cppValue);
308 }
309
310 static void windowExposedAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
311 {
312     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
313     TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeSetter(v8Value, info);
314     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
315 }
316
317 static void TestInterface5ImplementationConstructorGetter(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
318 {
319     v8::Handle<v8::Value> data = info.Data();
320     ASSERT(data->IsExternal());
321     V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->CreationContext());
322     if (!perContextData)
323         return;
324     v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::unwrap(data)));
325 }
326
327 static void TestInterface5ImplementationForceSetAttributeOnThis(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
328 {
329     if (info.This()->IsObject())
330         v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value);
331 }
332
333 static void TestInterface5ImplementationForceSetAttributeOnThisCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
334 {
335     TestInterface5ImplementationV8Internal::TestInterface5ImplementationForceSetAttributeOnThis(name, v8Value, info);
336 }
337
338 static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
339 {
340     if (UNLIKELY(info.Length() < 1)) {
341         V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(info.GetIsolate(), "voidMethodTestInterfaceEmptyArg", "TestInterface5", 1, info.Length()), info.GetIsolate());
342         return;
343     }
344     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
345     TestInterfaceEmpty* testInterfaceEmptyArg;
346     {
347         if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], info.GetIsolate())) {
348             V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodTestInterfaceEmptyArg", "TestInterface5", "parameter 1 is not of type 'TestInterfaceEmpty'."));
349             return;
350         }
351         testInterfaceEmptyArg = V8TestInterfaceEmpty::toImpl(v8::Handle<v8::Object>::Cast(info[0]));
352     }
353     impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg);
354 }
355
356 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
357 {
358     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
359     TestInterface5ImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethod(info);
360     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
361 }
362
363 static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
364 {
365     ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodDoubleArgFloatArg", "TestInterface5", info.Holder(), info.GetIsolate());
366     if (UNLIKELY(info.Length() < 2)) {
367         setMinimumArityTypeError(exceptionState, 2, info.Length());
368         exceptionState.throwIfNeeded();
369         return;
370     }
371     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
372     double doubleArg;
373     float floatArg;
374     {
375         TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(doubleArg, toDouble(info[0], exceptionState), exceptionState);
376         if (!std::isfinite(doubleArg)) {
377             exceptionState.throwTypeError("double parameter 1 is non-finite.");
378             exceptionState.throwIfNeeded();
379             return;
380         }
381         TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(floatArg, toFloat(info[1], exceptionState), exceptionState);
382         if (!std::isfinite(floatArg)) {
383             exceptionState.throwTypeError("float parameter 2 is non-finite.");
384             exceptionState.throwIfNeeded();
385             return;
386         }
387     }
388     impl->voidMethodDoubleArgFloatArg(doubleArg, floatArg);
389 }
390
391 static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
392 {
393     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
394     TestInterface5ImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(info);
395     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
396 }
397
398 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
399 {
400     ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", "TestInterface5", info.Holder(), info.GetIsolate());
401     if (UNLIKELY(info.Length() < 2)) {
402         setMinimumArityTypeError(exceptionState, 2, info.Length());
403         exceptionState.throwIfNeeded();
404         return;
405     }
406     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
407     double unrestrictedDoubleArg;
408     float unrestrictedFloatArg;
409     {
410         TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(unrestrictedDoubleArg, toDouble(info[0], exceptionState), exceptionState);
411         TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(unrestrictedFloatArg, toFloat(info[1], exceptionState), exceptionState);
412     }
413     impl->voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestrictedDoubleArg, unrestrictedFloatArg);
414 }
415
416 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
417 {
418     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
419     TestInterface5ImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(info);
420     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
421 }
422
423 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
424 {
425     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
426     impl->voidMethod();
427 }
428
429 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
430 {
431     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
432     TestInterface5ImplementationV8Internal::voidMethodMethod(info);
433     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
434 }
435
436 static void voidMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
437 {
438     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
439     impl->voidMethod();
440 }
441
442 static void voidMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
443 {
444     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
445     TestInterface5ImplementationV8Internal::voidMethodMethodForMainWorld(info);
446     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
447 }
448
449 static void alwaysExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
450 {
451     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
452     impl->alwaysExposedMethod();
453 }
454
455 static void alwaysExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
456 {
457     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
458     TestInterface5ImplementationV8Internal::alwaysExposedMethodMethod(info);
459     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
460 }
461
462 static void workerExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
463 {
464     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
465     impl->workerExposedMethod();
466 }
467
468 static void workerExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
469 {
470     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
471     TestInterface5ImplementationV8Internal::workerExposedMethodMethod(info);
472     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
473 }
474
475 static void windowExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
476 {
477     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
478     impl->windowExposedMethod();
479 }
480
481 static void windowExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
482 {
483     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
484     TestInterface5ImplementationV8Internal::windowExposedMethodMethod(info);
485     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
486 }
487
488 static void alwaysExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
489 {
490     TestInterface5Implementation::alwaysExposedStaticMethod();
491 }
492
493 static void alwaysExposedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
494 {
495     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
496     TestInterface5ImplementationV8Internal::alwaysExposedStaticMethodMethod(info);
497     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
498 }
499
500 static void workerExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
501 {
502     TestInterface5Implementation::workerExposedStaticMethod();
503 }
504
505 static void workerExposedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
506 {
507     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
508     TestInterface5ImplementationV8Internal::workerExposedStaticMethodMethod(info);
509     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
510 }
511
512 static void windowExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
513 {
514     TestInterface5Implementation::windowExposedStaticMethod();
515 }
516
517 static void windowExposedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
518 {
519     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
520     TestInterface5ImplementationV8Internal::windowExposedStaticMethodMethod(info);
521     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
522 }
523
524 static void windowAndServiceWorkerExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
525 {
526     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
527     impl->windowAndServiceWorkerExposedMethod();
528 }
529
530 static void windowAndServiceWorkerExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
531 {
532     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
533     TestInterface5ImplementationV8Internal::windowAndServiceWorkerExposedMethodMethod(info);
534     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
535 }
536
537 static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
538 {
539     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
540     v8SetReturnValueString(info, impl->toString(), info.GetIsolate());
541 }
542
543 static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
544 {
545     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
546     TestInterface5ImplementationV8Internal::toStringMethod(info);
547     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
548 }
549
550 static void iteratorMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
551 {
552     ExceptionState exceptionState(ExceptionState::ExecutionContext, "iterator", "TestInterface5", info.Holder(), info.GetIsolate());
553     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
554     ScriptState* scriptState = ScriptState::current(info.GetIsolate());
555     RawPtr<Iterator> result = impl->iterator(scriptState, exceptionState);
556     if (exceptionState.hadException()) {
557         exceptionState.throwIfNeeded();
558         return;
559     }
560     v8SetReturnValue(info, result.release());
561 }
562
563 static void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
564 {
565     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
566     TestInterface5ImplementationV8Internal::iteratorMethod(info);
567     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
568 }
569
570 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
571 {
572     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
573     String result = impl->anonymousIndexedGetter(index);
574     if (result.isNull())
575         return;
576     v8SetReturnValueString(info, result, info.GetIsolate());
577 }
578
579 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
580 {
581     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
582     TestInterface5ImplementationV8Internal::indexedPropertyGetter(index, info);
583     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
584 }
585
586 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
587 {
588     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
589     TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value);
590     bool result = impl->anonymousIndexedSetter(index, propertyValue);
591     if (!result)
592         return;
593     v8SetReturnValue(info, v8Value);
594 }
595
596 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
597 {
598     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
599     TestInterface5ImplementationV8Internal::indexedPropertySetter(index, v8Value, info);
600     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
601 }
602
603 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
604 {
605     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
606     DeleteResult result = impl->anonymousIndexedDeleter(index);
607     if (result != DeleteUnknownProperty)
608         return v8SetReturnValueBool(info, result == DeleteSuccess);
609 }
610
611 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
612 {
613     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
614     TestInterface5ImplementationV8Internal::indexedPropertyDeleter(index, info);
615     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
616 }
617
618 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
619 {
620     if (info.Holder()->HasRealNamedProperty(name))
621         return;
622     if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
623         return;
624
625     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
626     AtomicString propertyName = toCoreAtomicString(name);
627     String result = impl->anonymousNamedGetter(propertyName);
628     if (result.isNull())
629         return;
630     v8SetReturnValueString(info, result, info.GetIsolate());
631 }
632
633 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
634 {
635     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
636     TestInterface5ImplementationV8Internal::namedPropertyGetter(name, info);
637     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
638 }
639
640 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
641 {
642     if (info.Holder()->HasRealNamedProperty(name))
643         return;
644     if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
645         return;
646
647     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
648     TOSTRING_VOID(V8StringResource<>, propertyName, name);
649     TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value);
650     bool result = impl->anonymousNamedSetter(propertyName, propertyValue);
651     if (!result)
652         return;
653     v8SetReturnValue(info, v8Value);
654 }
655
656 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
657 {
658     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
659     TestInterface5ImplementationV8Internal::namedPropertySetter(name, v8Value, info);
660     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
661 }
662
663 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
664 {
665     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
666     AtomicString propertyName = toCoreAtomicString(name);
667     v8::String::Utf8Value namedProperty(name);
668     ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface5", info.Holder(), info.GetIsolate());
669     bool result = impl->namedPropertyQuery(propertyName, exceptionState);
670     if (exceptionState.throwIfNeeded())
671         return;
672     if (!result)
673         return;
674     v8SetReturnValueInt(info, v8::None);
675 }
676
677 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
678 {
679     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
680     TestInterface5ImplementationV8Internal::namedPropertyQuery(name, info);
681     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
682 }
683
684 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
685 {
686     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
687     AtomicString propertyName = toCoreAtomicString(name);
688     DeleteResult result = impl->anonymousNamedDeleter(propertyName);
689     if (result != DeleteUnknownProperty)
690         return v8SetReturnValueBool(info, result == DeleteSuccess);
691 }
692
693 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
694 {
695     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
696     TestInterface5ImplementationV8Internal::namedPropertyDeleter(name, info);
697     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
698 }
699
700 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info)
701 {
702     TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
703     Vector<String> names;
704     ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestInterface5", info.Holder(), info.GetIsolate());
705     impl->namedPropertyEnumerator(names, exceptionState);
706     if (exceptionState.throwIfNeeded())
707         return;
708     v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size());
709     for (size_t i = 0; i < names.size(); ++i)
710         v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIsolate(), names[i]));
711     v8SetReturnValue(info, v8names);
712 }
713
714 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info)
715 {
716     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
717     TestInterface5ImplementationV8Internal::namedPropertyEnumerator(info);
718     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
719 }
720
721 } // namespace TestInterface5ImplementationV8Internal
722
723 void V8TestInterface5::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappableBase* scriptWrappableBase, const v8::Persistent<v8::Object>& wrapper)
724 {
725     TestInterface5Implementation* impl = scriptWrappableBase->toImpl<TestInterface5Implementation>();
726     v8::Local<v8::Object> creationContext = v8::Local<v8::Object>::New(isolate, wrapper);
727     V8WrapperInstantiationScope scope(creationContext, isolate);
728     TestInterface5Implementation* referencedName = impl->referencedName();
729     if (referencedName) {
730         if (!DOMDataStore::containsWrapper(referencedName, isolate))
731             referencedName->wrap(creationContext, isolate);
732         DOMDataStore::setWrapperReference(wrapper, referencedName, isolate);
733     }
734     setObjectGroup(isolate, scriptWrappableBase, wrapper);
735 }
736
737 static const V8DOMConfiguration::AttributeConfiguration V8TestInterface5Attributes[] = {
738     {"testInterfaceAttribute", TestInterface5ImplementationV8Internal::testInterfaceAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::testInterfaceAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
739     {"testInterfaceConstructorAttribute", TestInterface5ImplementationV8Internal::TestInterface5ImplementationConstructorGetter, TestInterface5ImplementationV8Internal::TestInterface5ImplementationForceSetAttributeOnThisCallback, 0, 0, const_cast<WrapperTypeInfo*>(&V8TestInterface5::wrapperTypeInfo), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
740     {"doubleAttribute", TestInterface5ImplementationV8Internal::doubleAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::doubleAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
741     {"floatAttribute", TestInterface5ImplementationV8Internal::floatAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::floatAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
742     {"unrestrictedDoubleAttribute", TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
743     {"unrestrictedFloatAttribute", TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
744     {"alwaysExposedAttribute", TestInterface5ImplementationV8Internal::alwaysExposedAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::alwaysExposedAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
745 };
746
747 static const V8DOMConfiguration::MethodConfiguration V8TestInterface5Methods[] = {
748     {"voidMethodTestInterfaceEmptyArg", TestInterface5ImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
749     {"voidMethodDoubleArgFloatArg", TestInterface5ImplementationV8Internal::voidMethodDoubleArgFloatArgMethodCallback, 0, 2, V8DOMConfiguration::ExposedToAllScripts},
750     {"voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", TestInterface5ImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback, 0, 2, V8DOMConfiguration::ExposedToAllScripts},
751     {"voidMethod", TestInterface5ImplementationV8Internal::voidMethodMethodCallback, TestInterface5ImplementationV8Internal::voidMethodMethodCallbackForMainWorld, 0, V8DOMConfiguration::ExposedToAllScripts},
752     {"alwaysExposedMethod", TestInterface5ImplementationV8Internal::alwaysExposedMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
753 };
754
755 static void installV8TestInterface5Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
756 {
757     functionTemplate->ReadOnlyPrototype();
758
759     v8::Local<v8::Signature> defaultSignature;
760     if (!RuntimeEnabledFeatures::featureNameEnabled())
761         defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterface5::internalFieldCount, 0, 0, 0, 0, 0, 0, isolate);
762     else
763         defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterface5", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterface5::internalFieldCount,
764             V8TestInterface5Attributes, WTF_ARRAY_LENGTH(V8TestInterface5Attributes),
765             0, 0,
766             V8TestInterface5Methods, WTF_ARRAY_LENGTH(V8TestInterface5Methods),
767             isolate);
768     v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
769     ALLOW_UNUSED_LOCAL(instanceTemplate);
770     v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
771     ALLOW_UNUSED_LOCAL(prototypeTemplate);
772     static const V8DOMConfiguration::ConstantConfiguration V8TestInterface5Constants[] = {
773         {"UNSIGNED_LONG", 0, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
774         {"CONST_JAVASCRIPT", 1, 0, 0, V8DOMConfiguration::ConstantTypeShort},
775     };
776     V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8TestInterface5Constants, WTF_ARRAY_LENGTH(V8TestInterface5Constants), isolate);
777     functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestInterface5ImplementationV8Internal::indexedPropertyGetterCallback, TestInterface5ImplementationV8Internal::indexedPropertySetterCallback, 0, TestInterface5ImplementationV8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterface5Implementation>);
778     functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterface5ImplementationV8Internal::namedPropertyGetterCallback, TestInterface5ImplementationV8Internal::namedPropertySetterCallback, TestInterface5ImplementationV8Internal::namedPropertyQueryCallback, TestInterface5ImplementationV8Internal::namedPropertyDeleterCallback, TestInterface5ImplementationV8Internal::namedPropertyEnumeratorCallback);
779     static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, TestInterface5ImplementationV8Internal::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts };
780     V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::DontDelete, symbolKeyedIteratorConfiguration, isolate);
781     functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestInterface5::legacyCallCustom);
782     static const V8DOMConfiguration::MethodConfiguration alwaysExposedStaticMethodMethodConfiguration = {
783         "alwaysExposedStaticMethod", TestInterface5ImplementationV8Internal::alwaysExposedStaticMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts,
784     };
785     V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature>(), v8::None, alwaysExposedStaticMethodMethodConfiguration, isolate);
786     static const V8DOMConfiguration::MethodConfiguration toStringMethodConfiguration = {
787         "toString", TestInterface5ImplementationV8Internal::toStringMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts,
788     };
789     V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::DontEnum), toStringMethodConfiguration, isolate);
790     functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "staticStringAttribute"), TestInterface5ImplementationV8Internal::staticStringAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::staticStringAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
791
792     // Custom toString template
793     functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
794 }
795
796 v8::Handle<v8::FunctionTemplate> V8TestInterface5::domTemplate(v8::Isolate* isolate)
797 {
798     return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterface5Template);
799 }
800
801 bool V8TestInterface5::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
802 {
803     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
804 }
805
806 v8::Handle<v8::Object> V8TestInterface5::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
807 {
808     return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
809 }
810
811 TestInterface5Implementation* V8TestInterface5::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
812 {
813     return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterface5Implementation>() : 0;
814 }
815
816 void V8TestInterface5::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceObject, v8::Isolate* isolate)
817 {
818     v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instanceObject->GetPrototype());
819     ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext());
820
821     if (context && (context->isWorkerGlobalScope())) {
822         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
823         {"workerExposedAttribute", TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance};
824         V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attributeConfiguration, isolate);
825     }
826     if (context && (context->isDocument())) {
827         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
828         {"windowExposedAttribute", TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance};
829         V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attributeConfiguration, isolate);
830     }
831 }
832
833 void V8TestInterface5::installConditionallyEnabledMethods(v8::Handle<v8::Object> prototypeObject, v8::Isolate* isolate)
834 {
835     v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domTemplate(isolate));
836     ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext());
837     ASSERT(context);
838
839     if (context && (context->isWorkerGlobalScope())) {
840         prototypeObject->Set(v8AtomicString(isolate, "workerExposedMethod"), v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::workerExposedMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction());
841     }
842     if (context && (context->isDocument())) {
843         prototypeObject->Set(v8AtomicString(isolate, "windowExposedMethod"), v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::windowExposedMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction());
844     }
845     if (context && (context->isWorkerGlobalScope())) {
846         prototypeObject->Set(v8AtomicString(isolate, "workerExposedStaticMethod"), v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::workerExposedStaticMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction());
847     }
848     if (context && (context->isDocument())) {
849         prototypeObject->Set(v8AtomicString(isolate, "windowExposedStaticMethod"), v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::windowExposedStaticMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction());
850     }
851     if (context && (context->isDocument() || context->isServiceWorkerGlobalScope())) {
852         prototypeObject->Set(v8AtomicString(isolate, "windowAndServiceWorkerExposedMethod"), v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::windowAndServiceWorkerExposedMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction());
853     }
854 }
855
856 ActiveDOMObject* V8TestInterface5::toActiveDOMObject(v8::Handle<v8::Object> wrapper)
857 {
858     return toImpl(wrapper);
859 }
860
861 void V8TestInterface5::refObject(ScriptWrappableBase* scriptWrappableBase)
862 {
863     scriptWrappableBase->toImpl<TestInterface5Implementation>()->ref();
864 }
865
866 void V8TestInterface5::derefObject(ScriptWrappableBase* scriptWrappableBase)
867 {
868     scriptWrappableBase->toImpl<TestInterface5Implementation>()->deref();
869 }
870
871 template<>
872 v8::Handle<v8::Value> toV8NoInline(TestInterface5Implementation* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
873 {
874     return toV8(impl, creationContext, isolate);
875 }
876
877 } // namespace blink
878 #endif // ENABLE(CONDITION)