Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: Source/bindings/tests/results/V8TestInterface.cpp

Issue 557203002: Added core and modules to binding tests results for binding modularization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6
7 #include "config.h"
8 #if ENABLE(CONDITION)
9 #include "V8TestInterface.h"
10
11 #include "bindings/core/v8/ExceptionState.h"
12 #include "bindings/core/v8/PrivateScriptRunner.h"
13 #include "bindings/core/v8/ScriptState.h"
14 #include "bindings/core/v8/ScriptValue.h"
15 #include "bindings/core/v8/V8AbstractEventListener.h"
16 #include "bindings/core/v8/V8DOMConfiguration.h"
17 #include "bindings/core/v8/V8EventListenerList.h"
18 #include "bindings/core/v8/V8HiddenValue.h"
19 #include "bindings/core/v8/V8ObjectConstructor.h"
20 #include "bindings/tests/idls/core/TestImplements2.h"
21 #include "bindings/tests/idls/core/TestImplements3Implementation.h"
22 #include "bindings/tests/idls/core/TestPartialInterface.h"
23 #include "bindings/tests/idls/core/TestPartialInterfaceImplementation.h"
24 #include "bindings/tests/idls/modules/TestPartialInterfaceImplementation3.h"
25 #include "bindings/tests/v8/V8Iterator.h"
26 #include "bindings/tests/v8/V8Node.h"
27 #include "bindings/tests/v8/V8TestInterface.h"
28 #include "bindings/tests/v8/V8TestInterfaceEmpty.h"
29 #include "core/dom/ContextFeatures.h"
30 #include "core/dom/Document.h"
31 #include "core/frame/LocalFrame.h"
32 #include "platform/RuntimeEnabledFeatures.h"
33 #include "platform/ScriptForbiddenScope.h"
34 #include "platform/TraceEvent.h"
35 #include "wtf/GetPtr.h"
36 #include "wtf/RefPtr.h"
37
38 namespace blink {
39
40 const WrapperTypeInfo V8TestInterface::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface::domTemplate, V8TestInterface::refObject, V8TestInterface::deref Object, V8TestInterface::createPersistentHandle, V8TestInterface::toActiveDOMObj ect, 0, V8TestInterface::visitDOMWrapper, V8TestInterface::installConditionallyE nabledMethods, V8TestInterface::installConditionallyEnabledProperties, &V8TestIn terfaceEmpty::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, Wrap perTypeInfo::ObjectClassId, WrapperTypeInfo::Dependent, WrapperTypeInfo::RefCoun tedObject };
41
42 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfac eImplementation.h.
43 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
44 // bindings/core/v8/ScriptWrappable.h.
45 const WrapperTypeInfo& TestInterfaceImplementation::s_wrapperTypeInfo = V8TestIn terface::wrapperTypeInfo;
46
47 namespace TestInterfaceImplementationV8Internal {
48
49 template <typename T> void V8_USE(T) { }
50
51 static void testInterfaceAttributeAttributeGetter(const v8::PropertyCallbackInfo <v8::Value>& info)
52 {
53 v8::Handle<v8::Object> holder = info.Holder();
54 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
55 v8SetReturnValueFast(info, WTF::getPtr(impl->testInterfaceAttribute()), impl );
56 }
57
58 static void testInterfaceAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
59 {
60 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
61 TestInterfaceImplementationV8Internal::testInterfaceAttributeAttributeGetter (info);
62 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
63 }
64
65 static void testInterfaceAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
66 {
67 v8::Handle<v8::Object> holder = info.Holder();
68 ExceptionState exceptionState(ExceptionState::SetterContext, "testInterfaceA ttribute", "TestInterface", holder, info.GetIsolate());
69 if (!V8TestInterface::hasInstance(v8Value, info.GetIsolate())) {
70 exceptionState.throwTypeError("The provided value is not of type 'TestIn terface'.");
71 exceptionState.throwIfNeeded();
72 return;
73 }
74 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
75 TONATIVE_VOID(TestInterfaceImplementation*, cppValue, V8TestInterface::toImp lWithTypeCheck(info.GetIsolate(), v8Value));
76 impl->setTestInterfaceAttribute(WTF::getPtr(cppValue));
77 }
78
79 static void testInterfaceAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
80 {
81 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
82 TestInterfaceImplementationV8Internal::testInterfaceAttributeAttributeSetter (v8Value, info);
83 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
84 }
85
86 static void doubleAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Va lue>& info)
87 {
88 v8::Handle<v8::Object> holder = info.Holder();
89 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
90 v8SetReturnValue(info, impl->doubleAttribute());
91 }
92
93 static void doubleAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
94 {
95 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
96 TestInterfaceImplementationV8Internal::doubleAttributeAttributeGetter(info);
97 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
98 }
99
100 static void doubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v 8::PropertyCallbackInfo<void>& info)
101 {
102 v8::Handle<v8::Object> holder = info.Holder();
103 ExceptionState exceptionState(ExceptionState::SetterContext, "doubleAttribut e", "TestInterface", holder, info.GetIsolate());
104 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
105 TONATIVE_VOID(double, cppValue, static_cast<double>(v8Value->NumberValue())) ;
106 if (!std::isfinite(cppValue)) {
107 exceptionState.throwTypeError("The provided double value is non-finite." );
108 exceptionState.throwIfNeeded();
109 return;
110 }
111 impl->setDoubleAttribute(cppValue);
112 }
113
114 static void doubleAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Lo cal<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
115 {
116 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
117 TestInterfaceImplementationV8Internal::doubleAttributeAttributeSetter(v8Valu e, info);
118 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
119 }
120
121 static void floatAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Val ue>& info)
122 {
123 v8::Handle<v8::Object> holder = info.Holder();
124 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
125 v8SetReturnValue(info, impl->floatAttribute());
126 }
127
128 static void floatAttributeAttributeGetterCallback(v8::Local<v8::String>, const v 8::PropertyCallbackInfo<v8::Value>& info)
129 {
130 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
131 TestInterfaceImplementationV8Internal::floatAttributeAttributeGetter(info);
132 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
133 }
134
135 static void floatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8 ::PropertyCallbackInfo<void>& info)
136 {
137 v8::Handle<v8::Object> holder = info.Holder();
138 ExceptionState exceptionState(ExceptionState::SetterContext, "floatAttribute ", "TestInterface", holder, info.GetIsolate());
139 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
140 TONATIVE_VOID(float, cppValue, static_cast<float>(v8Value->NumberValue()));
141 if (!std::isfinite(cppValue)) {
142 exceptionState.throwTypeError("The provided float value is non-finite.") ;
143 exceptionState.throwIfNeeded();
144 return;
145 }
146 impl->setFloatAttribute(cppValue);
147 }
148
149 static void floatAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Loc al<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
150 {
151 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
152 TestInterfaceImplementationV8Internal::floatAttributeAttributeSetter(v8Value , info);
153 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
154 }
155
156 static void unrestrictedDoubleAttributeAttributeGetter(const v8::PropertyCallbac kInfo<v8::Value>& info)
157 {
158 v8::Handle<v8::Object> holder = info.Holder();
159 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
160 v8SetReturnValue(info, impl->unrestrictedDoubleAttribute());
161 }
162
163 static void unrestrictedDoubleAttributeAttributeGetterCallback(v8::Local<v8::Str ing>, const v8::PropertyCallbackInfo<v8::Value>& info)
164 {
165 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
166 TestInterfaceImplementationV8Internal::unrestrictedDoubleAttributeAttributeG etter(info);
167 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
168 }
169
170 static void unrestrictedDoubleAttributeAttributeSetter(v8::Local<v8::Value> v8Va lue, const v8::PropertyCallbackInfo<void>& info)
171 {
172 v8::Handle<v8::Object> holder = info.Holder();
173 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
174 TONATIVE_VOID(double, cppValue, static_cast<double>(v8Value->NumberValue())) ;
175 impl->setUnrestrictedDoubleAttribute(cppValue);
176 }
177
178 static void unrestrictedDoubleAttributeAttributeSetterCallback(v8::Local<v8::Str ing>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
179 {
180 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
181 TestInterfaceImplementationV8Internal::unrestrictedDoubleAttributeAttributeS etter(v8Value, info);
182 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
183 }
184
185 static void unrestrictedFloatAttributeAttributeGetter(const v8::PropertyCallback Info<v8::Value>& info)
186 {
187 v8::Handle<v8::Object> holder = info.Holder();
188 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
189 v8SetReturnValue(info, impl->unrestrictedFloatAttribute());
190 }
191
192 static void unrestrictedFloatAttributeAttributeGetterCallback(v8::Local<v8::Stri ng>, const v8::PropertyCallbackInfo<v8::Value>& info)
193 {
194 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
195 TestInterfaceImplementationV8Internal::unrestrictedFloatAttributeAttributeGe tter(info);
196 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
197 }
198
199 static void unrestrictedFloatAttributeAttributeSetter(v8::Local<v8::Value> v8Val ue, const v8::PropertyCallbackInfo<void>& info)
200 {
201 v8::Handle<v8::Object> holder = info.Holder();
202 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
203 TONATIVE_VOID(float, cppValue, static_cast<float>(v8Value->NumberValue()));
204 impl->setUnrestrictedFloatAttribute(cppValue);
205 }
206
207 static void unrestrictedFloatAttributeAttributeSetterCallback(v8::Local<v8::Stri ng>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
208 {
209 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
210 TestInterfaceImplementationV8Internal::unrestrictedFloatAttributeAttributeSe tter(v8Value, info);
211 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
212 }
213
214 static void staticStringAttributeAttributeGetter(const v8::PropertyCallbackInfo< v8::Value>& info)
215 {
216 v8SetReturnValueString(info, TestInterfaceImplementation::staticStringAttrib ute(), info.GetIsolate());
217 }
218
219 static void staticStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
220 {
221 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
222 TestInterfaceImplementationV8Internal::staticStringAttributeAttributeGetter( info);
223 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
224 }
225
226 static void staticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, c onst v8::PropertyCallbackInfo<void>& info)
227 {
228 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
229 TestInterfaceImplementation::setStaticStringAttribute(cppValue);
230 }
231
232 static void staticStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
233 {
234 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
235 TestInterfaceImplementationV8Internal::staticStringAttributeAttributeSetter( v8Value, info);
236 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
237 }
238
239 static void alwaysExposedAttributeAttributeGetter(const v8::PropertyCallbackInfo <v8::Value>& info)
240 {
241 v8::Handle<v8::Object> holder = info.Holder();
242 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
243 v8SetReturnValueInt(info, impl->alwaysExposedAttribute());
244 }
245
246 static void alwaysExposedAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
247 {
248 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
249 TestInterfaceImplementationV8Internal::alwaysExposedAttributeAttributeGetter (info);
250 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
251 }
252
253 static void alwaysExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
254 {
255 v8::Handle<v8::Object> holder = info.Holder();
256 ExceptionState exceptionState(ExceptionState::SetterContext, "alwaysExposedA ttribute", "TestInterface", holder, info.GetIsolate());
257 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
258 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState) , exceptionState);
259 impl->setAlwaysExposedAttribute(cppValue);
260 }
261
262 static void alwaysExposedAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
263 {
264 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
265 TestInterfaceImplementationV8Internal::alwaysExposedAttributeAttributeSetter (v8Value, info);
266 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
267 }
268
269 static void workerExposedAttributeAttributeGetter(const v8::PropertyCallbackInfo <v8::Value>& info)
270 {
271 v8::Handle<v8::Object> holder = info.Holder();
272 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
273 v8SetReturnValueInt(info, impl->workerExposedAttribute());
274 }
275
276 static void workerExposedAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
277 {
278 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
279 TestInterfaceImplementationV8Internal::workerExposedAttributeAttributeGetter (info);
280 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
281 }
282
283 static void workerExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
284 {
285 v8::Handle<v8::Object> holder = info.Holder();
286 ExceptionState exceptionState(ExceptionState::SetterContext, "workerExposedA ttribute", "TestInterface", holder, info.GetIsolate());
287 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
288 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState) , exceptionState);
289 impl->setWorkerExposedAttribute(cppValue);
290 }
291
292 static void workerExposedAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
293 {
294 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
295 TestInterfaceImplementationV8Internal::workerExposedAttributeAttributeSetter (v8Value, info);
296 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
297 }
298
299 static void windowExposedAttributeAttributeGetter(const v8::PropertyCallbackInfo <v8::Value>& info)
300 {
301 v8::Handle<v8::Object> holder = info.Holder();
302 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
303 v8SetReturnValueInt(info, impl->windowExposedAttribute());
304 }
305
306 static void windowExposedAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
307 {
308 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
309 TestInterfaceImplementationV8Internal::windowExposedAttributeAttributeGetter (info);
310 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
311 }
312
313 static void windowExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
314 {
315 v8::Handle<v8::Object> holder = info.Holder();
316 ExceptionState exceptionState(ExceptionState::SetterContext, "windowExposedA ttribute", "TestInterface", holder, info.GetIsolate());
317 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
318 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState) , exceptionState);
319 impl->setWindowExposedAttribute(cppValue);
320 }
321
322 static void windowExposedAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
323 {
324 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
325 TestInterfaceImplementationV8Internal::windowExposedAttributeAttributeSetter (v8Value, info);
326 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
327 }
328
329 static void implementsStaticReadOnlyLongAttributeAttributeGetter(const v8::Prope rtyCallbackInfo<v8::Value>& info)
330 {
331 v8SetReturnValueInt(info, TestInterfaceImplementation::implementsStaticReadO nlyLongAttribute());
332 }
333
334 static void implementsStaticReadOnlyLongAttributeAttributeGetterCallback(v8::Loc al<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
335 {
336 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
337 TestInterfaceImplementationV8Internal::implementsStaticReadOnlyLongAttribute AttributeGetter(info);
338 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
339 }
340
341 static void implementsStaticStringAttributeAttributeGetter(const v8::PropertyCal lbackInfo<v8::Value>& info)
342 {
343 v8SetReturnValueString(info, TestInterfaceImplementation::implementsStaticSt ringAttribute(), info.GetIsolate());
344 }
345
346 static void implementsStaticStringAttributeAttributeGetterCallback(v8::Local<v8: :String>, const v8::PropertyCallbackInfo<v8::Value>& info)
347 {
348 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
349 TestInterfaceImplementationV8Internal::implementsStaticStringAttributeAttrib uteGetter(info);
350 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
351 }
352
353 static void implementsStaticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
354 {
355 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
356 TestInterfaceImplementation::setImplementsStaticStringAttribute(cppValue);
357 }
358
359 static void implementsStaticStringAttributeAttributeSetterCallback(v8::Local<v8: :String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& in fo)
360 {
361 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
362 TestInterfaceImplementationV8Internal::implementsStaticStringAttributeAttrib uteSetter(v8Value, info);
363 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
364 }
365
366 static void implementsReadonlyStringAttributeAttributeGetter(const v8::PropertyC allbackInfo<v8::Value>& info)
367 {
368 v8::Handle<v8::Object> holder = info.Holder();
369 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
370 v8SetReturnValueString(info, impl->implementsReadonlyStringAttribute(), info .GetIsolate());
371 }
372
373 static void implementsReadonlyStringAttributeAttributeGetterCallback(v8::Local<v 8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
374 {
375 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
376 TestInterfaceImplementationV8Internal::implementsReadonlyStringAttributeAttr ibuteGetter(info);
377 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
378 }
379
380 static void implementsStringAttributeAttributeGetter(const v8::PropertyCallbackI nfo<v8::Value>& info)
381 {
382 v8::Handle<v8::Object> holder = info.Holder();
383 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
384 v8SetReturnValueString(info, impl->implementsStringAttribute(), info.GetIsol ate());
385 }
386
387 static void implementsStringAttributeAttributeGetterCallback(v8::Local<v8::Strin g>, const v8::PropertyCallbackInfo<v8::Value>& info)
388 {
389 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
390 TestInterfaceImplementationV8Internal::implementsStringAttributeAttributeGet ter(info);
391 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
392 }
393
394 static void implementsStringAttributeAttributeSetter(v8::Local<v8::Value> v8Valu e, const v8::PropertyCallbackInfo<void>& info)
395 {
396 v8::Handle<v8::Object> holder = info.Holder();
397 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
398 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
399 impl->setImplementsStringAttribute(cppValue);
400 }
401
402 static void implementsStringAttributeAttributeSetterCallback(v8::Local<v8::Strin g>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
403 {
404 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
405 TestInterfaceImplementationV8Internal::implementsStringAttributeAttributeSet ter(v8Value, info);
406 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
407 }
408
409 static void implementsNodeAttributeAttributeGetter(const v8::PropertyCallbackInf o<v8::Value>& info)
410 {
411 v8::Handle<v8::Object> holder = info.Holder();
412 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
413 v8SetReturnValueFast(info, WTF::getPtr(impl->implementsNodeAttribute()), imp l);
414 }
415
416 static void implementsNodeAttributeAttributeGetterCallback(v8::Local<v8::String> , const v8::PropertyCallbackInfo<v8::Value>& info)
417 {
418 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
419 TestInterfaceImplementationV8Internal::implementsNodeAttributeAttributeGette r(info);
420 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
421 }
422
423 static void implementsNodeAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
424 {
425 v8::Handle<v8::Object> holder = info.Holder();
426 ExceptionState exceptionState(ExceptionState::SetterContext, "implementsNode Attribute", "TestInterface", holder, info.GetIsolate());
427 if (!V8Node::hasInstance(v8Value, info.GetIsolate())) {
428 exceptionState.throwTypeError("The provided value is not of type 'Node'. ");
429 exceptionState.throwIfNeeded();
430 return;
431 }
432 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
433 TONATIVE_VOID(Node*, cppValue, V8Node::toImplWithTypeCheck(info.GetIsolate() , v8Value));
434 impl->setImplementsNodeAttribute(WTF::getPtr(cppValue));
435 }
436
437 static void implementsNodeAttributeAttributeSetterCallback(v8::Local<v8::String> , v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
438 {
439 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
440 TestInterfaceImplementationV8Internal::implementsNodeAttributeAttributeSette r(v8Value, info);
441 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
442 }
443
444 static void implementsEventHandlerAttributeAttributeGetter(const v8::PropertyCal lbackInfo<v8::Value>& info)
445 {
446 v8::Handle<v8::Object> holder = info.Holder();
447 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
448 EventListener* cppValue(impl->implementsEventHandlerAttribute());
449 v8SetReturnValue(info, cppValue ? v8::Handle<v8::Value>(V8AbstractEventListe ner::cast(cppValue)->getListenerObject(impl->executionContext())) : v8::Handle<v 8::Value>(v8::Null(info.GetIsolate())));
450 }
451
452 static void implementsEventHandlerAttributeAttributeGetterCallback(v8::Local<v8: :String>, const v8::PropertyCallbackInfo<v8::Value>& info)
453 {
454 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
455 TestInterfaceImplementationV8Internal::implementsEventHandlerAttributeAttrib uteGetter(info);
456 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
457 }
458
459 static void implementsEventHandlerAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
460 {
461 v8::Handle<v8::Object> holder = info.Holder();
462 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
463 moveEventListenerToNewWrapper(holder, impl->implementsEventHandlerAttribute( ), v8Value, V8TestInterface::eventListenerCacheIndex, info.GetIsolate());
464 impl->setImplementsEventHandlerAttribute(V8EventListenerList::getEventListen er(ScriptState::current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate) );
465 }
466
467 static void implementsEventHandlerAttributeAttributeSetterCallback(v8::Local<v8: :String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& in fo)
468 {
469 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
470 TestInterfaceImplementationV8Internal::implementsEventHandlerAttributeAttrib uteSetter(v8Value, info);
471 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
472 }
473
474 static void implementsRuntimeEnabledNodeAttributeAttributeGetter(const v8::Prope rtyCallbackInfo<v8::Value>& info)
475 {
476 v8::Handle<v8::Object> holder = info.Holder();
477 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
478 v8SetReturnValueFast(info, WTF::getPtr(impl->implementsRuntimeEnabledNodeAtt ribute()), impl);
479 }
480
481 static void implementsRuntimeEnabledNodeAttributeAttributeGetterCallback(v8::Loc al<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
482 {
483 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
484 TestInterfaceImplementationV8Internal::implementsRuntimeEnabledNodeAttribute AttributeGetter(info);
485 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
486 }
487
488 static void implementsRuntimeEnabledNodeAttributeAttributeSetter(v8::Local<v8::V alue> v8Value, const v8::PropertyCallbackInfo<void>& info)
489 {
490 v8::Handle<v8::Object> holder = info.Holder();
491 ExceptionState exceptionState(ExceptionState::SetterContext, "implementsRunt imeEnabledNodeAttribute", "TestInterface", holder, info.GetIsolate());
492 if (!V8Node::hasInstance(v8Value, info.GetIsolate())) {
493 exceptionState.throwTypeError("The provided value is not of type 'Node'. ");
494 exceptionState.throwIfNeeded();
495 return;
496 }
497 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
498 TONATIVE_VOID(Node*, cppValue, V8Node::toImplWithTypeCheck(info.GetIsolate() , v8Value));
499 impl->setImplementsRuntimeEnabledNodeAttribute(WTF::getPtr(cppValue));
500 }
501
502 static void implementsRuntimeEnabledNodeAttributeAttributeSetterCallback(v8::Loc al<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<voi d>& info)
503 {
504 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
505 TestInterfaceImplementationV8Internal::implementsRuntimeEnabledNodeAttribute AttributeSetter(v8Value, info);
506 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
507 }
508
509 static void implementsPerContextEnabledNodeAttributeAttributeGetter(const v8::Pr opertyCallbackInfo<v8::Value>& info)
510 {
511 v8::Handle<v8::Object> holder = info.Holder();
512 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
513 v8SetReturnValueFast(info, WTF::getPtr(impl->implementsPerContextEnabledNode Attribute()), impl);
514 }
515
516 static void implementsPerContextEnabledNodeAttributeAttributeGetterCallback(v8:: Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
517 {
518 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
519 TestInterfaceImplementationV8Internal::implementsPerContextEnabledNodeAttrib uteAttributeGetter(info);
520 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
521 }
522
523 static void implementsPerContextEnabledNodeAttributeAttributeSetter(v8::Local<v8 ::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
524 {
525 v8::Handle<v8::Object> holder = info.Holder();
526 ExceptionState exceptionState(ExceptionState::SetterContext, "implementsPerC ontextEnabledNodeAttribute", "TestInterface", holder, info.GetIsolate());
527 if (!V8Node::hasInstance(v8Value, info.GetIsolate())) {
528 exceptionState.throwTypeError("The provided value is not of type 'Node'. ");
529 exceptionState.throwIfNeeded();
530 return;
531 }
532 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
533 TONATIVE_VOID(Node*, cppValue, V8Node::toImplWithTypeCheck(info.GetIsolate() , v8Value));
534 impl->setImplementsPerContextEnabledNodeAttribute(WTF::getPtr(cppValue));
535 }
536
537 static void implementsPerContextEnabledNodeAttributeAttributeSetterCallback(v8:: Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo< void>& info)
538 {
539 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
540 TestInterfaceImplementationV8Internal::implementsPerContextEnabledNodeAttrib uteAttributeSetter(v8Value, info);
541 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
542 }
543
544 static void implements2StaticStringAttributeAttributeGetter(const v8::PropertyCa llbackInfo<v8::Value>& info)
545 {
546 v8SetReturnValueString(info, TestImplements2::implements2StaticStringAttribu te(), info.GetIsolate());
547 }
548
549 static void implements2StaticStringAttributeAttributeGetterCallback(v8::Local<v8 ::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
550 {
551 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
552 TestInterfaceImplementationV8Internal::implements2StaticStringAttributeAttri buteGetter(info);
553 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
554 }
555
556 static void implements2StaticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
557 {
558 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
559 TestImplements2::setImplements2StaticStringAttribute(cppValue);
560 }
561
562 static void implements2StaticStringAttributeAttributeSetterCallback(v8::Local<v8 ::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& i nfo)
563 {
564 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
565 TestInterfaceImplementationV8Internal::implements2StaticStringAttributeAttri buteSetter(v8Value, info);
566 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
567 }
568
569 static void implements2StringAttributeAttributeGetter(const v8::PropertyCallback Info<v8::Value>& info)
570 {
571 v8::Handle<v8::Object> holder = info.Holder();
572 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
573 v8SetReturnValueString(info, TestImplements2::implements2StringAttribute(*im pl), info.GetIsolate());
574 }
575
576 static void implements2StringAttributeAttributeGetterCallback(v8::Local<v8::Stri ng>, const v8::PropertyCallbackInfo<v8::Value>& info)
577 {
578 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
579 TestInterfaceImplementationV8Internal::implements2StringAttributeAttributeGe tter(info);
580 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
581 }
582
583 static void implements2StringAttributeAttributeSetter(v8::Local<v8::Value> v8Val ue, const v8::PropertyCallbackInfo<void>& info)
584 {
585 v8::Handle<v8::Object> holder = info.Holder();
586 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
587 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
588 TestImplements2::setImplements2StringAttribute(*impl, cppValue);
589 }
590
591 static void implements2StringAttributeAttributeSetterCallback(v8::Local<v8::Stri ng>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
592 {
593 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
594 TestInterfaceImplementationV8Internal::implements2StringAttributeAttributeSe tter(v8Value, info);
595 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
596 }
597
598 static void implements3StringAttributeAttributeGetter(const v8::PropertyCallback Info<v8::Value>& info)
599 {
600 v8::Handle<v8::Object> holder = info.Holder();
601 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
602 v8SetReturnValueString(info, TestImplements3Implementation::implements3Strin gAttribute(*impl), info.GetIsolate());
603 }
604
605 static void implements3StringAttributeAttributeGetterCallback(v8::Local<v8::Stri ng>, const v8::PropertyCallbackInfo<v8::Value>& info)
606 {
607 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
608 TestInterfaceImplementationV8Internal::implements3StringAttributeAttributeGe tter(info);
609 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
610 }
611
612 static void implements3StringAttributeAttributeSetter(v8::Local<v8::Value> v8Val ue, const v8::PropertyCallbackInfo<void>& info)
613 {
614 v8::Handle<v8::Object> holder = info.Holder();
615 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
616 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
617 TestImplements3Implementation::setImplements3StringAttribute(*impl, cppValue );
618 }
619
620 static void implements3StringAttributeAttributeSetterCallback(v8::Local<v8::Stri ng>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
621 {
622 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
623 TestInterfaceImplementationV8Internal::implements3StringAttributeAttributeSe tter(v8Value, info);
624 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
625 }
626
627 static void implements3StaticStringAttributeAttributeGetter(const v8::PropertyCa llbackInfo<v8::Value>& info)
628 {
629 v8SetReturnValueString(info, TestImplements3Implementation::implements3Stati cStringAttribute(), info.GetIsolate());
630 }
631
632 static void implements3StaticStringAttributeAttributeGetterCallback(v8::Local<v8 ::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
633 {
634 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
635 TestInterfaceImplementationV8Internal::implements3StaticStringAttributeAttri buteGetter(info);
636 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
637 }
638
639 static void implements3StaticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
640 {
641 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
642 TestImplements3Implementation::setImplements3StaticStringAttribute(cppValue) ;
643 }
644
645 static void implements3StaticStringAttributeAttributeSetterCallback(v8::Local<v8 ::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& i nfo)
646 {
647 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
648 TestInterfaceImplementationV8Internal::implements3StaticStringAttributeAttri buteSetter(v8Value, info);
649 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
650 }
651
652 #if ENABLE(PARTIAL_CONDITION)
653 static void partialLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v 8::Value>& info)
654 {
655 v8::Handle<v8::Object> holder = info.Holder();
656 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
657 v8SetReturnValueInt(info, TestPartialInterface::partialLongAttribute(*impl)) ;
658 }
659 #endif // ENABLE(PARTIAL_CONDITION)
660
661 #if ENABLE(PARTIAL_CONDITION)
662 static void partialLongAttributeAttributeGetterCallback(v8::Local<v8::String>, c onst v8::PropertyCallbackInfo<v8::Value>& info)
663 {
664 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
665 TestInterfaceImplementationV8Internal::partialLongAttributeAttributeGetter(i nfo);
666 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
667 }
668 #endif // ENABLE(PARTIAL_CONDITION)
669
670 #if ENABLE(PARTIAL_CONDITION)
671 static void partialLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, co nst v8::PropertyCallbackInfo<void>& info)
672 {
673 v8::Handle<v8::Object> holder = info.Holder();
674 ExceptionState exceptionState(ExceptionState::SetterContext, "partialLongAtt ribute", "TestInterface", holder, info.GetIsolate());
675 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
676 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState) , exceptionState);
677 TestPartialInterface::setPartialLongAttribute(*impl, cppValue);
678 }
679 #endif // ENABLE(PARTIAL_CONDITION)
680
681 #if ENABLE(PARTIAL_CONDITION)
682 static void partialLongAttributeAttributeSetterCallback(v8::Local<v8::String>, v 8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
683 {
684 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
685 TestInterfaceImplementationV8Internal::partialLongAttributeAttributeSetter(v 8Value, info);
686 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
687 }
688 #endif // ENABLE(PARTIAL_CONDITION)
689
690 #if ENABLE(PARTIAL_CONDITION)
691 static void partialStaticLongAttributeAttributeGetter(const v8::PropertyCallback Info<v8::Value>& info)
692 {
693 v8SetReturnValueInt(info, TestPartialInterface::partialStaticLongAttribute() );
694 }
695 #endif // ENABLE(PARTIAL_CONDITION)
696
697 #if ENABLE(PARTIAL_CONDITION)
698 static void partialStaticLongAttributeAttributeGetterCallback(v8::Local<v8::Stri ng>, const v8::PropertyCallbackInfo<v8::Value>& info)
699 {
700 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
701 TestInterfaceImplementationV8Internal::partialStaticLongAttributeAttributeGe tter(info);
702 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
703 }
704 #endif // ENABLE(PARTIAL_CONDITION)
705
706 #if ENABLE(PARTIAL_CONDITION)
707 static void partialStaticLongAttributeAttributeSetter(v8::Local<v8::Value> v8Val ue, const v8::PropertyCallbackInfo<void>& info)
708 {
709 ExceptionState exceptionState(ExceptionState::SetterContext, "partialStaticL ongAttribute", "TestInterface", holder, info.GetIsolate());
710 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState) , exceptionState);
711 TestPartialInterface::setPartialStaticLongAttribute(cppValue);
712 }
713 #endif // ENABLE(PARTIAL_CONDITION)
714
715 #if ENABLE(PARTIAL_CONDITION)
716 static void partialStaticLongAttributeAttributeSetterCallback(v8::Local<v8::Stri ng>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
717 {
718 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
719 TestInterfaceImplementationV8Internal::partialStaticLongAttributeAttributeSe tter(v8Value, info);
720 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
721 }
722 #endif // ENABLE(PARTIAL_CONDITION)
723
724 #if ENABLE(PARTIAL_CONDITION)
725 static void partialCallWithExecutionContextLongAttributeAttributeGetter(const v8 ::PropertyCallbackInfo<v8::Value>& info)
726 {
727 v8::Handle<v8::Object> holder = info.Holder();
728 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
729 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
730 v8SetReturnValueInt(info, TestPartialInterface::partialCallWithExecutionCont extLongAttribute(executionContext, *impl));
731 }
732 #endif // ENABLE(PARTIAL_CONDITION)
733
734 #if ENABLE(PARTIAL_CONDITION)
735 static void partialCallWithExecutionContextLongAttributeAttributeGetterCallback( v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
736 {
737 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
738 TestInterfaceImplementationV8Internal::partialCallWithExecutionContextLongAt tributeAttributeGetter(info);
739 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
740 }
741 #endif // ENABLE(PARTIAL_CONDITION)
742
743 #if ENABLE(PARTIAL_CONDITION)
744 static void partialCallWithExecutionContextLongAttributeAttributeSetter(v8::Loca l<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
745 {
746 v8::Handle<v8::Object> holder = info.Holder();
747 ExceptionState exceptionState(ExceptionState::SetterContext, "partialCallWit hExecutionContextLongAttribute", "TestInterface", holder, info.GetIsolate());
748 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
749 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState) , exceptionState);
750 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
751 TestPartialInterface::setPartialCallWithExecutionContextLongAttribute(execut ionContext, *impl, cppValue);
752 }
753 #endif // ENABLE(PARTIAL_CONDITION)
754
755 #if ENABLE(PARTIAL_CONDITION)
756 static void partialCallWithExecutionContextLongAttributeAttributeSetterCallback( v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackI nfo<void>& info)
757 {
758 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
759 TestInterfaceImplementationV8Internal::partialCallWithExecutionContextLongAt tributeAttributeSetter(v8Value, info);
760 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
761 }
762 #endif // ENABLE(PARTIAL_CONDITION)
763
764 #if ENABLE(PARTIAL_CONDITION)
765 static void partialPartialEnumTypeAttributeAttributeGetter(const v8::PropertyCal lbackInfo<v8::Value>& info)
766 {
767 v8::Handle<v8::Object> holder = info.Holder();
768 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
769 v8SetReturnValueString(info, TestPartialInterface::partialPartialEnumTypeAtt ribute(*impl), info.GetIsolate());
770 }
771 #endif // ENABLE(PARTIAL_CONDITION)
772
773 #if ENABLE(PARTIAL_CONDITION)
774 static void partialPartialEnumTypeAttributeAttributeGetterCallback(v8::Local<v8: :String>, const v8::PropertyCallbackInfo<v8::Value>& info)
775 {
776 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
777 TestInterfaceImplementationV8Internal::partialPartialEnumTypeAttributeAttrib uteGetter(info);
778 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
779 }
780 #endif // ENABLE(PARTIAL_CONDITION)
781
782 #if ENABLE(PARTIAL_CONDITION)
783 static void partialPartialEnumTypeAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
784 {
785 v8::Handle<v8::Object> holder = info.Holder();
786 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
787 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
788 String string = cppValue;
789 if (!(string == "foo" || string == "bar"))
790 return;
791 TestPartialInterface::setPartialPartialEnumTypeAttribute(*impl, cppValue);
792 }
793 #endif // ENABLE(PARTIAL_CONDITION)
794
795 #if ENABLE(PARTIAL_CONDITION)
796 static void partialPartialEnumTypeAttributeAttributeSetterCallback(v8::Local<v8: :String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& in fo)
797 {
798 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
799 TestInterfaceImplementationV8Internal::partialPartialEnumTypeAttributeAttrib uteSetter(v8Value, info);
800 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
801 }
802 #endif // ENABLE(PARTIAL_CONDITION)
803
804 #if ENABLE(PARTIAL_CONDITION)
805 static void stringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Va lue>& info)
806 {
807 v8::Handle<v8::Object> holder = info.Holder();
808 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
809 String result;
810 if (!V8TestInterface::PrivateScript::stringAttributeAttributeGetter(toFrameI fNotDetached(info.GetIsolate()->GetCurrentContext()), impl, &result))
811 return;
812 v8SetReturnValueString(info, result, info.GetIsolate());
813 }
814 #endif // ENABLE(PARTIAL_CONDITION)
815
816 #if ENABLE(PARTIAL_CONDITION)
817 static void stringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
818 {
819 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
820 TestInterfaceImplementationV8Internal::stringAttributeAttributeGetter(info);
821 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
822 }
823 #endif // ENABLE(PARTIAL_CONDITION)
824
825 #if ENABLE(PARTIAL_CONDITION)
826 static void stringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v 8::PropertyCallbackInfo<void>& info)
827 {
828 v8::Handle<v8::Object> holder = info.Holder();
829 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
830 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
831 V8TestInterface::PrivateScript::stringAttributeAttributeSetter(toFrameIfNotD etached(info.GetIsolate()->GetCurrentContext()), impl, cppValue);
832 }
833 #endif // ENABLE(PARTIAL_CONDITION)
834
835 #if ENABLE(PARTIAL_CONDITION)
836 static void stringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Lo cal<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
837 {
838 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
839 TestInterfaceImplementationV8Internal::stringAttributeAttributeSetter(v8Valu e, info);
840 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
841 }
842 #endif // ENABLE(PARTIAL_CONDITION)
843
844 static void partial2LongAttributeAttributeGetter(const v8::PropertyCallbackInfo< v8::Value>& info)
845 {
846 v8::Handle<v8::Object> holder = info.Holder();
847 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
848 v8SetReturnValueInt(info, TestPartialInterfaceImplementation::partial2LongAt tribute(*impl));
849 }
850
851 static void partial2LongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
852 {
853 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
854 TestInterfaceImplementationV8Internal::partial2LongAttributeAttributeGetter( info);
855 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
856 }
857
858 static void partial2LongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, c onst v8::PropertyCallbackInfo<void>& info)
859 {
860 v8::Handle<v8::Object> holder = info.Holder();
861 ExceptionState exceptionState(ExceptionState::SetterContext, "partial2LongAt tribute", "TestInterface", holder, info.GetIsolate());
862 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
863 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState) , exceptionState);
864 TestPartialInterfaceImplementation::setPartial2LongAttribute(*impl, cppValue );
865 }
866
867 static void partial2LongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
868 {
869 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
870 TestInterfaceImplementationV8Internal::partial2LongAttributeAttributeSetter( v8Value, info);
871 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
872 }
873
874 static void partial2StaticLongAttributeAttributeGetter(const v8::PropertyCallbac kInfo<v8::Value>& info)
875 {
876 v8SetReturnValueInt(info, TestPartialInterfaceImplementation::partial2Static LongAttribute());
877 }
878
879 static void partial2StaticLongAttributeAttributeGetterCallback(v8::Local<v8::Str ing>, const v8::PropertyCallbackInfo<v8::Value>& info)
880 {
881 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
882 TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeG etter(info);
883 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
884 }
885
886 static void partial2StaticLongAttributeAttributeSetter(v8::Local<v8::Value> v8Va lue, const v8::PropertyCallbackInfo<void>& info)
887 {
888 ExceptionState exceptionState(ExceptionState::SetterContext, "partial2Static LongAttribute", "TestInterface", holder, info.GetIsolate());
889 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState) , exceptionState);
890 TestPartialInterfaceImplementation::setPartial2StaticLongAttribute(cppValue) ;
891 }
892
893 static void partial2StaticLongAttributeAttributeSetterCallback(v8::Local<v8::Str ing>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
894 {
895 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
896 TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeS etter(v8Value, info);
897 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
898 }
899
900 static void partial3LongAttributeAttributeGetter(const v8::PropertyCallbackInfo< v8::Value>& info)
901 {
902 v8::Handle<v8::Object> holder = info.Holder();
903 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
904 v8SetReturnValueInt(info, TestPartialInterfaceImplementation3::partial3LongA ttribute(*impl));
905 }
906
907 static void partial3LongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
908 {
909 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
910 TestInterfaceImplementationV8Internal::partial3LongAttributeAttributeGetter( info);
911 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
912 }
913
914 static void partial3LongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, c onst v8::PropertyCallbackInfo<void>& info)
915 {
916 v8::Handle<v8::Object> holder = info.Holder();
917 ExceptionState exceptionState(ExceptionState::SetterContext, "partial3LongAt tribute", "TestInterface", holder, info.GetIsolate());
918 TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
919 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState) , exceptionState);
920 TestPartialInterfaceImplementation3::setPartial3LongAttribute(*impl, cppValu e);
921 }
922
923 static void partial3LongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
924 {
925 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
926 TestInterfaceImplementationV8Internal::partial3LongAttributeAttributeSetter( v8Value, info);
927 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
928 }
929
930 static void partial3StaticLongAttributeAttributeGetter(const v8::PropertyCallbac kInfo<v8::Value>& info)
931 {
932 v8SetReturnValueInt(info, TestPartialInterfaceImplementation3::partial3Stati cLongAttribute());
933 }
934
935 static void partial3StaticLongAttributeAttributeGetterCallback(v8::Local<v8::Str ing>, const v8::PropertyCallbackInfo<v8::Value>& info)
936 {
937 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
938 TestInterfaceImplementationV8Internal::partial3StaticLongAttributeAttributeG etter(info);
939 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
940 }
941
942 static void partial3StaticLongAttributeAttributeSetter(v8::Local<v8::Value> v8Va lue, const v8::PropertyCallbackInfo<void>& info)
943 {
944 ExceptionState exceptionState(ExceptionState::SetterContext, "partial3Static LongAttribute", "TestInterface", holder, info.GetIsolate());
945 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState) , exceptionState);
946 TestPartialInterfaceImplementation3::setPartial3StaticLongAttribute(cppValue );
947 }
948
949 static void partial3StaticLongAttributeAttributeSetterCallback(v8::Local<v8::Str ing>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
950 {
951 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
952 TestInterfaceImplementationV8Internal::partial3StaticLongAttributeAttributeS etter(v8Value, info);
953 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
954 }
955
956 static void TestInterfaceImplementationConstructorGetter(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
957 {
958 v8::Handle<v8::Value> data = info.Data();
959 ASSERT(data->IsExternal());
960 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext());
961 if (!perContextData)
962 return;
963 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data)));
964 }
965
966 static void TestInterfaceImplementationForceSetAttributeOnThis(v8::Local<v8::Str ing> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& i nfo)
967 {
968 if (info.This()->IsObject())
969 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value);
970 }
971
972 static void TestInterfaceImplementationForceSetAttributeOnThisCallback(v8::Local <v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo< void>& info)
973 {
974 TestInterfaceImplementationV8Internal::TestInterfaceImplementationForceSetAt tributeOnThis(name, v8Value, info);
975 }
976
977 static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info)
978 {
979 if (UNLIKELY(info.Length() < 1)) {
980 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodTestInterfaceEmptyArg", "TestInterface", 1, info.Length(), info.GetIsol ate()), info.GetIsolate());
981 return;
982 }
983 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
984 TestInterfaceEmpty* testInterfaceEmptyArg;
985 {
986 v8::TryCatch block;
987 V8RethrowTryCatchScope rethrow(block);
988 if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], inf o.GetIsolate())) {
989 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "voidMethodTestInterfaceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpty'."), info.GetIsolate());
990 return;
991 }
992 TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toIm plWithTypeCheck(info.GetIsolate(), info[0]));
993 }
994 impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg);
995 }
996
997 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info)
998 {
999 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1000 TestInterfaceImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethod (info);
1001 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1002 }
1003
1004 static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info)
1005 {
1006 if (UNLIKELY(info.Length() < 2)) {
1007 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodDoubleArgFloatArg", "TestInterface", 2, info.Length(), info.GetIsolate( )), info.GetIsolate());
1008 return;
1009 }
1010 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1011 double doubleArg;
1012 float floatArg;
1013 {
1014 v8::TryCatch block;
1015 V8RethrowTryCatchScope rethrow(block);
1016 TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberVal ue()));
1017 if (!std::isfinite(doubleArg)) {
1018 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "voidMethodDoubleArgFloatArg", "TestInterface", "double parameter 1 is non-finit e."), info.GetIsolate());
1019 return;
1020 }
1021 TONATIVE_VOID_INTERNAL(floatArg, static_cast<float>(info[1]->NumberValue ()));
1022 if (!std::isfinite(floatArg)) {
1023 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "voidMethodDoubleArgFloatArg", "TestInterface", "float parameter 2 is non-finite ."), info.GetIsolate());
1024 return;
1025 }
1026 }
1027 impl->voidMethodDoubleArgFloatArg(doubleArg, floatArg);
1028 }
1029
1030 static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info)
1031 {
1032 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1033 TestInterfaceImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(inf o);
1034 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1035 }
1036
1037 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8:: FunctionCallbackInfo<v8::Value>& info)
1038 {
1039 if (UNLIKELY(info.Length() < 2)) {
1040 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", "TestInterface", 2, info.Le ngth(), info.GetIsolate()), info.GetIsolate());
1041 return;
1042 }
1043 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1044 double unrestrictedDoubleArg;
1045 float unrestrictedFloatArg;
1046 {
1047 v8::TryCatch block;
1048 V8RethrowTryCatchScope rethrow(block);
1049 TONATIVE_VOID_INTERNAL(unrestrictedDoubleArg, static_cast<double>(info[0 ]->NumberValue()));
1050 TONATIVE_VOID_INTERNAL(unrestrictedFloatArg, static_cast<float>(info[1]- >NumberValue()));
1051 }
1052 impl->voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestrictedDouble Arg, unrestrictedFloatArg);
1053 }
1054
1055 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(co nst v8::FunctionCallbackInfo<v8::Value>& info)
1056 {
1057 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1058 TestInterfaceImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrest rictedFloatArgMethod(info);
1059 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1060 }
1061
1062 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1063 {
1064 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1065 impl->voidMethod();
1066 }
1067
1068 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
1069 {
1070 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1071 TestInterfaceImplementationV8Internal::voidMethodMethod(info);
1072 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1073 }
1074
1075 static void voidMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Valu e>& info)
1076 {
1077 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1078 impl->voidMethod();
1079 }
1080
1081 static void voidMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo< v8::Value>& info)
1082 {
1083 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1084 TestInterfaceImplementationV8Internal::voidMethodMethodForMainWorld(info);
1085 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1086 }
1087
1088 static void alwaysExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1089 {
1090 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1091 impl->alwaysExposedMethod();
1092 }
1093
1094 static void alwaysExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info)
1095 {
1096 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1097 TestInterfaceImplementationV8Internal::alwaysExposedMethodMethod(info);
1098 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1099 }
1100
1101 static void workerExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1102 {
1103 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1104 impl->workerExposedMethod();
1105 }
1106
1107 static void workerExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info)
1108 {
1109 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1110 TestInterfaceImplementationV8Internal::workerExposedMethodMethod(info);
1111 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1112 }
1113
1114 static void windowExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1115 {
1116 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1117 impl->windowExposedMethod();
1118 }
1119
1120 static void windowExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info)
1121 {
1122 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1123 TestInterfaceImplementationV8Internal::windowExposedMethodMethod(info);
1124 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1125 }
1126
1127 static void alwaysExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::V alue>& info)
1128 {
1129 TestInterfaceImplementation::alwaysExposedStaticMethod();
1130 }
1131
1132 static void alwaysExposedStaticMethodMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info)
1133 {
1134 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1135 TestInterfaceImplementationV8Internal::alwaysExposedStaticMethodMethod(info) ;
1136 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1137 }
1138
1139 static void workerExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::V alue>& info)
1140 {
1141 TestInterfaceImplementation::workerExposedStaticMethod();
1142 }
1143
1144 static void workerExposedStaticMethodMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info)
1145 {
1146 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1147 TestInterfaceImplementationV8Internal::workerExposedStaticMethodMethod(info) ;
1148 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1149 }
1150
1151 static void windowExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::V alue>& info)
1152 {
1153 TestInterfaceImplementation::windowExposedStaticMethod();
1154 }
1155
1156 static void windowExposedStaticMethodMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info)
1157 {
1158 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1159 TestInterfaceImplementationV8Internal::windowExposedStaticMethodMethod(info) ;
1160 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1161 }
1162
1163 static void windowAndServiceWorkerExposedMethodMethod(const v8::FunctionCallback Info<v8::Value>& info)
1164 {
1165 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1166 impl->windowAndServiceWorkerExposedMethod();
1167 }
1168
1169 static void windowAndServiceWorkerExposedMethodMethodCallback(const v8::Function CallbackInfo<v8::Value>& info)
1170 {
1171 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1172 TestInterfaceImplementationV8Internal::windowAndServiceWorkerExposedMethodMe thod(info);
1173 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1174 }
1175
1176 static void voidMethodPartailOverloadMethod(const v8::FunctionCallbackInfo<v8::V alue>& info)
1177 {
1178 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1179 impl->voidMethodPartailOverload();
1180 }
1181
1182 static void voidMethodPartailOverloadMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info)
1183 {
1184 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1185 TestInterfaceImplementationV8Internal::voidMethodPartailOverloadMethod(info) ;
1186 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1187 }
1188
1189 static void voidMethodPartailOverloadMethod(const v8::FunctionCallbackInfo<v8::V alue>& info)
1190 {
1191 TestInterfaceImplementation::voidMethodPartailOverload();
1192 }
1193
1194 static void voidMethodPartailOverloadMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info)
1195 {
1196 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1197 TestInterfaceImplementationV8Internal::voidMethodPartailOverloadMethod(info) ;
1198 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1199 }
1200
1201 static void implementsVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value> & info)
1202 {
1203 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1204 impl->implementsVoidMethod();
1205 }
1206
1207 static void implementsVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8 ::Value>& info)
1208 {
1209 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1210 TestInterfaceImplementationV8Internal::implementsVoidMethodMethod(info);
1211 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1212 }
1213
1214 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val ue>& info)
1215 {
1216 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsC omplexMethod", "TestInterface", info.Holder(), info.GetIsolate());
1217 if (UNLIKELY(info.Length() < 2)) {
1218 setMinimumArityTypeError(exceptionState, 2, info.Length());
1219 exceptionState.throwIfNeeded();
1220 return;
1221 }
1222 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1223 V8StringResource<> strArg;
1224 TestInterfaceEmpty* testInterfaceEmptyArg;
1225 {
1226 v8::TryCatch block;
1227 V8RethrowTryCatchScope rethrow(block);
1228 TOSTRING_VOID_INTERNAL(strArg, info[0]);
1229 if (info.Length() > 1 && !V8TestInterfaceEmpty::hasInstance(info[1], inf o.GetIsolate())) {
1230 exceptionState.throwTypeError("parameter 2 is not of type 'TestInter faceEmpty'.");
1231 exceptionState.throwIfNeeded();
1232 return;
1233 }
1234 TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toIm plWithTypeCheck(info.GetIsolate(), info[1]));
1235 }
1236 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
1237 RefPtr<TestInterfaceEmpty> result = impl->implementsComplexMethod(executionC ontext, strArg, testInterfaceEmptyArg, exceptionState);
1238 if (exceptionState.hadException()) {
1239 exceptionState.throwIfNeeded();
1240 return;
1241 }
1242 v8SetReturnValue(info, result.release());
1243 }
1244
1245 static void implementsComplexMethodMethodCallback(const v8::FunctionCallbackInfo <v8::Value>& info)
1246 {
1247 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1248 TestInterfaceImplementationV8Internal::implementsComplexMethodMethod(info);
1249 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1250 }
1251
1252 static void implementsCustomVoidMethodMethodCallback(const v8::FunctionCallbackI nfo<v8::Value>& info)
1253 {
1254 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1255 V8TestInterface::implementsCustomVoidMethodMethodCustom(info);
1256 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1257 }
1258
1259 static void implementsStaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8:: Value>& info)
1260 {
1261 TestInterfaceImplementation::implementsStaticVoidMethod();
1262 }
1263
1264 static void implementsStaticVoidMethodMethodCallback(const v8::FunctionCallbackI nfo<v8::Value>& info)
1265 {
1266 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1267 TestInterfaceImplementationV8Internal::implementsStaticVoidMethodMethod(info );
1268 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1269 }
1270
1271 static void implements2VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value >& info)
1272 {
1273 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1274 TestImplements2::implements2VoidMethod(*impl);
1275 }
1276
1277 static void implements2VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v 8::Value>& info)
1278 {
1279 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1280 TestInterfaceImplementationV8Internal::implements2VoidMethodMethod(info);
1281 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1282 }
1283
1284 static void implements3VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value >& info)
1285 {
1286 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1287 TestImplements3Implementation::implements3VoidMethod(*impl);
1288 }
1289
1290 static void implements3VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v 8::Value>& info)
1291 {
1292 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1293 TestInterfaceImplementationV8Internal::implements3VoidMethodMethod(info);
1294 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1295 }
1296
1297 static void implements3StaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8: :Value>& info)
1298 {
1299 TestImplements3Implementation::implements3StaticVoidMethod();
1300 }
1301
1302 static void implements3StaticVoidMethodMethodCallback(const v8::FunctionCallback Info<v8::Value>& info)
1303 {
1304 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1305 TestInterfaceImplementationV8Internal::implements3StaticVoidMethodMethod(inf o);
1306 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1307 }
1308
1309 #if ENABLE(PARTIAL_CONDITION)
1310 static void partialVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
1311 {
1312 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1313 TestPartialInterface::partialVoidMethod(*impl);
1314 }
1315 #endif // ENABLE(PARTIAL_CONDITION)
1316
1317 #if ENABLE(PARTIAL_CONDITION)
1318 static void partialVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::V alue>& info)
1319 {
1320 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1321 TestInterfaceImplementationV8Internal::partialVoidMethodMethod(info);
1322 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1323 }
1324 #endif // ENABLE(PARTIAL_CONDITION)
1325
1326 #if ENABLE(PARTIAL_CONDITION)
1327 static void partialStaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Val ue>& info)
1328 {
1329 TestPartialInterface::partialStaticVoidMethod();
1330 }
1331 #endif // ENABLE(PARTIAL_CONDITION)
1332
1333 #if ENABLE(PARTIAL_CONDITION)
1334 static void partialStaticVoidMethodMethodCallback(const v8::FunctionCallbackInfo <v8::Value>& info)
1335 {
1336 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1337 TestInterfaceImplementationV8Internal::partialStaticVoidMethodMethod(info);
1338 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1339 }
1340 #endif // ENABLE(PARTIAL_CONDITION)
1341
1342 #if ENABLE(PARTIAL_CONDITION)
1343 static void partialVoidMethodLongArgMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info)
1344 {
1345 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialVoid MethodLongArg", "TestInterface", info.Holder(), info.GetIsolate());
1346 if (UNLIKELY(info.Length() < 1)) {
1347 setMinimumArityTypeError(exceptionState, 1, info.Length());
1348 exceptionState.throwIfNeeded();
1349 return;
1350 }
1351 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1352 int longArg;
1353 {
1354 v8::TryCatch block;
1355 V8RethrowTryCatchScope rethrow(block);
1356 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[0], exceptio nState), exceptionState);
1357 }
1358 TestPartialInterface::partialVoidMethodLongArg(*impl, longArg);
1359 }
1360 #endif // ENABLE(PARTIAL_CONDITION)
1361
1362 #if ENABLE(PARTIAL_CONDITION)
1363 static void partialVoidMethodLongArgMethodCallback(const v8::FunctionCallbackInf o<v8::Value>& info)
1364 {
1365 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1366 TestInterfaceImplementationV8Internal::partialVoidMethodLongArgMethod(info);
1367 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1368 }
1369 #endif // ENABLE(PARTIAL_CONDITION)
1370
1371 #if ENABLE(PARTIAL_CONDITION)
1372 static void partialCallWithExecutionContextRaisesExceptionVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1373 {
1374 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialCall WithExecutionContextRaisesExceptionVoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
1375 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1376 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
1377 TestPartialInterface::partialCallWithExecutionContextRaisesExceptionVoidMeth od(executionContext, *impl, exceptionState);
1378 if (exceptionState.hadException()) {
1379 exceptionState.throwIfNeeded();
1380 return;
1381 }
1382 }
1383 #endif // ENABLE(PARTIAL_CONDITION)
1384
1385 #if ENABLE(PARTIAL_CONDITION)
1386 static void partialCallWithExecutionContextRaisesExceptionVoidMethodMethodCallba ck(const v8::FunctionCallbackInfo<v8::Value>& info)
1387 {
1388 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1389 TestInterfaceImplementationV8Internal::partialCallWithExecutionContextRaises ExceptionVoidMethodMethod(info);
1390 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1391 }
1392 #endif // ENABLE(PARTIAL_CONDITION)
1393
1394 #if ENABLE(PARTIAL_CONDITION)
1395 static void partialVoidMethodPartialCallbackTypeArgMethod(const v8::FunctionCall backInfo<v8::Value>& info)
1396 {
1397 if (UNLIKELY(info.Length() < 1)) {
1398 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("p artialVoidMethodPartialCallbackTypeArg", "TestInterface", 1, info.Length(), info .GetIsolate()), info.GetIsolate());
1399 return;
1400 }
1401 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1402 ScriptValue partialCallbackTypeArg;
1403 {
1404 v8::TryCatch block;
1405 V8RethrowTryCatchScope rethrow(block);
1406 TONATIVE_VOID_INTERNAL(partialCallbackTypeArg, ScriptValue(ScriptState:: current(info.GetIsolate()), info[0]));
1407 }
1408 TestPartialInterface::partialVoidMethodPartialCallbackTypeArg(*impl, partial CallbackTypeArg);
1409 }
1410 #endif // ENABLE(PARTIAL_CONDITION)
1411
1412 #if ENABLE(PARTIAL_CONDITION)
1413 static void partialVoidMethodPartialCallbackTypeArgMethodCallback(const v8::Func tionCallbackInfo<v8::Value>& info)
1414 {
1415 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1416 TestInterfaceImplementationV8Internal::partialVoidMethodPartialCallbackTypeA rgMethod(info);
1417 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1418 }
1419 #endif // ENABLE(PARTIAL_CONDITION)
1420
1421 #if ENABLE(PARTIAL_CONDITION)
1422 static void shortMethodWithShortArgumentImplementedInPrivateScriptMethod(const v 8::FunctionCallbackInfo<v8::Value>& info)
1423 {
1424 ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod WithShortArgumentImplementedInPrivateScript", "TestInterface", info.Holder(), in fo.GetIsolate());
1425 if (UNLIKELY(info.Length() < 1)) {
1426 setMinimumArityTypeError(exceptionState, 1, info.Length());
1427 exceptionState.throwIfNeeded();
1428 return;
1429 }
1430 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1431 int value;
1432 {
1433 v8::TryCatch block;
1434 V8RethrowTryCatchScope rethrow(block);
1435 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(value, toInt16(info[0], exceptionS tate), exceptionState);
1436 }
1437 int result = 0;
1438 if (!V8TestInterface::PrivateScript::shortMethodWithShortArgumentImplemented InPrivateScriptMethod(toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext( )), impl, value, &result))
1439 return;
1440 v8SetReturnValueInt(info, result);
1441 }
1442 #endif // ENABLE(PARTIAL_CONDITION)
1443
1444 #if ENABLE(PARTIAL_CONDITION)
1445 static void shortMethodWithShortArgumentImplementedInPrivateScriptMethodCallback (const v8::FunctionCallbackInfo<v8::Value>& info)
1446 {
1447 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1448 TestInterfaceImplementationV8Internal::shortMethodWithShortArgumentImplement edInPrivateScriptMethod(info);
1449 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1450 }
1451 #endif // ENABLE(PARTIAL_CONDITION)
1452
1453 static void partial2VoidMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
1454 {
1455 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1456 TestPartialInterfaceImplementation::partial2VoidMethod(*impl);
1457 }
1458
1459 static void partial2StaticVoidMethod1Method(const v8::FunctionCallbackInfo<v8::V alue>& info)
1460 {
1461 TestPartialInterfaceImplementation::partial2StaticVoidMethod();
1462 }
1463
1464 static void voidMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8::V alue>& info)
1465 {
1466 if (UNLIKELY(info.Length() < 1)) {
1467 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodPartialOverload", "TestInterface", 1, info.Length(), info.GetIsolate()) , info.GetIsolate());
1468 return;
1469 }
1470 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1471 V8StringResource<> value;
1472 {
1473 TOSTRING_VOID_INTERNAL(value, info[0]);
1474 }
1475 TestPartialInterfaceImplementation3::voidMethodPartialOverload(*impl, value) ;
1476 }
1477
1478 static void voidMethodPartialOverloadMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info)
1479 {
1480 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1481 TestInterfaceImplementationV8Internal::voidMethodPartialOverloadMethod(info) ;
1482 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1483 }
1484
1485 static void voidMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8::V alue>& info)
1486 {
1487 if (UNLIKELY(info.Length() < 1)) {
1488 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodPartialOverload", "TestInterface", 1, info.Length(), info.GetIsolate()) , info.GetIsolate());
1489 return;
1490 }
1491 V8StringResource<> value;
1492 {
1493 TOSTRING_VOID_INTERNAL(value, info[0]);
1494 }
1495 TestPartialInterfaceImplementation3::voidMethodPartialOverload(value);
1496 }
1497
1498 static void voidMethodPartialOverloadMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info)
1499 {
1500 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1501 TestInterfaceImplementationV8Internal::voidMethodPartialOverloadMethod(info) ;
1502 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1503 }
1504
1505 static void partial2VoidMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
1506 {
1507 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1508 V8StringResource<> value;
1509 {
1510 TOSTRING_VOID_INTERNAL(value, info[0]);
1511 }
1512 TestPartialInterfaceImplementation3::partial2VoidMethod(*impl, value);
1513 }
1514
1515 static void partial2VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1516 {
1517 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partial2Voi dMethod", "TestInterface", info.Holder(), info.GetIsolate());
1518 switch (std::min(1, info.Length())) {
1519 case 0:
1520 if (true) {
1521 partial2VoidMethod1Method(info);
1522 return;
1523 }
1524 break;
1525 case 1:
1526 if (true) {
1527 partial2VoidMethod2Method(info);
1528 return;
1529 }
1530 break;
1531 default:
1532 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, i nfo.Length()));
1533 exceptionState.throwIfNeeded();
1534 return;
1535 }
1536 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
1537 exceptionState.throwIfNeeded();
1538 }
1539
1540 static void partial2VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8:: Value>& info)
1541 {
1542 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1543 TestInterfaceImplementationV8Internal::partial2VoidMethodMethod(info);
1544 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1545 }
1546
1547 static void partial2StaticVoidMethod2Method(const v8::FunctionCallbackInfo<v8::V alue>& info)
1548 {
1549 V8StringResource<> value;
1550 {
1551 TOSTRING_VOID_INTERNAL(value, info[0]);
1552 }
1553 TestPartialInterfaceImplementation3::partial2StaticVoidMethod(value);
1554 }
1555
1556 static void partial2StaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info)
1557 {
1558 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partial2Sta ticVoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
1559 switch (std::min(1, info.Length())) {
1560 case 0:
1561 if (true) {
1562 partial2StaticVoidMethod1Method(info);
1563 return;
1564 }
1565 break;
1566 case 1:
1567 if (true) {
1568 partial2StaticVoidMethod2Method(info);
1569 return;
1570 }
1571 break;
1572 default:
1573 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, i nfo.Length()));
1574 exceptionState.throwIfNeeded();
1575 return;
1576 }
1577 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
1578 exceptionState.throwIfNeeded();
1579 }
1580
1581 static void partial2StaticVoidMethodMethodCallback(const v8::FunctionCallbackInf o<v8::Value>& info)
1582 {
1583 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1584 TestInterfaceImplementationV8Internal::partial2StaticVoidMethodMethod(info);
1585 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1586 }
1587
1588 static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1589 {
1590 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1591 v8SetReturnValueString(info, impl->toString(), info.GetIsolate());
1592 }
1593
1594 static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in fo)
1595 {
1596 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1597 TestInterfaceImplementationV8Internal::toStringMethod(info);
1598 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1599 }
1600
1601 static void iteratorMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1602 {
1603 ExceptionState exceptionState(ExceptionState::ExecutionContext, "iterator", "TestInterface", info.Holder(), info.GetIsolate());
1604 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1605 ScriptState* scriptState = ScriptState::current(info.GetIsolate());
1606 RawPtr<Iterator> result = impl->iterator(scriptState, exceptionState);
1607 if (exceptionState.hadException()) {
1608 exceptionState.throwIfNeeded();
1609 return;
1610 }
1611 v8SetReturnValue(info, result.release());
1612 }
1613
1614 static void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in fo)
1615 {
1616 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1617 TestInterfaceImplementationV8Internal::iteratorMethod(info);
1618 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1619 }
1620
1621 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info)
1622 {
1623 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1624 String result = impl->anonymousIndexedGetter(index);
1625 if (result.isNull())
1626 return;
1627 v8SetReturnValueString(info, result, info.GetIsolate());
1628 }
1629
1630 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall backInfo<v8::Value>& info)
1631 {
1632 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
1633 TestInterfaceImplementationV8Internal::indexedPropertyGetter(index, info);
1634 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1635 }
1636
1637 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
1638 {
1639 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1640 TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value);
1641 bool result = impl->anonymousIndexedSetter(index, propertyValue);
1642 if (!result)
1643 return;
1644 v8SetReturnValue(info, v8Value);
1645 }
1646
1647 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
1648 {
1649 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
1650 TestInterfaceImplementationV8Internal::indexedPropertySetter(index, v8Value, info);
1651 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1652 }
1653
1654 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf o<v8::Boolean>& info)
1655 {
1656 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1657 DeleteResult result = impl->anonymousIndexedDeleter(index);
1658 if (result != DeleteUnknownProperty)
1659 return v8SetReturnValueBool(info, result == DeleteSuccess);
1660 }
1661
1662 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info)
1663 {
1664 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
1665 TestInterfaceImplementationV8Internal::indexedPropertyDeleter(index, info);
1666 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1667 }
1668
1669 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa llbackInfo<v8::Value>& info)
1670 {
1671 if (info.Holder()->HasRealNamedProperty(name))
1672 return;
1673 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
1674 return;
1675
1676 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1677 AtomicString propertyName = toCoreAtomicString(name);
1678 String result = impl->anonymousNamedGetter(propertyName);
1679 if (result.isNull())
1680 return;
1681 v8SetReturnValueString(info, result, info.GetIsolate());
1682 }
1683
1684 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info)
1685 {
1686 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
1687 TestInterfaceImplementationV8Internal::namedPropertyGetter(name, info);
1688 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1689 }
1690
1691 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
1692 {
1693 if (info.Holder()->HasRealNamedProperty(name))
1694 return;
1695 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
1696 return;
1697
1698 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1699 TOSTRING_VOID(V8StringResource<>, propertyName, name);
1700 TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value);
1701 bool result = impl->anonymousNamedSetter(propertyName, propertyValue);
1702 if (!result)
1703 return;
1704 v8SetReturnValue(info, v8Value);
1705 }
1706
1707 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
1708 {
1709 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
1710 TestInterfaceImplementationV8Internal::namedPropertySetter(name, v8Value, in fo);
1711 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1712 }
1713
1714 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info)
1715 {
1716 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1717 AtomicString propertyName = toCoreAtomicString(name);
1718 v8::String::Utf8Value namedProperty(name);
1719 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface", info.Holder(), info.GetIsolate());
1720 bool result = impl->namedPropertyQuery(propertyName, exceptionState);
1721 if (exceptionState.throwIfNeeded())
1722 return;
1723 if (!result)
1724 return;
1725 v8SetReturnValueInt(info, v8::None);
1726 }
1727
1728 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info)
1729 {
1730 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
1731 TestInterfaceImplementationV8Internal::namedPropertyQuery(name, info);
1732 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1733 }
1734
1735 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info)
1736 {
1737 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1738 AtomicString propertyName = toCoreAtomicString(name);
1739 DeleteResult result = impl->anonymousNamedDeleter(propertyName);
1740 if (result != DeleteUnknownProperty)
1741 return v8SetReturnValueBool(info, result == DeleteSuccess);
1742 }
1743
1744 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Boolean>& info)
1745 {
1746 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
1747 TestInterfaceImplementationV8Internal::namedPropertyDeleter(name, info);
1748 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1749 }
1750
1751 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo)
1752 {
1753 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1754 Vector<String> names;
1755 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestInter face", info.Holder(), info.GetIsolate());
1756 impl->namedPropertyEnumerator(names, exceptionState);
1757 if (exceptionState.throwIfNeeded())
1758 return;
1759 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size ());
1760 for (size_t i = 0; i < names.size(); ++i)
1761 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs olate(), names[i]));
1762 v8SetReturnValue(info, v8names);
1763 }
1764
1765 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info)
1766 {
1767 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
1768 TestInterfaceImplementationV8Internal::namedPropertyEnumerator(info);
1769 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1770 }
1771
1772 } // namespace TestInterfaceImplementationV8Internal
1773
1774 void V8TestInterface::visitDOMWrapper(ScriptWrappableBase* internalPointer, cons t v8::Persistent<v8::Object>& wrapper, v8::Isolate* isolate)
1775 {
1776 TestInterfaceImplementation* impl = internalPointer->toImpl<TestInterfaceImp lementation>();
1777 v8::Local<v8::Object> creationContext = v8::Local<v8::Object>::New(isolate, wrapper);
1778 V8WrapperInstantiationScope scope(creationContext, isolate);
1779 TestInterfaceImplementation* referencedName = impl->referencedName();
1780 if (referencedName) {
1781 if (!DOMDataStore::containsWrapper<V8TestInterface>(referencedName, isol ate))
1782 wrap(referencedName, creationContext, isolate);
1783 DOMDataStore::setWrapperReference<V8TestInterface>(wrapper, referencedNa me, isolate);
1784 }
1785 setObjectGroup(internalPointer, wrapper, isolate);
1786 }
1787
1788 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceAttribute s[] = {
1789 {"testInterfaceAttribute", TestInterfaceImplementationV8Internal::testInterf aceAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::test InterfaceAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessContro l>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguratio n::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
1790 {"testInterfaceConstructorAttribute", TestInterfaceImplementationV8Internal: :TestInterfaceImplementationConstructorGetter, TestInterfaceImplementationV8Inte rnal::TestInterfaceImplementationForceSetAttributeOnThisCallback, 0, 0, const_ca st<WrapperTypeInfo*>(&V8TestInterface::wrapperTypeInfo), static_cast<v8::AccessC ontrol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMCon figuration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
1791 {"doubleAttribute", TestInterfaceImplementationV8Internal::doubleAttributeAt tributeGetterCallback, TestInterfaceImplementationV8Internal::doubleAttributeAtt ributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), stat ic_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScript s, V8DOMConfiguration::OnInstance},
1792 {"floatAttribute", TestInterfaceImplementationV8Internal::floatAttributeAttr ibuteGetterCallback, TestInterfaceImplementationV8Internal::floatAttributeAttrib uteSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_ cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
1793 {"unrestrictedDoubleAttribute", TestInterfaceImplementationV8Internal::unres trictedDoubleAttributeAttributeGetterCallback, TestInterfaceImplementationV8Inte rnal::unrestrictedDoubleAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v 8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8 DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
1794 {"unrestrictedFloatAttribute", TestInterfaceImplementationV8Internal::unrest rictedFloatAttributeAttributeGetterCallback, TestInterfaceImplementationV8Intern al::unrestrictedFloatAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8:: AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOM Configuration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
1795 {"alwaysExposedAttribute", TestInterfaceImplementationV8Internal::alwaysExpo sedAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::alwa ysExposedAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessContro l>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguratio n::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
1796 {"implementsReadonlyStringAttribute", TestInterfaceImplementationV8Internal: :implementsReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_ca st<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None) , V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
1797 {"implementsStringAttribute", TestInterfaceImplementationV8Internal::impleme ntsStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal ::implementsStringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::Acc essControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMCon figuration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
1798 {"implementsNodeAttribute", TestInterfaceImplementationV8Internal::implement sNodeAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::im plementsNodeAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessCon trol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigura tion::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
1799 {"implementsEventHandlerAttribute", TestInterfaceImplementationV8Internal::i mplementsEventHandlerAttributeAttributeGetterCallback, TestInterfaceImplementati onV8Internal::implementsEventHandlerAttributeAttributeSetterCallback, 0, 0, 0, s tatic_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v 8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstanc e},
1800 {"implements3StringAttribute", TestInterfaceImplementationV8Internal::implem ents3StringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Intern al::implements3StringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8:: AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOM Configuration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
1801 };
1802
1803 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceMethods[] = {
1804 {"voidMethodTestInterfaceEmptyArg", TestInterfaceImplementationV8Internal::v oidMethodTestInterfaceEmptyArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedT oAllScripts},
1805 {"voidMethodDoubleArgFloatArg", TestInterfaceImplementationV8Internal::voidM ethodDoubleArgFloatArgMethodCallback, 0, 2, V8DOMConfiguration::ExposedToAllScri pts},
1806 {"voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", TestInterfaceImpleme ntationV8Internal::voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCall back, 0, 2, V8DOMConfiguration::ExposedToAllScripts},
1807 {"voidMethod", TestInterfaceImplementationV8Internal::voidMethodMethodCallba ck, TestInterfaceImplementationV8Internal::voidMethodMethodCallbackForMainWorld, 0, V8DOMConfiguration::ExposedToAllScripts},
1808 {"alwaysExposedMethod", TestInterfaceImplementationV8Internal::alwaysExposed MethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
1809 {"voidMethodPartailOverload", TestInterfaceImplementationV8Internal::voidMet hodPartailOverloadMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts} ,
1810 {"implementsVoidMethod", TestInterfaceImplementationV8Internal::implementsVo idMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
1811 {"implementsComplexMethod", TestInterfaceImplementationV8Internal::implement sComplexMethodMethodCallback, 0, 2, V8DOMConfiguration::ExposedToAllScripts},
1812 {"implementsCustomVoidMethod", TestInterfaceImplementationV8Internal::implem entsCustomVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScript s},
1813 {"implements3VoidMethod", TestInterfaceImplementationV8Internal::implements3 VoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
1814 {"partial2VoidMethod", TestInterfaceImplementationV8Internal::partial2VoidMe thodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
1815 };
1816
1817 static void installV8TestInterfaceTemplate(v8::Handle<v8::FunctionTemplate> func tionTemplate, v8::Isolate* isolate)
1818 {
1819 functionTemplate->ReadOnlyPrototype();
1820
1821 v8::Local<v8::Signature> defaultSignature;
1822 if (!RuntimeEnabledFeatures::featureNameEnabled())
1823 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterface::intern alFieldCount, 0, 0, 0, 0, 0, 0, isolate);
1824 else
1825 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "TestInterface", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInte rface::internalFieldCount,
1826 V8TestInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceAttribute s),
1827 0, 0,
1828 V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods),
1829 isolate);
1830 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla te->InstanceTemplate();
1831 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl ate->PrototypeTemplate();
1832 if (RuntimeEnabledFeatures::implementsFeatureNameEnabled()) {
1833 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
1834 {"implementsRuntimeEnabledNodeAttribute", TestInterfaceImplementationV8I nternal::implementsRuntimeEnabledNodeAttributeAttributeGetterCallback, TestInter faceImplementationV8Internal::implementsRuntimeEnabledNodeAttributeAttributeSett erCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8 ::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMCo nfiguration::OnInstance};
1835 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
1836 }
1837 if (RuntimeEnabledFeatures::implements2FeatureNameEnabled()) {
1838 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
1839 {"implements2StringAttribute", TestInterfaceImplementationV8Internal::im plements2StringAttributeAttributeGetterCallback, TestInterfaceImplementationV8In ternal::implements2StringAttributeAttributeSetterCallback, 0, 0, 0, static_cast< v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V 8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance};
1840 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
1841 }
1842 #if ENABLE(PARTIAL_CONDITION)
1843 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
1844 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
1845 {"partialLongAttribute", TestInterfaceImplementationV8Internal::partialL ongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::part ialLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl> (v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration: :ExposedToAllScripts, V8DOMConfiguration::OnInstance};
1846 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
1847 }
1848 #endif // ENABLE(PARTIAL_CONDITION)
1849 #if ENABLE(PARTIAL_CONDITION)
1850 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
1851 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
1852 {"partialCallWithExecutionContextLongAttribute", TestInterfaceImplementa tionV8Internal::partialCallWithExecutionContextLongAttributeAttributeGetterCallb ack, TestInterfaceImplementationV8Internal::partialCallWithExecutionContextLongA ttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEF AULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::Exposed ToAllScripts, V8DOMConfiguration::OnInstance};
1853 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
1854 }
1855 #endif // ENABLE(PARTIAL_CONDITION)
1856 #if ENABLE(PARTIAL_CONDITION)
1857 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
1858 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
1859 {"partialPartialEnumTypeAttribute", TestInterfaceImplementationV8Interna l::partialPartialEnumTypeAttributeAttributeGetterCallback, TestInterfaceImplemen tationV8Internal::partialPartialEnumTypeAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribut e>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnIns tance};
1860 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
1861 }
1862 #endif // ENABLE(PARTIAL_CONDITION)
1863 #if ENABLE(PARTIAL_CONDITION)
1864 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
1865 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
1866 {"stringAttribute", TestInterfaceImplementationV8Internal::stringAttribu teAttributeGetterCallback, TestInterfaceImplementationV8Internal::stringAttribut eAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllSc ripts, V8DOMConfiguration::OnInstance};
1867 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
1868 }
1869 #endif // ENABLE(PARTIAL_CONDITION)
1870 static const V8DOMConfiguration::ConstantConfiguration V8TestInterfaceConsta nts[] = {
1871 {"UNSIGNED_LONG", 0, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong} ,
1872 {"CONST_JAVASCRIPT", 1, 0, 0, V8DOMConfiguration::ConstantTypeShort},
1873 {"IMPLEMENTS_CONSTANT_1", 1, 0, 0, V8DOMConfiguration::ConstantTypeUnsig nedShort},
1874 {"IMPLEMENTS_CONSTANT_2", 2, 0, 0, V8DOMConfiguration::ConstantTypeUnsig nedShort},
1875 {"PARTIAL2_UNSIGNED_SHORT", 0, 0, 0, V8DOMConfiguration::ConstantTypeUns ignedShort},
1876 {"PARTIAL3_UNSIGNED_SHORT", 0, 0, 0, V8DOMConfiguration::ConstantTypeUns ignedShort},
1877 };
1878 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8 TestInterfaceConstants, WTF_ARRAY_LENGTH(V8TestInterfaceConstants), isolate);
1879 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
1880 static const V8DOMConfiguration::ConstantConfiguration constantConfigura tion = {"PARTIAL_UNSIGNED_SHORT", 0, 0, 0, V8DOMConfiguration::ConstantTypeUnsig nedShort};
1881 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate , &constantConfiguration, 1, isolate);
1882 }
1883 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestInterfac eImplementationV8Internal::indexedPropertyGetterCallback, TestInterfaceImplement ationV8Internal::indexedPropertySetterCallback, 0, TestInterfaceImplementationV8 Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterfac eImplementation>);
1884 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterfaceI mplementationV8Internal::namedPropertyGetterCallback, TestInterfaceImplementatio nV8Internal::namedPropertySetterCallback, TestInterfaceImplementationV8Internal: :namedPropertyQueryCallback, TestInterfaceImplementationV8Internal::namedPropert yDeleterCallback, TestInterfaceImplementationV8Internal::namedPropertyEnumerator Callback);
1885 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedI teratorConfiguration = { v8::Symbol::GetIterator, TestInterfaceImplementationV8I nternal::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts };
1886 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::D ontDelete, symbolKeyedIteratorConfiguration, isolate);
1887 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestInterfa ce::legacyCallCustom);
1888 static const V8DOMConfiguration::MethodConfiguration alwaysExposedStaticMeth odMethodConfiguration = {
1889 "alwaysExposedStaticMethod", TestInterfaceImplementationV8Internal::alwa ysExposedStaticMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScrip ts,
1890 };
1891 V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature> (), v8::None, alwaysExposedStaticMethodMethodConfiguration, isolate);
1892 static const V8DOMConfiguration::MethodConfiguration voidMethodPartailOverlo adMethodConfiguration = {
1893 "voidMethodPartailOverload", TestInterfaceImplementationV8Internal::void MethodPartailOverloadMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScrip ts,
1894 };
1895 V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature> (), v8::None, voidMethodPartailOverloadMethodConfiguration, isolate);
1896 static const V8DOMConfiguration::MethodConfiguration implementsStaticVoidMet hodMethodConfiguration = {
1897 "implementsStaticVoidMethod", TestInterfaceImplementationV8Internal::imp lementsStaticVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScr ipts,
1898 };
1899 V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature> (), v8::None, implementsStaticVoidMethodMethodConfiguration, isolate);
1900 if (RuntimeEnabledFeatures::implements2FeatureNameEnabled()) {
1901 static const V8DOMConfiguration::MethodConfiguration implements2VoidMeth odMethodConfiguration = {
1902 "implements2VoidMethod", TestInterfaceImplementationV8Internal::impl ements2VoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts,
1903 };
1904 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v 8::None, implements2VoidMethodMethodConfiguration, isolate);
1905 }
1906 static const V8DOMConfiguration::MethodConfiguration implements3StaticVoidMe thodMethodConfiguration = {
1907 "implements3StaticVoidMethod", TestInterfaceImplementationV8Internal::im plements3StaticVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllS cripts,
1908 };
1909 V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature> (), v8::None, implements3StaticVoidMethodMethodConfiguration, isolate);
1910 #if ENABLE(PARTIAL_CONDITION)
1911 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
1912 static const V8DOMConfiguration::MethodConfiguration partialVoidMethodMe thodConfiguration = {
1913 "partialVoidMethod", TestInterfaceImplementationV8Internal::partialV oidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts,
1914 };
1915 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v 8::None, partialVoidMethodMethodConfiguration, isolate);
1916 }
1917 #endif // ENABLE(PARTIAL_CONDITION)
1918 #if ENABLE(PARTIAL_CONDITION)
1919 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
1920 static const V8DOMConfiguration::MethodConfiguration partialStaticVoidMe thodMethodConfiguration = {
1921 "partialStaticVoidMethod", TestInterfaceImplementationV8Internal::pa rtialStaticVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScrip ts,
1922 };
1923 V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signat ure>(), v8::None, partialStaticVoidMethodMethodConfiguration, isolate);
1924 }
1925 #endif // ENABLE(PARTIAL_CONDITION)
1926 #if ENABLE(PARTIAL_CONDITION)
1927 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
1928 static const V8DOMConfiguration::MethodConfiguration partialVoidMethodLo ngArgMethodConfiguration = {
1929 "partialVoidMethodLongArg", TestInterfaceImplementationV8Internal::p artialVoidMethodLongArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScr ipts,
1930 };
1931 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v 8::None, partialVoidMethodLongArgMethodConfiguration, isolate);
1932 }
1933 #endif // ENABLE(PARTIAL_CONDITION)
1934 #if ENABLE(PARTIAL_CONDITION)
1935 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
1936 static const V8DOMConfiguration::MethodConfiguration partialCallWithExec utionContextRaisesExceptionVoidMethodMethodConfiguration = {
1937 "partialCallWithExecutionContextRaisesExceptionVoidMethod", TestInte rfaceImplementationV8Internal::partialCallWithExecutionContextRaisesExceptionVoi dMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts,
1938 };
1939 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v 8::None, partialCallWithExecutionContextRaisesExceptionVoidMethodMethodConfigura tion, isolate);
1940 }
1941 #endif // ENABLE(PARTIAL_CONDITION)
1942 #if ENABLE(PARTIAL_CONDITION)
1943 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
1944 static const V8DOMConfiguration::MethodConfiguration partialVoidMethodPa rtialCallbackTypeArgMethodConfiguration = {
1945 "partialVoidMethodPartialCallbackTypeArg", TestInterfaceImplementati onV8Internal::partialVoidMethodPartialCallbackTypeArgMethodCallback, 0, 1, V8DOM Configuration::ExposedToAllScripts,
1946 };
1947 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v 8::None, partialVoidMethodPartialCallbackTypeArgMethodConfiguration, isolate);
1948 }
1949 #endif // ENABLE(PARTIAL_CONDITION)
1950 #if ENABLE(PARTIAL_CONDITION)
1951 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
1952 static const V8DOMConfiguration::MethodConfiguration shortMethodWithShor tArgumentImplementedInPrivateScriptMethodConfiguration = {
1953 "shortMethodWithShortArgumentImplementedInPrivateScript", TestInterf aceImplementationV8Internal::shortMethodWithShortArgumentImplementedInPrivateScr iptMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts,
1954 };
1955 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v 8::None, shortMethodWithShortArgumentImplementedInPrivateScriptMethodConfigurati on, isolate);
1956 }
1957 #endif // ENABLE(PARTIAL_CONDITION)
1958 static const V8DOMConfiguration::MethodConfiguration partial2StaticVoidMetho dMethodConfiguration = {
1959 "partial2StaticVoidMethod", TestInterfaceImplementationV8Internal::parti al2StaticVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts ,
1960 };
1961 V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature> (), v8::None, partial2StaticVoidMethodMethodConfiguration, isolate);
1962 static const V8DOMConfiguration::MethodConfiguration toStringMethodConfigura tion = {
1963 "toString", TestInterfaceImplementationV8Internal::toStringMethodCallbac k, 0, 0, V8DOMConfiguration::ExposedToAllScripts,
1964 };
1965 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, stati c_cast<v8::PropertyAttribute>(v8::DontDelete | v8::DontEnum), toStringMethodConf iguration, isolate);
1966 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "staticStrin gAttribute"), TestInterfaceImplementationV8Internal::staticStringAttributeAttrib uteGetterCallback, TestInterfaceImplementationV8Internal::staticStringAttributeA ttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyA ttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::Access Control>(v8::DEFAULT));
1967 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implementsS taticReadOnlyLongAttribute"), TestInterfaceImplementationV8Internal::implementsS taticReadOnlyLongAttributeAttributeGetterCallback, 0, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignat ure>(), static_cast<v8::AccessControl>(v8::DEFAULT));
1968 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implementsS taticStringAttribute"), TestInterfaceImplementationV8Internal::implementsStaticS tringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::im plementsStaticStringAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignat ure>(), static_cast<v8::AccessControl>(v8::DEFAULT));
1969 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implements2 StaticStringAttribute"), TestInterfaceImplementationV8Internal::implements2Stati cStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal:: implements2StaticStringAttributeAttributeSetterCallback, v8::External::New(isola te, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSig nature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
1970 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implements3 StaticStringAttribute"), TestInterfaceImplementationV8Internal::implements3Stati cStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal:: implements3StaticStringAttributeAttributeSetterCallback, v8::External::New(isola te, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSig nature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
1971 #if ENABLE(PARTIAL_CONDITION)
1972 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "partialStat icLongAttribute"), TestInterfaceImplementationV8Internal::partialStaticLongAttri buteAttributeGetterCallback, TestInterfaceImplementationV8Internal::partialStati cLongAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cas t<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_ cast<v8::AccessControl>(v8::DEFAULT));
1973 #endif // ENABLE(PARTIAL_CONDITION)
1974 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "partial2Sta ticLongAttribute"), TestInterfaceImplementationV8Internal::partial2StaticLongAtt ributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partial2St aticLongAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_ cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), stat ic_cast<v8::AccessControl>(v8::DEFAULT));
1975 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "partial3Sta ticLongAttribute"), TestInterfaceImplementationV8Internal::partial3StaticLongAtt ributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partial3St aticLongAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_ cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), stat ic_cast<v8::AccessControl>(v8::DEFAULT));
1976
1977 // Custom toString template
1978 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate());
1979 }
1980
1981 v8::Handle<v8::FunctionTemplate> V8TestInterface::domTemplate(v8::Isolate* isola te)
1982 {
1983 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI nfo*>(&wrapperTypeInfo), installV8TestInterfaceTemplate);
1984 }
1985
1986 bool V8TestInterface::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* is olate)
1987 {
1988 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu e);
1989 }
1990
1991 v8::Handle<v8::Object> V8TestInterface::findInstanceInPrototypeChain(v8::Handle< v8::Value> v8Value, v8::Isolate* isolate)
1992 {
1993 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value);
1994 }
1995
1996 TestInterfaceImplementation* V8TestInterface::toImplWithTypeCheck(v8::Isolate* i solate, v8::Handle<v8::Value> value)
1997 {
1998 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle <v8::Object>::Cast(value))->toImpl<TestInterfaceImplementation>() : 0;
1999 }
2000
2001 void V8TestInterface::installConditionallyEnabledProperties(v8::Handle<v8::Objec t> instanceObject, v8::Isolate* isolate)
2002 {
2003 v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instance Object->GetPrototype());
2004 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext());
2005
2006 if (context && (context->isWorkerGlobalScope())) {
2007 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
2008 {"workerExposedAttribute", TestInterfaceImplementationV8Internal::worker ExposedAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal:: workerExposedAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessCo ntrol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigur ation::ExposedToAllScripts, V8DOMConfiguration::OnInstance};
2009 V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, at tributeConfiguration, isolate);
2010 }
2011 if (context && (context->isDocument())) {
2012 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
2013 {"windowExposedAttribute", TestInterfaceImplementationV8Internal::window ExposedAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal:: windowExposedAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessCo ntrol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigur ation::ExposedToAllScripts, V8DOMConfiguration::OnInstance};
2014 V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, at tributeConfiguration, isolate);
2015 }
2016 if (context && context->isDocument() && ContextFeatures::implementsContextNa meEnabled(toDocument(context))) {
2017 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
2018 {"implementsPerContextEnabledNodeAttribute", TestInterfaceImplementation V8Internal::implementsPerContextEnabledNodeAttributeAttributeGetterCallback, Tes tInterfaceImplementationV8Internal::implementsPerContextEnabledNodeAttributeAttr ibuteSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), stati c_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts , V8DOMConfiguration::OnInstance};
2019 V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, at tributeConfiguration, isolate);
2020 }
2021 if (context && context->isDocument() && ContextFeatures::partialContextNameE nabled(toDocument(context))) {
2022 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
2023 {"partial2LongAttribute", TestInterfaceImplementationV8Internal::partial 2LongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::pa rtial2LongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessContr ol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigurati on::ExposedToAllScripts, V8DOMConfiguration::OnInstance};
2024 V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, at tributeConfiguration, isolate);
2025 }
2026 if (context && context->isDocument() && ContextFeatures::partialContextNameE nabled(toDocument(context))) {
2027 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
2028 {"partial2StaticLongAttribute", TestInterfaceImplementationV8Internal::p artial2StaticLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8 Internal::partial2StaticLongAttributeAttributeSetterCallback, 0, 0, 0, static_ca st<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None) , V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance};
2029 V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, at tributeConfiguration, isolate);
2030 }
2031 if (context && context->isDocument() && ContextFeatures::partialContextName3 Enabled(toDocument(context))) {
2032 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
2033 {"partial3LongAttribute", TestInterfaceImplementationV8Internal::partial 3LongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::pa rtial3LongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessContr ol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigurati on::ExposedToAllScripts, V8DOMConfiguration::OnInstance};
2034 V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, at tributeConfiguration, isolate);
2035 }
2036 if (context && context->isDocument() && ContextFeatures::partialContextName3 Enabled(toDocument(context))) {
2037 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
2038 {"partial3StaticLongAttribute", TestInterfaceImplementationV8Internal::p artial3StaticLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8 Internal::partial3StaticLongAttributeAttributeSetterCallback, 0, 0, 0, static_ca st<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None) , V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance};
2039 V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, at tributeConfiguration, isolate);
2040 }
2041 }
2042
2043 void V8TestInterface::installConditionallyEnabledMethods(v8::Handle<v8::Object> prototypeObject, v8::Isolate* isolate)
2044 {
2045 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT emplate(isolate));
2046 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext());
2047 ASSERT(context);
2048
2049 if (context && (context->isWorkerGlobalScope())) {
2050 prototypeObject->Set(v8AtomicString(isolate, "workerExposedMethod"), v8: :FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::workerExp osedMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction());
2051 }
2052 if (context && (context->isDocument())) {
2053 prototypeObject->Set(v8AtomicString(isolate, "windowExposedMethod"), v8: :FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::windowExp osedMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction());
2054 }
2055 if (context && (context->isWorkerGlobalScope())) {
2056 prototypeObject->Set(v8AtomicString(isolate, "workerExposedStaticMethod" ), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::wor kerExposedStaticMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFu nction());
2057 }
2058 if (context && (context->isDocument())) {
2059 prototypeObject->Set(v8AtomicString(isolate, "windowExposedStaticMethod" ), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::win dowExposedStaticMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFu nction());
2060 }
2061 if (context && (context->isDocument() || context->isServiceWorkerGlobalScope ())) {
2062 prototypeObject->Set(v8AtomicString(isolate, "windowAndServiceWorkerExpo sedMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Int ernal::windowAndServiceWorkerExposedMethodMethodCallback, v8Undefined(), default Signature, 0)->GetFunction());
2063 }
2064 if (context && context->isDocument() && ContextFeatures::partialContextName3 Enabled(toDocument(context))) {
2065 prototypeObject->Set(v8AtomicString(isolate, "voidMethodPartialOverload" ), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::voi dMethodPartialOverloadMethodCallback, v8Undefined(), defaultSignature, 1)->GetFu nction());
2066 }
2067 if (context && context->isDocument() && ContextFeatures::partialContextName3 Enabled(toDocument(context))) {
2068 prototypeObject->Set(v8AtomicString(isolate, "voidMethodPartialOverload" ), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::voi dMethodPartialOverloadMethodCallback, v8Undefined(), defaultSignature, 1)->GetFu nction());
2069 }
2070 }
2071
2072 ActiveDOMObject* V8TestInterface::toActiveDOMObject(v8::Handle<v8::Object> wrapp er)
2073 {
2074 return toImpl(wrapper);
2075 }
2076
2077
2078 void V8TestInterface::refObject(ScriptWrappableBase* internalPointer)
2079 {
2080 internalPointer->toImpl<TestInterfaceImplementation>()->ref();
2081 }
2082
2083 void V8TestInterface::derefObject(ScriptWrappableBase* internalPointer)
2084 {
2085 internalPointer->toImpl<TestInterfaceImplementation>()->deref();
2086 }
2087
2088 WrapperPersistentNode* V8TestInterface::createPersistentHandle(ScriptWrappableBa se* internalPointer)
2089 {
2090 ASSERT_NOT_REACHED();
2091 return 0;
2092 }
2093
2094 template<>
2095 v8::Handle<v8::Value> toV8NoInline(TestInterfaceImplementation* impl, v8::Handle <v8::Object> creationContext, v8::Isolate* isolate)
2096 {
2097 return toV8(impl, creationContext, isolate);
2098 }
2099
2100 bool V8TestInterface::PrivateScript::shortMethodWithShortArgumentImplementedInPr ivateScriptMethod(LocalFrame* frame, TestInterface* holderImpl, int value, int* result)
2101 {
2102 if (!frame)
2103 return false;
2104 v8::HandleScope handleScope(toIsolate(frame));
2105 ScriptForbiddenScope::AllowUserAgentScript script;
2106 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat eScriptIsolatedWorld());
2107 if (context.IsEmpty())
2108 return false;
2109 ScriptState* scriptState = ScriptState::from(context);
2110 if (!scriptState->executionContext())
2111 return false;
2112
2113 ScriptState::Scope scope(scriptState);
2114 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob al(), scriptState->isolate());
2115
2116 v8::Handle<v8::Value> valueHandle = v8::Integer::New(scriptState->isolate(), value);
2117 v8::Handle<v8::Value> argv[] = { valueHandle };
2118 ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod WithShortArgumentImplementedInPrivateScript", "TestInterfaceImplementation", scr iptState->context()->Global(), scriptState->isolate());
2119 v8::TryCatch block;
2120 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat e, "TestInterfaceImplementation", "shortMethodWithShortArgumentImplementedInPriv ateScript", holder, 1, argv);
2121 if (block.HasCaught()) {
2122 PrivateScriptRunner::rethrowExceptionInPrivateScript(scriptState->isolat e(), exceptionState, block);
2123 block.ReThrow();
2124 return false;
2125 }
2126 TONATIVE_DEFAULT_EXCEPTIONSTATE(int, cppValue, toInt16(v8Value, exceptionSta te), exceptionState, false);
2127 RELEASE_ASSERT(!exceptionState.hadException());
2128 *result = cppValue;
2129 return true;
2130 }
2131
2132 bool V8TestInterface::PrivateScript::stringAttributeAttributeGetter(LocalFrame* frame, TestInterfaceImplementation* holderImpl, String* result)
2133 {
2134 if (!frame)
2135 return false;
2136 v8::HandleScope handleScope(toIsolate(frame));
2137 ScriptForbiddenScope::AllowUserAgentScript script;
2138 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat eScriptIsolatedWorld());
2139 if (context.IsEmpty())
2140 return false;
2141 ScriptState* scriptState = ScriptState::from(context);
2142 if (!scriptState->executionContext())
2143 return false;
2144
2145 ScriptState::Scope scope(scriptState);
2146 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob al(), scriptState->isolate());
2147
2148 ExceptionState exceptionState(ExceptionState::GetterContext, "stringAttribut e", "TestInterfaceImplementation", scriptState->context()->Global(), scriptState ->isolate());
2149 v8::TryCatch block;
2150 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(s criptState, "TestInterfaceImplementation", "stringAttribute", holder);
2151 if (block.HasCaught()) {
2152 PrivateScriptRunner::rethrowExceptionInPrivateScript(scriptState->isolat e(), exceptionState, block);
2153 block.ReThrow();
2154 return false;
2155 }
2156 TOSTRING_DEFAULT(V8StringResource<>, cppValue, v8Value, false);
2157 RELEASE_ASSERT(!exceptionState.hadException());
2158 *result = cppValue;
2159 return true;
2160 }
2161
2162 bool V8TestInterface::PrivateScript::stringAttributeAttributeSetter(LocalFrame* frame, TestInterfaceImplementation* holderImpl, String cppValue)
2163 {
2164 if (!frame)
2165 return false;
2166 v8::HandleScope handleScope(toIsolate(frame));
2167 ScriptForbiddenScope::AllowUserAgentScript script;
2168 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat eScriptIsolatedWorld());
2169 if (context.IsEmpty())
2170 return false;
2171 ScriptState* scriptState = ScriptState::from(context);
2172 if (!scriptState->executionContext())
2173 return false;
2174
2175 ScriptState::Scope scope(scriptState);
2176 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob al(), scriptState->isolate());
2177
2178 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttribut e", "TestInterfaceImplementation", scriptState->context()->Global(), scriptState ->isolate());
2179 v8::TryCatch block;
2180 PrivateScriptRunner::runDOMAttributeSetter(scriptState, "TestInterfaceImplem entation", "stringAttribute", holder, v8String(scriptState->isolate(), cppValue) );
2181 if (block.HasCaught()) {
2182 PrivateScriptRunner::rethrowExceptionInPrivateScript(scriptState->isolat e(), exceptionState, block);
2183 block.ReThrow();
2184 return false;
2185 }
2186 return true;
2187 }
2188
2189 } // namespace blink
2190 #endif // ENABLE(CONDITION)
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface.h ('k') | Source/bindings/tests/results/V8TestInterface2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698