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.
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
9 #include "V8TestInterface5.h"
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"
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 };
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;
35 namespace TestInterface5ImplementationV8Internal {
37 static void testInterfaceAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
39 v8::Handle<v8::Object> holder = info.Holder();
40 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
41 v8SetReturnValueFast(info, WTF::getPtr(impl->testInterfaceAttribute()), impl);
44 static void testInterfaceAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
46 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
47 TestInterface5ImplementationV8Internal::testInterfaceAttributeAttributeGetter(info);
48 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
51 static void testInterfaceAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
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();
60 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
61 TestInterface5Implementation* cppValue = V8TestInterface5::toImpl(v8::Handle<v8::Object>::Cast(v8Value));
62 impl->setTestInterfaceAttribute(WTF::getPtr(cppValue));
65 static void testInterfaceAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
67 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
68 TestInterface5ImplementationV8Internal::testInterfaceAttributeAttributeSetter(v8Value, info);
69 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
72 static void doubleAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
74 v8::Handle<v8::Object> holder = info.Holder();
75 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
76 v8SetReturnValue(info, impl->doubleAttribute());
79 static void doubleAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
81 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
82 TestInterface5ImplementationV8Internal::doubleAttributeAttributeGetter(info);
83 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
86 static void doubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
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();
97 impl->setDoubleAttribute(cppValue);
100 static void doubleAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
102 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
103 TestInterface5ImplementationV8Internal::doubleAttributeAttributeSetter(v8Value, info);
104 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
107 static void floatAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
109 v8::Handle<v8::Object> holder = info.Holder();
110 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
111 v8SetReturnValue(info, impl->floatAttribute());
114 static void floatAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
116 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
117 TestInterface5ImplementationV8Internal::floatAttributeAttributeGetter(info);
118 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
121 static void floatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
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();
132 impl->setFloatAttribute(cppValue);
135 static void floatAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
137 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
138 TestInterface5ImplementationV8Internal::floatAttributeAttributeSetter(v8Value, info);
139 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
142 static void unrestrictedDoubleAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
144 v8::Handle<v8::Object> holder = info.Holder();
145 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
146 v8SetReturnValue(info, impl->unrestrictedDoubleAttribute());
149 static void unrestrictedDoubleAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
151 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
152 TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttributeGetter(info);
153 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
156 static void unrestrictedDoubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
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);
165 static void unrestrictedDoubleAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
167 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
168 TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttributeSetter(v8Value, info);
169 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
172 static void unrestrictedFloatAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
174 v8::Handle<v8::Object> holder = info.Holder();
175 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
176 v8SetReturnValue(info, impl->unrestrictedFloatAttribute());
179 static void unrestrictedFloatAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
181 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
182 TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeGetter(info);
183 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
186 static void unrestrictedFloatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
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);
195 static void unrestrictedFloatAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
197 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
198 TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeSetter(v8Value, info);
199 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
202 static void staticStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
204 v8SetReturnValueString(info, TestInterface5Implementation::staticStringAttribute(), info.GetIsolate());
207 static void staticStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
209 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
210 TestInterface5ImplementationV8Internal::staticStringAttributeAttributeGetter(info);
211 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
214 static void staticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
216 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
217 TestInterface5Implementation::setStaticStringAttribute(cppValue);
220 static void staticStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
222 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
223 TestInterface5ImplementationV8Internal::staticStringAttributeAttributeSetter(v8Value, info);
224 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
227 static void alwaysExposedAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
229 v8::Handle<v8::Object> holder = info.Holder();
230 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
231 v8SetReturnValueInt(info, impl->alwaysExposedAttribute());
234 static void alwaysExposedAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
236 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
237 TestInterface5ImplementationV8Internal::alwaysExposedAttributeAttributeGetter(info);
238 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
241 static void alwaysExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
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);
250 static void alwaysExposedAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
252 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
253 TestInterface5ImplementationV8Internal::alwaysExposedAttributeAttributeSetter(v8Value, info);
254 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
257 static void workerExposedAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
259 v8::Handle<v8::Object> holder = info.Holder();
260 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
261 v8SetReturnValueInt(info, impl->workerExposedAttribute());
264 static void workerExposedAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
266 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
267 TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeGetter(info);
268 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
271 static void workerExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
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);
280 static void workerExposedAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
282 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
283 TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeSetter(v8Value, info);
284 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
287 static void windowExposedAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
289 v8::Handle<v8::Object> holder = info.Holder();
290 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
291 v8SetReturnValueInt(info, impl->windowExposedAttribute());
294 static void windowExposedAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
296 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
297 TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeGetter(info);
298 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
301 static void windowExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
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);
310 static void windowExposedAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
312 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
313 TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeSetter(v8Value, info);
314 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
317 static void TestInterface5ImplementationConstructorGetter(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
319 v8::Handle<v8::Value> data = info.Data();
320 ASSERT(data->IsExternal());
321 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->CreationContext());
324 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::unwrap(data)));
327 static void TestInterface5ImplementationForceSetAttributeOnThis(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
329 if (info.This()->IsObject())
330 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value);
333 static void TestInterface5ImplementationForceSetAttributeOnThisCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
335 TestInterface5ImplementationV8Internal::TestInterface5ImplementationForceSetAttributeOnThis(name, v8Value, info);
338 static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
340 if (UNLIKELY(info.Length() < 1)) {
341 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(info.GetIsolate(), "voidMethodTestInterfaceEmptyArg", "TestInterface5", 1, info.Length()), info.GetIsolate());
344 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
345 TestInterfaceEmpty* testInterfaceEmptyArg;
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'."));
351 testInterfaceEmptyArg = V8TestInterfaceEmpty::toImpl(v8::Handle<v8::Object>::Cast(info[0]));
353 impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg);
356 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
358 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
359 TestInterface5ImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethod(info);
360 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
363 static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
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();
371 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
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();
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();
388 impl->voidMethodDoubleArgFloatArg(doubleArg, floatArg);
391 static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
393 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
394 TestInterface5ImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(info);
395 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
398 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
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();
406 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
407 double unrestrictedDoubleArg;
408 float unrestrictedFloatArg;
410 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(unrestrictedDoubleArg, toDouble(info[0], exceptionState), exceptionState);
411 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(unrestrictedFloatArg, toFloat(info[1], exceptionState), exceptionState);
413 impl->voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestrictedDoubleArg, unrestrictedFloatArg);
416 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
418 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
419 TestInterface5ImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(info);
420 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
423 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
425 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
429 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
431 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
432 TestInterface5ImplementationV8Internal::voidMethodMethod(info);
433 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
436 static void voidMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
438 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
442 static void voidMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
444 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
445 TestInterface5ImplementationV8Internal::voidMethodMethodForMainWorld(info);
446 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
449 static void alwaysExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
451 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
452 impl->alwaysExposedMethod();
455 static void alwaysExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
457 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
458 TestInterface5ImplementationV8Internal::alwaysExposedMethodMethod(info);
459 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
462 static void workerExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
464 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
465 impl->workerExposedMethod();
468 static void workerExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
470 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
471 TestInterface5ImplementationV8Internal::workerExposedMethodMethod(info);
472 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
475 static void windowExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
477 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
478 impl->windowExposedMethod();
481 static void windowExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
483 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
484 TestInterface5ImplementationV8Internal::windowExposedMethodMethod(info);
485 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
488 static void alwaysExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
490 TestInterface5Implementation::alwaysExposedStaticMethod();
493 static void alwaysExposedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
495 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
496 TestInterface5ImplementationV8Internal::alwaysExposedStaticMethodMethod(info);
497 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
500 static void workerExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
502 TestInterface5Implementation::workerExposedStaticMethod();
505 static void workerExposedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
507 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
508 TestInterface5ImplementationV8Internal::workerExposedStaticMethodMethod(info);
509 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
512 static void windowExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
514 TestInterface5Implementation::windowExposedStaticMethod();
517 static void windowExposedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
519 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
520 TestInterface5ImplementationV8Internal::windowExposedStaticMethodMethod(info);
521 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
524 static void windowAndServiceWorkerExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
526 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
527 impl->windowAndServiceWorkerExposedMethod();
530 static void windowAndServiceWorkerExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
532 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
533 TestInterface5ImplementationV8Internal::windowAndServiceWorkerExposedMethodMethod(info);
534 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
537 static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
539 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
540 v8SetReturnValueString(info, impl->toString(), info.GetIsolate());
543 static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
545 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
546 TestInterface5ImplementationV8Internal::toStringMethod(info);
547 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
550 static void iteratorMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
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();
560 v8SetReturnValue(info, result.release());
563 static void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
565 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
566 TestInterface5ImplementationV8Internal::iteratorMethod(info);
567 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
570 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
572 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
573 String result = impl->anonymousIndexedGetter(index);
576 v8SetReturnValueString(info, result, info.GetIsolate());
579 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
581 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
582 TestInterface5ImplementationV8Internal::indexedPropertyGetter(index, info);
583 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
586 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
588 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
589 TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value);
590 bool result = impl->anonymousIndexedSetter(index, propertyValue);
593 v8SetReturnValue(info, v8Value);
596 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
598 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
599 TestInterface5ImplementationV8Internal::indexedPropertySetter(index, v8Value, info);
600 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
603 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
605 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
606 DeleteResult result = impl->anonymousIndexedDeleter(index);
607 if (result != DeleteUnknownProperty)
608 return v8SetReturnValueBool(info, result == DeleteSuccess);
611 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
613 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
614 TestInterface5ImplementationV8Internal::indexedPropertyDeleter(index, info);
615 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
618 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
620 if (info.Holder()->HasRealNamedProperty(name))
622 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
625 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
626 AtomicString propertyName = toCoreAtomicString(name);
627 String result = impl->anonymousNamedGetter(propertyName);
630 v8SetReturnValueString(info, result, info.GetIsolate());
633 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
635 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
636 TestInterface5ImplementationV8Internal::namedPropertyGetter(name, info);
637 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
640 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
642 if (info.Holder()->HasRealNamedProperty(name))
644 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
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);
653 v8SetReturnValue(info, v8Value);
656 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
658 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
659 TestInterface5ImplementationV8Internal::namedPropertySetter(name, v8Value, info);
660 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
663 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
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())
674 v8SetReturnValueInt(info, v8::None);
677 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
679 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
680 TestInterface5ImplementationV8Internal::namedPropertyQuery(name, info);
681 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
684 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
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);
693 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
695 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
696 TestInterface5ImplementationV8Internal::namedPropertyDeleter(name, info);
697 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
700 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info)
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())
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);
714 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info)
716 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
717 TestInterface5ImplementationV8Internal::namedPropertyEnumerator(info);
718 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
721 } // namespace TestInterface5ImplementationV8Internal
723 void V8TestInterface5::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappableBase* scriptWrappableBase, const v8::Persistent<v8::Object>& wrapper)
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);
734 setObjectGroup(isolate, scriptWrappableBase, wrapper);
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},
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},
755 static void installV8TestInterface5Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
757 functionTemplate->ReadOnlyPrototype();
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);
763 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterface5", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterface5::internalFieldCount,
764 V8TestInterface5Attributes, WTF_ARRAY_LENGTH(V8TestInterface5Attributes),
766 V8TestInterface5Methods, WTF_ARRAY_LENGTH(V8TestInterface5Methods),
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},
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,
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,
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));
792 // Custom toString template
793 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
796 v8::Handle<v8::FunctionTemplate> V8TestInterface5::domTemplate(v8::Isolate* isolate)
798 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterface5Template);
801 bool V8TestInterface5::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
803 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
806 v8::Handle<v8::Object> V8TestInterface5::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
808 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
811 TestInterface5Implementation* V8TestInterface5::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
813 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterface5Implementation>() : 0;
816 void V8TestInterface5::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceObject, v8::Isolate* isolate)
818 v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instanceObject->GetPrototype());
819 ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext());
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);
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);
833 void V8TestInterface5::installConditionallyEnabledMethods(v8::Handle<v8::Object> prototypeObject, v8::Isolate* isolate)
835 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domTemplate(isolate));
836 ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext());
839 if (context && (context->isWorkerGlobalScope())) {
840 prototypeObject->Set(v8AtomicString(isolate, "workerExposedMethod"), v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::workerExposedMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction());
842 if (context && (context->isDocument())) {
843 prototypeObject->Set(v8AtomicString(isolate, "windowExposedMethod"), v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::windowExposedMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction());
845 if (context && (context->isWorkerGlobalScope())) {
846 prototypeObject->Set(v8AtomicString(isolate, "workerExposedStaticMethod"), v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::workerExposedStaticMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction());
848 if (context && (context->isDocument())) {
849 prototypeObject->Set(v8AtomicString(isolate, "windowExposedStaticMethod"), v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::windowExposedStaticMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction());
851 if (context && (context->isDocument() || context->isServiceWorkerGlobalScope())) {
852 prototypeObject->Set(v8AtomicString(isolate, "windowAndServiceWorkerExposedMethod"), v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::windowAndServiceWorkerExposedMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction());
856 ActiveDOMObject* V8TestInterface5::toActiveDOMObject(v8::Handle<v8::Object> wrapper)
858 return toImpl(wrapper);
861 void V8TestInterface5::refObject(ScriptWrappableBase* scriptWrappableBase)
863 scriptWrappableBase->toImpl<TestInterface5Implementation>()->ref();
866 void V8TestInterface5::derefObject(ScriptWrappableBase* scriptWrappableBase)
868 scriptWrappableBase->toImpl<TestInterface5Implementation>()->deref();
872 v8::Handle<v8::Value> toV8NoInline(TestInterface5Implementation* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
874 return toV8(impl, creationContext, isolate);
878 #endif // ENABLE(CONDITION)