Rename [Optional=CallWithDefaultValue] and [Optional=CallWithNullValue]
[WebKit-https.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 "ExceptionCode.h"
25 #include "HTMLNames.h"
26 #include "IDBBindingUtilities.h"
27 #include "IDBKey.h"
28 #include "OptionsObject.h"
29 #include "RuntimeEnabledFeatures.h"
30 #include "SVGPropertyTearOff.h"
31 #include "SVGStaticPropertyTearOff.h"
32 #include "ScriptArguments.h"
33 #include "ScriptCallStack.h"
34 #include "ScriptCallStackFactory.h"
35 #include "SerializedScriptValue.h"
36 #include "V8Binding.h"
37 #include "V8BindingMacros.h"
38 #include "V8BindingState.h"
39 #include "V8DOMWrapper.h"
40 #include "V8Document.h"
41 #include "V8IsolatedContext.h"
42 #include "V8Proxy.h"
43 #include "V8SVGDocument.h"
44 #include "V8SVGPoint.h"
45 #include "V8TestCallback.h"
46 #include "V8a.h"
47 #include "V8any.h"
48 #include "V8b.h"
49 #include "V8bool.h"
50 #include "V8c.h"
51 #include "V8d.h"
52 #include "V8e.h"
53 #include "V8int.h"
54 #include "V8log.h"
55 #include <wtf/GetPtr.h>
56 #include <wtf/RefCounted.h>
57 #include <wtf/RefPtr.h>
58 #include <wtf/UnusedParam.h>
59 #include <wtf/Vector.h>
60
61 #if ENABLE(Condition1)
62 #include "V8TestObjectA.h"
63 #endif
64
65 #if ENABLE(Condition1) && ENABLE(Condition2)
66 #include "V8TestObjectB.h"
67 #endif
68
69 #if ENABLE(Condition1) || ENABLE(Condition2)
70 #include "V8TestObjectC.h"
71 #endif
72
73 namespace WebCore {
74
75 WrapperTypeInfo V8TestObj::info = { V8TestObj::GetTemplate, V8TestObj::derefObject, 0, 0 };
76
77 namespace TestObjInternal {
78
79 template <typename T> void V8_USE(T) { }
80
81 static v8::Handle<v8::Value> readOnlyIntAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
82 {
83     INC_STATS("DOM.TestObj.readOnlyIntAttr._get");
84     TestObj* imp = V8TestObj::toNative(info.Holder());
85     return v8::Integer::New(imp->readOnlyIntAttr());
86 }
87
88 static v8::Handle<v8::Value> readOnlyStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
89 {
90     INC_STATS("DOM.TestObj.readOnlyStringAttr._get");
91     TestObj* imp = V8TestObj::toNative(info.Holder());
92     return v8String(imp->readOnlyStringAttr());
93 }
94
95 static v8::Handle<v8::Value> readOnlyTestObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
96 {
97     INC_STATS("DOM.TestObj.readOnlyTestObjAttr._get");
98     TestObj* imp = V8TestObj::toNative(info.Holder());
99     RefPtr<TestObj> result = imp->readOnlyTestObjAttr();
100     v8::Handle<v8::Value> wrapper = result.get() ? V8TestObj::existingWrapper(result.get()) : v8::Handle<v8::Object>();
101     if (wrapper.IsEmpty()) {
102         wrapper = toV8(result.get());
103         if (!wrapper.IsEmpty())
104             V8DOMWrapper::setNamedHiddenReference(info.Holder(), "readOnlyTestObjAttr", wrapper);
105     }
106     return wrapper;
107 }
108
109 static v8::Handle<v8::Value> shortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
110 {
111     INC_STATS("DOM.TestObj.shortAttr._get");
112     TestObj* imp = V8TestObj::toNative(info.Holder());
113     return v8::Integer::New(imp->shortAttr());
114 }
115
116 static void shortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
117 {
118     INC_STATS("DOM.TestObj.shortAttr._set");
119     TestObj* imp = V8TestObj::toNative(info.Holder());
120     int v = toInt32(value);
121     imp->setShortAttr(v);
122     return;
123 }
124
125 static v8::Handle<v8::Value> unsignedShortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
126 {
127     INC_STATS("DOM.TestObj.unsignedShortAttr._get");
128     TestObj* imp = V8TestObj::toNative(info.Holder());
129     return v8::Integer::New(imp->unsignedShortAttr());
130 }
131
132 static void unsignedShortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
133 {
134     INC_STATS("DOM.TestObj.unsignedShortAttr._set");
135     TestObj* imp = V8TestObj::toNative(info.Holder());
136     int v = toUInt32(value);
137     imp->setUnsignedShortAttr(v);
138     return;
139 }
140
141 static v8::Handle<v8::Value> intAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
142 {
143     INC_STATS("DOM.TestObj.intAttr._get");
144     TestObj* imp = V8TestObj::toNative(info.Holder());
145     return v8::Integer::New(imp->intAttr());
146 }
147
148 static void intAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
149 {
150     INC_STATS("DOM.TestObj.intAttr._set");
151     TestObj* imp = V8TestObj::toNative(info.Holder());
152     int v = toInt32(value);
153     imp->setIntAttr(v);
154     return;
155 }
156
157 static v8::Handle<v8::Value> longLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
158 {
159     INC_STATS("DOM.TestObj.longLongAttr._get");
160     TestObj* imp = V8TestObj::toNative(info.Holder());
161     return v8::Number::New(static_cast<double>(imp->longLongAttr()));
162 }
163
164 static void longLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
165 {
166     INC_STATS("DOM.TestObj.longLongAttr._set");
167     TestObj* imp = V8TestObj::toNative(info.Holder());
168     long long v = toInt64(value);
169     imp->setLongLongAttr(WTF::getPtr(v));
170     return;
171 }
172
173 static v8::Handle<v8::Value> unsignedLongLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
174 {
175     INC_STATS("DOM.TestObj.unsignedLongLongAttr._get");
176     TestObj* imp = V8TestObj::toNative(info.Holder());
177     return v8::Number::New(static_cast<double>(imp->unsignedLongLongAttr()));
178 }
179
180 static void unsignedLongLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
181 {
182     INC_STATS("DOM.TestObj.unsignedLongLongAttr._set");
183     TestObj* imp = V8TestObj::toNative(info.Holder());
184     unsigned long long v = toInt64(value);
185     imp->setUnsignedLongLongAttr(WTF::getPtr(v));
186     return;
187 }
188
189 static v8::Handle<v8::Value> stringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
190 {
191     INC_STATS("DOM.TestObj.stringAttr._get");
192     TestObj* imp = V8TestObj::toNative(info.Holder());
193     return v8String(imp->stringAttr());
194 }
195
196 static void stringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
197 {
198     INC_STATS("DOM.TestObj.stringAttr._set");
199     TestObj* imp = V8TestObj::toNative(info.Holder());
200     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value);
201     imp->setStringAttr(v);
202     return;
203 }
204
205 static v8::Handle<v8::Value> testObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
206 {
207     INC_STATS("DOM.TestObj.testObjAttr._get");
208     TestObj* imp = V8TestObj::toNative(info.Holder());
209     return toV8(imp->testObjAttr());
210 }
211
212 static void testObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
213 {
214     INC_STATS("DOM.TestObj.testObjAttr._set");
215     TestObj* imp = V8TestObj::toNative(info.Holder());
216     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
217     imp->setTestObjAttr(WTF::getPtr(v));
218     return;
219 }
220
221 static v8::Handle<v8::Value> XMLObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
222 {
223     INC_STATS("DOM.TestObj.XMLObjAttr._get");
224     TestObj* imp = V8TestObj::toNative(info.Holder());
225     return toV8(imp->xmlObjAttr());
226 }
227
228 static void XMLObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
229 {
230     INC_STATS("DOM.TestObj.XMLObjAttr._set");
231     TestObj* imp = V8TestObj::toNative(info.Holder());
232     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
233     imp->setXMLObjAttr(WTF::getPtr(v));
234     return;
235 }
236
237 static v8::Handle<v8::Value> createAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
238 {
239     INC_STATS("DOM.TestObj.create._get");
240     TestObj* imp = V8TestObj::toNative(info.Holder());
241     return v8Boolean(imp->isCreate());
242 }
243
244 static void createAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
245 {
246     INC_STATS("DOM.TestObj.create._set");
247     TestObj* imp = V8TestObj::toNative(info.Holder());
248     bool v = value->BooleanValue();
249     imp->setCreate(v);
250     return;
251 }
252
253 static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
254 {
255     INC_STATS("DOM.TestObj.reflectedStringAttr._get");
256     TestObj* imp = V8TestObj::toNative(info.Holder());
257     return v8String(imp->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr));
258 }
259
260 static void reflectedStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
261 {
262     INC_STATS("DOM.TestObj.reflectedStringAttr._set");
263     TestObj* imp = V8TestObj::toNative(info.Holder());
264     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
265     imp->setAttribute(WebCore::HTMLNames::reflectedstringattrAttr, v);
266     return;
267 }
268
269 static v8::Handle<v8::Value> reflectedIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
270 {
271     INC_STATS("DOM.TestObj.reflectedIntegralAttr._get");
272     TestObj* imp = V8TestObj::toNative(info.Holder());
273     return v8::Integer::New(imp->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr));
274 }
275
276 static void reflectedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
277 {
278     INC_STATS("DOM.TestObj.reflectedIntegralAttr._set");
279     TestObj* imp = V8TestObj::toNative(info.Holder());
280     int v = toInt32(value);
281     imp->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, v);
282     return;
283 }
284
285 static v8::Handle<v8::Value> reflectedUnsignedIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
286 {
287     INC_STATS("DOM.TestObj.reflectedUnsignedIntegralAttr._get");
288     TestObj* imp = V8TestObj::toNative(info.Holder());
289     return v8::Integer::NewFromUnsigned(std::max(0, imp->getIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr)));
290 }
291
292 static void reflectedUnsignedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
293 {
294     INC_STATS("DOM.TestObj.reflectedUnsignedIntegralAttr._set");
295     TestObj* imp = V8TestObj::toNative(info.Holder());
296     unsigned v = toUInt32(value);
297     imp->setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, v);
298     return;
299 }
300
301 static v8::Handle<v8::Value> reflectedBooleanAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
302 {
303     INC_STATS("DOM.TestObj.reflectedBooleanAttr._get");
304     TestObj* imp = V8TestObj::toNative(info.Holder());
305     return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr));
306 }
307
308 static void reflectedBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
309 {
310     INC_STATS("DOM.TestObj.reflectedBooleanAttr._set");
311     TestObj* imp = V8TestObj::toNative(info.Holder());
312     bool v = value->BooleanValue();
313     imp->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, v);
314     return;
315 }
316
317 static v8::Handle<v8::Value> reflectedURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
318 {
319     INC_STATS("DOM.TestObj.reflectedURLAttr._get");
320     TestObj* imp = V8TestObj::toNative(info.Holder());
321     return v8String(imp->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr));
322 }
323
324 static void reflectedURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
325 {
326     INC_STATS("DOM.TestObj.reflectedURLAttr._set");
327     TestObj* imp = V8TestObj::toNative(info.Holder());
328     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
329     imp->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, v);
330     return;
331 }
332
333 static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
334 {
335     INC_STATS("DOM.TestObj.reflectedStringAttr._get");
336     TestObj* imp = V8TestObj::toNative(info.Holder());
337     return v8String(imp->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr));
338 }
339
340 static void reflectedStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
341 {
342     INC_STATS("DOM.TestObj.reflectedStringAttr._set");
343     TestObj* imp = V8TestObj::toNative(info.Holder());
344     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
345     imp->setAttribute(WebCore::HTMLNames::customContentStringAttrAttr, v);
346     return;
347 }
348
349 static v8::Handle<v8::Value> reflectedCustomIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
350 {
351     INC_STATS("DOM.TestObj.reflectedCustomIntegralAttr._get");
352     TestObj* imp = V8TestObj::toNative(info.Holder());
353     return v8::Integer::New(imp->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr));
354 }
355
356 static void reflectedCustomIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
357 {
358     INC_STATS("DOM.TestObj.reflectedCustomIntegralAttr._set");
359     TestObj* imp = V8TestObj::toNative(info.Holder());
360     int v = toInt32(value);
361     imp->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, v);
362     return;
363 }
364
365 static v8::Handle<v8::Value> reflectedCustomBooleanAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
366 {
367     INC_STATS("DOM.TestObj.reflectedCustomBooleanAttr._get");
368     TestObj* imp = V8TestObj::toNative(info.Holder());
369     return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr));
370 }
371
372 static void reflectedCustomBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
373 {
374     INC_STATS("DOM.TestObj.reflectedCustomBooleanAttr._set");
375     TestObj* imp = V8TestObj::toNative(info.Holder());
376     bool v = value->BooleanValue();
377     imp->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, v);
378     return;
379 }
380
381 static v8::Handle<v8::Value> reflectedCustomURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
382 {
383     INC_STATS("DOM.TestObj.reflectedCustomURLAttr._get");
384     TestObj* imp = V8TestObj::toNative(info.Holder());
385     return v8String(imp->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr));
386 }
387
388 static void reflectedCustomURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
389 {
390     INC_STATS("DOM.TestObj.reflectedCustomURLAttr._set");
391     TestObj* imp = V8TestObj::toNative(info.Holder());
392     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
393     imp->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, v);
394     return;
395 }
396
397 static v8::Handle<v8::Value> attrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
398 {
399     INC_STATS("DOM.TestObj.attrWithGetterException._get");
400     TestObj* imp = V8TestObj::toNative(info.Holder());
401     ExceptionCode ec = 0;
402     int v = imp->attrWithGetterException(ec);
403     if (UNLIKELY(ec)) {
404         V8Proxy::setDOMException(ec);
405         return v8::Handle<v8::Value>();
406     }
407     return v8::Integer::New(v);
408 }
409
410 static void attrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
411 {
412     INC_STATS("DOM.TestObj.attrWithGetterException._set");
413     TestObj* imp = V8TestObj::toNative(info.Holder());
414     int v = toInt32(value);
415     ExceptionCode ec = 0;
416     imp->setAttrWithGetterException(v, ec);
417     if (UNLIKELY(ec))
418         V8Proxy::setDOMException(ec);
419     return;
420 }
421
422 static v8::Handle<v8::Value> attrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
423 {
424     INC_STATS("DOM.TestObj.attrWithSetterException._get");
425     TestObj* imp = V8TestObj::toNative(info.Holder());
426     return v8::Integer::New(imp->attrWithSetterException());
427 }
428
429 static void attrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
430 {
431     INC_STATS("DOM.TestObj.attrWithSetterException._set");
432     TestObj* imp = V8TestObj::toNative(info.Holder());
433     int v = toInt32(value);
434     ExceptionCode ec = 0;
435     imp->setAttrWithSetterException(v, ec);
436     if (UNLIKELY(ec))
437         V8Proxy::setDOMException(ec);
438     return;
439 }
440
441 static v8::Handle<v8::Value> stringAttrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
442 {
443     INC_STATS("DOM.TestObj.stringAttrWithGetterException._get");
444     TestObj* imp = V8TestObj::toNative(info.Holder());
445     ExceptionCode ec = 0;
446     String v = imp->stringAttrWithGetterException(ec);
447     if (UNLIKELY(ec)) {
448         V8Proxy::setDOMException(ec);
449         return v8::Handle<v8::Value>();
450     }
451     return v8String(v);
452 }
453
454 static void stringAttrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
455 {
456     INC_STATS("DOM.TestObj.stringAttrWithGetterException._set");
457     TestObj* imp = V8TestObj::toNative(info.Holder());
458     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value);
459     ExceptionCode ec = 0;
460     imp->setStringAttrWithGetterException(v, ec);
461     if (UNLIKELY(ec))
462         V8Proxy::setDOMException(ec);
463     return;
464 }
465
466 static v8::Handle<v8::Value> stringAttrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
467 {
468     INC_STATS("DOM.TestObj.stringAttrWithSetterException._get");
469     TestObj* imp = V8TestObj::toNative(info.Holder());
470     return v8String(imp->stringAttrWithSetterException());
471 }
472
473 static void stringAttrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
474 {
475     INC_STATS("DOM.TestObj.stringAttrWithSetterException._set");
476     TestObj* imp = V8TestObj::toNative(info.Holder());
477     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value);
478     ExceptionCode ec = 0;
479     imp->setStringAttrWithSetterException(v, ec);
480     if (UNLIKELY(ec))
481         V8Proxy::setDOMException(ec);
482     return;
483 }
484
485 static v8::Handle<v8::Value> withScriptStateAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
486 {
487     INC_STATS("DOM.TestObj.withScriptStateAttribute._get");
488     TestObj* imp = V8TestObj::toNative(info.Holder());
489     ScriptState* state = ScriptState::current();
490     if (!state)
491         return v8::Undefined();
492     return v8::Integer::New(imp->withScriptStateAttribute(state));
493 }
494
495 static void withScriptStateAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
496 {
497     INC_STATS("DOM.TestObj.withScriptStateAttribute._set");
498     TestObj* imp = V8TestObj::toNative(info.Holder());
499     int v = toInt32(value);
500     ScriptState* state = ScriptState::current();
501     if (!state)
502         return;
503     imp->setWithScriptStateAttribute(state, v);
504     if (state.hadException())
505         throwError(state.exception());
506     return;
507 }
508
509 static v8::Handle<v8::Value> withScriptExecutionContextAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
510 {
511     INC_STATS("DOM.TestObj.withScriptExecutionContextAttribute._get");
512     TestObj* imp = V8TestObj::toNative(info.Holder());
513     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
514     if (!scriptContext)
515         return v8::Undefined();
516     return toV8(imp->withScriptExecutionContextAttribute(scriptContext));
517 }
518
519 static void withScriptExecutionContextAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
520 {
521     INC_STATS("DOM.TestObj.withScriptExecutionContextAttribute._set");
522     TestObj* imp = V8TestObj::toNative(info.Holder());
523     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
524     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
525     if (!scriptContext)
526         return;
527     imp->setWithScriptExecutionContextAttribute(scriptContext, WTF::getPtr(v));
528     return;
529 }
530
531 static v8::Handle<v8::Value> withScriptStateAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
532 {
533     INC_STATS("DOM.TestObj.withScriptStateAttributeRaises._get");
534     TestObj* imp = V8TestObj::toNative(info.Holder());
535     ExceptionCode ec = 0;
536     ScriptState* state = ScriptState::current();
537     if (!state)
538         return v8::Undefined();
539     RefPtr<TestObj> v = imp->withScriptStateAttributeRaises(state, ec);
540     if (UNLIKELY(ec)) {
541         V8Proxy::setDOMException(ec);
542         return v8::Handle<v8::Value>();
543     }
544     if (state.hadException())
545         return throwError(state.exception());
546     return toV8(v.release());
547 }
548
549 static void withScriptStateAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
550 {
551     INC_STATS("DOM.TestObj.withScriptStateAttributeRaises._set");
552     TestObj* imp = V8TestObj::toNative(info.Holder());
553     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
554     ExceptionCode ec = 0;
555     ScriptState* state = ScriptState::current();
556     if (!state)
557         return;
558     imp->setWithScriptStateAttributeRaises(state, WTF::getPtr(v), ec);
559     if (UNLIKELY(ec))
560         V8Proxy::setDOMException(ec);
561     if (state.hadException())
562         throwError(state.exception());
563     return;
564 }
565
566 static v8::Handle<v8::Value> withScriptExecutionContextAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
567 {
568     INC_STATS("DOM.TestObj.withScriptExecutionContextAttributeRaises._get");
569     TestObj* imp = V8TestObj::toNative(info.Holder());
570     ExceptionCode ec = 0;
571     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
572     if (!scriptContext)
573         return v8::Undefined();
574     RefPtr<TestObj> v = imp->withScriptExecutionContextAttributeRaises(scriptContext, ec);
575     if (UNLIKELY(ec)) {
576         V8Proxy::setDOMException(ec);
577         return v8::Handle<v8::Value>();
578     }
579     return toV8(v.release());
580 }
581
582 static void withScriptExecutionContextAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
583 {
584     INC_STATS("DOM.TestObj.withScriptExecutionContextAttributeRaises._set");
585     TestObj* imp = V8TestObj::toNative(info.Holder());
586     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
587     ExceptionCode ec = 0;
588     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
589     if (!scriptContext)
590         return;
591     imp->setWithScriptExecutionContextAttributeRaises(scriptContext, WTF::getPtr(v), ec);
592     if (UNLIKELY(ec))
593         V8Proxy::setDOMException(ec);
594     return;
595 }
596
597 static v8::Handle<v8::Value> scriptStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
598 {
599     INC_STATS("DOM.TestObj.scriptStringAttr._get");
600     TestObj* imp = V8TestObj::toNative(info.Holder());
601     return v8StringOrNull(imp->scriptStringAttr());
602 }
603
604 #if ENABLE(Condition1)
605
606 static v8::Handle<v8::Value> conditionalAttr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
607 {
608     INC_STATS("DOM.TestObj.conditionalAttr1._get");
609     TestObj* imp = V8TestObj::toNative(info.Holder());
610     return v8::Integer::New(imp->conditionalAttr1());
611 }
612
613 #endif // ENABLE(Condition1)
614
615 #if ENABLE(Condition1)
616
617 static void conditionalAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
618 {
619     INC_STATS("DOM.TestObj.conditionalAttr1._set");
620     TestObj* imp = V8TestObj::toNative(info.Holder());
621     int v = toInt32(value);
622     imp->setConditionalAttr1(v);
623     return;
624 }
625
626 #endif // ENABLE(Condition1)
627
628 #if ENABLE(Condition1) && ENABLE(Condition2)
629
630 static v8::Handle<v8::Value> conditionalAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
631 {
632     INC_STATS("DOM.TestObj.conditionalAttr2._get");
633     TestObj* imp = V8TestObj::toNative(info.Holder());
634     return v8::Integer::New(imp->conditionalAttr2());
635 }
636
637 #endif // ENABLE(Condition1) && ENABLE(Condition2)
638
639 #if ENABLE(Condition1) && ENABLE(Condition2)
640
641 static void conditionalAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
642 {
643     INC_STATS("DOM.TestObj.conditionalAttr2._set");
644     TestObj* imp = V8TestObj::toNative(info.Holder());
645     int v = toInt32(value);
646     imp->setConditionalAttr2(v);
647     return;
648 }
649
650 #endif // ENABLE(Condition1) && ENABLE(Condition2)
651
652 #if ENABLE(Condition1) || ENABLE(Condition2)
653
654 static v8::Handle<v8::Value> conditionalAttr3AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
655 {
656     INC_STATS("DOM.TestObj.conditionalAttr3._get");
657     TestObj* imp = V8TestObj::toNative(info.Holder());
658     return v8::Integer::New(imp->conditionalAttr3());
659 }
660
661 #endif // ENABLE(Condition1) || ENABLE(Condition2)
662
663 #if ENABLE(Condition1) || ENABLE(Condition2)
664
665 static void conditionalAttr3AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
666 {
667     INC_STATS("DOM.TestObj.conditionalAttr3._set");
668     TestObj* imp = V8TestObj::toNative(info.Holder());
669     int v = toInt32(value);
670     imp->setConditionalAttr3(v);
671     return;
672 }
673
674 #endif // ENABLE(Condition1) || ENABLE(Condition2)
675
676 static v8::Handle<v8::Value> cachedAttribute1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
677 {
678     INC_STATS("DOM.TestObj.cachedAttribute1._get");
679     TestObj* imp = V8TestObj::toNative(info.Holder());
680     RefPtr<any> result = imp->cachedAttribute1();
681     v8::Handle<v8::Value> wrapper = result.get() ? V8any::existingWrapper(result.get()) : v8::Handle<v8::Object>();
682     if (wrapper.IsEmpty()) {
683         wrapper = toV8(result.get());
684         if (!wrapper.IsEmpty())
685             V8DOMWrapper::setNamedHiddenReference(info.Holder(), "cachedAttribute1", wrapper);
686     }
687     return wrapper;
688 }
689
690 static v8::Handle<v8::Value> cachedAttribute2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
691 {
692     INC_STATS("DOM.TestObj.cachedAttribute2._get");
693     TestObj* imp = V8TestObj::toNative(info.Holder());
694     RefPtr<any> result = imp->cachedAttribute2();
695     v8::Handle<v8::Value> wrapper = result.get() ? V8any::existingWrapper(result.get()) : v8::Handle<v8::Object>();
696     if (wrapper.IsEmpty()) {
697         wrapper = toV8(result.get());
698         if (!wrapper.IsEmpty())
699             V8DOMWrapper::setNamedHiddenReference(info.Holder(), "cachedAttribute2", wrapper);
700     }
701     return wrapper;
702 }
703
704 static v8::Handle<v8::Value> enabledAtRuntimeAttr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
705 {
706     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr1._get");
707     TestObj* imp = V8TestObj::toNative(info.Holder());
708     return v8::Integer::New(imp->enabledAtRuntimeAttr1());
709 }
710
711 static void enabledAtRuntimeAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
712 {
713     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr1._set");
714     TestObj* imp = V8TestObj::toNative(info.Holder());
715     int v = toInt32(value);
716     imp->setEnabledAtRuntimeAttr1(v);
717     return;
718 }
719
720 static v8::Handle<v8::Value> enabledAtRuntimeAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
721 {
722     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr2._get");
723     TestObj* imp = V8TestObj::toNative(info.Holder());
724     return v8::Integer::New(imp->enabledAtRuntimeAttr2());
725 }
726
727 static void enabledAtRuntimeAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
728 {
729     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr2._set");
730     TestObj* imp = V8TestObj::toNative(info.Holder());
731     int v = toInt32(value);
732     imp->setEnabledAtRuntimeAttr2(v);
733     return;
734 }
735
736 static v8::Handle<v8::Value> floatArrayAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
737 {
738     INC_STATS("DOM.TestObj.floatArray._get");
739     TestObj* imp = V8TestObj::toNative(info.Holder());
740     return v8NumberArray(imp->floatArray());
741 }
742
743 static void floatArrayAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
744 {
745     INC_STATS("DOM.TestObj.floatArray._set");
746     TestObj* imp = V8TestObj::toNative(info.Holder());
747     Vector<float> v = v8NumberArrayToVector<float>(value);
748     imp->setFloatArray(v);
749     return;
750 }
751
752 static v8::Handle<v8::Value> doubleArrayAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
753 {
754     INC_STATS("DOM.TestObj.doubleArray._get");
755     TestObj* imp = V8TestObj::toNative(info.Holder());
756     return v8NumberArray(imp->doubleArray());
757 }
758
759 static void doubleArrayAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
760 {
761     INC_STATS("DOM.TestObj.doubleArray._set");
762     TestObj* imp = V8TestObj::toNative(info.Holder());
763     Vector<double> v = v8NumberArrayToVector<double>(value);
764     imp->setDoubleArray(v);
765     return;
766 }
767
768 static v8::Handle<v8::Value> contentDocumentAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
769 {
770     INC_STATS("DOM.TestObj.contentDocument._get");
771     TestObj* imp = V8TestObj::toNative(info.Holder());
772     if (!V8BindingSecurity::shouldAllowAccessToNode(V8BindingState::Only(), imp->contentDocument()))
773     return v8::Handle<v8::Value>();
774
775     return toV8(imp->contentDocument());
776 }
777
778 static v8::Handle<v8::Value> mutablePointAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
779 {
780     INC_STATS("DOM.TestObj.mutablePoint._get");
781     TestObj* imp = V8TestObj::toNative(info.Holder());
782     return toV8(WTF::getPtr(SVGStaticPropertyTearOff<TestObj, FloatPoint>::create(imp, imp->mutablePoint(), &TestObj::updateMutablePoint)));
783 }
784
785 static void mutablePointAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
786 {
787     INC_STATS("DOM.TestObj.mutablePoint._set");
788     TestObj* imp = V8TestObj::toNative(info.Holder());
789     RefPtr<SVGPropertyTearOff<FloatPoint> > v = V8SVGPoint::HasInstance(value) ? V8SVGPoint::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
790     imp->setMutablePoint(WTF::getPtr(v));
791     return;
792 }
793
794 static v8::Handle<v8::Value> immutablePointAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
795 {
796     INC_STATS("DOM.TestObj.immutablePoint._get");
797     TestObj* imp = V8TestObj::toNative(info.Holder());
798     return toV8(WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(imp->immutablePoint())));
799 }
800
801 static void immutablePointAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
802 {
803     INC_STATS("DOM.TestObj.immutablePoint._set");
804     TestObj* imp = V8TestObj::toNative(info.Holder());
805     RefPtr<SVGPropertyTearOff<FloatPoint> > v = V8SVGPoint::HasInstance(value) ? V8SVGPoint::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
806     imp->setImmutablePoint(WTF::getPtr(v));
807     return;
808 }
809
810 static v8::Handle<v8::Value> strictFloatAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
811 {
812     INC_STATS("DOM.TestObj.strictFloat._get");
813     TestObj* imp = V8TestObj::toNative(info.Holder());
814     return v8::Number::New(imp->strictFloat());
815 }
816
817 static void strictFloatAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
818 {
819     INC_STATS("DOM.TestObj.strictFloat._set");
820     TestObj* imp = V8TestObj::toNative(info.Holder());
821     float v = static_cast<float>(value->NumberValue());
822     imp->setStrictFloat(v);
823     return;
824 }
825
826 static v8::Handle<v8::Value> descriptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
827 {
828     INC_STATS("DOM.TestObj.description._get");
829     TestObj* imp = V8TestObj::toNative(info.Holder());
830     return v8::Integer::New(imp->description());
831 }
832
833 static v8::Handle<v8::Value> idAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
834 {
835     INC_STATS("DOM.TestObj.id._get");
836     TestObj* imp = V8TestObj::toNative(info.Holder());
837     return v8::Integer::New(imp->id());
838 }
839
840 static void idAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
841 {
842     INC_STATS("DOM.TestObj.id._set");
843     TestObj* imp = V8TestObj::toNative(info.Holder());
844     int v = toInt32(value);
845     imp->setId(v);
846     return;
847 }
848
849 static v8::Handle<v8::Value> hashAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
850 {
851     INC_STATS("DOM.TestObj.hash._get");
852     TestObj* imp = V8TestObj::toNative(info.Holder());
853     return v8String(imp->hash());
854 }
855
856 static v8::Handle<v8::Value> TestObjConstructorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
857 {
858     INC_STATS("DOM.TestObj.constructors._get");
859     v8::Handle<v8::Value> data = info.Data();
860     ASSERT(data->IsExternal() || data->IsNumber());
861     WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data);
862     return v8::Handle<v8::Value>();}
863
864 static v8::Handle<v8::Value> voidMethodCallback(const v8::Arguments& args)
865 {
866     INC_STATS("DOM.TestObj.voidMethod");
867     TestObj* imp = V8TestObj::toNative(args.Holder());
868     imp->voidMethod();
869     return v8::Handle<v8::Value>();
870 }
871
872 static v8::Handle<v8::Value> voidMethodWithArgsCallback(const v8::Arguments& args)
873 {
874     INC_STATS("DOM.TestObj.voidMethodWithArgs");
875     if (args.Length() < 3)
876         return throwError("Not enough arguments", V8Proxy::TypeError);
877     TestObj* imp = V8TestObj::toNative(args.Holder());
878     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
879     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
880     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);
881     imp->voidMethodWithArgs(intArg, strArg, objArg);
882     return v8::Handle<v8::Value>();
883 }
884
885 static v8::Handle<v8::Value> intMethodCallback(const v8::Arguments& args)
886 {
887     INC_STATS("DOM.TestObj.intMethod");
888     TestObj* imp = V8TestObj::toNative(args.Holder());
889     return v8::Integer::New(imp->intMethod());
890 }
891
892 static v8::Handle<v8::Value> intMethodWithArgsCallback(const v8::Arguments& args)
893 {
894     INC_STATS("DOM.TestObj.intMethodWithArgs");
895     if (args.Length() < 3)
896         return throwError("Not enough arguments", V8Proxy::TypeError);
897     TestObj* imp = V8TestObj::toNative(args.Holder());
898     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
899     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
900     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);
901     return v8::Integer::New(imp->intMethodWithArgs(intArg, strArg, objArg));
902 }
903
904 static v8::Handle<v8::Value> objMethodCallback(const v8::Arguments& args)
905 {
906     INC_STATS("DOM.TestObj.objMethod");
907     TestObj* imp = V8TestObj::toNative(args.Holder());
908     return toV8(imp->objMethod());
909 }
910
911 static v8::Handle<v8::Value> objMethodWithArgsCallback(const v8::Arguments& args)
912 {
913     INC_STATS("DOM.TestObj.objMethodWithArgs");
914     if (args.Length() < 3)
915         return throwError("Not enough arguments", V8Proxy::TypeError);
916     TestObj* imp = V8TestObj::toNative(args.Holder());
917     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
918     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
919     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);
920     return toV8(imp->objMethodWithArgs(intArg, strArg, objArg));
921 }
922
923 static v8::Handle<v8::Value> methodThatRequiresAllArgsAndThrowsCallback(const v8::Arguments& args)
924 {
925     INC_STATS("DOM.TestObj.methodThatRequiresAllArgsAndThrows");
926     if (args.Length() < 2)
927         return throwError("Not enough arguments", V8Proxy::TypeError);
928     TestObj* imp = V8TestObj::toNative(args.Holder());
929     ExceptionCode ec = 0;
930     {
931     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
932     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);
933     RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec);
934     if (UNLIKELY(ec))
935         goto fail;
936     return toV8(result.release());
937     }
938     fail:
939     V8Proxy::setDOMException(ec);
940     return v8::Handle<v8::Value>();
941 }
942
943 static v8::Handle<v8::Value> serializedValueCallback(const v8::Arguments& args)
944 {
945     INC_STATS("DOM.TestObj.serializedValue");
946     if (args.Length() < 1)
947         return throwError("Not enough arguments", V8Proxy::TypeError);
948     TestObj* imp = V8TestObj::toNative(args.Holder());
949     bool serializedArgDidThrow = false;
950     RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(args[0], 0, 0, serializedArgDidThrow);
951     if (serializedArgDidThrow)
952         return v8::Undefined();
953     imp->serializedValue(serializedArg);
954     return v8::Handle<v8::Value>();
955 }
956
957 static v8::Handle<v8::Value> idbKeyCallback(const v8::Arguments& args)
958 {
959     INC_STATS("DOM.TestObj.idbKey");
960     if (args.Length() < 1)
961         return throwError("Not enough arguments", V8Proxy::TypeError);
962     TestObj* imp = V8TestObj::toNative(args.Holder());
963     EXCEPTION_BLOCK(RefPtr<IDBKey>, key, createIDBKeyFromValue(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
964     imp->idbKey(key);
965     return v8::Handle<v8::Value>();
966 }
967
968 static v8::Handle<v8::Value> optionsObjectCallback(const v8::Arguments& args)
969 {
970     INC_STATS("DOM.TestObj.optionsObject");
971     if (args.Length() < 1)
972         return throwError("Not enough arguments", V8Proxy::TypeError);
973     TestObj* imp = V8TestObj::toNative(args.Holder());
974     EXCEPTION_BLOCK(OptionsObject, oo, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
975     if (args.Length() > 0 && !oo.isUndefinedOrNull() && !oo.isObject()) {
976         ec = TYPE_MISMATCH_ERR;
977         V8Proxy::setDOMException(ec);
978         return throwError("Not an object.", V8Proxy::TypeError);
979     }
980     if (args.Length() <= 1) {
981         imp->optionsObject(oo);
982         return v8::Handle<v8::Value>();
983     }
984     EXCEPTION_BLOCK(OptionsObject, ooo, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
985     if (args.Length() > 1 && !ooo.isUndefinedOrNull() && !ooo.isObject()) {
986         ec = TYPE_MISMATCH_ERR;
987         V8Proxy::setDOMException(ec);
988         return throwError("Not an object.", V8Proxy::TypeError);
989     }
990     imp->optionsObject(oo, ooo);
991     return v8::Handle<v8::Value>();
992 }
993
994 static v8::Handle<v8::Value> methodWithExceptionCallback(const v8::Arguments& args)
995 {
996     INC_STATS("DOM.TestObj.methodWithException");
997     TestObj* imp = V8TestObj::toNative(args.Holder());
998     ExceptionCode ec = 0;
999     {
1000     imp->methodWithException(ec);
1001     if (UNLIKELY(ec))
1002         goto fail;
1003     return v8::Handle<v8::Value>();
1004     }
1005     fail:
1006     V8Proxy::setDOMException(ec);
1007     return v8::Handle<v8::Value>();
1008 }
1009
1010 static v8::Handle<v8::Value> customArgsAndExceptionCallback(const v8::Arguments& args)
1011 {
1012     INC_STATS("DOM.TestObj.customArgsAndException");
1013     if (args.Length() < 1)
1014         return throwError("Not enough arguments", V8Proxy::TypeError);
1015     TestObj* imp = V8TestObj::toNative(args.Holder());
1016     ExceptionCode ec = 0;
1017     {
1018     RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1));
1019     RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector());
1020     if (!callStack)
1021         return v8::Undefined();
1022     EXCEPTION_BLOCK(log*, intArg, V8log::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8log::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1023     imp->customArgsAndException(intArg, scriptArguments, callStack, ec);
1024     if (UNLIKELY(ec))
1025         goto fail;
1026     return v8::Handle<v8::Value>();
1027     }
1028     fail:
1029     V8Proxy::setDOMException(ec);
1030     return v8::Handle<v8::Value>();
1031 }
1032
1033 static v8::Handle<v8::Value> addEventListenerCallback(const v8::Arguments& args)
1034 {
1035     INC_STATS("DOM.TestObj.addEventListener()");
1036     RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOrCreate);
1037     if (listener) {
1038         V8TestObj::toNative(args.Holder())->addEventListener(v8ValueToAtomicWebCoreString(args[0]), listener, args[2]->BooleanValue());
1039         createHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex);
1040     }
1041     return v8::Undefined();
1042 }
1043
1044 static v8::Handle<v8::Value> removeEventListenerCallback(const v8::Arguments& args)
1045 {
1046     INC_STATS("DOM.TestObj.removeEventListener()");
1047     RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOnly);
1048     if (listener) {
1049         V8TestObj::toNative(args.Holder())->removeEventListener(v8ValueToAtomicWebCoreString(args[0]), listener.get(), args[2]->BooleanValue());
1050         removeHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex);
1051     }
1052     return v8::Undefined();
1053 }
1054
1055 static v8::Handle<v8::Value> withScriptStateVoidCallback(const v8::Arguments& args)
1056 {
1057     INC_STATS("DOM.TestObj.withScriptStateVoid");
1058     TestObj* imp = V8TestObj::toNative(args.Holder());
1059     EmptyScriptState state;
1060     imp->withScriptStateVoid(&state);
1061     if (state.hadException())
1062         return throwError(state.exception());
1063     return v8::Handle<v8::Value>();
1064 }
1065
1066 static v8::Handle<v8::Value> withScriptStateObjCallback(const v8::Arguments& args)
1067 {
1068     INC_STATS("DOM.TestObj.withScriptStateObj");
1069     TestObj* imp = V8TestObj::toNative(args.Holder());
1070     EmptyScriptState state;
1071     RefPtr<TestObj> result = imp->withScriptStateObj(&state);
1072     if (state.hadException())
1073         return throwError(state.exception());
1074     return toV8(result.release());
1075 }
1076
1077 static v8::Handle<v8::Value> withScriptStateVoidExceptionCallback(const v8::Arguments& args)
1078 {
1079     INC_STATS("DOM.TestObj.withScriptStateVoidException");
1080     TestObj* imp = V8TestObj::toNative(args.Holder());
1081     ExceptionCode ec = 0;
1082     {
1083     EmptyScriptState state;
1084     imp->withScriptStateVoidException(&state, ec);
1085     if (UNLIKELY(ec))
1086         goto fail;
1087     if (state.hadException())
1088         return throwError(state.exception());
1089     return v8::Handle<v8::Value>();
1090     }
1091     fail:
1092     V8Proxy::setDOMException(ec);
1093     return v8::Handle<v8::Value>();
1094 }
1095
1096 static v8::Handle<v8::Value> withScriptStateObjExceptionCallback(const v8::Arguments& args)
1097 {
1098     INC_STATS("DOM.TestObj.withScriptStateObjException");
1099     TestObj* imp = V8TestObj::toNative(args.Holder());
1100     ExceptionCode ec = 0;
1101     {
1102     EmptyScriptState state;
1103     RefPtr<TestObj> result = imp->withScriptStateObjException(&state, ec);
1104     if (UNLIKELY(ec))
1105         goto fail;
1106     if (state.hadException())
1107         return throwError(state.exception());
1108     return toV8(result.release());
1109     }
1110     fail:
1111     V8Proxy::setDOMException(ec);
1112     return v8::Handle<v8::Value>();
1113 }
1114
1115 static v8::Handle<v8::Value> withScriptExecutionContextCallback(const v8::Arguments& args)
1116 {
1117     INC_STATS("DOM.TestObj.withScriptExecutionContext");
1118     TestObj* imp = V8TestObj::toNative(args.Holder());
1119     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
1120     if (!scriptContext)
1121         return v8::Undefined();
1122     imp->withScriptExecutionContext(scriptContext);
1123     return v8::Handle<v8::Value>();
1124 }
1125
1126 static v8::Handle<v8::Value> methodWithOptionalArgCallback(const v8::Arguments& args)
1127 {
1128     INC_STATS("DOM.TestObj.methodWithOptionalArg");
1129     TestObj* imp = V8TestObj::toNative(args.Holder());
1130     if (args.Length() <= 0) {
1131         imp->methodWithOptionalArg();
1132         return v8::Handle<v8::Value>();
1133     }
1134     EXCEPTION_BLOCK(int, opt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1135     imp->methodWithOptionalArg(opt);
1136     return v8::Handle<v8::Value>();
1137 }
1138
1139 static v8::Handle<v8::Value> methodWithNonOptionalArgAndOptionalArgCallback(const v8::Arguments& args)
1140 {
1141     INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndOptionalArg");
1142     if (args.Length() < 1)
1143         return throwError("Not enough arguments", V8Proxy::TypeError);
1144     TestObj* imp = V8TestObj::toNative(args.Holder());
1145     EXCEPTION_BLOCK(int, nonOpt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1146     if (args.Length() <= 1) {
1147         imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
1148         return v8::Handle<v8::Value>();
1149     }
1150     EXCEPTION_BLOCK(int, opt, toInt32(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)));
1151     imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
1152     return v8::Handle<v8::Value>();
1153 }
1154
1155 static v8::Handle<v8::Value> methodWithNonOptionalArgAndTwoOptionalArgsCallback(const v8::Arguments& args)
1156 {
1157     INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndTwoOptionalArgs");
1158     if (args.Length() < 1)
1159         return throwError("Not enough arguments", V8Proxy::TypeError);
1160     TestObj* imp = V8TestObj::toNative(args.Holder());
1161     EXCEPTION_BLOCK(int, nonOpt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1162     if (args.Length() <= 1) {
1163         imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
1164         return v8::Handle<v8::Value>();
1165     }
1166     EXCEPTION_BLOCK(int, opt1, toInt32(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)));
1167     if (args.Length() <= 2) {
1168         imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1);
1169         return v8::Handle<v8::Value>();
1170     }
1171     EXCEPTION_BLOCK(int, opt2, toInt32(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)));
1172     imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
1173     return v8::Handle<v8::Value>();
1174 }
1175
1176 static v8::Handle<v8::Value> methodWithOptionalStringCallback(const v8::Arguments& args)
1177 {
1178     INC_STATS("DOM.TestObj.methodWithOptionalString");
1179     TestObj* imp = V8TestObj::toNative(args.Holder());
1180     if (args.Length() <= 0) {
1181         imp->methodWithOptionalString();
1182         return v8::Handle<v8::Value>();
1183     }
1184     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1185     imp->methodWithOptionalString(str);
1186     return v8::Handle<v8::Value>();
1187 }
1188
1189 static v8::Handle<v8::Value> methodWithOptionalStringIsUndefinedCallback(const v8::Arguments& args)
1190 {
1191     INC_STATS("DOM.TestObj.methodWithOptionalStringIsUndefined");
1192     TestObj* imp = V8TestObj::toNative(args.Holder());
1193     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1194     imp->methodWithOptionalStringIsUndefined(str);
1195     return v8::Handle<v8::Value>();
1196 }
1197
1198 static v8::Handle<v8::Value> methodWithOptionalStringIsNullStringCallback(const v8::Arguments& args)
1199 {
1200     INC_STATS("DOM.TestObj.methodWithOptionalStringIsNullString");
1201     TestObj* imp = V8TestObj::toNative(args.Holder());
1202     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsNullString));
1203     imp->methodWithOptionalStringIsNullString(str);
1204     return v8::Handle<v8::Value>();
1205 }
1206
1207 static v8::Handle<v8::Value> methodWithCallbackArgCallback(const v8::Arguments& args)
1208 {
1209     INC_STATS("DOM.TestObj.methodWithCallbackArg");
1210     if (args.Length() < 1)
1211         return throwError("Not enough arguments", V8Proxy::TypeError);
1212     TestObj* imp = V8TestObj::toNative(args.Holder());
1213     if (args.Length() <= 0 || !args[0]->IsObject())
1214         return throwError(TYPE_MISMATCH_ERR);
1215     RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1216     imp->methodWithCallbackArg(callback);
1217     return v8::Handle<v8::Value>();
1218 }
1219
1220 static v8::Handle<v8::Value> methodWithNonCallbackArgAndCallbackArgCallback(const v8::Arguments& args)
1221 {
1222     INC_STATS("DOM.TestObj.methodWithNonCallbackArgAndCallbackArg");
1223     if (args.Length() < 2)
1224         return throwError("Not enough arguments", V8Proxy::TypeError);
1225     TestObj* imp = V8TestObj::toNative(args.Holder());
1226     EXCEPTION_BLOCK(int, nonCallback, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1227     if (args.Length() <= 1 || !args[1]->IsObject())
1228         return throwError(TYPE_MISMATCH_ERR);
1229     RefPtr<TestCallback> callback = V8TestCallback::create(args[1], getScriptExecutionContext());
1230     imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
1231     return v8::Handle<v8::Value>();
1232 }
1233
1234 static v8::Handle<v8::Value> methodWithCallbackAndOptionalArgCallback(const v8::Arguments& args)
1235 {
1236     INC_STATS("DOM.TestObj.methodWithCallbackAndOptionalArg");
1237     TestObj* imp = V8TestObj::toNative(args.Holder());
1238     RefPtr<TestCallback> callback;
1239     if (args.Length() > 0 && !args[0]->IsNull() && !args[0]->IsUndefined()) {
1240         if (!args[0]->IsObject())
1241             return throwError(TYPE_MISMATCH_ERR);
1242         callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1243     }
1244     imp->methodWithCallbackAndOptionalArg(callback);
1245     return v8::Handle<v8::Value>();
1246 }
1247
1248 #if ENABLE(Condition1)
1249
1250 static v8::Handle<v8::Value> conditionalMethod1Callback(const v8::Arguments& args)
1251 {
1252     INC_STATS("DOM.TestObj.conditionalMethod1");
1253     TestObj* imp = V8TestObj::toNative(args.Holder());
1254     return v8String(imp->conditionalMethod1());
1255 }
1256
1257 #endif // ENABLE(Condition1)
1258
1259 #if ENABLE(Condition1) && ENABLE(Condition2)
1260
1261 static v8::Handle<v8::Value> conditionalMethod2Callback(const v8::Arguments& args)
1262 {
1263     INC_STATS("DOM.TestObj.conditionalMethod2");
1264     TestObj* imp = V8TestObj::toNative(args.Holder());
1265     imp->conditionalMethod2();
1266     return v8::Handle<v8::Value>();
1267 }
1268
1269 #endif // ENABLE(Condition1) && ENABLE(Condition2)
1270
1271 #if ENABLE(Condition1) || ENABLE(Condition2)
1272
1273 static v8::Handle<v8::Value> conditionalMethod3Callback(const v8::Arguments& args)
1274 {
1275     INC_STATS("DOM.TestObj.conditionalMethod3");
1276     TestObj* imp = V8TestObj::toNative(args.Holder());
1277     imp->conditionalMethod3();
1278     return v8::Handle<v8::Value>();
1279 }
1280
1281 #endif // ENABLE(Condition1) || ENABLE(Condition2)
1282
1283 static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args)
1284 {
1285     INC_STATS("DOM.TestObj.overloadedMethod1");
1286     if (args.Length() < 2)
1287         return throwError("Not enough arguments", V8Proxy::TypeError);
1288     TestObj* imp = V8TestObj::toNative(args.Holder());
1289     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);
1290     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
1291     imp->overloadedMethod(objArg, strArg);
1292     return v8::Handle<v8::Value>();
1293 }
1294
1295 static v8::Handle<v8::Value> overloadedMethod2Callback(const v8::Arguments& args)
1296 {
1297     INC_STATS("DOM.TestObj.overloadedMethod2");
1298     if (args.Length() < 1)
1299         return throwError("Not enough arguments", V8Proxy::TypeError);
1300     TestObj* imp = V8TestObj::toNative(args.Holder());
1301     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);
1302     if (args.Length() <= 1) {
1303         imp->overloadedMethod(objArg);
1304         return v8::Handle<v8::Value>();
1305     }
1306     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)));
1307     imp->overloadedMethod(objArg, intArg);
1308     return v8::Handle<v8::Value>();
1309 }
1310
1311 static v8::Handle<v8::Value> overloadedMethod3Callback(const v8::Arguments& args)
1312 {
1313     INC_STATS("DOM.TestObj.overloadedMethod3");
1314     if (args.Length() < 1)
1315         return throwError("Not enough arguments", V8Proxy::TypeError);
1316     TestObj* imp = V8TestObj::toNative(args.Holder());
1317     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1318     imp->overloadedMethod(strArg);
1319     return v8::Handle<v8::Value>();
1320 }
1321
1322 static v8::Handle<v8::Value> overloadedMethod4Callback(const v8::Arguments& args)
1323 {
1324     INC_STATS("DOM.TestObj.overloadedMethod4");
1325     if (args.Length() < 1)
1326         return throwError("Not enough arguments", V8Proxy::TypeError);
1327     TestObj* imp = V8TestObj::toNative(args.Holder());
1328     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1329     imp->overloadedMethod(intArg);
1330     return v8::Handle<v8::Value>();
1331 }
1332
1333 static v8::Handle<v8::Value> overloadedMethod5Callback(const v8::Arguments& args)
1334 {
1335     INC_STATS("DOM.TestObj.overloadedMethod5");
1336     if (args.Length() < 1)
1337         return throwError("Not enough arguments", V8Proxy::TypeError);
1338     TestObj* imp = V8TestObj::toNative(args.Holder());
1339     if (args.Length() <= 0 || !args[0]->IsObject())
1340         return throwError(TYPE_MISMATCH_ERR);
1341     RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1342     imp->overloadedMethod(callback);
1343     return v8::Handle<v8::Value>();
1344 }
1345
1346 static v8::Handle<v8::Value> overloadedMethod6Callback(const v8::Arguments& args)
1347 {
1348     INC_STATS("DOM.TestObj.overloadedMethod6");
1349     if (args.Length() < 1)
1350         return throwError("Not enough arguments", V8Proxy::TypeError);
1351     TestObj* imp = V8TestObj::toNative(args.Holder());
1352     EXCEPTION_BLOCK(RefPtr<DOMStringList>, listArg, v8ValueToWebCoreDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1353     imp->overloadedMethod(listArg);
1354     return v8::Handle<v8::Value>();
1355 }
1356
1357 static v8::Handle<v8::Value> overloadedMethod7Callback(const v8::Arguments& args)
1358 {
1359     INC_STATS("DOM.TestObj.overloadedMethod7");
1360     if (args.Length() < 1)
1361         return throwError("Not enough arguments", V8Proxy::TypeError);
1362     TestObj* imp = V8TestObj::toNative(args.Holder());
1363     EXCEPTION_BLOCK(RefPtr<DOMStringList>, arrayArg, v8ValueToWebCoreDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1364     imp->overloadedMethod(arrayArg);
1365     return v8::Handle<v8::Value>();
1366 }
1367
1368 static v8::Handle<v8::Value> overloadedMethodCallback(const v8::Arguments& args)
1369 {
1370     INC_STATS("DOM.TestObj.overloadedMethod");
1371     if ((args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0])) && (args[1]->IsNull() || args[1]->IsUndefined() || args[1]->IsString() || args[1]->IsObject())))
1372         return overloadedMethod1Callback(args);
1373     if ((args.Length() == 1 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0]))) || (args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0]))))
1374         return overloadedMethod2Callback(args);
1375     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject())))
1376         return overloadedMethod3Callback(args);
1377     if (args.Length() == 1)
1378         return overloadedMethod4Callback(args);
1379     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsObject())))
1380         return overloadedMethod5Callback(args);
1381     if ((args.Length() == 1 && (args[0]->IsNull() || V8DOMStringList::HasInstance(args[0]))))
1382         return overloadedMethod6Callback(args);
1383     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsArray())))
1384         return overloadedMethod7Callback(args);
1385     V8Proxy::throwTypeError();
1386     return notHandledByInterceptor();
1387 }
1388
1389 static v8::Handle<v8::Value> classMethodCallback(const v8::Arguments& args)
1390 {
1391     INC_STATS("DOM.TestObj.classMethod");
1392     TestObj::classMethod();
1393     return v8::Handle<v8::Value>();
1394 }
1395
1396 static v8::Handle<v8::Value> classMethodWithOptionalCallback(const v8::Arguments& args)
1397 {
1398     INC_STATS("DOM.TestObj.classMethodWithOptional");
1399     if (args.Length() <= 0) {
1400         return v8::Integer::New(TestObj::classMethodWithOptional());
1401     }
1402     EXCEPTION_BLOCK(int, arg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1403     return v8::Integer::New(TestObj::classMethodWithOptional(arg));
1404 }
1405
1406 #if ENABLE(Condition1)
1407
1408 static v8::Handle<v8::Value> overloadedMethod11Callback(const v8::Arguments& args)
1409 {
1410     INC_STATS("DOM.TestObj.overloadedMethod11");
1411     if (args.Length() < 1)
1412         return throwError("Not enough arguments", V8Proxy::TypeError);
1413     EXCEPTION_BLOCK(int, arg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1414     TestObj::overloadedMethod1(arg);
1415     return v8::Handle<v8::Value>();
1416 }
1417
1418 #endif // ENABLE(Condition1)
1419
1420 #if ENABLE(Condition1)
1421
1422 static v8::Handle<v8::Value> overloadedMethod12Callback(const v8::Arguments& args)
1423 {
1424     INC_STATS("DOM.TestObj.overloadedMethod12");
1425     if (args.Length() < 1)
1426         return throwError("Not enough arguments", V8Proxy::TypeError);
1427     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, type, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1428     TestObj::overloadedMethod1(type);
1429     return v8::Handle<v8::Value>();
1430 }
1431
1432 #endif // ENABLE(Condition1)
1433
1434 #if ENABLE(Condition1)
1435
1436 static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args)
1437 {
1438     INC_STATS("DOM.TestObj.overloadedMethod1");
1439     if (args.Length() == 1)
1440         return overloadedMethod11Callback(args);
1441     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject())))
1442         return overloadedMethod12Callback(args);
1443     V8Proxy::throwTypeError();
1444     return notHandledByInterceptor();
1445 }
1446
1447 #endif // ENABLE(Condition1)
1448
1449 static v8::Handle<v8::Value> enabledAtRuntimeMethod1Callback(const v8::Arguments& args)
1450 {
1451     INC_STATS("DOM.TestObj.enabledAtRuntimeMethod1");
1452     if (args.Length() < 1)
1453         return throwError("Not enough arguments", V8Proxy::TypeError);
1454     TestObj* imp = V8TestObj::toNative(args.Holder());
1455     EXCEPTION_BLOCK(int, intArg, V8int::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8int::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1456     imp->enabledAtRuntimeMethod1(intArg);
1457     return v8::Handle<v8::Value>();
1458 }
1459
1460 static v8::Handle<v8::Value> enabledAtRuntimeMethod2Callback(const v8::Arguments& args)
1461 {
1462     INC_STATS("DOM.TestObj.enabledAtRuntimeMethod2");
1463     if (args.Length() < 1)
1464         return throwError("Not enough arguments", V8Proxy::TypeError);
1465     TestObj* imp = V8TestObj::toNative(args.Holder());
1466     EXCEPTION_BLOCK(int, intArg, V8int::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8int::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1467     imp->enabledAtRuntimeMethod2(intArg);
1468     return v8::Handle<v8::Value>();
1469 }
1470
1471 static v8::Handle<v8::Value> getSVGDocumentCallback(const v8::Arguments& args)
1472 {
1473     INC_STATS("DOM.TestObj.getSVGDocument");
1474     TestObj* imp = V8TestObj::toNative(args.Holder());
1475     ExceptionCode ec = 0;
1476     {
1477     if (!V8BindingSecurity::shouldAllowAccessToNode(V8BindingState::Only(), imp->getSVGDocument(ec)))
1478         return v8::Handle<v8::Value>();
1479     RefPtr<SVGDocument> result = imp->getSVGDocument(ec);
1480     if (UNLIKELY(ec))
1481         goto fail;
1482     return toV8(result.release());
1483     }
1484     fail:
1485     V8Proxy::setDOMException(ec);
1486     return v8::Handle<v8::Value>();
1487 }
1488
1489 static v8::Handle<v8::Value> convert1Callback(const v8::Arguments& args)
1490 {
1491     INC_STATS("DOM.TestObj.convert1");
1492     if (args.Length() < 1)
1493         return throwError("Not enough arguments", V8Proxy::TypeError);
1494     TestObj* imp = V8TestObj::toNative(args.Holder());
1495     EXCEPTION_BLOCK(a*, , V8a::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8a::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1496     imp->convert1();
1497     return v8::Handle<v8::Value>();
1498 }
1499
1500 static v8::Handle<v8::Value> convert2Callback(const v8::Arguments& args)
1501 {
1502     INC_STATS("DOM.TestObj.convert2");
1503     if (args.Length() < 1)
1504         return throwError("Not enough arguments", V8Proxy::TypeError);
1505     TestObj* imp = V8TestObj::toNative(args.Holder());
1506     EXCEPTION_BLOCK(b*, , V8b::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8b::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1507     imp->convert2();
1508     return v8::Handle<v8::Value>();
1509 }
1510
1511 static v8::Handle<v8::Value> convert3Callback(const v8::Arguments& args)
1512 {
1513     INC_STATS("DOM.TestObj.convert3");
1514     if (args.Length() < 1)
1515         return throwError("Not enough arguments", V8Proxy::TypeError);
1516     TestObj* imp = V8TestObj::toNative(args.Holder());
1517     EXCEPTION_BLOCK(c*, , V8c::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8c::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1518     imp->convert3();
1519     return v8::Handle<v8::Value>();
1520 }
1521
1522 static v8::Handle<v8::Value> convert4Callback(const v8::Arguments& args)
1523 {
1524     INC_STATS("DOM.TestObj.convert4");
1525     if (args.Length() < 1)
1526         return throwError("Not enough arguments", V8Proxy::TypeError);
1527     TestObj* imp = V8TestObj::toNative(args.Holder());
1528     EXCEPTION_BLOCK(d*, , V8d::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8d::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1529     imp->convert4();
1530     return v8::Handle<v8::Value>();
1531 }
1532
1533 static v8::Handle<v8::Value> convert5Callback(const v8::Arguments& args)
1534 {
1535     INC_STATS("DOM.TestObj.convert5");
1536     if (args.Length() < 1)
1537         return throwError("Not enough arguments", V8Proxy::TypeError);
1538     TestObj* imp = V8TestObj::toNative(args.Holder());
1539     EXCEPTION_BLOCK(e*, , V8e::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8e::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1540     imp->convert5();
1541     return v8::Handle<v8::Value>();
1542 }
1543
1544 static v8::Handle<v8::Value> mutablePointFunctionCallback(const v8::Arguments& args)
1545 {
1546     INC_STATS("DOM.TestObj.mutablePointFunction");
1547     TestObj* imp = V8TestObj::toNative(args.Holder());
1548     return toV8(WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(imp->mutablePointFunction())));
1549 }
1550
1551 static v8::Handle<v8::Value> immutablePointFunctionCallback(const v8::Arguments& args)
1552 {
1553     INC_STATS("DOM.TestObj.immutablePointFunction");
1554     TestObj* imp = V8TestObj::toNative(args.Holder());
1555     return toV8(WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(imp->immutablePointFunction())));
1556 }
1557
1558 static v8::Handle<v8::Value> orangeCallback(const v8::Arguments& args)
1559 {
1560     INC_STATS("DOM.TestObj.orange");
1561     TestObj* imp = V8TestObj::toNative(args.Holder());
1562     imp->banana();
1563     return v8::Handle<v8::Value>();
1564 }
1565
1566 static v8::Handle<v8::Value> strictFunctionCallback(const v8::Arguments& args)
1567 {
1568     INC_STATS("DOM.TestObj.strictFunction");
1569     if (args.Length() < 3)
1570         return throwError("Not enough arguments", V8Proxy::TypeError);
1571     TestObj* imp = V8TestObj::toNative(args.Holder());
1572     ExceptionCode ec = 0;
1573     {
1574     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1575     EXCEPTION_BLOCK(float, a, static_cast<float>(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)->NumberValue()));
1576     EXCEPTION_BLOCK(int, b, V8int::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)) ? V8int::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))) : 0);
1577     RefPtr<bool> result = imp->strictFunction(str, a, b, ec);
1578     if (UNLIKELY(ec))
1579         goto fail;
1580     return toV8(result.release());
1581     }
1582     fail:
1583     V8Proxy::setDOMException(ec);
1584     return v8::Handle<v8::Value>();
1585 }
1586
1587 } // namespace TestObjInternal
1588
1589 static const BatchedAttribute TestObjAttrs[] = {
1590     // Attribute 'readOnlyIntAttr' (Type: 'readonly attribute' ExtAttr: '')
1591     {"readOnlyIntAttr", TestObjInternal::readOnlyIntAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1592     // Attribute 'readOnlyStringAttr' (Type: 'readonly attribute' ExtAttr: '')
1593     {"readOnlyStringAttr", TestObjInternal::readOnlyStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1594     // Attribute 'readOnlyTestObjAttr' (Type: 'readonly attribute' ExtAttr: '')
1595     {"readOnlyTestObjAttr", TestObjInternal::readOnlyTestObjAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1596     // Attribute 'shortAttr' (Type: 'attribute' ExtAttr: '')
1597     {"shortAttr", TestObjInternal::shortAttrAttrGetter, TestObjInternal::shortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1598     // Attribute 'unsignedShortAttr' (Type: 'attribute' ExtAttr: '')
1599     {"unsignedShortAttr", TestObjInternal::unsignedShortAttrAttrGetter, TestObjInternal::unsignedShortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1600     // Attribute 'intAttr' (Type: 'attribute' ExtAttr: '')
1601     {"intAttr", TestObjInternal::intAttrAttrGetter, TestObjInternal::intAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1602     // Attribute 'longLongAttr' (Type: 'attribute' ExtAttr: '')
1603     {"longLongAttr", TestObjInternal::longLongAttrAttrGetter, TestObjInternal::longLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1604     // Attribute 'unsignedLongLongAttr' (Type: 'attribute' ExtAttr: '')
1605     {"unsignedLongLongAttr", TestObjInternal::unsignedLongLongAttrAttrGetter, TestObjInternal::unsignedLongLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1606     // Attribute 'stringAttr' (Type: 'attribute' ExtAttr: '')
1607     {"stringAttr", TestObjInternal::stringAttrAttrGetter, TestObjInternal::stringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1608     // Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: '')
1609     {"testObjAttr", TestObjInternal::testObjAttrAttrGetter, TestObjInternal::testObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1610     // Attribute 'XMLObjAttr' (Type: 'attribute' ExtAttr: '')
1611     {"XMLObjAttr", TestObjInternal::XMLObjAttrAttrGetter, TestObjInternal::XMLObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1612     // Attribute 'create' (Type: 'attribute' ExtAttr: '')
1613     {"create", TestObjInternal::createAttrGetter, TestObjInternal::createAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1614     // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1615     {"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1616     // Attribute 'reflectedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1617     {"reflectedIntegralAttr", TestObjInternal::reflectedIntegralAttrAttrGetter, TestObjInternal::reflectedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1618     // Attribute 'reflectedUnsignedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1619     {"reflectedUnsignedIntegralAttr", TestObjInternal::reflectedUnsignedIntegralAttrAttrGetter, TestObjInternal::reflectedUnsignedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1620     // Attribute 'reflectedBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1621     {"reflectedBooleanAttr", TestObjInternal::reflectedBooleanAttrAttrGetter, TestObjInternal::reflectedBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1622     // Attribute 'reflectedURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect')
1623     {"reflectedURLAttr", TestObjInternal::reflectedURLAttrAttrGetter, TestObjInternal::reflectedURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1624     // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1625     {"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1626     // Attribute 'reflectedCustomIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1627     {"reflectedCustomIntegralAttr", TestObjInternal::reflectedCustomIntegralAttrAttrGetter, TestObjInternal::reflectedCustomIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1628     // Attribute 'reflectedCustomBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1629     {"reflectedCustomBooleanAttr", TestObjInternal::reflectedCustomBooleanAttrAttrGetter, TestObjInternal::reflectedCustomBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1630     // Attribute 'reflectedCustomURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect')
1631     {"reflectedCustomURLAttr", TestObjInternal::reflectedCustomURLAttrAttrGetter, TestObjInternal::reflectedCustomURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1632     // Attribute 'attrWithGetterException' (Type: 'attribute' ExtAttr: '')
1633     {"attrWithGetterException", TestObjInternal::attrWithGetterExceptionAttrGetter, TestObjInternal::attrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1634     // Attribute 'attrWithSetterException' (Type: 'attribute' ExtAttr: '')
1635     {"attrWithSetterException", TestObjInternal::attrWithSetterExceptionAttrGetter, TestObjInternal::attrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1636     // Attribute 'stringAttrWithGetterException' (Type: 'attribute' ExtAttr: '')
1637     {"stringAttrWithGetterException", TestObjInternal::stringAttrWithGetterExceptionAttrGetter, TestObjInternal::stringAttrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1638     // Attribute 'stringAttrWithSetterException' (Type: 'attribute' ExtAttr: '')
1639     {"stringAttrWithSetterException", TestObjInternal::stringAttrWithSetterExceptionAttrGetter, TestObjInternal::stringAttrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1640     // Attribute 'customAttr' (Type: 'attribute' ExtAttr: 'Custom')
1641     {"customAttr", V8TestObj::customAttrAccessorGetter, V8TestObj::customAttrAccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1642     // Attribute 'withScriptStateAttribute' (Type: 'attribute' ExtAttr: 'CallWith')
1643     {"withScriptStateAttribute", TestObjInternal::withScriptStateAttributeAttrGetter, TestObjInternal::withScriptStateAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1644     // Attribute 'withScriptExecutionContextAttribute' (Type: 'attribute' ExtAttr: 'CallWith')
1645     {"withScriptExecutionContextAttribute", TestObjInternal::withScriptExecutionContextAttributeAttrGetter, TestObjInternal::withScriptExecutionContextAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1646     // Attribute 'withScriptStateAttributeRaises' (Type: 'attribute' ExtAttr: 'CallWith')
1647     {"withScriptStateAttributeRaises", TestObjInternal::withScriptStateAttributeRaisesAttrGetter, TestObjInternal::withScriptStateAttributeRaisesAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1648     // Attribute 'withScriptExecutionContextAttributeRaises' (Type: 'attribute' ExtAttr: 'CallWith')
1649     {"withScriptExecutionContextAttributeRaises", TestObjInternal::withScriptExecutionContextAttributeRaisesAttrGetter, TestObjInternal::withScriptExecutionContextAttributeRaisesAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1650     // Attribute 'scriptStringAttr' (Type: 'readonly attribute' ExtAttr: 'ConvertScriptString')
1651     {"scriptStringAttr", TestObjInternal::scriptStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1652 #if ENABLE(Condition1)
1653     // Attribute 'conditionalAttr1' (Type: 'attribute' ExtAttr: 'Conditional')
1654     {"conditionalAttr1", TestObjInternal::conditionalAttr1AttrGetter, TestObjInternal::conditionalAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1655 #endif // ENABLE(Condition1)
1656 #if ENABLE(Condition1) && ENABLE(Condition2)
1657     // Attribute 'conditionalAttr2' (Type: 'attribute' ExtAttr: 'Conditional')
1658     {"conditionalAttr2", TestObjInternal::conditionalAttr2AttrGetter, TestObjInternal::conditionalAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1659 #endif // ENABLE(Condition1) && ENABLE(Condition2)
1660 #if ENABLE(Condition1) || ENABLE(Condition2)
1661     // Attribute 'conditionalAttr3' (Type: 'attribute' ExtAttr: 'Conditional')
1662     {"conditionalAttr3", TestObjInternal::conditionalAttr3AttrGetter, TestObjInternal::conditionalAttr3AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1663 #endif // ENABLE(Condition1) || ENABLE(Condition2)
1664 #if ENABLE(Condition1)
1665     // Attribute 'conditionalAttr4' (Type: 'attribute' ExtAttr: 'Conditional')
1666     {"conditionalAttr4", TestObjInternal::TestObjConstructorGetter, 0, &V8TestObjectA::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */},
1667 #endif // ENABLE(Condition1)
1668 #if ENABLE(Condition1) && ENABLE(Condition2)
1669     // Attribute 'conditionalAttr5' (Type: 'attribute' ExtAttr: 'Conditional')
1670     {"conditionalAttr5", TestObjInternal::TestObjConstructorGetter, 0, &V8TestObjectB::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */},
1671 #endif // ENABLE(Condition1) && ENABLE(Condition2)
1672 #if ENABLE(Condition1) || ENABLE(Condition2)
1673     // Attribute 'conditionalAttr6' (Type: 'attribute' ExtAttr: 'Conditional')
1674     {"conditionalAttr6", TestObjInternal::TestObjConstructorGetter, 0, &V8TestObjectC::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */},
1675 #endif // ENABLE(Condition1) || ENABLE(Condition2)
1676     // Attribute 'cachedAttribute1' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute')
1677     {"cachedAttribute1", TestObjInternal::cachedAttribute1AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1678     // Attribute 'cachedAttribute2' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute')
1679     {"cachedAttribute2", TestObjInternal::cachedAttribute2AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1680     // Attribute 'floatArray' (Type: 'attribute' ExtAttr: '')
1681     {"floatArray", TestObjInternal::floatArrayAttrGetter, TestObjInternal::floatArrayAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1682     // Attribute 'doubleArray' (Type: 'attribute' ExtAttr: '')
1683     {"doubleArray", TestObjInternal::doubleArrayAttrGetter, TestObjInternal::doubleArrayAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1684     // Attribute 'contentDocument' (Type: 'readonly attribute' ExtAttr: 'CheckAccessToNode')
1685     {"contentDocument", TestObjInternal::contentDocumentAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1686     // Attribute 'mutablePoint' (Type: 'attribute' ExtAttr: '')
1687     {"mutablePoint", TestObjInternal::mutablePointAttrGetter, TestObjInternal::mutablePointAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1688     // Attribute 'immutablePoint' (Type: 'attribute' ExtAttr: 'Immutable')
1689     {"immutablePoint", TestObjInternal::immutablePointAttrGetter, TestObjInternal::immutablePointAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1690     // Attribute 'strictFloat' (Type: 'attribute' ExtAttr: 'StrictTypeChecking')
1691     {"strictFloat", TestObjInternal::strictFloatAttrGetter, TestObjInternal::strictFloatAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1692     // Attribute 'description' (Type: 'readonly attribute' ExtAttr: '')
1693     {"description", TestObjInternal::descriptionAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1694     // Attribute 'id' (Type: 'attribute' ExtAttr: '')
1695     {"id", TestObjInternal::idAttrGetter, TestObjInternal::idAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1696     // Attribute 'hash' (Type: 'readonly attribute' ExtAttr: '')
1697     {"hash", TestObjInternal::hashAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1698 };
1699
1700 static const BatchedCallback TestObjCallbacks[] = {
1701     {"voidMethod", TestObjInternal::voidMethodCallback},
1702     {"intMethod", TestObjInternal::intMethodCallback},
1703     {"objMethod", TestObjInternal::objMethodCallback},
1704     {"serializedValue", TestObjInternal::serializedValueCallback},
1705     {"idbKey", TestObjInternal::idbKeyCallback},
1706     {"optionsObject", TestObjInternal::optionsObjectCallback},
1707     {"methodWithException", TestObjInternal::methodWithExceptionCallback},
1708     {"customMethod", V8TestObj::customMethodCallback},
1709     {"customMethodWithArgs", V8TestObj::customMethodWithArgsCallback},
1710     {"addEventListener", TestObjInternal::addEventListenerCallback},
1711     {"removeEventListener", TestObjInternal::removeEventListenerCallback},
1712     {"withScriptStateVoid", TestObjInternal::withScriptStateVoidCallback},
1713     {"withScriptStateObj", TestObjInternal::withScriptStateObjCallback},
1714     {"withScriptStateVoidException", TestObjInternal::withScriptStateVoidExceptionCallback},
1715     {"withScriptStateObjException", TestObjInternal::withScriptStateObjExceptionCallback},
1716     {"withScriptExecutionContext", TestObjInternal::withScriptExecutionContextCallback},
1717     {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback},
1718     {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback},
1719     {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback},
1720     {"methodWithOptionalString", TestObjInternal::methodWithOptionalStringCallback},
1721     {"methodWithOptionalStringIsUndefined", TestObjInternal::methodWithOptionalStringIsUndefinedCallback},
1722     {"methodWithOptionalStringIsNullString", TestObjInternal::methodWithOptionalStringIsNullStringCallback},
1723     {"methodWithCallbackArg", TestObjInternal::methodWithCallbackArgCallback},
1724     {"methodWithNonCallbackArgAndCallbackArg", TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback},
1725     {"methodWithCallbackAndOptionalArg", TestObjInternal::methodWithCallbackAndOptionalArgCallback},
1726 #if ENABLE(Condition1)
1727     {"conditionalMethod1", TestObjInternal::conditionalMethod1Callback},
1728 #endif
1729 #if ENABLE(Condition1) && ENABLE(Condition2)
1730     {"conditionalMethod2", TestObjInternal::conditionalMethod2Callback},
1731 #endif
1732 #if ENABLE(Condition1) || ENABLE(Condition2)
1733     {"conditionalMethod3", TestObjInternal::conditionalMethod3Callback},
1734 #endif
1735     {"overloadedMethod", TestObjInternal::overloadedMethodCallback},
1736     {"getSVGDocument", TestObjInternal::getSVGDocumentCallback},
1737     {"mutablePointFunction", TestObjInternal::mutablePointFunctionCallback},
1738     {"immutablePointFunction", TestObjInternal::immutablePointFunctionCallback},
1739     {"orange", TestObjInternal::orangeCallback},
1740     {"strictFunction", TestObjInternal::strictFunctionCallback},
1741 };
1742
1743 static const BatchedConstant TestObjConsts[] = {
1744 #if ENABLE(Condition1)
1745     {"CONDITIONAL_CONST", static_cast<signed int>(0)},
1746 #endif
1747     {"CONST_VALUE_0", static_cast<signed int>(0)},
1748     {"CONST_VALUE_1", static_cast<signed int>(1)},
1749     {"CONST_VALUE_2", static_cast<signed int>(2)},
1750     {"CONST_VALUE_4", static_cast<signed int>(4)},
1751     {"CONST_VALUE_8", static_cast<signed int>(8)},
1752     {"CONST_VALUE_9", static_cast<signed int>(-1)},
1753     {"CONST_VALUE_10", static_cast<signed int>("my constant string")},
1754     {"CONST_VALUE_11", static_cast<signed int>(0xffffffff)},
1755     {"CONST_VALUE_12", static_cast<signed int>(0x01)},
1756     {"CONST_VALUE_13", static_cast<signed int>(0X20)},
1757     {"CONST_VALUE_14", static_cast<signed int>(0x1abc)},
1758     {"CONST_JAVASCRIPT", static_cast<signed int>(15)},
1759 };
1760
1761
1762 #if ENABLE(Condition1)
1763 COMPILE_ASSERT(0 == TestObj::CONDITIONAL_CONST, TestObjEnumCONDITIONAL_CONSTIsWrongUseDoNotCheckConstants);
1764 #endif
1765 COMPILE_ASSERT(0 == TestObj::CONST_VALUE_0, TestObjEnumCONST_VALUE_0IsWrongUseDoNotCheckConstants);
1766 COMPILE_ASSERT(1 == TestObj::CONST_VALUE_1, TestObjEnumCONST_VALUE_1IsWrongUseDoNotCheckConstants);
1767 COMPILE_ASSERT(2 == TestObj::CONST_VALUE_2, TestObjEnumCONST_VALUE_2IsWrongUseDoNotCheckConstants);
1768 COMPILE_ASSERT(4 == TestObj::CONST_VALUE_4, TestObjEnumCONST_VALUE_4IsWrongUseDoNotCheckConstants);
1769 COMPILE_ASSERT(8 == TestObj::CONST_VALUE_8, TestObjEnumCONST_VALUE_8IsWrongUseDoNotCheckConstants);
1770 COMPILE_ASSERT(-1 == TestObj::CONST_VALUE_9, TestObjEnumCONST_VALUE_9IsWrongUseDoNotCheckConstants);
1771 COMPILE_ASSERT("my constant string" == TestObj::CONST_VALUE_10, TestObjEnumCONST_VALUE_10IsWrongUseDoNotCheckConstants);
1772 COMPILE_ASSERT(0xffffffff == TestObj::CONST_VALUE_11, TestObjEnumCONST_VALUE_11IsWrongUseDoNotCheckConstants);
1773 COMPILE_ASSERT(0x01 == TestObj::CONST_VALUE_12, TestObjEnumCONST_VALUE_12IsWrongUseDoNotCheckConstants);
1774 COMPILE_ASSERT(0X20 == TestObj::CONST_VALUE_13, TestObjEnumCONST_VALUE_13IsWrongUseDoNotCheckConstants);
1775 COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWrongUseDoNotCheckConstants);
1776 COMPILE_ASSERT(15 == TestObj::CONST_IMPL, TestObjEnumCONST_IMPLIsWrongUseDoNotCheckConstants);
1777
1778 v8::Handle<v8::Value> V8TestObj::constructorCallback(const v8::Arguments& args)
1779 {
1780     INC_STATS("DOM.TestObj.Constructor");
1781
1782     if (!args.IsConstructCall())
1783         return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
1784
1785     if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
1786         return args.Holder();
1787
1788     RefPtr<TestObj> impl = TestObj::create();
1789     v8::Handle<v8::Object> wrapper = args.Holder();
1790
1791     V8DOMWrapper::setDOMWrapper(wrapper, &info, impl.get());
1792     impl->ref();
1793     V8DOMWrapper::setJSWrapperForDOMObject(impl.get(), v8::Persistent<v8::Object>::New(wrapper));
1794     return args.Holder();
1795 }
1796
1797 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persistent<v8::FunctionTemplate> desc)
1798 {
1799     desc->ReadOnlyPrototype();
1800
1801     v8::Local<v8::Signature> defaultSignature;
1802     defaultSignature = configureTemplate(desc, "TestObj", v8::Persistent<v8::FunctionTemplate>(), V8TestObj::internalFieldCount,
1803         TestObjAttrs, WTF_ARRAY_LENGTH(TestObjAttrs),
1804         TestObjCallbacks, WTF_ARRAY_LENGTH(TestObjCallbacks));
1805     UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
1806     desc->SetCallHandler(V8TestObj::constructorCallback);
1807     v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
1808     v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
1809     UNUSED_PARAM(instance); // In some cases, it will not be used.
1810     UNUSED_PARAM(proto); // In some cases, it will not be used.
1811     
1812     if (RuntimeEnabledFeatures::enabledAtRuntimeAttr1Enabled()) {
1813         static const BatchedAttribute attrData =\
1814         // Attribute 'enabledAtRuntimeAttr1' (Type: 'attribute' ExtAttr: 'V8EnabledAtRuntime')
1815         {"enabledAtRuntimeAttr1", TestObjInternal::enabledAtRuntimeAttr1AttrGetter, TestObjInternal::enabledAtRuntimeAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1816         configureAttribute(instance, proto, attrData);
1817     }
1818     if (RuntimeEnabledFeatures::featureNameEnabled()) {
1819         static const BatchedAttribute attrData =\
1820         // Attribute 'enabledAtRuntimeAttr2' (Type: 'attribute' ExtAttr: 'V8EnabledAtRuntime')
1821         {"enabledAtRuntimeAttr2", TestObjInternal::enabledAtRuntimeAttr2AttrGetter, TestObjInternal::enabledAtRuntimeAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1822         configureAttribute(instance, proto, attrData);
1823     }
1824
1825     // Custom Signature 'voidMethodWithArgs'
1826     const int voidMethodWithArgsArgc = 3;
1827     v8::Handle<v8::FunctionTemplate> voidMethodWithArgsArgv[voidMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1828     v8::Handle<v8::Signature> voidMethodWithArgsSignature = v8::Signature::New(desc, voidMethodWithArgsArgc, voidMethodWithArgsArgv);
1829     proto->Set(v8::String::New("voidMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::voidMethodWithArgsCallback, v8::Handle<v8::Value>(), voidMethodWithArgsSignature));
1830
1831     // Custom Signature 'intMethodWithArgs'
1832     const int intMethodWithArgsArgc = 3;
1833     v8::Handle<v8::FunctionTemplate> intMethodWithArgsArgv[intMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1834     v8::Handle<v8::Signature> intMethodWithArgsSignature = v8::Signature::New(desc, intMethodWithArgsArgc, intMethodWithArgsArgv);
1835     proto->Set(v8::String::New("intMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::intMethodWithArgsCallback, v8::Handle<v8::Value>(), intMethodWithArgsSignature));
1836
1837     // Custom Signature 'objMethodWithArgs'
1838     const int objMethodWithArgsArgc = 3;
1839     v8::Handle<v8::FunctionTemplate> objMethodWithArgsArgv[objMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1840     v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(desc, objMethodWithArgsArgc, objMethodWithArgsArgv);
1841     proto->Set(v8::String::New("objMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::objMethodWithArgsCallback, v8::Handle<v8::Value>(), objMethodWithArgsSignature));
1842
1843     // Custom Signature 'methodThatRequiresAllArgsAndThrows'
1844     const int methodThatRequiresAllArgsAndThrowsArgc = 2;
1845     v8::Handle<v8::FunctionTemplate> methodThatRequiresAllArgsAndThrowsArgv[methodThatRequiresAllArgsAndThrowsArgc] = { v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1846     v8::Handle<v8::Signature> methodThatRequiresAllArgsAndThrowsSignature = v8::Signature::New(desc, methodThatRequiresAllArgsAndThrowsArgc, methodThatRequiresAllArgsAndThrowsArgv);
1847     proto->Set(v8::String::New("methodThatRequiresAllArgsAndThrows"), v8::FunctionTemplate::New(TestObjInternal::methodThatRequiresAllArgsAndThrowsCallback, v8::Handle<v8::Value>(), methodThatRequiresAllArgsAndThrowsSignature));
1848
1849     // Custom Signature 'customArgsAndException'
1850     const int customArgsAndExceptionArgc = 1;
1851     v8::Handle<v8::FunctionTemplate> customArgsAndExceptionArgv[customArgsAndExceptionArgc] = { V8log::GetRawTemplate() };
1852     v8::Handle<v8::Signature> customArgsAndExceptionSignature = v8::Signature::New(desc, customArgsAndExceptionArgc, customArgsAndExceptionArgv);
1853     proto->Set(v8::String::New("customArgsAndException"), v8::FunctionTemplate::New(TestObjInternal::customArgsAndExceptionCallback, v8::Handle<v8::Value>(), customArgsAndExceptionSignature));
1854     desc->Set(v8::String::New("classMethod"), v8::FunctionTemplate::New(TestObjInternal::classMethodCallback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
1855     desc->Set(v8::String::New("classMethodWithOptional"), v8::FunctionTemplate::New(TestObjInternal::classMethodWithOptionalCallback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
1856 #if ENABLE(Condition1)
1857     desc->Set(v8::String::New("overloadedMethod1"), v8::FunctionTemplate::New(TestObjInternal::overloadedMethod1Callback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
1858 #endif // ENABLE(Condition1)
1859     if (RuntimeEnabledFeatures::enabledAtRuntimeMethod1Enabled())
1860         proto->Set(v8::String::New("enabledAtRuntimeMethod1"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod1Callback, v8::Handle<v8::Value>(), defaultSignature));
1861     if (RuntimeEnabledFeatures::featureNameEnabled())
1862         proto->Set(v8::String::New("enabledAtRuntimeMethod2"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod2Callback, v8::Handle<v8::Value>(), defaultSignature));
1863
1864     // Custom Signature 'convert1'
1865     const int convert1Argc = 1;
1866     v8::Handle<v8::FunctionTemplate> convert1Argv[convert1Argc] = { V8a::GetRawTemplate() };
1867     v8::Handle<v8::Signature> convert1Signature = v8::Signature::New(desc, convert1Argc, convert1Argv);
1868     proto->Set(v8::String::New("convert1"), v8::FunctionTemplate::New(TestObjInternal::convert1Callback, v8::Handle<v8::Value>(), convert1Signature));
1869
1870     // Custom Signature 'convert2'
1871     const int convert2Argc = 1;
1872     v8::Handle<v8::FunctionTemplate> convert2Argv[convert2Argc] = { V8b::GetRawTemplate() };
1873     v8::Handle<v8::Signature> convert2Signature = v8::Signature::New(desc, convert2Argc, convert2Argv);
1874     proto->Set(v8::String::New("convert2"), v8::FunctionTemplate::New(TestObjInternal::convert2Callback, v8::Handle<v8::Value>(), convert2Signature));
1875
1876     // Custom Signature 'convert3'
1877     const int convert3Argc = 1;
1878     v8::Handle<v8::FunctionTemplate> convert3Argv[convert3Argc] = { V8c::GetRawTemplate() };
1879     v8::Handle<v8::Signature> convert3Signature = v8::Signature::New(desc, convert3Argc, convert3Argv);
1880     proto->Set(v8::String::New("convert3"), v8::FunctionTemplate::New(TestObjInternal::convert3Callback, v8::Handle<v8::Value>(), convert3Signature));
1881
1882     // Custom Signature 'convert4'
1883     const int convert4Argc = 1;
1884     v8::Handle<v8::FunctionTemplate> convert4Argv[convert4Argc] = { V8d::GetRawTemplate() };
1885     v8::Handle<v8::Signature> convert4Signature = v8::Signature::New(desc, convert4Argc, convert4Argv);
1886     proto->Set(v8::String::New("convert4"), v8::FunctionTemplate::New(TestObjInternal::convert4Callback, v8::Handle<v8::Value>(), convert4Signature));
1887
1888     // Custom Signature 'convert5'
1889     const int convert5Argc = 1;
1890     v8::Handle<v8::FunctionTemplate> convert5Argv[convert5Argc] = { V8e::GetRawTemplate() };
1891     v8::Handle<v8::Signature> convert5Signature = v8::Signature::New(desc, convert5Argc, convert5Argv);
1892     proto->Set(v8::String::New("convert5"), v8::FunctionTemplate::New(TestObjInternal::convert5Callback, v8::Handle<v8::Value>(), convert5Signature));
1893     batchConfigureConstants(desc, proto, TestObjConsts, WTF_ARRAY_LENGTH(TestObjConsts));
1894
1895     // Custom toString template
1896     desc->Set(getToStringName(), getToStringTemplate());
1897     return desc;
1898 }
1899
1900 v8::Persistent<v8::FunctionTemplate> V8TestObj::GetRawTemplate()
1901 {
1902     V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
1903     V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info);
1904     if (result != data->rawTemplateMap().end())
1905         return result->second;
1906
1907     v8::HandleScope handleScope;
1908     v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
1909     data->rawTemplateMap().add(&info, templ);
1910     return templ;
1911 }
1912
1913 v8::Persistent<v8::FunctionTemplate> V8TestObj::GetTemplate()
1914 {
1915     V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
1916     V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info);
1917     if (result != data->templateMap().end())
1918         return result->second;
1919
1920     v8::HandleScope handleScope;
1921     v8::Persistent<v8::FunctionTemplate> templ =
1922         ConfigureV8TestObjTemplate(GetRawTemplate());
1923     data->templateMap().add(&info, templ);
1924     return templ;
1925 }
1926
1927 bool V8TestObj::HasInstance(v8::Handle<v8::Value> value)
1928 {
1929     return GetRawTemplate()->HasInstance(value);
1930 }
1931
1932
1933 v8::Handle<v8::Object> V8TestObj::wrapSlow(TestObj* impl)
1934 {
1935     v8::Handle<v8::Object> wrapper;
1936     V8Proxy* proxy = 0;
1937     wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
1938     if (wrapper.IsEmpty())
1939         return wrapper;
1940
1941     impl->ref();
1942     v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
1943
1944     if (!hasDependentLifetime)
1945         wrapperHandle.MarkIndependent();
1946     getDOMObjectMap().set(impl, wrapperHandle);
1947     return wrapper;
1948 }
1949
1950 void V8TestObj::derefObject(void* object)
1951 {
1952     static_cast<TestObj*>(object)->deref();
1953 }
1954
1955 } // namespace WebCore