DOM4: Add support for rest parameters to DOMTokenList
[WebKit.git] / Source / WebCore / bindings / scripts / test / V8 / V8TestObj.cpp
1 /*
2     This file is part of the WebKit open source project.
3     This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Library General Public
7     License as published by the Free Software Foundation; either
8     version 2 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13     Library General Public License for more details.
14
15     You should have received a copy of the GNU Library General Public License
16     along with this library; see the file COPYING.LIB.  If not, write to
17     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18     Boston, MA 02111-1307, USA.
19 */
20
21 #include "config.h"
22 #include "V8TestObj.h"
23
24 #include "BindingState.h"
25 #include "ContextFeatures.h"
26 #include "DOMStringList.h"
27 #include "Dictionary.h"
28 #include "ExceptionCode.h"
29 #include "FeatureObserver.h"
30 #include "Frame.h"
31 #include "HTMLNames.h"
32 #include "IDBBindingUtilities.h"
33 #include "IDBKey.h"
34 #include "RuntimeEnabledFeatures.h"
35 #include "SVGPropertyTearOff.h"
36 #include "SVGStaticPropertyTearOff.h"
37 #include "ScriptArguments.h"
38 #include "ScriptCallStack.h"
39 #include "ScriptCallStackFactory.h"
40 #include "ScriptProfile.h"
41 #include "ScriptValue.h"
42 #include "SerializedScriptValue.h"
43 #include "V8Binding.h"
44 #include "V8DOMStringList.h"
45 #include "V8DOMWrapper.h"
46 #include "V8Document.h"
47 #include "V8Float32Array.h"
48 #include "V8Node.h"
49 #include "V8SVGDocument.h"
50 #include "V8SVGPoint.h"
51 #include "V8ScriptProfile.h"
52 #include "V8TestCallback.h"
53 #include "V8TestSubObj.h"
54 #include "V8a.h"
55 #include "V8b.h"
56 #include "V8bool.h"
57 #include "V8d.h"
58 #include "V8e.h"
59 #include <wtf/Float32Array.h>
60 #include <wtf/GetPtr.h>
61 #include <wtf/RefCounted.h>
62 #include <wtf/RefPtr.h>
63 #include <wtf/UnusedParam.h>
64
65 #if ENABLE(Condition1)
66 #include "V8TestObjectA.h"
67 #endif
68
69 #if ENABLE(Condition1) && ENABLE(Condition2)
70 #include "V8TestObjectB.h"
71 #endif
72
73 #if ENABLE(Condition1) || ENABLE(Condition2)
74 #include "V8TestObjectC.h"
75 #endif
76
77 namespace WebCore {
78
79 WrapperTypeInfo V8TestObj::info = { V8TestObj::GetTemplate, V8TestObj::derefObject, 0, 0, 0, WrapperTypeObjectPrototype };
80
81 namespace TestObjV8Internal {
82
83 template <typename T> void V8_USE(T) { }
84
85 static v8::Handle<v8::Value> readOnlyLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
86 {
87     INC_STATS("DOM.TestObj.readOnlyLongAttr._get");
88     TestObj* imp = V8TestObj::toNative(info.Holder());
89     return v8Integer(imp->readOnlyLongAttr(), info.GetIsolate());
90 }
91
92 static v8::Handle<v8::Value> readOnlyStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
93 {
94     INC_STATS("DOM.TestObj.readOnlyStringAttr._get");
95     TestObj* imp = V8TestObj::toNative(info.Holder());
96     return v8String(imp->readOnlyStringAttr(), info.GetIsolate());
97 }
98
99 static v8::Handle<v8::Value> readOnlyTestObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
100 {
101     INC_STATS("DOM.TestObj.readOnlyTestObjAttr._get");
102     TestObj* imp = V8TestObj::toNative(info.Holder());
103     RefPtr<TestObj> result = imp->readOnlyTestObjAttr();
104     v8::Handle<v8::Value> wrapper = result.get() ? getDOMObjectMap(info.GetIsolate()).get(result.get()) : v8Undefined();
105     if (wrapper.IsEmpty()) {
106         wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
107         if (!wrapper.IsEmpty())
108             V8DOMWrapper::setNamedHiddenReference(info.Holder(), "readOnlyTestObjAttr", wrapper);
109     }
110     return wrapper;
111 }
112
113 static v8::Handle<v8::Value> staticReadOnlyLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
114 {
115     INC_STATS("DOM.TestObj.staticReadOnlyLongAttr._get");
116     return v8Integer(TestObj::staticReadOnlyLongAttr(), info.GetIsolate());
117 }
118
119 static v8::Handle<v8::Value> staticStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
120 {
121     INC_STATS("DOM.TestObj.staticStringAttr._get");
122     return v8String(TestObj::staticStringAttr(), info.GetIsolate());
123 }
124
125 static void staticStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
126 {
127     INC_STATS("DOM.TestObj.staticStringAttr._set");
128     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value);
129     TestObj::setStaticStringAttr(v);
130     return;
131 }
132
133 static v8::Handle<v8::Value> shortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
134 {
135     INC_STATS("DOM.TestObj.shortAttr._get");
136     TestObj* imp = V8TestObj::toNative(info.Holder());
137     return v8Integer(imp->shortAttr(), info.GetIsolate());
138 }
139
140 static void shortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
141 {
142     INC_STATS("DOM.TestObj.shortAttr._set");
143     TestObj* imp = V8TestObj::toNative(info.Holder());
144     int v = toInt32(value);
145     imp->setShortAttr(v);
146     return;
147 }
148
149 static v8::Handle<v8::Value> unsignedShortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
150 {
151     INC_STATS("DOM.TestObj.unsignedShortAttr._get");
152     TestObj* imp = V8TestObj::toNative(info.Holder());
153     return v8Integer(imp->unsignedShortAttr(), info.GetIsolate());
154 }
155
156 static void unsignedShortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
157 {
158     INC_STATS("DOM.TestObj.unsignedShortAttr._set");
159     TestObj* imp = V8TestObj::toNative(info.Holder());
160     int v = toUInt32(value);
161     imp->setUnsignedShortAttr(v);
162     return;
163 }
164
165 static v8::Handle<v8::Value> longAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
166 {
167     INC_STATS("DOM.TestObj.longAttr._get");
168     TestObj* imp = V8TestObj::toNative(info.Holder());
169     return v8Integer(imp->longAttr(), info.GetIsolate());
170 }
171
172 static void longAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
173 {
174     INC_STATS("DOM.TestObj.longAttr._set");
175     TestObj* imp = V8TestObj::toNative(info.Holder());
176     int v = toInt32(value);
177     imp->setLongAttr(v);
178     return;
179 }
180
181 static v8::Handle<v8::Value> longLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
182 {
183     INC_STATS("DOM.TestObj.longLongAttr._get");
184     TestObj* imp = V8TestObj::toNative(info.Holder());
185     return v8::Number::New(static_cast<double>(imp->longLongAttr()));
186 }
187
188 static void longLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
189 {
190     INC_STATS("DOM.TestObj.longLongAttr._set");
191     TestObj* imp = V8TestObj::toNative(info.Holder());
192     long long v = toInt64(value);
193     imp->setLongLongAttr(WTF::getPtr(v));
194     return;
195 }
196
197 static v8::Handle<v8::Value> unsignedLongLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
198 {
199     INC_STATS("DOM.TestObj.unsignedLongLongAttr._get");
200     TestObj* imp = V8TestObj::toNative(info.Holder());
201     return v8::Number::New(static_cast<double>(imp->unsignedLongLongAttr()));
202 }
203
204 static void unsignedLongLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
205 {
206     INC_STATS("DOM.TestObj.unsignedLongLongAttr._set");
207     TestObj* imp = V8TestObj::toNative(info.Holder());
208     unsigned long long v = toInt64(value);
209     imp->setUnsignedLongLongAttr(WTF::getPtr(v));
210     return;
211 }
212
213 static v8::Handle<v8::Value> stringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
214 {
215     INC_STATS("DOM.TestObj.stringAttr._get");
216     TestObj* imp = V8TestObj::toNative(info.Holder());
217     return v8String(imp->stringAttr(), info.GetIsolate());
218 }
219
220 static void stringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
221 {
222     INC_STATS("DOM.TestObj.stringAttr._set");
223     TestObj* imp = V8TestObj::toNative(info.Holder());
224     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value);
225     imp->setStringAttr(v);
226     return;
227 }
228
229 static v8::Handle<v8::Value> testObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
230 {
231     INC_STATS("DOM.TestObj.testObjAttr._get");
232     FeatureObserver::observe(activeDOMWindow(BindingState::instance()), FeatureObserver::TestFeature);
233     TestObj* imp = V8TestObj::toNative(info.Holder());
234     return toV8(imp->testObjAttr(), info.Holder(), info.GetIsolate());
235 }
236
237 static void testObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
238 {
239     INC_STATS("DOM.TestObj.testObjAttr._set");
240     FeatureObserver::observe(activeDOMWindow(BindingState::instance()), FeatureObserver::TestFeature);
241     TestObj* imp = V8TestObj::toNative(info.Holder());
242     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
243     imp->setTestObjAttr(WTF::getPtr(v));
244     return;
245 }
246
247 static v8::Handle<v8::Value> XMLObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
248 {
249     INC_STATS("DOM.TestObj.XMLObjAttr._get");
250     TestObj* imp = V8TestObj::toNative(info.Holder());
251     return toV8(imp->xmlObjAttr(), info.Holder(), info.GetIsolate());
252 }
253
254 static void XMLObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
255 {
256     INC_STATS("DOM.TestObj.XMLObjAttr._set");
257     TestObj* imp = V8TestObj::toNative(info.Holder());
258     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
259     imp->setXMLObjAttr(WTF::getPtr(v));
260     return;
261 }
262
263 static v8::Handle<v8::Value> createAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
264 {
265     INC_STATS("DOM.TestObj.create._get");
266     TestObj* imp = V8TestObj::toNative(info.Holder());
267     return v8Boolean(imp->isCreate(), info.GetIsolate());
268 }
269
270 static void createAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
271 {
272     INC_STATS("DOM.TestObj.create._set");
273     TestObj* imp = V8TestObj::toNative(info.Holder());
274     bool v = value->BooleanValue();
275     imp->setCreate(v);
276     return;
277 }
278
279 static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
280 {
281     INC_STATS("DOM.TestObj.reflectedStringAttr._get");
282     TestObj* imp = V8TestObj::toNative(info.Holder());
283     return v8String(imp->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr), info.GetIsolate());
284 }
285
286 static void reflectedStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
287 {
288     INC_STATS("DOM.TestObj.reflectedStringAttr._set");
289     TestObj* imp = V8TestObj::toNative(info.Holder());
290     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
291     imp->setAttribute(WebCore::HTMLNames::reflectedstringattrAttr, v);
292     return;
293 }
294
295 static v8::Handle<v8::Value> reflectedIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
296 {
297     INC_STATS("DOM.TestObj.reflectedIntegralAttr._get");
298     TestObj* imp = V8TestObj::toNative(info.Holder());
299     return v8Integer(imp->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr), info.GetIsolate());
300 }
301
302 static void reflectedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
303 {
304     INC_STATS("DOM.TestObj.reflectedIntegralAttr._set");
305     TestObj* imp = V8TestObj::toNative(info.Holder());
306     int v = toInt32(value);
307     imp->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, v);
308     return;
309 }
310
311 static v8::Handle<v8::Value> reflectedUnsignedIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
312 {
313     INC_STATS("DOM.TestObj.reflectedUnsignedIntegralAttr._get");
314     TestObj* imp = V8TestObj::toNative(info.Holder());
315     return v8UnsignedInteger(std::max(0, imp->getIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr)), info.GetIsolate());
316 }
317
318 static void reflectedUnsignedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
319 {
320     INC_STATS("DOM.TestObj.reflectedUnsignedIntegralAttr._set");
321     TestObj* imp = V8TestObj::toNative(info.Holder());
322     unsigned v = toUInt32(value);
323     imp->setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, v);
324     return;
325 }
326
327 static v8::Handle<v8::Value> reflectedBooleanAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
328 {
329     INC_STATS("DOM.TestObj.reflectedBooleanAttr._get");
330     TestObj* imp = V8TestObj::toNative(info.Holder());
331     return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr), info.GetIsolate());
332 }
333
334 static void reflectedBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
335 {
336     INC_STATS("DOM.TestObj.reflectedBooleanAttr._set");
337     TestObj* imp = V8TestObj::toNative(info.Holder());
338     bool v = value->BooleanValue();
339     imp->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, v);
340     return;
341 }
342
343 static v8::Handle<v8::Value> reflectedURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
344 {
345     INC_STATS("DOM.TestObj.reflectedURLAttr._get");
346     TestObj* imp = V8TestObj::toNative(info.Holder());
347     return v8String(imp->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr), info.GetIsolate());
348 }
349
350 static void reflectedURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
351 {
352     INC_STATS("DOM.TestObj.reflectedURLAttr._set");
353     TestObj* imp = V8TestObj::toNative(info.Holder());
354     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
355     imp->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, v);
356     return;
357 }
358
359 static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
360 {
361     INC_STATS("DOM.TestObj.reflectedStringAttr._get");
362     TestObj* imp = V8TestObj::toNative(info.Holder());
363     return v8String(imp->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr), info.GetIsolate());
364 }
365
366 static void reflectedStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
367 {
368     INC_STATS("DOM.TestObj.reflectedStringAttr._set");
369     TestObj* imp = V8TestObj::toNative(info.Holder());
370     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
371     imp->setAttribute(WebCore::HTMLNames::customContentStringAttrAttr, v);
372     return;
373 }
374
375 static v8::Handle<v8::Value> reflectedCustomIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
376 {
377     INC_STATS("DOM.TestObj.reflectedCustomIntegralAttr._get");
378     TestObj* imp = V8TestObj::toNative(info.Holder());
379     return v8Integer(imp->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr), info.GetIsolate());
380 }
381
382 static void reflectedCustomIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
383 {
384     INC_STATS("DOM.TestObj.reflectedCustomIntegralAttr._set");
385     TestObj* imp = V8TestObj::toNative(info.Holder());
386     int v = toInt32(value);
387     imp->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, v);
388     return;
389 }
390
391 static v8::Handle<v8::Value> reflectedCustomBooleanAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
392 {
393     INC_STATS("DOM.TestObj.reflectedCustomBooleanAttr._get");
394     TestObj* imp = V8TestObj::toNative(info.Holder());
395     return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr), info.GetIsolate());
396 }
397
398 static void reflectedCustomBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
399 {
400     INC_STATS("DOM.TestObj.reflectedCustomBooleanAttr._set");
401     TestObj* imp = V8TestObj::toNative(info.Holder());
402     bool v = value->BooleanValue();
403     imp->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, v);
404     return;
405 }
406
407 static v8::Handle<v8::Value> reflectedCustomURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
408 {
409     INC_STATS("DOM.TestObj.reflectedCustomURLAttr._get");
410     TestObj* imp = V8TestObj::toNative(info.Holder());
411     return v8String(imp->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr), info.GetIsolate());
412 }
413
414 static void reflectedCustomURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
415 {
416     INC_STATS("DOM.TestObj.reflectedCustomURLAttr._set");
417     TestObj* imp = V8TestObj::toNative(info.Holder());
418     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
419     imp->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, v);
420     return;
421 }
422
423 static v8::Handle<v8::Value> typedArrayAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
424 {
425     INC_STATS("DOM.TestObj.typedArrayAttr._get");
426     TestObj* imp = V8TestObj::toNative(info.Holder());
427     return toV8(imp->typedArrayAttr(), info.Holder(), info.GetIsolate());
428 }
429
430 static void typedArrayAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
431 {
432     INC_STATS("DOM.TestObj.typedArrayAttr._set");
433     TestObj* imp = V8TestObj::toNative(info.Holder());
434     Float32Array* v = V8Float32Array::HasInstance(value) ? V8Float32Array::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
435     imp->setTypedArrayAttr(WTF::getPtr(v));
436     return;
437 }
438
439 static v8::Handle<v8::Value> attrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
440 {
441     INC_STATS("DOM.TestObj.attrWithGetterException._get");
442     TestObj* imp = V8TestObj::toNative(info.Holder());
443     ExceptionCode ec = 0;
444     int v = imp->attrWithGetterException(ec);
445     if (UNLIKELY(ec))
446         return setDOMException(ec, info.GetIsolate());
447     return v8Integer(v, info.GetIsolate());
448 }
449
450 static void attrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
451 {
452     INC_STATS("DOM.TestObj.attrWithGetterException._set");
453     TestObj* imp = V8TestObj::toNative(info.Holder());
454     int v = toInt32(value);
455     imp->setAttrWithGetterException(v);
456     return;
457 }
458
459 static v8::Handle<v8::Value> attrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
460 {
461     INC_STATS("DOM.TestObj.attrWithSetterException._get");
462     TestObj* imp = V8TestObj::toNative(info.Holder());
463     return v8Integer(imp->attrWithSetterException(), info.GetIsolate());
464 }
465
466 static void attrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
467 {
468     INC_STATS("DOM.TestObj.attrWithSetterException._set");
469     TestObj* imp = V8TestObj::toNative(info.Holder());
470     int v = toInt32(value);
471     ExceptionCode ec = 0;
472     imp->setAttrWithSetterException(v, ec);
473     if (UNLIKELY(ec))
474         setDOMException(ec, info.GetIsolate());
475     return;
476 }
477
478 static v8::Handle<v8::Value> stringAttrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
479 {
480     INC_STATS("DOM.TestObj.stringAttrWithGetterException._get");
481     TestObj* imp = V8TestObj::toNative(info.Holder());
482     ExceptionCode ec = 0;
483     String v = imp->stringAttrWithGetterException(ec);
484     if (UNLIKELY(ec))
485         return setDOMException(ec, info.GetIsolate());
486     return v8String(v, info.GetIsolate());
487 }
488
489 static void stringAttrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
490 {
491     INC_STATS("DOM.TestObj.stringAttrWithGetterException._set");
492     TestObj* imp = V8TestObj::toNative(info.Holder());
493     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value);
494     imp->setStringAttrWithGetterException(v);
495     return;
496 }
497
498 static v8::Handle<v8::Value> stringAttrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
499 {
500     INC_STATS("DOM.TestObj.stringAttrWithSetterException._get");
501     TestObj* imp = V8TestObj::toNative(info.Holder());
502     return v8String(imp->stringAttrWithSetterException(), info.GetIsolate());
503 }
504
505 static void stringAttrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
506 {
507     INC_STATS("DOM.TestObj.stringAttrWithSetterException._set");
508     TestObj* imp = V8TestObj::toNative(info.Holder());
509     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value);
510     ExceptionCode ec = 0;
511     imp->setStringAttrWithSetterException(v, ec);
512     if (UNLIKELY(ec))
513         setDOMException(ec, info.GetIsolate());
514     return;
515 }
516
517 static v8::Handle<v8::Value> withScriptStateAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
518 {
519     INC_STATS("DOM.TestObj.withScriptStateAttribute._get");
520     TestObj* imp = V8TestObj::toNative(info.Holder());
521     ScriptState* state = ScriptState::current();
522     if (!state)
523         return v8Undefined();
524     return v8Integer(imp->withScriptStateAttribute(state), info.GetIsolate());
525 }
526
527 static void withScriptStateAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
528 {
529     INC_STATS("DOM.TestObj.withScriptStateAttribute._set");
530     TestObj* imp = V8TestObj::toNative(info.Holder());
531     int v = toInt32(value);
532     ScriptState* state = ScriptState::current();
533     if (!state)
534         return;
535     imp->setWithScriptStateAttribute(state, v);
536     if (state.hadException())
537         throwError(state.exception(), info.GetIsolate());
538     return;
539 }
540
541 static v8::Handle<v8::Value> withScriptExecutionContextAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
542 {
543     INC_STATS("DOM.TestObj.withScriptExecutionContextAttribute._get");
544     TestObj* imp = V8TestObj::toNative(info.Holder());
545     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
546     return toV8(imp->withScriptExecutionContextAttribute(scriptContext), info.Holder(), info.GetIsolate());
547 }
548
549 static void withScriptExecutionContextAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
550 {
551     INC_STATS("DOM.TestObj.withScriptExecutionContextAttribute._set");
552     TestObj* imp = V8TestObj::toNative(info.Holder());
553     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
554     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
555     imp->setWithScriptExecutionContextAttribute(scriptContext, WTF::getPtr(v));
556     return;
557 }
558
559 static v8::Handle<v8::Value> withScriptStateAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
560 {
561     INC_STATS("DOM.TestObj.withScriptStateAttributeRaises._get");
562     TestObj* imp = V8TestObj::toNative(info.Holder());
563     ExceptionCode ec = 0;
564     ScriptState* state = ScriptState::current();
565     if (!state)
566         return v8Undefined();
567     RefPtr<TestObj> v = imp->withScriptStateAttributeRaises(state, ec);
568     if (UNLIKELY(ec))
569         return setDOMException(ec, info.GetIsolate());
570     if (state.hadException())
571         return throwError(state.exception(), info.GetIsolate());
572     return toV8(v.release(), info.Holder(), info.GetIsolate());
573 }
574
575 static void withScriptStateAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
576 {
577     INC_STATS("DOM.TestObj.withScriptStateAttributeRaises._set");
578     TestObj* imp = V8TestObj::toNative(info.Holder());
579     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
580     ScriptState* state = ScriptState::current();
581     if (!state)
582         return;
583     imp->setWithScriptStateAttributeRaises(state, WTF::getPtr(v));
584     if (state.hadException())
585         throwError(state.exception(), info.GetIsolate());
586     return;
587 }
588
589 static v8::Handle<v8::Value> withScriptExecutionContextAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
590 {
591     INC_STATS("DOM.TestObj.withScriptExecutionContextAttributeRaises._get");
592     TestObj* imp = V8TestObj::toNative(info.Holder());
593     ExceptionCode ec = 0;
594     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
595     RefPtr<TestObj> v = imp->withScriptExecutionContextAttributeRaises(scriptContext, ec);
596     if (UNLIKELY(ec))
597         return setDOMException(ec, info.GetIsolate());
598     return toV8(v.release(), info.Holder(), info.GetIsolate());
599 }
600
601 static void withScriptExecutionContextAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
602 {
603     INC_STATS("DOM.TestObj.withScriptExecutionContextAttributeRaises._set");
604     TestObj* imp = V8TestObj::toNative(info.Holder());
605     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
606     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
607     imp->setWithScriptExecutionContextAttributeRaises(scriptContext, WTF::getPtr(v));
608     return;
609 }
610
611 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
612 {
613     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateAttribute._get");
614     TestObj* imp = V8TestObj::toNative(info.Holder());
615     ScriptState* state = ScriptState::current();
616     if (!state)
617         return v8Undefined();
618     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
619     return toV8(imp->withScriptExecutionContextAndScriptStateAttribute(state, scriptContext), info.Holder(), info.GetIsolate());
620 }
621
622 static void withScriptExecutionContextAndScriptStateAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
623 {
624     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateAttribute._set");
625     TestObj* imp = V8TestObj::toNative(info.Holder());
626     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
627     ScriptState* state = ScriptState::current();
628     if (!state)
629         return;
630     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
631     imp->setWithScriptExecutionContextAndScriptStateAttribute(state, scriptContext, WTF::getPtr(v));
632     if (state.hadException())
633         throwError(state.exception(), info.GetIsolate());
634     return;
635 }
636
637 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
638 {
639     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateAttributeRaises._get");
640     TestObj* imp = V8TestObj::toNative(info.Holder());
641     ExceptionCode ec = 0;
642     ScriptState* state = ScriptState::current();
643     if (!state)
644         return v8Undefined();
645     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
646     RefPtr<TestObj> v = imp->withScriptExecutionContextAndScriptStateAttributeRaises(state, scriptContext, ec);
647     if (UNLIKELY(ec))
648         return setDOMException(ec, info.GetIsolate());
649     if (state.hadException())
650         return throwError(state.exception(), info.GetIsolate());
651     return toV8(v.release(), info.Holder(), info.GetIsolate());
652 }
653
654 static void withScriptExecutionContextAndScriptStateAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
655 {
656     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateAttributeRaises._set");
657     TestObj* imp = V8TestObj::toNative(info.Holder());
658     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
659     ScriptState* state = ScriptState::current();
660     if (!state)
661         return;
662     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
663     imp->setWithScriptExecutionContextAndScriptStateAttributeRaises(state, scriptContext, WTF::getPtr(v));
664     if (state.hadException())
665         throwError(state.exception(), info.GetIsolate());
666     return;
667 }
668
669 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
670 {
671     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateWithSpacesAttribute._get");
672     TestObj* imp = V8TestObj::toNative(info.Holder());
673     ScriptState* state = ScriptState::current();
674     if (!state)
675         return v8Undefined();
676     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
677     return toV8(imp->withScriptExecutionContextAndScriptStateWithSpacesAttribute(state, scriptContext), info.Holder(), info.GetIsolate());
678 }
679
680 static void withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
681 {
682     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateWithSpacesAttribute._set");
683     TestObj* imp = V8TestObj::toNative(info.Holder());
684     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
685     ScriptState* state = ScriptState::current();
686     if (!state)
687         return;
688     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
689     imp->setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(state, scriptContext, WTF::getPtr(v));
690     if (state.hadException())
691         throwError(state.exception(), info.GetIsolate());
692     return;
693 }
694
695 static v8::Handle<v8::Value> withScriptArgumentsAndCallStackAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
696 {
697     INC_STATS("DOM.TestObj.withScriptArgumentsAndCallStackAttribute._get");
698     TestObj* imp = V8TestObj::toNative(info.Holder());
699     RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole());
700     if (!callStack)
701         return v8Undefined();
702     return toV8(imp->withScriptArgumentsAndCallStackAttribute(callStack), info.Holder(), info.GetIsolate());
703 }
704
705 static void withScriptArgumentsAndCallStackAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
706 {
707     INC_STATS("DOM.TestObj.withScriptArgumentsAndCallStackAttribute._set");
708     TestObj* imp = V8TestObj::toNative(info.Holder());
709     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
710     RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole());
711     if (!callStack)
712         return v8Undefined();
713     imp->setWithScriptArgumentsAndCallStackAttribute(callStack, WTF::getPtr(v));
714     return;
715 }
716
717 #if ENABLE(Condition1)
718
719 static v8::Handle<v8::Value> conditionalAttr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
720 {
721     INC_STATS("DOM.TestObj.conditionalAttr1._get");
722     TestObj* imp = V8TestObj::toNative(info.Holder());
723     return v8Integer(imp->conditionalAttr1(), info.GetIsolate());
724 }
725
726 #endif // ENABLE(Condition1)
727
728 #if ENABLE(Condition1)
729
730 static void conditionalAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
731 {
732     INC_STATS("DOM.TestObj.conditionalAttr1._set");
733     TestObj* imp = V8TestObj::toNative(info.Holder());
734     int v = toInt32(value);
735     imp->setConditionalAttr1(v);
736     return;
737 }
738
739 #endif // ENABLE(Condition1)
740
741 #if ENABLE(Condition1) && ENABLE(Condition2)
742
743 static v8::Handle<v8::Value> conditionalAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
744 {
745     INC_STATS("DOM.TestObj.conditionalAttr2._get");
746     TestObj* imp = V8TestObj::toNative(info.Holder());
747     return v8Integer(imp->conditionalAttr2(), info.GetIsolate());
748 }
749
750 #endif // ENABLE(Condition1) && ENABLE(Condition2)
751
752 #if ENABLE(Condition1) && ENABLE(Condition2)
753
754 static void conditionalAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
755 {
756     INC_STATS("DOM.TestObj.conditionalAttr2._set");
757     TestObj* imp = V8TestObj::toNative(info.Holder());
758     int v = toInt32(value);
759     imp->setConditionalAttr2(v);
760     return;
761 }
762
763 #endif // ENABLE(Condition1) && ENABLE(Condition2)
764
765 #if ENABLE(Condition1) || ENABLE(Condition2)
766
767 static v8::Handle<v8::Value> conditionalAttr3AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
768 {
769     INC_STATS("DOM.TestObj.conditionalAttr3._get");
770     TestObj* imp = V8TestObj::toNative(info.Holder());
771     return v8Integer(imp->conditionalAttr3(), info.GetIsolate());
772 }
773
774 #endif // ENABLE(Condition1) || ENABLE(Condition2)
775
776 #if ENABLE(Condition1) || ENABLE(Condition2)
777
778 static void conditionalAttr3AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
779 {
780     INC_STATS("DOM.TestObj.conditionalAttr3._set");
781     TestObj* imp = V8TestObj::toNative(info.Holder());
782     int v = toInt32(value);
783     imp->setConditionalAttr3(v);
784     return;
785 }
786
787 #endif // ENABLE(Condition1) || ENABLE(Condition2)
788
789 static v8::Handle<v8::Value> cachedAttribute1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
790 {
791     INC_STATS("DOM.TestObj.cachedAttribute1._get");
792     TestObj* imp = V8TestObj::toNative(info.Holder());
793     return imp->cachedAttribute1().v8Value();
794 }
795
796 static v8::Handle<v8::Value> cachedAttribute2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
797 {
798     INC_STATS("DOM.TestObj.cachedAttribute2._get");
799     TestObj* imp = V8TestObj::toNative(info.Holder());
800     return imp->cachedAttribute2().v8Value();
801 }
802
803 static v8::Handle<v8::Value> anyAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
804 {
805     INC_STATS("DOM.TestObj.anyAttribute._get");
806     TestObj* imp = V8TestObj::toNative(info.Holder());
807     return imp->anyAttribute().v8Value();
808 }
809
810 static void anyAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
811 {
812     INC_STATS("DOM.TestObj.anyAttribute._set");
813     TestObj* imp = V8TestObj::toNative(info.Holder());
814     ScriptValue v = ScriptValue(value);
815     imp->setAnyAttribute(WTF::getPtr(v));
816     return;
817 }
818
819 static v8::Handle<v8::Value> enabledAtRuntimeAttr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
820 {
821     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr1._get");
822     TestObj* imp = V8TestObj::toNative(info.Holder());
823     return v8Integer(imp->enabledAtRuntimeAttr1(), info.GetIsolate());
824 }
825
826 static void enabledAtRuntimeAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
827 {
828     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr1._set");
829     TestObj* imp = V8TestObj::toNative(info.Holder());
830     int v = toInt32(value);
831     imp->setEnabledAtRuntimeAttr1(v);
832     return;
833 }
834
835 static v8::Handle<v8::Value> enabledAtRuntimeAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
836 {
837     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr2._get");
838     TestObj* imp = V8TestObj::toNative(info.Holder());
839     return v8Integer(imp->enabledAtRuntimeAttr2(), info.GetIsolate());
840 }
841
842 static void enabledAtRuntimeAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
843 {
844     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr2._set");
845     TestObj* imp = V8TestObj::toNative(info.Holder());
846     int v = toInt32(value);
847     imp->setEnabledAtRuntimeAttr2(v);
848     return;
849 }
850
851 static v8::Handle<v8::Value> enabledPerContextAttr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
852 {
853     INC_STATS("DOM.TestObj.enabledPerContextAttr1._get");
854     TestObj* imp = V8TestObj::toNative(info.Holder());
855     return v8Integer(imp->enabledPerContextAttr1(), info.GetIsolate());
856 }
857
858 static void enabledPerContextAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
859 {
860     INC_STATS("DOM.TestObj.enabledPerContextAttr1._set");
861     TestObj* imp = V8TestObj::toNative(info.Holder());
862     int v = toInt32(value);
863     imp->setEnabledPerContextAttr1(v);
864     return;
865 }
866
867 static v8::Handle<v8::Value> enabledPerContextAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
868 {
869     INC_STATS("DOM.TestObj.enabledPerContextAttr2._get");
870     TestObj* imp = V8TestObj::toNative(info.Holder());
871     return v8Integer(imp->enabledPerContextAttr2(), info.GetIsolate());
872 }
873
874 static void enabledPerContextAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
875 {
876     INC_STATS("DOM.TestObj.enabledPerContextAttr2._set");
877     TestObj* imp = V8TestObj::toNative(info.Holder());
878     int v = toInt32(value);
879     imp->setEnabledPerContextAttr2(v);
880     return;
881 }
882
883 static v8::Handle<v8::Value> floatArrayAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
884 {
885     INC_STATS("DOM.TestObj.floatArray._get");
886     TestObj* imp = V8TestObj::toNative(info.Holder());
887     return v8Array(imp->floatArray(), info.GetIsolate());
888 }
889
890 static void floatArrayAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
891 {
892     INC_STATS("DOM.TestObj.floatArray._set");
893     TestObj* imp = V8TestObj::toNative(info.Holder());
894     Vector<float> v = toNativeArray<float>(value);
895     imp->setFloatArray(v);
896     return;
897 }
898
899 static v8::Handle<v8::Value> doubleArrayAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
900 {
901     INC_STATS("DOM.TestObj.doubleArray._get");
902     TestObj* imp = V8TestObj::toNative(info.Holder());
903     return v8Array(imp->doubleArray(), info.GetIsolate());
904 }
905
906 static void doubleArrayAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
907 {
908     INC_STATS("DOM.TestObj.doubleArray._set");
909     TestObj* imp = V8TestObj::toNative(info.Holder());
910     Vector<double> v = toNativeArray<double>(value);
911     imp->setDoubleArray(v);
912     return;
913 }
914
915 static v8::Handle<v8::Value> contentDocumentAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
916 {
917     INC_STATS("DOM.TestObj.contentDocument._get");
918     TestObj* imp = V8TestObj::toNative(info.Holder());
919     if (!BindingSecurity::shouldAllowAccessToNode(BindingState::instance(), imp->contentDocument()))
920         return v8::Handle<v8::Value>(v8::Null(info.GetIsolate()));
921
922     return toV8(imp->contentDocument(), info.Holder(), info.GetIsolate());
923 }
924
925 static v8::Handle<v8::Value> mutablePointAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
926 {
927     INC_STATS("DOM.TestObj.mutablePoint._get");
928     TestObj* imp = V8TestObj::toNative(info.Holder());
929     return toV8(WTF::getPtr(SVGStaticPropertyTearOff<TestObj, FloatPoint>::create(imp, imp->mutablePoint(), &TestObj::updateMutablePoint)), info.Holder(), info.GetIsolate());
930 }
931
932 static void mutablePointAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
933 {
934     INC_STATS("DOM.TestObj.mutablePoint._set");
935     TestObj* imp = V8TestObj::toNative(info.Holder());
936     RefPtr<SVGPropertyTearOff<FloatPoint> > v = V8SVGPoint::HasInstance(value) ? V8SVGPoint::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
937     imp->setMutablePoint(WTF::getPtr(v));
938     return;
939 }
940
941 static v8::Handle<v8::Value> immutablePointAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
942 {
943     INC_STATS("DOM.TestObj.immutablePoint._get");
944     TestObj* imp = V8TestObj::toNative(info.Holder());
945     return toV8(WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(imp->immutablePoint())), info.Holder(), info.GetIsolate());
946 }
947
948 static void immutablePointAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
949 {
950     INC_STATS("DOM.TestObj.immutablePoint._set");
951     TestObj* imp = V8TestObj::toNative(info.Holder());
952     RefPtr<SVGPropertyTearOff<FloatPoint> > v = V8SVGPoint::HasInstance(value) ? V8SVGPoint::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
953     imp->setImmutablePoint(WTF::getPtr(v));
954     return;
955 }
956
957 static v8::Handle<v8::Value> strawberryAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
958 {
959     INC_STATS("DOM.TestObj.strawberry._get");
960     TestObj* imp = V8TestObj::toNative(info.Holder());
961     return v8Integer(imp->blueberry(), info.GetIsolate());
962 }
963
964 static void strawberryAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
965 {
966     INC_STATS("DOM.TestObj.strawberry._set");
967     TestObj* imp = V8TestObj::toNative(info.Holder());
968     int v = toInt32(value);
969     imp->setBlueberry(v);
970     return;
971 }
972
973 static v8::Handle<v8::Value> strictFloatAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
974 {
975     INC_STATS("DOM.TestObj.strictFloat._get");
976     TestObj* imp = V8TestObj::toNative(info.Holder());
977     return v8::Number::New(imp->strictFloat());
978 }
979
980 static void strictFloatAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
981 {
982     INC_STATS("DOM.TestObj.strictFloat._set");
983     TestObj* imp = V8TestObj::toNative(info.Holder());
984     float v = static_cast<float>(value->NumberValue());
985     imp->setStrictFloat(v);
986     return;
987 }
988
989 static v8::Handle<v8::Value> descriptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
990 {
991     INC_STATS("DOM.TestObj.description._get");
992     TestObj* imp = V8TestObj::toNative(info.Holder());
993     return v8Integer(imp->description(), info.GetIsolate());
994 }
995
996 static v8::Handle<v8::Value> idAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
997 {
998     INC_STATS("DOM.TestObj.id._get");
999     TestObj* imp = V8TestObj::toNative(info.Holder());
1000     return v8Integer(imp->id(), info.GetIsolate());
1001 }
1002
1003 static void idAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
1004 {
1005     INC_STATS("DOM.TestObj.id._set");
1006     TestObj* imp = V8TestObj::toNative(info.Holder());
1007     int v = toInt32(value);
1008     imp->setId(v);
1009     return;
1010 }
1011
1012 static v8::Handle<v8::Value> hashAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
1013 {
1014     INC_STATS("DOM.TestObj.hash._get");
1015     TestObj* imp = V8TestObj::toNative(info.Holder());
1016     return v8String(imp->hash(), info.GetIsolate());
1017 }
1018
1019 static v8::Handle<v8::Value> replaceableAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
1020 {
1021     INC_STATS("DOM.TestObj.replaceableAttribute._get");
1022     TestObj* imp = V8TestObj::toNative(info.Holder());
1023     return v8Integer(imp->replaceableAttribute(), info.GetIsolate());
1024 }
1025
1026 static v8::Handle<v8::Value> TestObjConstructorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
1027 {
1028     INC_STATS("DOM.TestObj.constructors._get");
1029     v8::Handle<v8::Value> data = info.Data();
1030     ASSERT(data->IsExternal() || data->IsNumber());
1031     V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->CreationContext());
1032     if (!perContextData)
1033         return v8Undefined();
1034     return perContextData->constructorForType(WrapperTypeInfo::unwrap(data));
1035 }
1036
1037 static void TestObjReplaceableAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
1038 {
1039     INC_STATS("DOM.TestObj.replaceable._set");
1040     info.This()->ForceSet(name, value);
1041 }
1042
1043 static v8::Handle<v8::Value> voidMethodCallback(const v8::Arguments& args)
1044 {
1045     INC_STATS("DOM.TestObj.voidMethod");
1046     TestObj* imp = V8TestObj::toNative(args.Holder());
1047     imp->voidMethod();
1048     return v8Undefined();
1049 }
1050
1051 static v8::Handle<v8::Value> voidMethodWithArgsCallback(const v8::Arguments& args)
1052 {
1053     INC_STATS("DOM.TestObj.voidMethodWithArgs");
1054     if (args.Length() < 3)
1055         return throwNotEnoughArgumentsError(args.GetIsolate());
1056     TestObj* imp = V8TestObj::toNative(args.Holder());
1057     EXCEPTION_BLOCK(int, longArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1058     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
1059     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))) : 0);
1060     imp->voidMethodWithArgs(longArg, strArg, objArg);
1061     return v8Undefined();
1062 }
1063
1064 static v8::Handle<v8::Value> longMethodCallback(const v8::Arguments& args)
1065 {
1066     INC_STATS("DOM.TestObj.longMethod");
1067     TestObj* imp = V8TestObj::toNative(args.Holder());
1068     return v8Integer(imp->longMethod(), args.GetIsolate());
1069 }
1070
1071 static v8::Handle<v8::Value> longMethodWithArgsCallback(const v8::Arguments& args)
1072 {
1073     INC_STATS("DOM.TestObj.longMethodWithArgs");
1074     if (args.Length() < 3)
1075         return throwNotEnoughArgumentsError(args.GetIsolate());
1076     TestObj* imp = V8TestObj::toNative(args.Holder());
1077     EXCEPTION_BLOCK(int, longArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1078     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
1079     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))) : 0);
1080     return v8Integer(imp->longMethodWithArgs(longArg, strArg, objArg), args.GetIsolate());
1081 }
1082
1083 static v8::Handle<v8::Value> objMethodCallback(const v8::Arguments& args)
1084 {
1085     INC_STATS("DOM.TestObj.objMethod");
1086     FeatureObserver::observe(activeDOMWindow(BindingState::instance()), FeatureObserver::TestFeature);
1087     TestObj* imp = V8TestObj::toNative(args.Holder());
1088     return toV8(imp->objMethod(), args.Holder(), args.GetIsolate());
1089 }
1090
1091 static v8::Handle<v8::Value> objMethodWithArgsCallback(const v8::Arguments& args)
1092 {
1093     INC_STATS("DOM.TestObj.objMethodWithArgs");
1094     if (args.Length() < 3)
1095         return throwNotEnoughArgumentsError(args.GetIsolate());
1096     TestObj* imp = V8TestObj::toNative(args.Holder());
1097     EXCEPTION_BLOCK(int, longArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1098     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
1099     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))) : 0);
1100     return toV8(imp->objMethodWithArgs(longArg, strArg, objArg), args.Holder(), args.GetIsolate());
1101 }
1102
1103 static v8::Handle<v8::Value> methodWithSequenceArgCallback(const v8::Arguments& args)
1104 {
1105     INC_STATS("DOM.TestObj.methodWithSequenceArg");
1106     if (args.Length() < 1)
1107         return throwNotEnoughArgumentsError(args.GetIsolate());
1108     TestObj* imp = V8TestObj::toNative(args.Holder());
1109     EXCEPTION_BLOCK(Vector<ScriptProfile>, sequenceArg, toNativeArray<ScriptProfile>(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1110     imp->methodWithSequenceArg(sequenceArg);
1111     return v8Undefined();
1112 }
1113
1114 static v8::Handle<v8::Value> methodReturningSequenceCallback(const v8::Arguments& args)
1115 {
1116     INC_STATS("DOM.TestObj.methodReturningSequence");
1117     if (args.Length() < 1)
1118         return throwNotEnoughArgumentsError(args.GetIsolate());
1119     TestObj* imp = V8TestObj::toNative(args.Holder());
1120     EXCEPTION_BLOCK(int, longArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1121     return v8Array(imp->methodReturningSequence(longArg), args.GetIsolate());
1122 }
1123
1124 static v8::Handle<v8::Value> methodThatRequiresAllArgsAndThrowsCallback(const v8::Arguments& args)
1125 {
1126     INC_STATS("DOM.TestObj.methodThatRequiresAllArgsAndThrows");
1127     if (args.Length() < 2)
1128         return throwNotEnoughArgumentsError(args.GetIsolate());
1129     TestObj* imp = V8TestObj::toNative(args.Holder());
1130     ExceptionCode ec = 0;
1131     {
1132     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1133     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined))) : 0);
1134     RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec);
1135     if (UNLIKELY(ec))
1136         goto fail;
1137     return toV8(result.release(), args.Holder(), args.GetIsolate());
1138     }
1139     fail:
1140     return setDOMException(ec, args.GetIsolate());
1141 }
1142
1143 static v8::Handle<v8::Value> serializedValueCallback(const v8::Arguments& args)
1144 {
1145     INC_STATS("DOM.TestObj.serializedValue");
1146     if (args.Length() < 1)
1147         return throwNotEnoughArgumentsError(args.GetIsolate());
1148     TestObj* imp = V8TestObj::toNative(args.Holder());
1149     bool serializedArgDidThrow = false;
1150     RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(args[0], 0, 0, serializedArgDidThrow, args.GetIsolate());
1151     if (serializedArgDidThrow)
1152         return v8Undefined();
1153     imp->serializedValue(serializedArg);
1154     return v8Undefined();
1155 }
1156
1157 static v8::Handle<v8::Value> idbKeyCallback(const v8::Arguments& args)
1158 {
1159     INC_STATS("DOM.TestObj.idbKey");
1160     if (args.Length() < 1)
1161         return throwNotEnoughArgumentsError(args.GetIsolate());
1162     TestObj* imp = V8TestObj::toNative(args.Holder());
1163     EXCEPTION_BLOCK(RefPtr<IDBKey>, key, createIDBKeyFromValue(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1164     imp->idbKey(key.get());
1165     return v8Undefined();
1166 }
1167
1168 static v8::Handle<v8::Value> optionsObjectCallback(const v8::Arguments& args)
1169 {
1170     INC_STATS("DOM.TestObj.optionsObject");
1171     if (args.Length() < 1)
1172         return throwNotEnoughArgumentsError(args.GetIsolate());
1173     TestObj* imp = V8TestObj::toNative(args.Holder());
1174     EXCEPTION_BLOCK(Dictionary, oo, Dictionary(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined), args.GetIsolate()));
1175     if (!oo.isUndefinedOrNull() && !oo.isObject())
1176         return throwTypeError("Not an object.", args.GetIsolate());
1177     if (args.Length() <= 1) {
1178         imp->optionsObject(oo);
1179         return v8Undefined();
1180     }
1181     EXCEPTION_BLOCK(Dictionary, ooo, Dictionary(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined), args.GetIsolate()));
1182     if (!ooo.isUndefinedOrNull() && !ooo.isObject())
1183         return throwTypeError("Not an object.", args.GetIsolate());
1184     imp->optionsObject(oo, ooo);
1185     return v8Undefined();
1186 }
1187
1188 static v8::Handle<v8::Value> methodWithExceptionCallback(const v8::Arguments& args)
1189 {
1190     INC_STATS("DOM.TestObj.methodWithException");
1191     TestObj* imp = V8TestObj::toNative(args.Holder());
1192     ExceptionCode ec = 0;
1193     {
1194     imp->methodWithException(ec);
1195     if (UNLIKELY(ec))
1196         goto fail;
1197     return v8Undefined();
1198     }
1199     fail:
1200     return setDOMException(ec, args.GetIsolate());
1201 }
1202
1203 static v8::Handle<v8::Value> addEventListenerCallback(const v8::Arguments& args)
1204 {
1205     INC_STATS("DOM.TestObj.addEventListener()");
1206     RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOrCreate);
1207     if (listener) {
1208         V8TestObj::toNative(args.Holder())->addEventListener(toWebCoreAtomicString(args[0]), listener, args[2]->BooleanValue());
1209         createHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex);
1210     }
1211     return v8Undefined();
1212 }
1213
1214 static v8::Handle<v8::Value> removeEventListenerCallback(const v8::Arguments& args)
1215 {
1216     INC_STATS("DOM.TestObj.removeEventListener()");
1217     RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOnly);
1218     if (listener) {
1219         V8TestObj::toNative(args.Holder())->removeEventListener(toWebCoreAtomicString(args[0]), listener.get(), args[2]->BooleanValue());
1220         removeHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex);
1221     }
1222     return v8Undefined();
1223 }
1224
1225 static v8::Handle<v8::Value> withScriptStateVoidCallback(const v8::Arguments& args)
1226 {
1227     INC_STATS("DOM.TestObj.withScriptStateVoid");
1228     TestObj* imp = V8TestObj::toNative(args.Holder());
1229     EmptyScriptState state;
1230     imp->withScriptStateVoid(&state);
1231     if (state.hadException())
1232         return throwError(state.exception(), args.GetIsolate());
1233     return v8Undefined();
1234 }
1235
1236 static v8::Handle<v8::Value> withScriptStateObjCallback(const v8::Arguments& args)
1237 {
1238     INC_STATS("DOM.TestObj.withScriptStateObj");
1239     TestObj* imp = V8TestObj::toNative(args.Holder());
1240     EmptyScriptState state;
1241     RefPtr<TestObj> result = imp->withScriptStateObj(&state);
1242     if (state.hadException())
1243         return throwError(state.exception(), args.GetIsolate());
1244     return toV8(result.release(), args.Holder(), args.GetIsolate());
1245 }
1246
1247 static v8::Handle<v8::Value> withScriptStateVoidExceptionCallback(const v8::Arguments& args)
1248 {
1249     INC_STATS("DOM.TestObj.withScriptStateVoidException");
1250     TestObj* imp = V8TestObj::toNative(args.Holder());
1251     ExceptionCode ec = 0;
1252     {
1253     EmptyScriptState state;
1254     imp->withScriptStateVoidException(&state, ec);
1255     if (UNLIKELY(ec))
1256         goto fail;
1257     if (state.hadException())
1258         return throwError(state.exception(), args.GetIsolate());
1259     return v8Undefined();
1260     }
1261     fail:
1262     return setDOMException(ec, args.GetIsolate());
1263 }
1264
1265 static v8::Handle<v8::Value> withScriptStateObjExceptionCallback(const v8::Arguments& args)
1266 {
1267     INC_STATS("DOM.TestObj.withScriptStateObjException");
1268     TestObj* imp = V8TestObj::toNative(args.Holder());
1269     ExceptionCode ec = 0;
1270     {
1271     EmptyScriptState state;
1272     RefPtr<TestObj> result = imp->withScriptStateObjException(&state, ec);
1273     if (UNLIKELY(ec))
1274         goto fail;
1275     if (state.hadException())
1276         return throwError(state.exception(), args.GetIsolate());
1277     return toV8(result.release(), args.Holder(), args.GetIsolate());
1278     }
1279     fail:
1280     return setDOMException(ec, args.GetIsolate());
1281 }
1282
1283 static v8::Handle<v8::Value> withScriptExecutionContextCallback(const v8::Arguments& args)
1284 {
1285     INC_STATS("DOM.TestObj.withScriptExecutionContext");
1286     TestObj* imp = V8TestObj::toNative(args.Holder());
1287     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
1288     imp->withScriptExecutionContext(scriptContext);
1289     return v8Undefined();
1290 }
1291
1292 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateCallback(const v8::Arguments& args)
1293 {
1294     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptState");
1295     TestObj* imp = V8TestObj::toNative(args.Holder());
1296     EmptyScriptState state;
1297     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
1298     imp->withScriptExecutionContextAndScriptState(&state, scriptContext);
1299     if (state.hadException())
1300         return throwError(state.exception(), args.GetIsolate());
1301     return v8Undefined();
1302 }
1303
1304 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateObjExceptionCallback(const v8::Arguments& args)
1305 {
1306     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateObjException");
1307     TestObj* imp = V8TestObj::toNative(args.Holder());
1308     ExceptionCode ec = 0;
1309     {
1310     EmptyScriptState state;
1311     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
1312     RefPtr<TestObj> result = imp->withScriptExecutionContextAndScriptStateObjException(&state, scriptContext, ec);
1313     if (UNLIKELY(ec))
1314         goto fail;
1315     if (state.hadException())
1316         return throwError(state.exception(), args.GetIsolate());
1317     return toV8(result.release(), args.Holder(), args.GetIsolate());
1318     }
1319     fail:
1320     return setDOMException(ec, args.GetIsolate());
1321 }
1322
1323 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateWithSpacesCallback(const v8::Arguments& args)
1324 {
1325     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateWithSpaces");
1326     TestObj* imp = V8TestObj::toNative(args.Holder());
1327     EmptyScriptState state;
1328     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
1329     RefPtr<TestObj> result = imp->withScriptExecutionContextAndScriptStateWithSpaces(&state, scriptContext);
1330     if (state.hadException())
1331         return throwError(state.exception(), args.GetIsolate());
1332     return toV8(result.release(), args.Holder(), args.GetIsolate());
1333 }
1334
1335 static v8::Handle<v8::Value> withScriptArgumentsAndCallStackCallback(const v8::Arguments& args)
1336 {
1337     INC_STATS("DOM.TestObj.withScriptArgumentsAndCallStack");
1338     TestObj* imp = V8TestObj::toNative(args.Holder());
1339     RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 0));
1340     RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole());
1341     if (!callStack)
1342         return v8Undefined();
1343     imp->withScriptArgumentsAndCallStack(scriptArguments, callStack);
1344     return v8Undefined();
1345 }
1346
1347 static v8::Handle<v8::Value> methodWithOptionalArgCallback(const v8::Arguments& args)
1348 {
1349     INC_STATS("DOM.TestObj.methodWithOptionalArg");
1350     TestObj* imp = V8TestObj::toNative(args.Holder());
1351     if (args.Length() <= 0) {
1352         imp->methodWithOptionalArg();
1353         return v8Undefined();
1354     }
1355     EXCEPTION_BLOCK(int, opt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1356     imp->methodWithOptionalArg(opt);
1357     return v8Undefined();
1358 }
1359
1360 static v8::Handle<v8::Value> methodWithNonOptionalArgAndOptionalArgCallback(const v8::Arguments& args)
1361 {
1362     INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndOptionalArg");
1363     if (args.Length() < 1)
1364         return throwNotEnoughArgumentsError(args.GetIsolate());
1365     TestObj* imp = V8TestObj::toNative(args.Holder());
1366     EXCEPTION_BLOCK(int, nonOpt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1367     if (args.Length() <= 1) {
1368         imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
1369         return v8Undefined();
1370     }
1371     EXCEPTION_BLOCK(int, opt, toInt32(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)));
1372     imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
1373     return v8Undefined();
1374 }
1375
1376 static v8::Handle<v8::Value> methodWithNonOptionalArgAndTwoOptionalArgsCallback(const v8::Arguments& args)
1377 {
1378     INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndTwoOptionalArgs");
1379     if (args.Length() < 1)
1380         return throwNotEnoughArgumentsError(args.GetIsolate());
1381     TestObj* imp = V8TestObj::toNative(args.Holder());
1382     EXCEPTION_BLOCK(int, nonOpt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1383     if (args.Length() <= 1) {
1384         imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
1385         return v8Undefined();
1386     }
1387     EXCEPTION_BLOCK(int, opt1, toInt32(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)));
1388     if (args.Length() <= 2) {
1389         imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1);
1390         return v8Undefined();
1391     }
1392     EXCEPTION_BLOCK(int, opt2, toInt32(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)));
1393     imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
1394     return v8Undefined();
1395 }
1396
1397 static v8::Handle<v8::Value> methodWithOptionalStringCallback(const v8::Arguments& args)
1398 {
1399     INC_STATS("DOM.TestObj.methodWithOptionalString");
1400     TestObj* imp = V8TestObj::toNative(args.Holder());
1401     if (args.Length() <= 0) {
1402         imp->methodWithOptionalString();
1403         return v8Undefined();
1404     }
1405     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1406     imp->methodWithOptionalString(str);
1407     return v8Undefined();
1408 }
1409
1410 static v8::Handle<v8::Value> methodWithOptionalStringIsUndefinedCallback(const v8::Arguments& args)
1411 {
1412     INC_STATS("DOM.TestObj.methodWithOptionalStringIsUndefined");
1413     TestObj* imp = V8TestObj::toNative(args.Holder());
1414     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1415     imp->methodWithOptionalStringIsUndefined(str);
1416     return v8Undefined();
1417 }
1418
1419 static v8::Handle<v8::Value> methodWithOptionalStringIsNullStringCallback(const v8::Arguments& args)
1420 {
1421     INC_STATS("DOM.TestObj.methodWithOptionalStringIsNullString");
1422     TestObj* imp = V8TestObj::toNative(args.Holder());
1423     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsNullString));
1424     imp->methodWithOptionalStringIsNullString(str);
1425     return v8Undefined();
1426 }
1427
1428 static v8::Handle<v8::Value> methodWithCallbackArgCallback(const v8::Arguments& args)
1429 {
1430     INC_STATS("DOM.TestObj.methodWithCallbackArg");
1431     if (args.Length() < 1)
1432         return throwNotEnoughArgumentsError(args.GetIsolate());
1433     TestObj* imp = V8TestObj::toNative(args.Holder());
1434     if (args.Length() <= 0 || !args[0]->IsFunction())
1435         return setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
1436     RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1437     imp->methodWithCallbackArg(callback);
1438     return v8Undefined();
1439 }
1440
1441 static v8::Handle<v8::Value> methodWithNonCallbackArgAndCallbackArgCallback(const v8::Arguments& args)
1442 {
1443     INC_STATS("DOM.TestObj.methodWithNonCallbackArgAndCallbackArg");
1444     if (args.Length() < 2)
1445         return throwNotEnoughArgumentsError(args.GetIsolate());
1446     TestObj* imp = V8TestObj::toNative(args.Holder());
1447     EXCEPTION_BLOCK(int, nonCallback, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1448     if (args.Length() <= 1 || !args[1]->IsFunction())
1449         return setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
1450     RefPtr<TestCallback> callback = V8TestCallback::create(args[1], getScriptExecutionContext());
1451     imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
1452     return v8Undefined();
1453 }
1454
1455 static v8::Handle<v8::Value> methodWithCallbackAndOptionalArgCallback(const v8::Arguments& args)
1456 {
1457     INC_STATS("DOM.TestObj.methodWithCallbackAndOptionalArg");
1458     TestObj* imp = V8TestObj::toNative(args.Holder());
1459     RefPtr<TestCallback> callback;
1460     if (args.Length() > 0 && !args[0]->IsNull() && !args[0]->IsUndefined()) {
1461         if (!args[0]->IsFunction())
1462             return setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
1463         callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1464     }
1465     imp->methodWithCallbackAndOptionalArg(callback);
1466     return v8Undefined();
1467 }
1468
1469 #if ENABLE(Condition1)
1470
1471 static v8::Handle<v8::Value> conditionalMethod1Callback(const v8::Arguments& args)
1472 {
1473     INC_STATS("DOM.TestObj.conditionalMethod1");
1474     TestObj* imp = V8TestObj::toNative(args.Holder());
1475     return v8String(imp->conditionalMethod1(), args.GetIsolate());
1476 }
1477
1478 #endif // ENABLE(Condition1)
1479
1480 #if ENABLE(Condition1) && ENABLE(Condition2)
1481
1482 static v8::Handle<v8::Value> conditionalMethod2Callback(const v8::Arguments& args)
1483 {
1484     INC_STATS("DOM.TestObj.conditionalMethod2");
1485     TestObj* imp = V8TestObj::toNative(args.Holder());
1486     imp->conditionalMethod2();
1487     return v8Undefined();
1488 }
1489
1490 #endif // ENABLE(Condition1) && ENABLE(Condition2)
1491
1492 #if ENABLE(Condition1) || ENABLE(Condition2)
1493
1494 static v8::Handle<v8::Value> conditionalMethod3Callback(const v8::Arguments& args)
1495 {
1496     INC_STATS("DOM.TestObj.conditionalMethod3");
1497     TestObj* imp = V8TestObj::toNative(args.Holder());
1498     imp->conditionalMethod3();
1499     return v8Undefined();
1500 }
1501
1502 #endif // ENABLE(Condition1) || ENABLE(Condition2)
1503
1504 static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args)
1505 {
1506     INC_STATS("DOM.TestObj.overloadedMethod1");
1507     if (args.Length() < 2)
1508         return throwNotEnoughArgumentsError(args.GetIsolate());
1509     TestObj* imp = V8TestObj::toNative(args.Holder());
1510     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1511     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
1512     imp->overloadedMethod(objArg, strArg);
1513     return v8Undefined();
1514 }
1515
1516 static v8::Handle<v8::Value> overloadedMethod2Callback(const v8::Arguments& args)
1517 {
1518     INC_STATS("DOM.TestObj.overloadedMethod2");
1519     if (args.Length() < 1)
1520         return throwNotEnoughArgumentsError(args.GetIsolate());
1521     TestObj* imp = V8TestObj::toNative(args.Holder());
1522     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1523     if (args.Length() <= 1) {
1524         imp->overloadedMethod(objArg);
1525         return v8Undefined();
1526     }
1527     EXCEPTION_BLOCK(int, longArg, toInt32(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)));
1528     imp->overloadedMethod(objArg, longArg);
1529     return v8Undefined();
1530 }
1531
1532 static v8::Handle<v8::Value> overloadedMethod3Callback(const v8::Arguments& args)
1533 {
1534     INC_STATS("DOM.TestObj.overloadedMethod3");
1535     if (args.Length() < 1)
1536         return throwNotEnoughArgumentsError(args.GetIsolate());
1537     TestObj* imp = V8TestObj::toNative(args.Holder());
1538     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1539     imp->overloadedMethod(strArg);
1540     return v8Undefined();
1541 }
1542
1543 static v8::Handle<v8::Value> overloadedMethod4Callback(const v8::Arguments& args)
1544 {
1545     INC_STATS("DOM.TestObj.overloadedMethod4");
1546     if (args.Length() < 1)
1547         return throwNotEnoughArgumentsError(args.GetIsolate());
1548     TestObj* imp = V8TestObj::toNative(args.Holder());
1549     EXCEPTION_BLOCK(int, longArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1550     imp->overloadedMethod(longArg);
1551     return v8Undefined();
1552 }
1553
1554 static v8::Handle<v8::Value> overloadedMethod5Callback(const v8::Arguments& args)
1555 {
1556     INC_STATS("DOM.TestObj.overloadedMethod5");
1557     if (args.Length() < 1)
1558         return throwNotEnoughArgumentsError(args.GetIsolate());
1559     TestObj* imp = V8TestObj::toNative(args.Holder());
1560     if (args.Length() <= 0 || !args[0]->IsFunction())
1561         return setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
1562     RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1563     imp->overloadedMethod(callback);
1564     return v8Undefined();
1565 }
1566
1567 static v8::Handle<v8::Value> overloadedMethod6Callback(const v8::Arguments& args)
1568 {
1569     INC_STATS("DOM.TestObj.overloadedMethod6");
1570     if (args.Length() < 1)
1571         return throwNotEnoughArgumentsError(args.GetIsolate());
1572     TestObj* imp = V8TestObj::toNative(args.Holder());
1573     EXCEPTION_BLOCK(RefPtr<DOMStringList>, listArg, toDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1574     imp->overloadedMethod(listArg);
1575     return v8Undefined();
1576 }
1577
1578 static v8::Handle<v8::Value> overloadedMethod7Callback(const v8::Arguments& args)
1579 {
1580     INC_STATS("DOM.TestObj.overloadedMethod7");
1581     if (args.Length() < 1)
1582         return throwNotEnoughArgumentsError(args.GetIsolate());
1583     TestObj* imp = V8TestObj::toNative(args.Holder());
1584     EXCEPTION_BLOCK(RefPtr<DOMStringList>, arrayArg, toDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1585     imp->overloadedMethod(arrayArg);
1586     return v8Undefined();
1587 }
1588
1589 static v8::Handle<v8::Value> overloadedMethod8Callback(const v8::Arguments& args)
1590 {
1591     INC_STATS("DOM.TestObj.overloadedMethod8");
1592     if (args.Length() < 1)
1593         return throwNotEnoughArgumentsError(args.GetIsolate());
1594     TestObj* imp = V8TestObj::toNative(args.Holder());
1595     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1596     imp->overloadedMethod(objArg);
1597     return v8Undefined();
1598 }
1599
1600 static v8::Handle<v8::Value> overloadedMethod9Callback(const v8::Arguments& args)
1601 {
1602     INC_STATS("DOM.TestObj.overloadedMethod9");
1603     if (args.Length() < 1)
1604         return throwNotEnoughArgumentsError(args.GetIsolate());
1605     TestObj* imp = V8TestObj::toNative(args.Holder());
1606     EXCEPTION_BLOCK(RefPtr<DOMStringList>, arrayArg, toDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1607     imp->overloadedMethod(arrayArg);
1608     return v8Undefined();
1609 }
1610
1611 static v8::Handle<v8::Value> overloadedMethod10Callback(const v8::Arguments& args)
1612 {
1613     INC_STATS("DOM.TestObj.overloadedMethod10");
1614     if (args.Length() < 1)
1615         return throwNotEnoughArgumentsError(args.GetIsolate());
1616     TestObj* imp = V8TestObj::toNative(args.Holder());
1617     EXCEPTION_BLOCK(Vector<unsigned long>, arrayArg, toNativeArray<unsigned long>(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1618     imp->overloadedMethod(arrayArg);
1619     return v8Undefined();
1620 }
1621
1622 static v8::Handle<v8::Value> overloadedMethodCallback(const v8::Arguments& args)
1623 {
1624     INC_STATS("DOM.TestObj.overloadedMethod");
1625     if ((args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0])) && (args[1]->IsNull() || args[1]->IsUndefined() || args[1]->IsString() || args[1]->IsObject())))
1626         return overloadedMethod1Callback(args);
1627     if ((args.Length() == 1 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0]))) || (args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0]))))
1628         return overloadedMethod2Callback(args);
1629     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject())))
1630         return overloadedMethod3Callback(args);
1631     if (args.Length() == 1)
1632         return overloadedMethod4Callback(args);
1633     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsFunction())))
1634         return overloadedMethod5Callback(args);
1635     if ((args.Length() == 1 && (args[0]->IsNull() || V8DOMStringList::HasInstance(args[0]))))
1636         return overloadedMethod6Callback(args);
1637     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsArray())))
1638         return overloadedMethod7Callback(args);
1639     if ((args.Length() == 1 && (V8TestObj::HasInstance(args[0]))))
1640         return overloadedMethod8Callback(args);
1641     if ((args.Length() == 1 && (args[0]->IsArray())))
1642         return overloadedMethod9Callback(args);
1643     if ((args.Length() == 1 && (args[0]->IsArray())))
1644         return overloadedMethod10Callback(args);
1645     if (args.Length() < 1)
1646         return throwNotEnoughArgumentsError(args.GetIsolate());
1647     return throwTypeError(0, args.GetIsolate());
1648 }
1649
1650 static v8::Handle<v8::Value> classMethodCallback(const v8::Arguments& args)
1651 {
1652     INC_STATS("DOM.TestObj.classMethod");
1653     TestObj::classMethod();
1654     return v8Undefined();
1655 }
1656
1657 static v8::Handle<v8::Value> classMethodWithOptionalCallback(const v8::Arguments& args)
1658 {
1659     INC_STATS("DOM.TestObj.classMethodWithOptional");
1660     if (args.Length() <= 0) {
1661         return v8Integer(TestObj::classMethodWithOptional(), args.GetIsolate());
1662     }
1663     EXCEPTION_BLOCK(int, arg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1664     return v8Integer(TestObj::classMethodWithOptional(arg), args.GetIsolate());
1665 }
1666
1667 #if ENABLE(Condition1)
1668
1669 static v8::Handle<v8::Value> overloadedMethod11Callback(const v8::Arguments& args)
1670 {
1671     INC_STATS("DOM.TestObj.overloadedMethod11");
1672     if (args.Length() < 1)
1673         return throwNotEnoughArgumentsError(args.GetIsolate());
1674     EXCEPTION_BLOCK(int, arg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1675     TestObj::overloadedMethod1(arg);
1676     return v8Undefined();
1677 }
1678
1679 #endif // ENABLE(Condition1)
1680
1681 #if ENABLE(Condition1)
1682
1683 static v8::Handle<v8::Value> overloadedMethod12Callback(const v8::Arguments& args)
1684 {
1685     INC_STATS("DOM.TestObj.overloadedMethod12");
1686     if (args.Length() < 1)
1687         return throwNotEnoughArgumentsError(args.GetIsolate());
1688     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, type, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1689     TestObj::overloadedMethod1(type);
1690     return v8Undefined();
1691 }
1692
1693 #endif // ENABLE(Condition1)
1694
1695 #if ENABLE(Condition1)
1696
1697 static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args)
1698 {
1699     INC_STATS("DOM.TestObj.overloadedMethod1");
1700     if (args.Length() == 1)
1701         return overloadedMethod11Callback(args);
1702     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject())))
1703         return overloadedMethod12Callback(args);
1704     if (args.Length() < 1)
1705         return throwNotEnoughArgumentsError(args.GetIsolate());
1706     return throwTypeError(0, args.GetIsolate());
1707 }
1708
1709 #endif // ENABLE(Condition1)
1710
1711 static v8::Handle<v8::Value> classMethodWithClampCallback(const v8::Arguments& args)
1712 {
1713     INC_STATS("DOM.TestObj.classMethodWithClamp");
1714     if (args.Length() < 2)
1715         return throwNotEnoughArgumentsError(args.GetIsolate());
1716     TestObj* imp = V8TestObj::toNative(args.Holder());
1717     unsigned short objArgsShort = 0;
1718     EXCEPTION_BLOCK(double, objArgsShortNativeValue, args[0]->NumberValue());
1719     if (!isnan(objArgsShortNativeValue))
1720         objArgsShort = clampTo<unsigned short>(objArgsShortNativeValue);
1721     unsigned long objArgsLong = 0;
1722     EXCEPTION_BLOCK(double, objArgsLongNativeValue, args[1]->NumberValue());
1723     if (!isnan(objArgsLongNativeValue))
1724         objArgsLong = clampTo<unsigned long>(objArgsLongNativeValue);
1725     imp->classMethodWithClamp(objArgsShort, objArgsLong);
1726     return v8Undefined();
1727 }
1728
1729 static v8::Handle<v8::Value> enabledAtRuntimeMethod1Callback(const v8::Arguments& args)
1730 {
1731     INC_STATS("DOM.TestObj.enabledAtRuntimeMethod1");
1732     if (args.Length() < 1)
1733         return throwNotEnoughArgumentsError(args.GetIsolate());
1734     TestObj* imp = V8TestObj::toNative(args.Holder());
1735     EXCEPTION_BLOCK(int, longArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1736     imp->enabledAtRuntimeMethod1(longArg);
1737     return v8Undefined();
1738 }
1739
1740 static v8::Handle<v8::Value> enabledAtRuntimeMethod2Callback(const v8::Arguments& args)
1741 {
1742     INC_STATS("DOM.TestObj.enabledAtRuntimeMethod2");
1743     if (args.Length() < 1)
1744         return throwNotEnoughArgumentsError(args.GetIsolate());
1745     TestObj* imp = V8TestObj::toNative(args.Holder());
1746     EXCEPTION_BLOCK(int, longArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1747     imp->enabledAtRuntimeMethod2(longArg);
1748     return v8Undefined();
1749 }
1750
1751 static v8::Handle<v8::Value> enabledPerContextMethod1Callback(const v8::Arguments& args)
1752 {
1753     INC_STATS("DOM.TestObj.enabledPerContextMethod1");
1754     if (args.Length() < 1)
1755         return throwNotEnoughArgumentsError(args.GetIsolate());
1756     TestObj* imp = V8TestObj::toNative(args.Holder());
1757     EXCEPTION_BLOCK(int, longArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1758     imp->enabledPerContextMethod1(longArg);
1759     return v8Undefined();
1760 }
1761
1762 static v8::Handle<v8::Value> enabledPerContextMethod2Callback(const v8::Arguments& args)
1763 {
1764     INC_STATS("DOM.TestObj.enabledPerContextMethod2");
1765     if (args.Length() < 1)
1766         return throwNotEnoughArgumentsError(args.GetIsolate());
1767     TestObj* imp = V8TestObj::toNative(args.Holder());
1768     EXCEPTION_BLOCK(int, longArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1769     imp->enabledPerContextMethod2(longArg);
1770     return v8Undefined();
1771 }
1772
1773 static v8::Handle<v8::Value> stringArrayFunctionCallback(const v8::Arguments& args)
1774 {
1775     INC_STATS("DOM.TestObj.stringArrayFunction");
1776     if (args.Length() < 1)
1777         return throwNotEnoughArgumentsError(args.GetIsolate());
1778     TestObj* imp = V8TestObj::toNative(args.Holder());
1779     ExceptionCode ec = 0;
1780     {
1781     EXCEPTION_BLOCK(RefPtr<DOMStringList>, values, toDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1782     RefPtr<DOMStringList> result = imp->stringArrayFunction(values, ec);
1783     if (UNLIKELY(ec))
1784         goto fail;
1785     return v8Array(result.release(), args.GetIsolate());
1786     }
1787     fail:
1788     return setDOMException(ec, args.GetIsolate());
1789 }
1790
1791 static v8::Handle<v8::Value> getSVGDocumentCallback(const v8::Arguments& args)
1792 {
1793     INC_STATS("DOM.TestObj.getSVGDocument");
1794     TestObj* imp = V8TestObj::toNative(args.Holder());
1795     ExceptionCode ec = 0;
1796     {
1797     if (!BindingSecurity::shouldAllowAccessToNode(BindingState::instance(), imp->getSVGDocument(ec)))
1798         return v8::Handle<v8::Value>(v8::Null(args.GetIsolate()));
1799     RefPtr<SVGDocument> result = imp->getSVGDocument(ec);
1800     if (UNLIKELY(ec))
1801         goto fail;
1802     return toV8(result.release(), args.Holder(), args.GetIsolate());
1803     }
1804     fail:
1805     return setDOMException(ec, args.GetIsolate());
1806 }
1807
1808 static v8::Handle<v8::Value> convert1Callback(const v8::Arguments& args)
1809 {
1810     INC_STATS("DOM.TestObj.convert1");
1811     if (args.Length() < 1)
1812         return throwNotEnoughArgumentsError(args.GetIsolate());
1813     TestObj* imp = V8TestObj::toNative(args.Holder());
1814     EXCEPTION_BLOCK(a*, value, V8a::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8a::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1815     imp->convert1(value);
1816     return v8Undefined();
1817 }
1818
1819 static v8::Handle<v8::Value> convert2Callback(const v8::Arguments& args)
1820 {
1821     INC_STATS("DOM.TestObj.convert2");
1822     if (args.Length() < 1)
1823         return throwNotEnoughArgumentsError(args.GetIsolate());
1824     TestObj* imp = V8TestObj::toNative(args.Holder());
1825     EXCEPTION_BLOCK(b*, value, V8b::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8b::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1826     imp->convert2(value);
1827     return v8Undefined();
1828 }
1829
1830 static v8::Handle<v8::Value> convert4Callback(const v8::Arguments& args)
1831 {
1832     INC_STATS("DOM.TestObj.convert4");
1833     if (args.Length() < 1)
1834         return throwNotEnoughArgumentsError(args.GetIsolate());
1835     TestObj* imp = V8TestObj::toNative(args.Holder());
1836     EXCEPTION_BLOCK(d*, value, V8d::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8d::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1837     imp->convert4(value);
1838     return v8Undefined();
1839 }
1840
1841 static v8::Handle<v8::Value> convert5Callback(const v8::Arguments& args)
1842 {
1843     INC_STATS("DOM.TestObj.convert5");
1844     if (args.Length() < 1)
1845         return throwNotEnoughArgumentsError(args.GetIsolate());
1846     TestObj* imp = V8TestObj::toNative(args.Holder());
1847     EXCEPTION_BLOCK(e*, value, V8e::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8e::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1848     imp->convert5(value);
1849     return v8Undefined();
1850 }
1851
1852 static v8::Handle<v8::Value> mutablePointFunctionCallback(const v8::Arguments& args)
1853 {
1854     INC_STATS("DOM.TestObj.mutablePointFunction");
1855     TestObj* imp = V8TestObj::toNative(args.Holder());
1856     return toV8(WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(imp->mutablePointFunction())), args.Holder(), args.GetIsolate());
1857 }
1858
1859 static v8::Handle<v8::Value> immutablePointFunctionCallback(const v8::Arguments& args)
1860 {
1861     INC_STATS("DOM.TestObj.immutablePointFunction");
1862     TestObj* imp = V8TestObj::toNative(args.Holder());
1863     return toV8(WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(imp->immutablePointFunction())), args.Holder(), args.GetIsolate());
1864 }
1865
1866 static v8::Handle<v8::Value> orangeCallback(const v8::Arguments& args)
1867 {
1868     INC_STATS("DOM.TestObj.orange");
1869     TestObj* imp = V8TestObj::toNative(args.Holder());
1870     imp->banana();
1871     return v8Undefined();
1872 }
1873
1874 static v8::Handle<v8::Value> strictFunctionCallback(const v8::Arguments& args)
1875 {
1876     INC_STATS("DOM.TestObj.strictFunction");
1877     if (args.Length() < 3)
1878         return throwNotEnoughArgumentsError(args.GetIsolate());
1879     TestObj* imp = V8TestObj::toNative(args.Holder());
1880     ExceptionCode ec = 0;
1881     {
1882     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1883     EXCEPTION_BLOCK(float, a, static_cast<float>(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)->NumberValue()));
1884     EXCEPTION_BLOCK(int, b, toInt32(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)));
1885     RefPtr<bool> result = imp->strictFunction(str, a, b, ec);
1886     if (UNLIKELY(ec))
1887         goto fail;
1888     return toV8(result.release(), args.Holder(), args.GetIsolate());
1889     }
1890     fail:
1891     return setDOMException(ec, args.GetIsolate());
1892 }
1893
1894 static v8::Handle<v8::Value> variadicStringMethodCallback(const v8::Arguments& args)
1895 {
1896     INC_STATS("DOM.TestObj.variadicStringMethod");
1897     if (args.Length() < 1)
1898         return throwNotEnoughArgumentsError(args.GetIsolate());
1899     TestObj* imp = V8TestObj::toNative(args.Holder());
1900     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, head, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1901     EXCEPTION_BLOCK(Vector<String>, tail, toNativeArguments<String>(args, 1));
1902     imp->variadicStringMethod(head, tail);
1903     return v8Undefined();
1904 }
1905
1906 static v8::Handle<v8::Value> variadicDoubleMethodCallback(const v8::Arguments& args)
1907 {
1908     INC_STATS("DOM.TestObj.variadicDoubleMethod");
1909     if (args.Length() < 1)
1910         return throwNotEnoughArgumentsError(args.GetIsolate());
1911     TestObj* imp = V8TestObj::toNative(args.Holder());
1912     EXCEPTION_BLOCK(double, head, static_cast<double>(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)->NumberValue()));
1913     EXCEPTION_BLOCK(Vector<double>, tail, toNativeArguments<double>(args, 1));
1914     imp->variadicDoubleMethod(head, tail);
1915     return v8Undefined();
1916 }
1917
1918 static v8::Handle<v8::Value> variadicNodeMethodCallback(const v8::Arguments& args)
1919 {
1920     INC_STATS("DOM.TestObj.variadicNodeMethod");
1921     if (args.Length() < 1)
1922         return throwNotEnoughArgumentsError(args.GetIsolate());
1923     TestObj* imp = V8TestObj::toNative(args.Holder());
1924     EXCEPTION_BLOCK(Node*, head, V8Node::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1925     Vector<RefPtr<Node> > tail;
1926     for (int i = 1; i < args.Length(); ++i) {
1927         if (!V8Node::HasInstance(args[i]))
1928             return throwTypeError(0, args.GetIsolate());
1929         tail.append(V8Node::toNative(v8::Handle<v8::Object>::Cast(args[i])));
1930     }
1931     imp->variadicNodeMethod(head, tail);
1932     return v8Undefined();
1933 }
1934
1935 } // namespace TestObjV8Internal
1936
1937 static const V8DOMConfiguration::BatchedAttribute V8TestObjAttrs[] = {
1938     // Attribute 'readOnlyLongAttr' (Type: 'readonly attribute' ExtAttr: '')
1939     {"readOnlyLongAttr", TestObjV8Internal::readOnlyLongAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1940     // Attribute 'readOnlyStringAttr' (Type: 'readonly attribute' ExtAttr: '')
1941     {"readOnlyStringAttr", TestObjV8Internal::readOnlyStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1942     // Attribute 'readOnlyTestObjAttr' (Type: 'readonly attribute' ExtAttr: '')
1943     {"readOnlyTestObjAttr", TestObjV8Internal::readOnlyTestObjAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1944     // Attribute 'staticReadOnlyLongAttr' (Type: 'readonly attribute' ExtAttr: '')
1945     {"staticReadOnlyLongAttr", TestObjV8Internal::staticReadOnlyLongAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1946     // Attribute 'staticStringAttr' (Type: 'attribute' ExtAttr: '')
1947     {"staticStringAttr", TestObjV8Internal::staticStringAttrAttrGetter, TestObjV8Internal::staticStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1948     // Attribute 'TestSubObj' (Type: 'readonly attribute' ExtAttr: '')
1949     {"TestSubObj", TestObjV8Internal::TestObjConstructorGetter, 0, &V8TestSubObj::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1950     // Attribute 'shortAttr' (Type: 'attribute' ExtAttr: '')
1951     {"shortAttr", TestObjV8Internal::shortAttrAttrGetter, TestObjV8Internal::shortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1952     // Attribute 'unsignedShortAttr' (Type: 'attribute' ExtAttr: '')
1953     {"unsignedShortAttr", TestObjV8Internal::unsignedShortAttrAttrGetter, TestObjV8Internal::unsignedShortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1954     // Attribute 'longAttr' (Type: 'attribute' ExtAttr: '')
1955     {"longAttr", TestObjV8Internal::longAttrAttrGetter, TestObjV8Internal::longAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1956     // Attribute 'longLongAttr' (Type: 'attribute' ExtAttr: '')
1957     {"longLongAttr", TestObjV8Internal::longLongAttrAttrGetter, TestObjV8Internal::longLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1958     // Attribute 'unsignedLongLongAttr' (Type: 'attribute' ExtAttr: '')
1959     {"unsignedLongLongAttr", TestObjV8Internal::unsignedLongLongAttrAttrGetter, TestObjV8Internal::unsignedLongLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1960     // Attribute 'stringAttr' (Type: 'attribute' ExtAttr: '')
1961     {"stringAttr", TestObjV8Internal::stringAttrAttrGetter, TestObjV8Internal::stringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1962     // Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: 'V8MeasureAs')
1963     {"testObjAttr", TestObjV8Internal::testObjAttrAttrGetter, TestObjV8Internal::testObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1964     // Attribute 'XMLObjAttr' (Type: 'attribute' ExtAttr: '')
1965     {"XMLObjAttr", TestObjV8Internal::XMLObjAttrAttrGetter, TestObjV8Internal::XMLObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1966     // Attribute 'create' (Type: 'attribute' ExtAttr: '')
1967     {"create", TestObjV8Internal::createAttrGetter, TestObjV8Internal::createAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1968     // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1969     {"reflectedStringAttr", TestObjV8Internal::reflectedStringAttrAttrGetter, TestObjV8Internal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1970     // Attribute 'reflectedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1971     {"reflectedIntegralAttr", TestObjV8Internal::reflectedIntegralAttrAttrGetter, TestObjV8Internal::reflectedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1972     // Attribute 'reflectedUnsignedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1973     {"reflectedUnsignedIntegralAttr", TestObjV8Internal::reflectedUnsignedIntegralAttrAttrGetter, TestObjV8Internal::reflectedUnsignedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1974     // Attribute 'reflectedBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1975     {"reflectedBooleanAttr", TestObjV8Internal::reflectedBooleanAttrAttrGetter, TestObjV8Internal::reflectedBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1976     // Attribute 'reflectedURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect')
1977     {"reflectedURLAttr", TestObjV8Internal::reflectedURLAttrAttrGetter, TestObjV8Internal::reflectedURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1978     // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1979     {"reflectedStringAttr", TestObjV8Internal::reflectedStringAttrAttrGetter, TestObjV8Internal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1980     // Attribute 'reflectedCustomIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1981     {"reflectedCustomIntegralAttr", TestObjV8Internal::reflectedCustomIntegralAttrAttrGetter, TestObjV8Internal::reflectedCustomIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1982     // Attribute 'reflectedCustomBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1983     {"reflectedCustomBooleanAttr", TestObjV8Internal::reflectedCustomBooleanAttrAttrGetter, TestObjV8Internal::reflectedCustomBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1984     // Attribute 'reflectedCustomURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect')
1985     {"reflectedCustomURLAttr", TestObjV8Internal::reflectedCustomURLAttrAttrGetter, TestObjV8Internal::reflectedCustomURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1986     // Attribute 'typedArrayAttr' (Type: 'attribute' ExtAttr: '')
1987     {"typedArrayAttr", TestObjV8Internal::typedArrayAttrAttrGetter, TestObjV8Internal::typedArrayAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1988     // Attribute 'attrWithGetterException' (Type: 'attribute' ExtAttr: '')
1989     {"attrWithGetterException", TestObjV8Internal::attrWithGetterExceptionAttrGetter, TestObjV8Internal::attrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1990     // Attribute 'attrWithSetterException' (Type: 'attribute' ExtAttr: '')
1991     {"attrWithSetterException", TestObjV8Internal::attrWithSetterExceptionAttrGetter, TestObjV8Internal::attrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1992     // Attribute 'stringAttrWithGetterException' (Type: 'attribute' ExtAttr: '')
1993     {"stringAttrWithGetterException", TestObjV8Internal::stringAttrWithGetterExceptionAttrGetter, TestObjV8Internal::stringAttrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1994     // Attribute 'stringAttrWithSetterException' (Type: 'attribute' ExtAttr: '')
1995     {"stringAttrWithSetterException", TestObjV8Internal::stringAttrWithSetterExceptionAttrGetter, TestObjV8Internal::stringAttrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1996     // Attribute 'customAttr' (Type: 'attribute' ExtAttr: 'Custom')
1997     {"customAttr", V8TestObj::customAttrAccessorGetter, V8TestObj::customAttrAccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1998     // Attribute 'withScriptStateAttribute' (Type: 'attribute' ExtAttr: 'CallWith')
1999     {"withScriptStateAttribute", TestObjV8Internal::withScriptStateAttributeAttrGetter, TestObjV8Internal::withScriptStateAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2000     // Attribute 'withScriptExecutionContextAttribute' (Type: 'attribute' ExtAttr: 'CallWith')
2001     {"withScriptExecutionContextAttribute", TestObjV8Internal::withScriptExecutionContextAttributeAttrGetter, TestObjV8Internal::withScriptExecutionContextAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2002     // Attribute 'withScriptStateAttributeRaises' (Type: 'attribute' ExtAttr: 'CallWith')
2003     {"withScriptStateAttributeRaises", TestObjV8Internal::withScriptStateAttributeRaisesAttrGetter, TestObjV8Internal::withScriptStateAttributeRaisesAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2004     // Attribute 'withScriptExecutionContextAttributeRaises' (Type: 'attribute' ExtAttr: 'CallWith')
2005     {"withScriptExecutionContextAttributeRaises", TestObjV8Internal::withScriptExecutionContextAttributeRaisesAttrGetter, TestObjV8Internal::withScriptExecutionContextAttributeRaisesAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2006     // Attribute 'withScriptExecutionContextAndScriptStateAttribute' (Type: 'attribute' ExtAttr: 'CallWith')
2007     {"withScriptExecutionContextAndScriptStateAttribute", TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeAttrGetter, TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2008     // Attribute 'withScriptExecutionContextAndScriptStateAttributeRaises' (Type: 'attribute' ExtAttr: 'CallWith')
2009     {"withScriptExecutionContextAndScriptStateAttributeRaises", TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrGetter, TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2010     // Attribute 'withScriptExecutionContextAndScriptStateWithSpacesAttribute' (Type: 'attribute' ExtAttr: 'CallWith')
2011     {"withScriptExecutionContextAndScriptStateWithSpacesAttribute", TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrGetter, TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2012     // Attribute 'withScriptArgumentsAndCallStackAttribute' (Type: 'attribute' ExtAttr: 'CallWith')
2013     {"withScriptArgumentsAndCallStackAttribute", TestObjV8Internal::withScriptArgumentsAndCallStackAttributeAttrGetter, TestObjV8Internal::withScriptArgumentsAndCallStackAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2014 #if ENABLE(Condition1)
2015     // Attribute 'conditionalAttr1' (Type: 'attribute' ExtAttr: 'Conditional')
2016     {"conditionalAttr1", TestObjV8Internal::conditionalAttr1AttrGetter, TestObjV8Internal::conditionalAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2017 #endif // ENABLE(Condition1)
2018 #if ENABLE(Condition1) && ENABLE(Condition2)
2019     // Attribute 'conditionalAttr2' (Type: 'attribute' ExtAttr: 'Conditional')
2020     {"conditionalAttr2", TestObjV8Internal::conditionalAttr2AttrGetter, TestObjV8Internal::conditionalAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2021 #endif // ENABLE(Condition1) && ENABLE(Condition2)
2022 #if ENABLE(Condition1) || ENABLE(Condition2)
2023     // Attribute 'conditionalAttr3' (Type: 'attribute' ExtAttr: 'Conditional')
2024     {"conditionalAttr3", TestObjV8Internal::conditionalAttr3AttrGetter, TestObjV8Internal::conditionalAttr3AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2025 #endif // ENABLE(Condition1) || ENABLE(Condition2)
2026 #if ENABLE(Condition1)
2027     // Attribute 'conditionalAttr4' (Type: 'attribute' ExtAttr: 'Conditional')
2028     {"conditionalAttr4", TestObjV8Internal::TestObjConstructorGetter, TestObjV8Internal::TestObjReplaceableAttrSetter, &V8TestObjectA::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2029 #endif // ENABLE(Condition1)
2030 #if ENABLE(Condition1) && ENABLE(Condition2)
2031     // Attribute 'conditionalAttr5' (Type: 'attribute' ExtAttr: 'Conditional')
2032     {"conditionalAttr5", TestObjV8Internal::TestObjConstructorGetter, TestObjV8Internal::TestObjReplaceableAttrSetter, &V8TestObjectB::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2033 #endif // ENABLE(Condition1) && ENABLE(Condition2)
2034 #if ENABLE(Condition1) || ENABLE(Condition2)
2035     // Attribute 'conditionalAttr6' (Type: 'attribute' ExtAttr: 'Conditional')
2036     {"conditionalAttr6", TestObjV8Internal::TestObjConstructorGetter, TestObjV8Internal::TestObjReplaceableAttrSetter, &V8TestObjectC::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2037 #endif // ENABLE(Condition1) || ENABLE(Condition2)
2038     // Attribute 'cachedAttribute1' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute')
2039     {"cachedAttribute1", TestObjV8Internal::cachedAttribute1AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2040     // Attribute 'cachedAttribute2' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute')
2041     {"cachedAttribute2", TestObjV8Internal::cachedAttribute2AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2042     // Attribute 'anyAttribute' (Type: 'attribute' ExtAttr: '')
2043     {"anyAttribute", TestObjV8Internal::anyAttributeAttrGetter, TestObjV8Internal::anyAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2044     // Attribute 'floatArray' (Type: 'attribute' ExtAttr: '')
2045     {"floatArray", TestObjV8Internal::floatArrayAttrGetter, TestObjV8Internal::floatArrayAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2046     // Attribute 'doubleArray' (Type: 'attribute' ExtAttr: '')
2047     {"doubleArray", TestObjV8Internal::doubleArrayAttrGetter, TestObjV8Internal::doubleArrayAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2048     // Attribute 'contentDocument' (Type: 'readonly attribute' ExtAttr: 'CheckSecurityForNode')
2049     {"contentDocument", TestObjV8Internal::contentDocumentAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2050     // Attribute 'mutablePoint' (Type: 'attribute' ExtAttr: '')
2051     {"mutablePoint", TestObjV8Internal::mutablePointAttrGetter, TestObjV8Internal::mutablePointAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2052     // Attribute 'immutablePoint' (Type: 'attribute' ExtAttr: 'Immutable')
2053     {"immutablePoint", TestObjV8Internal::immutablePointAttrGetter, TestObjV8Internal::immutablePointAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2054     // Attribute 'strawberry' (Type: 'attribute' ExtAttr: 'ImplementedAs')
2055     {"strawberry", TestObjV8Internal::strawberryAttrGetter, TestObjV8Internal::strawberryAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2056     // Attribute 'strictFloat' (Type: 'attribute' ExtAttr: 'StrictTypeChecking')
2057     {"strictFloat", TestObjV8Internal::strictFloatAttrGetter, TestObjV8Internal::strictFloatAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2058     // Attribute 'description' (Type: 'readonly attribute' ExtAttr: '')
2059     {"description", TestObjV8Internal::descriptionAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2060     // Attribute 'id' (Type: 'attribute' ExtAttr: '')
2061     {"id", TestObjV8Internal::idAttrGetter, TestObjV8Internal::idAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2062     // Attribute 'hash' (Type: 'readonly attribute' ExtAttr: '')
2063     {"hash", TestObjV8Internal::hashAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2064     // Attribute 'replaceableAttribute' (Type: 'attribute' ExtAttr: 'Replaceable')
2065     {"replaceableAttribute", TestObjV8Internal::replaceableAttributeAttrGetter, TestObjV8Internal::TestObjReplaceableAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
2066 };
2067
2068 static const V8DOMConfiguration::BatchedCallback V8TestObjCallbacks[] = {
2069     {"voidMethod", TestObjV8Internal::voidMethodCallback},
2070     {"longMethod", TestObjV8Internal::longMethodCallback},
2071     {"objMethod", TestObjV8Internal::objMethodCallback},
2072     {"methodReturningSequence", TestObjV8Internal::methodReturningSequenceCallback},
2073     {"serializedValue", TestObjV8Internal::serializedValueCallback},
2074     {"idbKey", TestObjV8Internal::idbKeyCallback},
2075     {"optionsObject", TestObjV8Internal::optionsObjectCallback},
2076     {"methodWithException", TestObjV8Internal::methodWithExceptionCallback},
2077     {"customMethod", V8TestObj::customMethodCallback},
2078     {"customMethodWithArgs", V8TestObj::customMethodWithArgsCallback},
2079     {"addEventListener", TestObjV8Internal::addEventListenerCallback},
2080     {"removeEventListener", TestObjV8Internal::removeEventListenerCallback},
2081     {"withScriptStateVoid", TestObjV8Internal::withScriptStateVoidCallback},
2082     {"withScriptStateObj", TestObjV8Internal::withScriptStateObjCallback},
2083     {"withScriptStateVoidException", TestObjV8Internal::withScriptStateVoidExceptionCallback},
2084     {"withScriptStateObjException", TestObjV8Internal::withScriptStateObjExceptionCallback},
2085     {"withScriptExecutionContext", TestObjV8Internal::withScriptExecutionContextCallback},
2086     {"withScriptExecutionContextAndScriptState", TestObjV8Internal::withScriptExecutionContextAndScriptStateCallback},
2087     {"withScriptExecutionContextAndScriptStateObjException", TestObjV8Internal::withScriptExecutionContextAndScriptStateObjExceptionCallback},
2088     {"withScriptExecutionContextAndScriptStateWithSpaces", TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesCallback},
2089     {"withScriptArgumentsAndCallStack", TestObjV8Internal::withScriptArgumentsAndCallStackCallback},
2090     {"methodWithOptionalArg", TestObjV8Internal::methodWithOptionalArgCallback},
2091     {"methodWithNonOptionalArgAndOptionalArg", TestObjV8Internal::methodWithNonOptionalArgAndOptionalArgCallback},
2092     {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjV8Internal::methodWithNonOptionalArgAndTwoOptionalArgsCallback},
2093     {"methodWithOptionalString", TestObjV8Internal::methodWithOptionalStringCallback},
2094     {"methodWithOptionalStringIsUndefined", TestObjV8Internal::methodWithOptionalStringIsUndefinedCallback},
2095     {"methodWithOptionalStringIsNullString", TestObjV8Internal::methodWithOptionalStringIsNullStringCallback},
2096     {"methodWithCallbackArg", TestObjV8Internal::methodWithCallbackArgCallback},
2097     {"methodWithNonCallbackArgAndCallbackArg", TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgCallback},
2098     {"methodWithCallbackAndOptionalArg", TestObjV8Internal::methodWithCallbackAndOptionalArgCallback},
2099 #if ENABLE(Condition1)
2100     {"conditionalMethod1", TestObjV8Internal::conditionalMethod1Callback},
2101 #endif
2102 #if ENABLE(Condition1) && ENABLE(Condition2)
2103     {"conditionalMethod2", TestObjV8Internal::conditionalMethod2Callback},
2104 #endif
2105 #if ENABLE(Condition1) || ENABLE(Condition2)
2106     {"conditionalMethod3", TestObjV8Internal::conditionalMethod3Callback},
2107 #endif
2108     {"overloadedMethod", TestObjV8Internal::overloadedMethodCallback},
2109     {"classMethodWithClamp", TestObjV8Internal::classMethodWithClampCallback},
2110     {"stringArrayFunction", TestObjV8Internal::stringArrayFunctionCallback},
2111     {"getSVGDocument", TestObjV8Internal::getSVGDocumentCallback},
2112     {"mutablePointFunction", TestObjV8Internal::mutablePointFunctionCallback},
2113     {"immutablePointFunction", TestObjV8Internal::immutablePointFunctionCallback},
2114     {"orange", TestObjV8Internal::orangeCallback},
2115     {"strictFunction", TestObjV8Internal::strictFunctionCallback},
2116     {"variadicStringMethod", TestObjV8Internal::variadicStringMethodCallback},
2117     {"variadicDoubleMethod", TestObjV8Internal::variadicDoubleMethodCallback},
2118 };
2119
2120 static const V8DOMConfiguration::BatchedConstant V8TestObjConsts[] = {
2121 #if ENABLE(Condition1)
2122     {"CONDITIONAL_CONST", static_cast<signed int>(0)},
2123 #endif
2124     {"CONST_VALUE_0", static_cast<signed int>(0)},
2125     {"CONST_VALUE_1", static_cast<signed int>(1)},
2126     {"CONST_VALUE_2", static_cast<signed int>(2)},
2127     {"CONST_VALUE_4", static_cast<signed int>(4)},
2128     {"CONST_VALUE_8", static_cast<signed int>(8)},
2129     {"CONST_VALUE_9", static_cast<signed int>(-1)},
2130     {"CONST_VALUE_10", static_cast<signed int>("my constant string")},
2131     {"CONST_VALUE_11", static_cast<signed int>(0xffffffff)},
2132     {"CONST_VALUE_12", static_cast<signed int>(0x01)},
2133     {"CONST_VALUE_13", static_cast<signed int>(0X20)},
2134     {"CONST_VALUE_14", static_cast<signed int>(0x1abc)},
2135     {"CONST_JAVASCRIPT", static_cast<signed int>(15)},
2136 };
2137
2138
2139 #if ENABLE(Condition1)
2140 COMPILE_ASSERT(0 == TestObj::CONDITIONAL_CONST, TestObjEnumCONDITIONAL_CONSTIsWrongUseDoNotCheckConstants);
2141 #endif
2142 COMPILE_ASSERT(0 == TestObj::CONST_VALUE_0, TestObjEnumCONST_VALUE_0IsWrongUseDoNotCheckConstants);
2143 COMPILE_ASSERT(1 == TestObj::CONST_VALUE_1, TestObjEnumCONST_VALUE_1IsWrongUseDoNotCheckConstants);
2144 COMPILE_ASSERT(2 == TestObj::CONST_VALUE_2, TestObjEnumCONST_VALUE_2IsWrongUseDoNotCheckConstants);
2145 COMPILE_ASSERT(4 == TestObj::CONST_VALUE_4, TestObjEnumCONST_VALUE_4IsWrongUseDoNotCheckConstants);
2146 COMPILE_ASSERT(8 == TestObj::CONST_VALUE_8, TestObjEnumCONST_VALUE_8IsWrongUseDoNotCheckConstants);
2147 COMPILE_ASSERT(-1 == TestObj::CONST_VALUE_9, TestObjEnumCONST_VALUE_9IsWrongUseDoNotCheckConstants);
2148 COMPILE_ASSERT("my constant string" == TestObj::CONST_VALUE_10, TestObjEnumCONST_VALUE_10IsWrongUseDoNotCheckConstants);
2149 COMPILE_ASSERT(0xffffffff == TestObj::CONST_VALUE_11, TestObjEnumCONST_VALUE_11IsWrongUseDoNotCheckConstants);
2150 COMPILE_ASSERT(0x01 == TestObj::CONST_VALUE_12, TestObjEnumCONST_VALUE_12IsWrongUseDoNotCheckConstants);
2151 COMPILE_ASSERT(0X20 == TestObj::CONST_VALUE_13, TestObjEnumCONST_VALUE_13IsWrongUseDoNotCheckConstants);
2152 COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWrongUseDoNotCheckConstants);
2153 COMPILE_ASSERT(15 == TestObj::CONST_IMPL, TestObjEnumCONST_IMPLIsWrongUseDoNotCheckConstants);
2154
2155 v8::Handle<v8::Value> V8TestObj::constructorCallback(const v8::Arguments& args)
2156 {
2157     INC_STATS("DOM.TestObj.Constructor");
2158     
2159     if (!args.IsConstructCall())
2160         return throwTypeError("DOM object constructor cannot be called as a function.");
2161
2162     if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
2163         return args.Holder();
2164     if (args.Length() < 1)
2165         return throwNotEnoughArgumentsError(args.GetIsolate());
2166     if (args.Length() <= 0 || !args[0]->IsFunction())
2167         return setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
2168     RefPtr<TestCallback> testCallback = V8TestCallback::create(args[0], getScriptExecutionContext());
2169
2170     RefPtr<TestObj> impl = TestObj::create(testCallback);
2171     v8::Handle<v8::Object> wrapper = args.Holder();
2172
2173     V8DOMWrapper::setDOMWrapper(wrapper, &info, impl.get());
2174     V8DOMWrapper::setJSWrapperForDOMObject(impl.release(), wrapper, args.GetIsolate());
2175     return wrapper;
2176 }
2177
2178 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persistent<v8::FunctionTemplate> desc)
2179 {
2180     desc->ReadOnlyPrototype();
2181
2182     v8::Local<v8::Signature> defaultSignature;
2183     defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestObject", v8::Persistent<v8::FunctionTemplate>(), V8TestObj::internalFieldCount,
2184         V8TestObjAttrs, WTF_ARRAY_LENGTH(V8TestObjAttrs),
2185         V8TestObjCallbacks, WTF_ARRAY_LENGTH(V8TestObjCallbacks));
2186     UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
2187     desc->SetCallHandler(V8TestObj::constructorCallback);
2188     v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
2189     v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
2190     UNUSED_PARAM(instance); // In some cases, it will not be used.
2191     UNUSED_PARAM(proto); // In some cases, it will not be used.
2192     
2193     if (RuntimeEnabledFeatures::enabledAtRuntimeAttr1Enabled()) {
2194         static const V8DOMConfiguration::BatchedAttribute attrData =\
2195         // Attribute 'enabledAtRuntimeAttr1' (Type: 'attribute' ExtAttr: 'V8EnabledAtRuntime')
2196         {"enabledAtRuntimeAttr1", TestObjV8Internal::enabledAtRuntimeAttr1AttrGetter, TestObjV8Internal::enabledAtRuntimeAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
2197         V8DOMConfiguration::configureAttribute(instance, proto, attrData);
2198     }
2199     if (RuntimeEnabledFeatures::featureNameEnabled()) {
2200         static const V8DOMConfiguration::BatchedAttribute attrData =\
2201         // Attribute 'enabledAtRuntimeAttr2' (Type: 'attribute' ExtAttr: 'V8EnabledAtRuntime')
2202         {"enabledAtRuntimeAttr2", TestObjV8Internal::enabledAtRuntimeAttr2AttrGetter, TestObjV8Internal::enabledAtRuntimeAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
2203         V8DOMConfiguration::configureAttribute(instance, proto, attrData);
2204     }
2205
2206     // Custom Signature 'voidMethodWithArgs'
2207     const int voidMethodWithArgsArgc = 3;
2208     v8::Handle<v8::FunctionTemplate> voidMethodWithArgsArgv[voidMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
2209     v8::Handle<v8::Signature> voidMethodWithArgsSignature = v8::Signature::New(desc, voidMethodWithArgsArgc, voidMethodWithArgsArgv);
2210     proto->Set(v8::String::NewSymbol("voidMethodWithArgs"), v8::FunctionTemplate::New(TestObjV8Internal::voidMethodWithArgsCallback, v8Undefined(), voidMethodWithArgsSignature));
2211
2212     // Custom Signature 'longMethodWithArgs'
2213     const int longMethodWithArgsArgc = 3;
2214     v8::Handle<v8::FunctionTemplate> longMethodWithArgsArgv[longMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
2215     v8::Handle<v8::Signature> longMethodWithArgsSignature = v8::Signature::New(desc, longMethodWithArgsArgc, longMethodWithArgsArgv);
2216     proto->Set(v8::String::NewSymbol("longMethodWithArgs"), v8::FunctionTemplate::New(TestObjV8Internal::longMethodWithArgsCallback, v8Undefined(), longMethodWithArgsSignature));
2217
2218     // Custom Signature 'objMethodWithArgs'
2219     const int objMethodWithArgsArgc = 3;
2220     v8::Handle<v8::FunctionTemplate> objMethodWithArgsArgv[objMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
2221     v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(desc, objMethodWithArgsArgc, objMethodWithArgsArgv);
2222     proto->Set(v8::String::NewSymbol("objMethodWithArgs"), v8::FunctionTemplate::New(TestObjV8Internal::objMethodWithArgsCallback, v8Undefined(), objMethodWithArgsSignature));
2223
2224     // Custom Signature 'methodWithSequenceArg'
2225     const int methodWithSequenceArgArgc = 1;
2226     v8::Handle<v8::FunctionTemplate> methodWithSequenceArgArgv[methodWithSequenceArgArgc] = { V8sequence<ScriptProfile>::GetRawTemplate() };
2227     v8::Handle<v8::Signature> methodWithSequenceArgSignature = v8::Signature::New(desc, methodWithSequenceArgArgc, methodWithSequenceArgArgv);
2228     proto->Set(v8::String::NewSymbol("methodWithSequenceArg"), v8::FunctionTemplate::New(TestObjV8Internal::methodWithSequenceArgCallback, v8Undefined(), methodWithSequenceArgSignature));
2229
2230     // Custom Signature 'methodThatRequiresAllArgsAndThrows'
2231     const int methodThatRequiresAllArgsAndThrowsArgc = 2;
2232     v8::Handle<v8::FunctionTemplate> methodThatRequiresAllArgsAndThrowsArgv[methodThatRequiresAllArgsAndThrowsArgc] = { v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
2233     v8::Handle<v8::Signature> methodThatRequiresAllArgsAndThrowsSignature = v8::Signature::New(desc, methodThatRequiresAllArgsAndThrowsArgc, methodThatRequiresAllArgsAndThrowsArgv);
2234     proto->Set(v8::String::NewSymbol("methodThatRequiresAllArgsAndThrows"), v8::FunctionTemplate::New(TestObjV8Internal::methodThatRequiresAllArgsAndThrowsCallback, v8Undefined(), methodThatRequiresAllArgsAndThrowsSignature));
2235     desc->Set(v8::String::NewSymbol("classMethod"), v8::FunctionTemplate::New(TestObjV8Internal::classMethodCallback, v8Undefined(), v8::Local<v8::Signature>()));
2236     desc->Set(v8::String::NewSymbol("classMethodWithOptional"), v8::FunctionTemplate::New(TestObjV8Internal::classMethodWithOptionalCallback, v8Undefined(), v8::Local<v8::Signature>()));
2237     desc->Set(v8::String::NewSymbol("classMethod2"), v8::FunctionTemplate::New(V8TestObj::classMethod2Callback, v8Undefined(), v8::Local<v8::Signature>()));
2238 #if ENABLE(Condition1)
2239     desc->Set(v8::String::NewSymbol("overloadedMethod1"), v8::FunctionTemplate::New(TestObjV8Internal::overloadedMethod1Callback, v8Undefined(), v8::Local<v8::Signature>()));
2240 #endif // ENABLE(Condition1)
2241     if (RuntimeEnabledFeatures::enabledAtRuntimeMethod1Enabled())
2242         proto->Set(v8::String::NewSymbol("enabledAtRuntimeMethod1"), v8::FunctionTemplate::New(TestObjV8Internal::enabledAtRuntimeMethod1Callback, v8Undefined(), defaultSignature));
2243     if (RuntimeEnabledFeatures::featureNameEnabled())
2244         proto->Set(v8::String::NewSymbol("enabledAtRuntimeMethod2"), v8::FunctionTemplate::New(TestObjV8Internal::enabledAtRuntimeMethod2Callback, v8Undefined(), defaultSignature));
2245
2246     // Custom Signature 'convert1'
2247     const int convert1Argc = 1;
2248     v8::Handle<v8::FunctionTemplate> convert1Argv[convert1Argc] = { V8a::GetRawTemplate() };
2249     v8::Handle<v8::Signature> convert1Signature = v8::Signature::New(desc, convert1Argc, convert1Argv);
2250     proto->Set(v8::String::NewSymbol("convert1"), v8::FunctionTemplate::New(TestObjV8Internal::convert1Callback, v8Undefined(), convert1Signature));
2251
2252     // Custom Signature 'convert2'
2253     const int convert2Argc = 1;
2254     v8::Handle<v8::FunctionTemplate> convert2Argv[convert2Argc] = { V8b::GetRawTemplate() };
2255     v8::Handle<v8::Signature> convert2Signature = v8::Signature::New(desc, convert2Argc, convert2Argv);
2256     proto->Set(v8::String::NewSymbol("convert2"), v8::FunctionTemplate::New(TestObjV8Internal::convert2Callback, v8Undefined(), convert2Signature));
2257
2258     // Custom Signature 'convert4'
2259     const int convert4Argc = 1;
2260     v8::Handle<v8::FunctionTemplate> convert4Argv[convert4Argc] = { V8d::GetRawTemplate() };
2261     v8::Handle<v8::Signature> convert4Signature = v8::Signature::New(desc, convert4Argc, convert4Argv);
2262     proto->Set(v8::String::NewSymbol("convert4"), v8::FunctionTemplate::New(TestObjV8Internal::convert4Callback, v8Undefined(), convert4Signature));
2263
2264     // Custom Signature 'convert5'
2265     const int convert5Argc = 1;
2266     v8::Handle<v8::FunctionTemplate> convert5Argv[convert5Argc] = { V8e::GetRawTemplate() };
2267     v8::Handle<v8::Signature> convert5Signature = v8::Signature::New(desc, convert5Argc, convert5Argv);
2268     proto->Set(v8::String::NewSymbol("convert5"), v8::FunctionTemplate::New(TestObjV8Internal::convert5Callback, v8Undefined(), convert5Signature));
2269
2270     // Custom Signature 'variadicNodeMethod'
2271     const int variadicNodeMethodArgc = 2;
2272     v8::Handle<v8::FunctionTemplate> variadicNodeMethodArgv[variadicNodeMethodArgc] = { V8Node::GetRawTemplate(), V8Node::GetRawTemplate() };
2273     v8::Handle<v8::Signature> variadicNodeMethodSignature = v8::Signature::New(desc, variadicNodeMethodArgc, variadicNodeMethodArgv);
2274     proto->Set(v8::String::NewSymbol("variadicNodeMethod"), v8::FunctionTemplate::New(TestObjV8Internal::variadicNodeMethodCallback, v8Undefined(), variadicNodeMethodSignature));
2275     V8DOMConfiguration::batchConfigureConstants(desc, proto, V8TestObjConsts, WTF_ARRAY_LENGTH(V8TestObjConsts));
2276
2277     // Custom toString template
2278     desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
2279     return desc;
2280 }
2281
2282 v8::Persistent<v8::FunctionTemplate> V8TestObj::GetRawTemplate()
2283 {
2284     V8PerIsolateData* data = V8PerIsolateData::current();
2285     V8PerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info);
2286     if (result != data->rawTemplateMap().end())
2287         return result->second;
2288
2289     v8::HandleScope handleScope;
2290     v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
2291     data->rawTemplateMap().add(&info, templ);
2292     return templ;
2293 }
2294
2295 v8::Persistent<v8::FunctionTemplate> V8TestObj::GetTemplate()
2296 {
2297     V8PerIsolateData* data = V8PerIsolateData::current();
2298     V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info);
2299     if (result != data->templateMap().end())
2300         return result->second;
2301
2302     v8::HandleScope handleScope;
2303     v8::Persistent<v8::FunctionTemplate> templ =
2304         ConfigureV8TestObjTemplate(GetRawTemplate());
2305     data->templateMap().add(&info, templ);
2306     return templ;
2307 }
2308
2309 bool V8TestObj::HasInstance(v8::Handle<v8::Value> value)
2310 {
2311     return GetRawTemplate()->HasInstance(value);
2312 }
2313
2314 void V8TestObj::installPerContextProperties(v8::Handle<v8::Object> instance, TestObj* impl)
2315 {
2316     v8::Local<v8::Object> proto = v8::Local<v8::Object>::Cast(instance->GetPrototype());
2317     // When building QtWebkit with V8 this variable is unused when none of the features are enabled.
2318     UNUSED_PARAM(proto);
2319     if (ContextFeatures::enabledPerContextAttr1Enabled(impl->document())) {
2320         static const V8DOMConfiguration::BatchedAttribute attrData =\
2321         // Attribute 'enabledPerContextAttr1' (Type: 'attribute' ExtAttr: 'V8EnabledPerContext')
2322         {"enabledPerContextAttr1", TestObjV8Internal::enabledPerContextAttr1AttrGetter, TestObjV8Internal::enabledPerContextAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
2323         V8DOMConfiguration::configureAttribute(instance, proto, attrData);
2324     }
2325     if (ContextFeatures::featureNameEnabled(impl->document())) {
2326         static const V8DOMConfiguration::BatchedAttribute attrData =\
2327         // Attribute 'enabledPerContextAttr2' (Type: 'attribute' ExtAttr: 'V8EnabledPerContext')
2328         {"enabledPerContextAttr2", TestObjV8Internal::enabledPerContextAttr2AttrGetter, TestObjV8Internal::enabledPerContextAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
2329         V8DOMConfiguration::configureAttribute(instance, proto, attrData);
2330     }
2331     v8::Local<v8::Signature> defaultSignature = v8::Signature::New(GetTemplate());
2332     UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
2333     if (ContextFeatures::enabledPerContextMethod1Enabled(impl->document())) {
2334         proto->Set(v8::String::NewSymbol("enabledPerContextMethod1"), v8::FunctionTemplate::New(TestObjV8Internal::enabledPerContextMethod1Callback, v8Undefined(), defaultSignature)->GetFunction());
2335     }
2336     if (ContextFeatures::featureNameEnabled(impl->document())) {
2337         proto->Set(v8::String::NewSymbol("enabledPerContextMethod2"), v8::FunctionTemplate::New(TestObjV8Internal::enabledPerContextMethod2Callback, v8Undefined(), defaultSignature)->GetFunction());
2338     }
2339 }
2340
2341 v8::Handle<v8::Object> V8TestObj::wrapSlow(PassRefPtr<TestObj> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
2342 {
2343     v8::Handle<v8::Object> wrapper;
2344     Document* document = 0;
2345     UNUSED_PARAM(document);
2346
2347     v8::Handle<v8::Context> context;
2348     if (!creationContext.IsEmpty() && creationContext->CreationContext() != v8::Context::GetCurrent()) {
2349         // For performance, we enter the context only if the currently running context
2350         // is different from the context that we are about to enter.
2351         context = v8::Local<v8::Context>::New(creationContext->CreationContext());
2352         ASSERT(!context.IsEmpty());
2353         context->Enter();
2354     }
2355
2356     wrapper = V8DOMWrapper::instantiateV8Object(document, &info, impl.get());
2357
2358     if (!context.IsEmpty())
2359         context->Exit();
2360
2361     if (UNLIKELY(wrapper.IsEmpty()))
2362         return wrapper;
2363     installPerContextProperties(wrapper, impl.get());
2364     v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate);
2365     if (!hasDependentLifetime)
2366         wrapperHandle.MarkIndependent();
2367     return wrapper;
2368 }
2369
2370 void V8TestObj::derefObject(void* object)
2371 {
2372     static_cast<TestObj*>(object)->deref();
2373 }
2374
2375 } // namespace WebCore