Remove support for LegacyDefaultOptionalArguments
[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 "ScriptArguments.h"
31 #include "ScriptCallStack.h"
32 #include "ScriptCallStackFactory.h"
33 #include "ScriptController.h"
34 #include "SerializedScriptValue.h"
35 #include "V8Binding.h"
36 #include "V8BindingMacros.h"
37 #include "V8BindingState.h"
38 #include "V8DOMWrapper.h"
39 #include "V8IsolatedContext.h"
40 #include "V8Proxy.h"
41 #include "V8TestCallback.h"
42 #include "V8any.h"
43 #include "V8int.h"
44 #include "V8log.h"
45 #include <wtf/GetPtr.h>
46 #include <wtf/RefCounted.h>
47 #include <wtf/RefPtr.h>
48 #include <wtf/UnusedParam.h>
49
50 #if ENABLE(Condition1)
51 #include "V8TestObjectA.h"
52 #endif
53
54 #if ENABLE(Condition1) && ENABLE(Condition2)
55 #include "V8TestObjectB.h"
56 #endif
57
58 #if ENABLE(Condition1) || ENABLE(Condition2)
59 #include "V8TestObjectC.h"
60 #endif
61
62 namespace WebCore {
63
64 WrapperTypeInfo V8TestObj::info = { V8TestObj::GetTemplate, V8TestObj::derefObject, 0, 0 };
65
66 namespace TestObjInternal {
67
68 template <typename T> void V8_USE(T) { }
69
70 static v8::Handle<v8::Value> readOnlyIntAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
71 {
72     INC_STATS("DOM.TestObj.readOnlyIntAttr._get");
73     TestObj* imp = V8TestObj::toNative(info.Holder());
74     return v8::Integer::New(imp->readOnlyIntAttr());
75 }
76
77 static v8::Handle<v8::Value> readOnlyStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
78 {
79     INC_STATS("DOM.TestObj.readOnlyStringAttr._get");
80     TestObj* imp = V8TestObj::toNative(info.Holder());
81     return v8String(imp->readOnlyStringAttr());
82 }
83
84 static v8::Handle<v8::Value> readOnlyTestObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
85 {
86     INC_STATS("DOM.TestObj.readOnlyTestObjAttr._get");
87     TestObj* imp = V8TestObj::toNative(info.Holder());
88     RefPtr<TestObj> result = imp->readOnlyTestObjAttr();
89     v8::Handle<v8::Value> wrapper = result.get() ? V8TestObj::existingWrapper(result.get()) : v8::Handle<v8::Object>();
90     if (wrapper.IsEmpty()) {
91         wrapper = toV8(result.get());
92         if (!wrapper.IsEmpty())
93             V8DOMWrapper::setNamedHiddenReference(info.Holder(), "readOnlyTestObjAttr", wrapper);
94     }
95     return wrapper;
96 }
97
98 static v8::Handle<v8::Value> shortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
99 {
100     INC_STATS("DOM.TestObj.shortAttr._get");
101     TestObj* imp = V8TestObj::toNative(info.Holder());
102     return v8::Integer::New(imp->shortAttr());
103 }
104
105 static void shortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
106 {
107     INC_STATS("DOM.TestObj.shortAttr._set");
108     TestObj* imp = V8TestObj::toNative(info.Holder());
109     int v = toInt32(value);
110     imp->setShortAttr(v);
111     return;
112 }
113
114 static v8::Handle<v8::Value> unsignedShortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
115 {
116     INC_STATS("DOM.TestObj.unsignedShortAttr._get");
117     TestObj* imp = V8TestObj::toNative(info.Holder());
118     return v8::Integer::New(imp->unsignedShortAttr());
119 }
120
121 static void unsignedShortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
122 {
123     INC_STATS("DOM.TestObj.unsignedShortAttr._set");
124     TestObj* imp = V8TestObj::toNative(info.Holder());
125     int v = toUInt32(value);
126     imp->setUnsignedShortAttr(v);
127     return;
128 }
129
130 static v8::Handle<v8::Value> intAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
131 {
132     INC_STATS("DOM.TestObj.intAttr._get");
133     TestObj* imp = V8TestObj::toNative(info.Holder());
134     return v8::Integer::New(imp->intAttr());
135 }
136
137 static void intAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
138 {
139     INC_STATS("DOM.TestObj.intAttr._set");
140     TestObj* imp = V8TestObj::toNative(info.Holder());
141     int v = toInt32(value);
142     imp->setIntAttr(v);
143     return;
144 }
145
146 static v8::Handle<v8::Value> longLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
147 {
148     INC_STATS("DOM.TestObj.longLongAttr._get");
149     TestObj* imp = V8TestObj::toNative(info.Holder());
150     return v8::Number::New(static_cast<double>(imp->longLongAttr()));
151 }
152
153 static void longLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
154 {
155     INC_STATS("DOM.TestObj.longLongAttr._set");
156     TestObj* imp = V8TestObj::toNative(info.Holder());
157     long long v = toInt64(value);
158     imp->setLongLongAttr(WTF::getPtr(v));
159     return;
160 }
161
162 static v8::Handle<v8::Value> unsignedLongLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
163 {
164     INC_STATS("DOM.TestObj.unsignedLongLongAttr._get");
165     TestObj* imp = V8TestObj::toNative(info.Holder());
166     return v8::Number::New(static_cast<double>(imp->unsignedLongLongAttr()));
167 }
168
169 static void unsignedLongLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
170 {
171     INC_STATS("DOM.TestObj.unsignedLongLongAttr._set");
172     TestObj* imp = V8TestObj::toNative(info.Holder());
173     unsigned long long v = toInt64(value);
174     imp->setUnsignedLongLongAttr(WTF::getPtr(v));
175     return;
176 }
177
178 static v8::Handle<v8::Value> stringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
179 {
180     INC_STATS("DOM.TestObj.stringAttr._get");
181     TestObj* imp = V8TestObj::toNative(info.Holder());
182     return v8String(imp->stringAttr());
183 }
184
185 static void stringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
186 {
187     INC_STATS("DOM.TestObj.stringAttr._set");
188     TestObj* imp = V8TestObj::toNative(info.Holder());
189     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value);
190     imp->setStringAttr(v);
191     return;
192 }
193
194 static v8::Handle<v8::Value> testObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
195 {
196     INC_STATS("DOM.TestObj.testObjAttr._get");
197     TestObj* imp = V8TestObj::toNative(info.Holder());
198     return toV8(imp->testObjAttr());
199 }
200
201 static void testObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
202 {
203     INC_STATS("DOM.TestObj.testObjAttr._set");
204     TestObj* imp = V8TestObj::toNative(info.Holder());
205     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
206     imp->setTestObjAttr(WTF::getPtr(v));
207     return;
208 }
209
210 static v8::Handle<v8::Value> XMLObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
211 {
212     INC_STATS("DOM.TestObj.XMLObjAttr._get");
213     TestObj* imp = V8TestObj::toNative(info.Holder());
214     return toV8(imp->xmlObjAttr());
215 }
216
217 static void XMLObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
218 {
219     INC_STATS("DOM.TestObj.XMLObjAttr._set");
220     TestObj* imp = V8TestObj::toNative(info.Holder());
221     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
222     imp->setXMLObjAttr(WTF::getPtr(v));
223     return;
224 }
225
226 static v8::Handle<v8::Value> createAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
227 {
228     INC_STATS("DOM.TestObj.create._get");
229     TestObj* imp = V8TestObj::toNative(info.Holder());
230     return v8Boolean(imp->isCreate());
231 }
232
233 static void createAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
234 {
235     INC_STATS("DOM.TestObj.create._set");
236     TestObj* imp = V8TestObj::toNative(info.Holder());
237     bool v = value->BooleanValue();
238     imp->setCreate(v);
239     return;
240 }
241
242 static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
243 {
244     INC_STATS("DOM.TestObj.reflectedStringAttr._get");
245     TestObj* imp = V8TestObj::toNative(info.Holder());
246     return v8String(imp->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr));
247 }
248
249 static void reflectedStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
250 {
251     INC_STATS("DOM.TestObj.reflectedStringAttr._set");
252     TestObj* imp = V8TestObj::toNative(info.Holder());
253     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
254     imp->setAttribute(WebCore::HTMLNames::reflectedstringattrAttr, v);
255     return;
256 }
257
258 static v8::Handle<v8::Value> reflectedIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
259 {
260     INC_STATS("DOM.TestObj.reflectedIntegralAttr._get");
261     TestObj* imp = V8TestObj::toNative(info.Holder());
262     return v8::Integer::New(imp->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr));
263 }
264
265 static void reflectedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
266 {
267     INC_STATS("DOM.TestObj.reflectedIntegralAttr._set");
268     TestObj* imp = V8TestObj::toNative(info.Holder());
269     int v = toInt32(value);
270     imp->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, v);
271     return;
272 }
273
274 static v8::Handle<v8::Value> reflectedUnsignedIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
275 {
276     INC_STATS("DOM.TestObj.reflectedUnsignedIntegralAttr._get");
277     TestObj* imp = V8TestObj::toNative(info.Holder());
278     return v8::Integer::NewFromUnsigned(std::max(0, imp->getIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr)));
279 }
280
281 static void reflectedUnsignedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
282 {
283     INC_STATS("DOM.TestObj.reflectedUnsignedIntegralAttr._set");
284     TestObj* imp = V8TestObj::toNative(info.Holder());
285     unsigned v = toUInt32(value);
286     imp->setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, v);
287     return;
288 }
289
290 static v8::Handle<v8::Value> reflectedBooleanAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
291 {
292     INC_STATS("DOM.TestObj.reflectedBooleanAttr._get");
293     TestObj* imp = V8TestObj::toNative(info.Holder());
294     return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr));
295 }
296
297 static void reflectedBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
298 {
299     INC_STATS("DOM.TestObj.reflectedBooleanAttr._set");
300     TestObj* imp = V8TestObj::toNative(info.Holder());
301     bool v = value->BooleanValue();
302     imp->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, v);
303     return;
304 }
305
306 static v8::Handle<v8::Value> reflectedURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
307 {
308     INC_STATS("DOM.TestObj.reflectedURLAttr._get");
309     TestObj* imp = V8TestObj::toNative(info.Holder());
310     return v8String(imp->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr));
311 }
312
313 static void reflectedURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
314 {
315     INC_STATS("DOM.TestObj.reflectedURLAttr._set");
316     TestObj* imp = V8TestObj::toNative(info.Holder());
317     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
318     imp->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, v);
319     return;
320 }
321
322 static v8::Handle<v8::Value> reflectedNonEmptyURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
323 {
324     INC_STATS("DOM.TestObj.reflectedNonEmptyURLAttr._get");
325     TestObj* imp = V8TestObj::toNative(info.Holder());
326     return v8String(imp->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr));
327 }
328
329 static void reflectedNonEmptyURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
330 {
331     INC_STATS("DOM.TestObj.reflectedNonEmptyURLAttr._set");
332     TestObj* imp = V8TestObj::toNative(info.Holder());
333     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
334     imp->setAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr, v);
335     return;
336 }
337
338 static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
339 {
340     INC_STATS("DOM.TestObj.reflectedStringAttr._get");
341     TestObj* imp = V8TestObj::toNative(info.Holder());
342     return v8String(imp->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr));
343 }
344
345 static void reflectedStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
346 {
347     INC_STATS("DOM.TestObj.reflectedStringAttr._set");
348     TestObj* imp = V8TestObj::toNative(info.Holder());
349     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
350     imp->setAttribute(WebCore::HTMLNames::customContentStringAttrAttr, v);
351     return;
352 }
353
354 static v8::Handle<v8::Value> reflectedCustomIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
355 {
356     INC_STATS("DOM.TestObj.reflectedCustomIntegralAttr._get");
357     TestObj* imp = V8TestObj::toNative(info.Holder());
358     return v8::Integer::New(imp->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr));
359 }
360
361 static void reflectedCustomIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
362 {
363     INC_STATS("DOM.TestObj.reflectedCustomIntegralAttr._set");
364     TestObj* imp = V8TestObj::toNative(info.Holder());
365     int v = toInt32(value);
366     imp->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, v);
367     return;
368 }
369
370 static v8::Handle<v8::Value> reflectedCustomBooleanAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
371 {
372     INC_STATS("DOM.TestObj.reflectedCustomBooleanAttr._get");
373     TestObj* imp = V8TestObj::toNative(info.Holder());
374     return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr));
375 }
376
377 static void reflectedCustomBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
378 {
379     INC_STATS("DOM.TestObj.reflectedCustomBooleanAttr._set");
380     TestObj* imp = V8TestObj::toNative(info.Holder());
381     bool v = value->BooleanValue();
382     imp->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, v);
383     return;
384 }
385
386 static v8::Handle<v8::Value> reflectedCustomURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
387 {
388     INC_STATS("DOM.TestObj.reflectedCustomURLAttr._get");
389     TestObj* imp = V8TestObj::toNative(info.Holder());
390     return v8String(imp->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr));
391 }
392
393 static void reflectedCustomURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
394 {
395     INC_STATS("DOM.TestObj.reflectedCustomURLAttr._set");
396     TestObj* imp = V8TestObj::toNative(info.Holder());
397     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
398     imp->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, v);
399     return;
400 }
401
402 static v8::Handle<v8::Value> reflectedCustomNonEmptyURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
403 {
404     INC_STATS("DOM.TestObj.reflectedCustomNonEmptyURLAttr._get");
405     TestObj* imp = V8TestObj::toNative(info.Holder());
406     return v8String(imp->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr));
407 }
408
409 static void reflectedCustomNonEmptyURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
410 {
411     INC_STATS("DOM.TestObj.reflectedCustomNonEmptyURLAttr._set");
412     TestObj* imp = V8TestObj::toNative(info.Holder());
413     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
414     imp->setAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr, v);
415     return;
416 }
417
418 static v8::Handle<v8::Value> attrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
419 {
420     INC_STATS("DOM.TestObj.attrWithGetterException._get");
421     TestObj* imp = V8TestObj::toNative(info.Holder());
422     ExceptionCode ec = 0;
423     int v = imp->attrWithGetterException(ec);
424     if (UNLIKELY(ec)) {
425         V8Proxy::setDOMException(ec);
426         return v8::Handle<v8::Value>();
427     }
428     return v8::Integer::New(v);
429 }
430
431 static void attrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
432 {
433     INC_STATS("DOM.TestObj.attrWithGetterException._set");
434     TestObj* imp = V8TestObj::toNative(info.Holder());
435     int v = toInt32(value);
436     ExceptionCode ec = 0;
437     imp->setAttrWithGetterException(v, ec);
438     if (UNLIKELY(ec))
439         V8Proxy::setDOMException(ec);
440     return;
441 }
442
443 static v8::Handle<v8::Value> attrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
444 {
445     INC_STATS("DOM.TestObj.attrWithSetterException._get");
446     TestObj* imp = V8TestObj::toNative(info.Holder());
447     return v8::Integer::New(imp->attrWithSetterException());
448 }
449
450 static void attrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
451 {
452     INC_STATS("DOM.TestObj.attrWithSetterException._set");
453     TestObj* imp = V8TestObj::toNative(info.Holder());
454     int v = toInt32(value);
455     ExceptionCode ec = 0;
456     imp->setAttrWithSetterException(v, ec);
457     if (UNLIKELY(ec))
458         V8Proxy::setDOMException(ec);
459     return;
460 }
461
462 static v8::Handle<v8::Value> stringAttrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
463 {
464     INC_STATS("DOM.TestObj.stringAttrWithGetterException._get");
465     TestObj* imp = V8TestObj::toNative(info.Holder());
466     ExceptionCode ec = 0;
467     String v = imp->stringAttrWithGetterException(ec);
468     if (UNLIKELY(ec)) {
469         V8Proxy::setDOMException(ec);
470         return v8::Handle<v8::Value>();
471     }
472     return v8String(v);
473 }
474
475 static void stringAttrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
476 {
477     INC_STATS("DOM.TestObj.stringAttrWithGetterException._set");
478     TestObj* imp = V8TestObj::toNative(info.Holder());
479     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value);
480     ExceptionCode ec = 0;
481     imp->setStringAttrWithGetterException(v, ec);
482     if (UNLIKELY(ec))
483         V8Proxy::setDOMException(ec);
484     return;
485 }
486
487 static v8::Handle<v8::Value> stringAttrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
488 {
489     INC_STATS("DOM.TestObj.stringAttrWithSetterException._get");
490     TestObj* imp = V8TestObj::toNative(info.Holder());
491     return v8String(imp->stringAttrWithSetterException());
492 }
493
494 static void stringAttrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
495 {
496     INC_STATS("DOM.TestObj.stringAttrWithSetterException._set");
497     TestObj* imp = V8TestObj::toNative(info.Holder());
498     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value);
499     ExceptionCode ec = 0;
500     imp->setStringAttrWithSetterException(v, ec);
501     if (UNLIKELY(ec))
502         V8Proxy::setDOMException(ec);
503     return;
504 }
505
506 static v8::Handle<v8::Value> scriptStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
507 {
508     INC_STATS("DOM.TestObj.scriptStringAttr._get");
509     TestObj* imp = V8TestObj::toNative(info.Holder());
510     return v8StringOrNull(imp->scriptStringAttr());
511 }
512
513 #if ENABLE(Condition1)
514
515 static v8::Handle<v8::Value> conditionalAttr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
516 {
517     INC_STATS("DOM.TestObj.conditionalAttr1._get");
518     TestObj* imp = V8TestObj::toNative(info.Holder());
519     return v8::Integer::New(imp->conditionalAttr1());
520 }
521
522 #endif // ENABLE(Condition1)
523
524 #if ENABLE(Condition1)
525
526 static void conditionalAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
527 {
528     INC_STATS("DOM.TestObj.conditionalAttr1._set");
529     TestObj* imp = V8TestObj::toNative(info.Holder());
530     int v = toInt32(value);
531     imp->setConditionalAttr1(v);
532     return;
533 }
534
535 #endif // ENABLE(Condition1)
536
537 #if ENABLE(Condition1) && ENABLE(Condition2)
538
539 static v8::Handle<v8::Value> conditionalAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
540 {
541     INC_STATS("DOM.TestObj.conditionalAttr2._get");
542     TestObj* imp = V8TestObj::toNative(info.Holder());
543     return v8::Integer::New(imp->conditionalAttr2());
544 }
545
546 #endif // ENABLE(Condition1) && ENABLE(Condition2)
547
548 #if ENABLE(Condition1) && ENABLE(Condition2)
549
550 static void conditionalAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
551 {
552     INC_STATS("DOM.TestObj.conditionalAttr2._set");
553     TestObj* imp = V8TestObj::toNative(info.Holder());
554     int v = toInt32(value);
555     imp->setConditionalAttr2(v);
556     return;
557 }
558
559 #endif // ENABLE(Condition1) && ENABLE(Condition2)
560
561 #if ENABLE(Condition1) || ENABLE(Condition2)
562
563 static v8::Handle<v8::Value> conditionalAttr3AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
564 {
565     INC_STATS("DOM.TestObj.conditionalAttr3._get");
566     TestObj* imp = V8TestObj::toNative(info.Holder());
567     return v8::Integer::New(imp->conditionalAttr3());
568 }
569
570 #endif // ENABLE(Condition1) || ENABLE(Condition2)
571
572 #if ENABLE(Condition1) || ENABLE(Condition2)
573
574 static void conditionalAttr3AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
575 {
576     INC_STATS("DOM.TestObj.conditionalAttr3._set");
577     TestObj* imp = V8TestObj::toNative(info.Holder());
578     int v = toInt32(value);
579     imp->setConditionalAttr3(v);
580     return;
581 }
582
583 #endif // ENABLE(Condition1) || ENABLE(Condition2)
584
585 static v8::Handle<v8::Value> cachedAttribute1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
586 {
587     INC_STATS("DOM.TestObj.cachedAttribute1._get");
588     TestObj* imp = V8TestObj::toNative(info.Holder());
589     RefPtr<any> result = imp->cachedAttribute1();
590     v8::Handle<v8::Value> wrapper = result.get() ? V8any::existingWrapper(result.get()) : v8::Handle<v8::Object>();
591     if (wrapper.IsEmpty()) {
592         wrapper = toV8(result.get());
593         if (!wrapper.IsEmpty())
594             V8DOMWrapper::setNamedHiddenReference(info.Holder(), "cachedAttribute1", wrapper);
595     }
596     return wrapper;
597 }
598
599 static v8::Handle<v8::Value> cachedAttribute2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
600 {
601     INC_STATS("DOM.TestObj.cachedAttribute2._get");
602     TestObj* imp = V8TestObj::toNative(info.Holder());
603     RefPtr<any> result = imp->cachedAttribute2();
604     v8::Handle<v8::Value> wrapper = result.get() ? V8any::existingWrapper(result.get()) : v8::Handle<v8::Object>();
605     if (wrapper.IsEmpty()) {
606         wrapper = toV8(result.get());
607         if (!wrapper.IsEmpty())
608             V8DOMWrapper::setNamedHiddenReference(info.Holder(), "cachedAttribute2", wrapper);
609     }
610     return wrapper;
611 }
612
613 static v8::Handle<v8::Value> enabledAtRuntimeAttr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
614 {
615     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr1._get");
616     TestObj* imp = V8TestObj::toNative(info.Holder());
617     return v8::Integer::New(imp->enabledAtRuntimeAttr1());
618 }
619
620 static void enabledAtRuntimeAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
621 {
622     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr1._set");
623     TestObj* imp = V8TestObj::toNative(info.Holder());
624     int v = toInt32(value);
625     imp->setEnabledAtRuntimeAttr1(v);
626     return;
627 }
628
629 static v8::Handle<v8::Value> enabledAtRuntimeAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
630 {
631     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr2._get");
632     TestObj* imp = V8TestObj::toNative(info.Holder());
633     return v8::Integer::New(imp->enabledAtRuntimeAttr2());
634 }
635
636 static void enabledAtRuntimeAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
637 {
638     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr2._set");
639     TestObj* imp = V8TestObj::toNative(info.Holder());
640     int v = toInt32(value);
641     imp->setEnabledAtRuntimeAttr2(v);
642     return;
643 }
644
645 static v8::Handle<v8::Value> descriptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
646 {
647     INC_STATS("DOM.TestObj.description._get");
648     TestObj* imp = V8TestObj::toNative(info.Holder());
649     return v8::Integer::New(imp->description());
650 }
651
652 static v8::Handle<v8::Value> idAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
653 {
654     INC_STATS("DOM.TestObj.id._get");
655     TestObj* imp = V8TestObj::toNative(info.Holder());
656     return v8::Integer::New(imp->id());
657 }
658
659 static void idAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
660 {
661     INC_STATS("DOM.TestObj.id._set");
662     TestObj* imp = V8TestObj::toNative(info.Holder());
663     int v = toInt32(value);
664     imp->setId(v);
665     return;
666 }
667
668 static v8::Handle<v8::Value> hashAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
669 {
670     INC_STATS("DOM.TestObj.hash._get");
671     TestObj* imp = V8TestObj::toNative(info.Holder());
672     return v8String(imp->hash());
673 }
674
675 static v8::Handle<v8::Value> TestObjConstructorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
676 {
677     INC_STATS("DOM.TestObj.constructors._get");
678     v8::Handle<v8::Value> data = info.Data();
679     ASSERT(data->IsExternal() || data->IsNumber());
680     WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data);
681     return v8::Handle<v8::Value>();}
682
683 static v8::Handle<v8::Value> voidMethodCallback(const v8::Arguments& args)
684 {
685     INC_STATS("DOM.TestObj.voidMethod");
686     TestObj* imp = V8TestObj::toNative(args.Holder());
687     imp->voidMethod();
688     return v8::Handle<v8::Value>();
689 }
690
691 static v8::Handle<v8::Value> voidMethodWithArgsCallback(const v8::Arguments& args)
692 {
693     INC_STATS("DOM.TestObj.voidMethodWithArgs");
694     if (args.Length() < 3)
695         return throwError("Not enough arguments", V8Proxy::TypeError);
696     TestObj* imp = V8TestObj::toNative(args.Holder());
697     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
698     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined));
699     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, MissingIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, MissingIsUndefined))) : 0);
700     imp->voidMethodWithArgs(intArg, strArg, objArg);
701     return v8::Handle<v8::Value>();
702 }
703
704 static v8::Handle<v8::Value> intMethodCallback(const v8::Arguments& args)
705 {
706     INC_STATS("DOM.TestObj.intMethod");
707     TestObj* imp = V8TestObj::toNative(args.Holder());
708     return v8::Integer::New(imp->intMethod());
709 }
710
711 static v8::Handle<v8::Value> intMethodWithArgsCallback(const v8::Arguments& args)
712 {
713     INC_STATS("DOM.TestObj.intMethodWithArgs");
714     if (args.Length() < 3)
715         return throwError("Not enough arguments", V8Proxy::TypeError);
716     TestObj* imp = V8TestObj::toNative(args.Holder());
717     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
718     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined));
719     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, MissingIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, MissingIsUndefined))) : 0);
720     return v8::Integer::New(imp->intMethodWithArgs(intArg, strArg, objArg));
721 }
722
723 static v8::Handle<v8::Value> objMethodCallback(const v8::Arguments& args)
724 {
725     INC_STATS("DOM.TestObj.objMethod");
726     TestObj* imp = V8TestObj::toNative(args.Holder());
727     return toV8(imp->objMethod());
728 }
729
730 static v8::Handle<v8::Value> objMethodWithArgsCallback(const v8::Arguments& args)
731 {
732     INC_STATS("DOM.TestObj.objMethodWithArgs");
733     if (args.Length() < 3)
734         return throwError("Not enough arguments", V8Proxy::TypeError);
735     TestObj* imp = V8TestObj::toNative(args.Holder());
736     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
737     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined));
738     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, MissingIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, MissingIsUndefined))) : 0);
739     return toV8(imp->objMethodWithArgs(intArg, strArg, objArg));
740 }
741
742 static v8::Handle<v8::Value> methodThatRequiresAllArgsCallback(const v8::Arguments& args)
743 {
744     INC_STATS("DOM.TestObj.methodThatRequiresAllArgs");
745     if (args.Length() < 2)
746         return v8::Handle<v8::Value>();
747     TestObj* imp = V8TestObj::toNative(args.Holder());
748     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined));
749     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined))) : 0);
750     return toV8(imp->methodThatRequiresAllArgs(strArg, objArg));
751 }
752
753 static v8::Handle<v8::Value> methodThatRequiresAllArgsAndThrowsCallback(const v8::Arguments& args)
754 {
755     INC_STATS("DOM.TestObj.methodThatRequiresAllArgsAndThrows");
756     if (args.Length() < 2)
757         return throwError("Not enough arguments", V8Proxy::TypeError);
758     TestObj* imp = V8TestObj::toNative(args.Holder());
759     ExceptionCode ec = 0;
760     {
761     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined));
762     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined))) : 0);
763     RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec);
764     if (UNLIKELY(ec))
765         goto fail;
766     return toV8(result.release());
767     }
768     fail:
769     V8Proxy::setDOMException(ec);
770     return v8::Handle<v8::Value>();
771 }
772
773 static v8::Handle<v8::Value> serializedValueCallback(const v8::Arguments& args)
774 {
775     INC_STATS("DOM.TestObj.serializedValue");
776     if (args.Length() < 1)
777         return throwError("Not enough arguments", V8Proxy::TypeError);
778     TestObj* imp = V8TestObj::toNative(args.Holder());
779     bool serializedArgDidThrow = false;
780     RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(args[0], 0, serializedArgDidThrow);
781     if (serializedArgDidThrow)
782         return v8::Undefined();
783     imp->serializedValue(serializedArg);
784     return v8::Handle<v8::Value>();
785 }
786
787 static v8::Handle<v8::Value> idbKeyCallback(const v8::Arguments& args)
788 {
789     INC_STATS("DOM.TestObj.idbKey");
790     if (args.Length() < 1)
791         return throwError("Not enough arguments", V8Proxy::TypeError);
792     TestObj* imp = V8TestObj::toNative(args.Holder());
793     EXCEPTION_BLOCK(RefPtr<IDBKey>, key, createIDBKeyFromValue(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
794     imp->idbKey(key);
795     return v8::Handle<v8::Value>();
796 }
797
798 static v8::Handle<v8::Value> optionsObjectCallback(const v8::Arguments& args)
799 {
800     INC_STATS("DOM.TestObj.optionsObject");
801     if (args.Length() < 1)
802         return throwError("Not enough arguments", V8Proxy::TypeError);
803     TestObj* imp = V8TestObj::toNative(args.Holder());
804     EXCEPTION_BLOCK(OptionsObject, oo, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined));
805     if (args.Length() <= 1) {
806         imp->optionsObject(oo);
807         return v8::Handle<v8::Value>();
808     }
809     EXCEPTION_BLOCK(OptionsObject, ooo, MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined));
810     imp->optionsObject(oo, ooo);
811     return v8::Handle<v8::Value>();
812 }
813
814 static v8::Handle<v8::Value> methodWithExceptionCallback(const v8::Arguments& args)
815 {
816     INC_STATS("DOM.TestObj.methodWithException");
817     TestObj* imp = V8TestObj::toNative(args.Holder());
818     ExceptionCode ec = 0;
819     {
820     imp->methodWithException(ec);
821     if (UNLIKELY(ec))
822         goto fail;
823     return v8::Handle<v8::Value>();
824     }
825     fail:
826     V8Proxy::setDOMException(ec);
827     return v8::Handle<v8::Value>();
828 }
829
830 static v8::Handle<v8::Value> customArgsAndExceptionCallback(const v8::Arguments& args)
831 {
832     INC_STATS("DOM.TestObj.customArgsAndException");
833     if (args.Length() < 1)
834         return throwError("Not enough arguments", V8Proxy::TypeError);
835     TestObj* imp = V8TestObj::toNative(args.Holder());
836     ExceptionCode ec = 0;
837     {
838     RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1));
839     size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;
840     RefPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize));
841     if (!callStack)
842         return v8::Undefined();
843     EXCEPTION_BLOCK(log*, intArg, V8log::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8log::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0);
844     imp->customArgsAndException(intArg, scriptArguments, callStack, ec);
845     if (UNLIKELY(ec))
846         goto fail;
847     return v8::Handle<v8::Value>();
848     }
849     fail:
850     V8Proxy::setDOMException(ec);
851     return v8::Handle<v8::Value>();
852 }
853
854 static v8::Handle<v8::Value> addEventListenerCallback(const v8::Arguments& args)
855 {
856     INC_STATS("DOM.TestObj.addEventListener()");
857     RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOrCreate);
858     if (listener) {
859         V8TestObj::toNative(args.Holder())->addEventListener(v8ValueToAtomicWebCoreString(args[0]), listener, args[2]->BooleanValue());
860         createHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex);
861     }
862     return v8::Undefined();
863 }
864
865 static v8::Handle<v8::Value> removeEventListenerCallback(const v8::Arguments& args)
866 {
867     INC_STATS("DOM.TestObj.removeEventListener()");
868     RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOnly);
869     if (listener) {
870         V8TestObj::toNative(args.Holder())->removeEventListener(v8ValueToAtomicWebCoreString(args[0]), listener.get(), args[2]->BooleanValue());
871         removeHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex);
872     }
873     return v8::Undefined();
874 }
875
876 static v8::Handle<v8::Value> withDynamicFrameCallback(const v8::Arguments& args)
877 {
878     INC_STATS("DOM.TestObj.withDynamicFrame");
879     TestObj* imp = V8TestObj::toNative(args.Holder());
880     Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
881     if (!enteredFrame)
882         return v8::Undefined();
883     imp->withDynamicFrame(enteredFrame);
884     return v8::Handle<v8::Value>();
885 }
886
887 static v8::Handle<v8::Value> withDynamicFrameAndArgCallback(const v8::Arguments& args)
888 {
889     INC_STATS("DOM.TestObj.withDynamicFrameAndArg");
890     if (args.Length() < 1)
891         return throwError("Not enough arguments", V8Proxy::TypeError);
892     TestObj* imp = V8TestObj::toNative(args.Holder());
893     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
894     Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
895     if (!enteredFrame)
896         return v8::Undefined();
897     imp->withDynamicFrameAndArg(enteredFrame, intArg);
898     return v8::Handle<v8::Value>();
899 }
900
901 static v8::Handle<v8::Value> withDynamicFrameAndOptionalArgCallback(const v8::Arguments& args)
902 {
903     INC_STATS("DOM.TestObj.withDynamicFrameAndOptionalArg");
904     if (args.Length() < 1)
905         return throwError("Not enough arguments", V8Proxy::TypeError);
906     TestObj* imp = V8TestObj::toNative(args.Holder());
907     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
908     if (args.Length() <= 1) {
909         Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
910         if (!enteredFrame)
911             return v8::Undefined();
912         imp->withDynamicFrameAndOptionalArg(enteredFrame, intArg);
913         return v8::Handle<v8::Value>();
914     }
915     EXCEPTION_BLOCK(int, optionalArg, toInt32(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)));
916     Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
917     if (!enteredFrame)
918         return v8::Undefined();
919     imp->withDynamicFrameAndOptionalArg(enteredFrame, intArg, optionalArg);
920     return v8::Handle<v8::Value>();
921 }
922
923 static v8::Handle<v8::Value> withDynamicFrameAndUserGestureCallback(const v8::Arguments& args)
924 {
925     INC_STATS("DOM.TestObj.withDynamicFrameAndUserGesture");
926     if (args.Length() < 1)
927         return throwError("Not enough arguments", V8Proxy::TypeError);
928     TestObj* imp = V8TestObj::toNative(args.Holder());
929     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
930     Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
931     if (!enteredFrame)
932         return v8::Undefined();
933     imp->withDynamicFrameAndUserGesture(enteredFrame, intArg, ScriptController::processingUserGesture());
934     return v8::Handle<v8::Value>();
935 }
936
937 static v8::Handle<v8::Value> withDynamicFrameAndUserGestureASADCallback(const v8::Arguments& args)
938 {
939     INC_STATS("DOM.TestObj.withDynamicFrameAndUserGestureASAD");
940     if (args.Length() < 1)
941         return throwError("Not enough arguments", V8Proxy::TypeError);
942     TestObj* imp = V8TestObj::toNative(args.Holder());
943     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
944     if (args.Length() <= 1) {
945         Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
946         if (!enteredFrame)
947             return v8::Undefined();
948         imp->withDynamicFrameAndUserGestureASAD(enteredFrame, intArg, ScriptController::processingUserGesture());
949         return v8::Handle<v8::Value>();
950     }
951     EXCEPTION_BLOCK(int, optionalArg, toInt32(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)));
952     Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
953     if (!enteredFrame)
954         return v8::Undefined();
955     imp->withDynamicFrameAndUserGestureASAD(enteredFrame, intArg, optionalArg, ScriptController::processingUserGesture());
956     return v8::Handle<v8::Value>();
957 }
958
959 static v8::Handle<v8::Value> withScriptStateVoidCallback(const v8::Arguments& args)
960 {
961     INC_STATS("DOM.TestObj.withScriptStateVoid");
962     TestObj* imp = V8TestObj::toNative(args.Holder());
963     EmptyScriptState state;
964     imp->withScriptStateVoid(&state);
965     if (state.hadException())
966         return throwError(state.exception());
967     return v8::Handle<v8::Value>();
968 }
969
970 static v8::Handle<v8::Value> withScriptStateObjCallback(const v8::Arguments& args)
971 {
972     INC_STATS("DOM.TestObj.withScriptStateObj");
973     TestObj* imp = V8TestObj::toNative(args.Holder());
974     EmptyScriptState state;
975     RefPtr<TestObj> result = imp->withScriptStateObj(&state);
976     if (state.hadException())
977         return throwError(state.exception());
978     return toV8(result.release());
979 }
980
981 static v8::Handle<v8::Value> withScriptStateVoidExceptionCallback(const v8::Arguments& args)
982 {
983     INC_STATS("DOM.TestObj.withScriptStateVoidException");
984     TestObj* imp = V8TestObj::toNative(args.Holder());
985     ExceptionCode ec = 0;
986     {
987     EmptyScriptState state;
988     imp->withScriptStateVoidException(&state, ec);
989     if (UNLIKELY(ec))
990         goto fail;
991     if (state.hadException())
992         return throwError(state.exception());
993     return v8::Handle<v8::Value>();
994     }
995     fail:
996     V8Proxy::setDOMException(ec);
997     return v8::Handle<v8::Value>();
998 }
999
1000 static v8::Handle<v8::Value> withScriptStateObjExceptionCallback(const v8::Arguments& args)
1001 {
1002     INC_STATS("DOM.TestObj.withScriptStateObjException");
1003     TestObj* imp = V8TestObj::toNative(args.Holder());
1004     ExceptionCode ec = 0;
1005     {
1006     EmptyScriptState state;
1007     RefPtr<TestObj> result = imp->withScriptStateObjException(&state, ec);
1008     if (UNLIKELY(ec))
1009         goto fail;
1010     if (state.hadException())
1011         return throwError(state.exception());
1012     return toV8(result.release());
1013     }
1014     fail:
1015     V8Proxy::setDOMException(ec);
1016     return v8::Handle<v8::Value>();
1017 }
1018
1019 static v8::Handle<v8::Value> withScriptExecutionContextCallback(const v8::Arguments& args)
1020 {
1021     INC_STATS("DOM.TestObj.withScriptExecutionContext");
1022     TestObj* imp = V8TestObj::toNative(args.Holder());
1023     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
1024     if (!scriptContext)
1025         return v8::Undefined();
1026     imp->withScriptExecutionContext(scriptContext);
1027     return v8::Handle<v8::Value>();
1028 }
1029
1030 static v8::Handle<v8::Value> methodWithOptionalArgCallback(const v8::Arguments& args)
1031 {
1032     INC_STATS("DOM.TestObj.methodWithOptionalArg");
1033     TestObj* imp = V8TestObj::toNative(args.Holder());
1034     if (args.Length() <= 0) {
1035         imp->methodWithOptionalArg();
1036         return v8::Handle<v8::Value>();
1037     }
1038     EXCEPTION_BLOCK(int, opt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1039     imp->methodWithOptionalArg(opt);
1040     return v8::Handle<v8::Value>();
1041 }
1042
1043 static v8::Handle<v8::Value> methodWithNonOptionalArgAndOptionalArgCallback(const v8::Arguments& args)
1044 {
1045     INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndOptionalArg");
1046     if (args.Length() < 1)
1047         return throwError("Not enough arguments", V8Proxy::TypeError);
1048     TestObj* imp = V8TestObj::toNative(args.Holder());
1049     EXCEPTION_BLOCK(int, nonOpt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1050     if (args.Length() <= 1) {
1051         imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
1052         return v8::Handle<v8::Value>();
1053     }
1054     EXCEPTION_BLOCK(int, opt, toInt32(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)));
1055     imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
1056     return v8::Handle<v8::Value>();
1057 }
1058
1059 static v8::Handle<v8::Value> methodWithNonOptionalArgAndTwoOptionalArgsCallback(const v8::Arguments& args)
1060 {
1061     INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndTwoOptionalArgs");
1062     if (args.Length() < 1)
1063         return throwError("Not enough arguments", V8Proxy::TypeError);
1064     TestObj* imp = V8TestObj::toNative(args.Holder());
1065     EXCEPTION_BLOCK(int, nonOpt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1066     if (args.Length() <= 1) {
1067         imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
1068         return v8::Handle<v8::Value>();
1069     }
1070     EXCEPTION_BLOCK(int, opt1, toInt32(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)));
1071     if (args.Length() <= 2) {
1072         imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1);
1073         return v8::Handle<v8::Value>();
1074     }
1075     EXCEPTION_BLOCK(int, opt2, toInt32(MAYBE_MISSING_PARAMETER(args, 2, MissingIsUndefined)));
1076     imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
1077     return v8::Handle<v8::Value>();
1078 }
1079
1080 static v8::Handle<v8::Value> methodWithCallbackArgCallback(const v8::Arguments& args)
1081 {
1082     INC_STATS("DOM.TestObj.methodWithCallbackArg");
1083     if (args.Length() < 1)
1084         return throwError("Not enough arguments", V8Proxy::TypeError);
1085     TestObj* imp = V8TestObj::toNative(args.Holder());
1086     if (args.Length() <= 0 || !args[0]->IsObject())
1087         return throwError(TYPE_MISMATCH_ERR);
1088     RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1089     imp->methodWithCallbackArg(callback);
1090     return v8::Handle<v8::Value>();
1091 }
1092
1093 static v8::Handle<v8::Value> methodWithNonCallbackArgAndCallbackArgCallback(const v8::Arguments& args)
1094 {
1095     INC_STATS("DOM.TestObj.methodWithNonCallbackArgAndCallbackArg");
1096     if (args.Length() < 2)
1097         return throwError("Not enough arguments", V8Proxy::TypeError);
1098     TestObj* imp = V8TestObj::toNative(args.Holder());
1099     EXCEPTION_BLOCK(int, nonCallback, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1100     if (args.Length() <= 1 || !args[1]->IsObject())
1101         return throwError(TYPE_MISMATCH_ERR);
1102     RefPtr<TestCallback> callback = V8TestCallback::create(args[1], getScriptExecutionContext());
1103     imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
1104     return v8::Handle<v8::Value>();
1105 }
1106
1107 static v8::Handle<v8::Value> methodWithCallbackAndOptionalArgCallback(const v8::Arguments& args)
1108 {
1109     INC_STATS("DOM.TestObj.methodWithCallbackAndOptionalArg");
1110     TestObj* imp = V8TestObj::toNative(args.Holder());
1111     RefPtr<TestCallback> callback;
1112     if (args.Length() > 0 && !args[0]->IsNull() && !args[0]->IsUndefined()) {
1113         if (!args[0]->IsObject())
1114             return throwError(TYPE_MISMATCH_ERR);
1115         callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1116     }
1117     imp->methodWithCallbackAndOptionalArg(callback);
1118     return v8::Handle<v8::Value>();
1119 }
1120
1121 static v8::Handle<v8::Value> conditionalMethod1Callback(const v8::Arguments& args)
1122 {
1123     INC_STATS("DOM.TestObj.conditionalMethod1");
1124     TestObj* imp = V8TestObj::toNative(args.Holder());
1125     return v8String(imp->conditionalMethod1());
1126 }
1127
1128 static v8::Handle<v8::Value> conditionalMethod2Callback(const v8::Arguments& args)
1129 {
1130     INC_STATS("DOM.TestObj.conditionalMethod2");
1131     TestObj* imp = V8TestObj::toNative(args.Holder());
1132     imp->conditionalMethod2();
1133     return v8::Handle<v8::Value>();
1134 }
1135
1136 static v8::Handle<v8::Value> conditionalMethod3Callback(const v8::Arguments& args)
1137 {
1138     INC_STATS("DOM.TestObj.conditionalMethod3");
1139     TestObj* imp = V8TestObj::toNative(args.Holder());
1140     imp->conditionalMethod3();
1141     return v8::Handle<v8::Value>();
1142 }
1143
1144 static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args)
1145 {
1146     INC_STATS("DOM.TestObj.overloadedMethod1");
1147     if (args.Length() < 2)
1148         return throwError("Not enough arguments", V8Proxy::TypeError);
1149     TestObj* imp = V8TestObj::toNative(args.Holder());
1150     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0);
1151     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined));
1152     imp->overloadedMethod(objArg, strArg);
1153     return v8::Handle<v8::Value>();
1154 }
1155
1156 static v8::Handle<v8::Value> overloadedMethod2Callback(const v8::Arguments& args)
1157 {
1158     INC_STATS("DOM.TestObj.overloadedMethod2");
1159     if (args.Length() < 1)
1160         return throwError("Not enough arguments", V8Proxy::TypeError);
1161     TestObj* imp = V8TestObj::toNative(args.Holder());
1162     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0);
1163     if (args.Length() <= 1) {
1164         imp->overloadedMethod(objArg);
1165         return v8::Handle<v8::Value>();
1166     }
1167     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)));
1168     imp->overloadedMethod(objArg, intArg);
1169     return v8::Handle<v8::Value>();
1170 }
1171
1172 static v8::Handle<v8::Value> overloadedMethod3Callback(const v8::Arguments& args)
1173 {
1174     INC_STATS("DOM.TestObj.overloadedMethod3");
1175     if (args.Length() < 1)
1176         return throwError("Not enough arguments", V8Proxy::TypeError);
1177     TestObj* imp = V8TestObj::toNative(args.Holder());
1178     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined));
1179     imp->overloadedMethod(strArg);
1180     return v8::Handle<v8::Value>();
1181 }
1182
1183 static v8::Handle<v8::Value> overloadedMethod4Callback(const v8::Arguments& args)
1184 {
1185     INC_STATS("DOM.TestObj.overloadedMethod4");
1186     if (args.Length() < 1)
1187         return throwError("Not enough arguments", V8Proxy::TypeError);
1188     TestObj* imp = V8TestObj::toNative(args.Holder());
1189     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1190     imp->overloadedMethod(intArg);
1191     return v8::Handle<v8::Value>();
1192 }
1193
1194 static v8::Handle<v8::Value> overloadedMethod5Callback(const v8::Arguments& args)
1195 {
1196     INC_STATS("DOM.TestObj.overloadedMethod5");
1197     if (args.Length() < 1)
1198         return throwError("Not enough arguments", V8Proxy::TypeError);
1199     TestObj* imp = V8TestObj::toNative(args.Holder());
1200     if (args.Length() <= 0 || !args[0]->IsObject())
1201         return throwError(TYPE_MISMATCH_ERR);
1202     RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1203     imp->overloadedMethod(callback);
1204     return v8::Handle<v8::Value>();
1205 }
1206
1207 static v8::Handle<v8::Value> overloadedMethod6Callback(const v8::Arguments& args)
1208 {
1209     INC_STATS("DOM.TestObj.overloadedMethod6");
1210     if (args.Length() < 1)
1211         return throwError("Not enough arguments", V8Proxy::TypeError);
1212     TestObj* imp = V8TestObj::toNative(args.Holder());
1213     EXCEPTION_BLOCK(RefPtr<DOMStringList>, listArg, v8ValueToWebCoreDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1214     imp->overloadedMethod(listArg);
1215     return v8::Handle<v8::Value>();
1216 }
1217
1218 static v8::Handle<v8::Value> overloadedMethod7Callback(const v8::Arguments& args)
1219 {
1220     INC_STATS("DOM.TestObj.overloadedMethod7");
1221     if (args.Length() < 1)
1222         return throwError("Not enough arguments", V8Proxy::TypeError);
1223     TestObj* imp = V8TestObj::toNative(args.Holder());
1224     EXCEPTION_BLOCK(RefPtr<DOMStringList>, arrayArg, v8ValueToWebCoreDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1225     imp->overloadedMethod(arrayArg);
1226     return v8::Handle<v8::Value>();
1227 }
1228
1229 static v8::Handle<v8::Value> overloadedMethodCallback(const v8::Arguments& args)
1230 {
1231     INC_STATS("DOM.TestObj.overloadedMethod");
1232     if ((args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0])) && (args[1]->IsNull() || args[1]->IsUndefined() || args[1]->IsString() || args[1]->IsObject())))
1233         return overloadedMethod1Callback(args);
1234     if ((args.Length() == 1 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0]))) || (args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0]))))
1235         return overloadedMethod2Callback(args);
1236     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject())))
1237         return overloadedMethod3Callback(args);
1238     if (args.Length() == 1)
1239         return overloadedMethod4Callback(args);
1240     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsObject())))
1241         return overloadedMethod5Callback(args);
1242     if ((args.Length() == 1 && (args[0]->IsNull() || V8DOMStringList::HasInstance(args[0]))))
1243         return overloadedMethod6Callback(args);
1244     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsArray())))
1245         return overloadedMethod7Callback(args);
1246     V8Proxy::throwTypeError();
1247     return notHandledByInterceptor();
1248 }
1249
1250 static v8::Handle<v8::Value> classMethodCallback(const v8::Arguments& args)
1251 {
1252     INC_STATS("DOM.TestObj.classMethod");
1253     TestObj::classMethod();
1254     return v8::Handle<v8::Value>();
1255 }
1256
1257 static v8::Handle<v8::Value> classMethodWithOptionalCallback(const v8::Arguments& args)
1258 {
1259     INC_STATS("DOM.TestObj.classMethodWithOptional");
1260     if (args.Length() <= 0) {
1261         return v8::Integer::New(TestObj::classMethodWithOptional());
1262     }
1263     EXCEPTION_BLOCK(int, arg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1264     return v8::Integer::New(TestObj::classMethodWithOptional(arg));
1265 }
1266
1267 static v8::Handle<v8::Value> enabledAtRuntimeMethod1Callback(const v8::Arguments& args)
1268 {
1269     INC_STATS("DOM.TestObj.enabledAtRuntimeMethod1");
1270     if (args.Length() < 1)
1271         return throwError("Not enough arguments", V8Proxy::TypeError);
1272     TestObj* imp = V8TestObj::toNative(args.Holder());
1273     EXCEPTION_BLOCK(int, intArg, V8int::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8int::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0);
1274     imp->enabledAtRuntimeMethod1(intArg);
1275     return v8::Handle<v8::Value>();
1276 }
1277
1278 static v8::Handle<v8::Value> enabledAtRuntimeMethod2Callback(const v8::Arguments& args)
1279 {
1280     INC_STATS("DOM.TestObj.enabledAtRuntimeMethod2");
1281     if (args.Length() < 1)
1282         return throwError("Not enough arguments", V8Proxy::TypeError);
1283     TestObj* imp = V8TestObj::toNative(args.Holder());
1284     EXCEPTION_BLOCK(int, intArg, V8int::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8int::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0);
1285     imp->enabledAtRuntimeMethod2(intArg);
1286     return v8::Handle<v8::Value>();
1287 }
1288
1289 } // namespace TestObjInternal
1290
1291 static const BatchedAttribute TestObjAttrs[] = {
1292     // Attribute 'readOnlyIntAttr' (Type: 'readonly attribute' ExtAttr: '')
1293     {"readOnlyIntAttr", TestObjInternal::readOnlyIntAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1294     // Attribute 'readOnlyStringAttr' (Type: 'readonly attribute' ExtAttr: '')
1295     {"readOnlyStringAttr", TestObjInternal::readOnlyStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1296     // Attribute 'readOnlyTestObjAttr' (Type: 'readonly attribute' ExtAttr: '')
1297     {"readOnlyTestObjAttr", TestObjInternal::readOnlyTestObjAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1298     // Attribute 'shortAttr' (Type: 'attribute' ExtAttr: '')
1299     {"shortAttr", TestObjInternal::shortAttrAttrGetter, TestObjInternal::shortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1300     // Attribute 'unsignedShortAttr' (Type: 'attribute' ExtAttr: '')
1301     {"unsignedShortAttr", TestObjInternal::unsignedShortAttrAttrGetter, TestObjInternal::unsignedShortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1302     // Attribute 'intAttr' (Type: 'attribute' ExtAttr: '')
1303     {"intAttr", TestObjInternal::intAttrAttrGetter, TestObjInternal::intAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1304     // Attribute 'longLongAttr' (Type: 'attribute' ExtAttr: '')
1305     {"longLongAttr", TestObjInternal::longLongAttrAttrGetter, TestObjInternal::longLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1306     // Attribute 'unsignedLongLongAttr' (Type: 'attribute' ExtAttr: '')
1307     {"unsignedLongLongAttr", TestObjInternal::unsignedLongLongAttrAttrGetter, TestObjInternal::unsignedLongLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1308     // Attribute 'stringAttr' (Type: 'attribute' ExtAttr: '')
1309     {"stringAttr", TestObjInternal::stringAttrAttrGetter, TestObjInternal::stringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1310     // Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: '')
1311     {"testObjAttr", TestObjInternal::testObjAttrAttrGetter, TestObjInternal::testObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1312     // Attribute 'XMLObjAttr' (Type: 'attribute' ExtAttr: '')
1313     {"XMLObjAttr", TestObjInternal::XMLObjAttrAttrGetter, TestObjInternal::XMLObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1314     // Attribute 'create' (Type: 'attribute' ExtAttr: '')
1315     {"create", TestObjInternal::createAttrGetter, TestObjInternal::createAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1316     // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1317     {"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1318     // Attribute 'reflectedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1319     {"reflectedIntegralAttr", TestObjInternal::reflectedIntegralAttrAttrGetter, TestObjInternal::reflectedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1320     // Attribute 'reflectedUnsignedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1321     {"reflectedUnsignedIntegralAttr", TestObjInternal::reflectedUnsignedIntegralAttrAttrGetter, TestObjInternal::reflectedUnsignedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1322     // Attribute 'reflectedBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1323     {"reflectedBooleanAttr", TestObjInternal::reflectedBooleanAttrAttrGetter, TestObjInternal::reflectedBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1324     // Attribute 'reflectedURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect')
1325     {"reflectedURLAttr", TestObjInternal::reflectedURLAttrAttrGetter, TestObjInternal::reflectedURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1326     // Attribute 'reflectedNonEmptyURLAttr' (Type: 'attribute' ExtAttr: 'URL NonEmpty Reflect')
1327     {"reflectedNonEmptyURLAttr", TestObjInternal::reflectedNonEmptyURLAttrAttrGetter, TestObjInternal::reflectedNonEmptyURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1328     // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1329     {"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1330     // Attribute 'reflectedCustomIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1331     {"reflectedCustomIntegralAttr", TestObjInternal::reflectedCustomIntegralAttrAttrGetter, TestObjInternal::reflectedCustomIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1332     // Attribute 'reflectedCustomBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1333     {"reflectedCustomBooleanAttr", TestObjInternal::reflectedCustomBooleanAttrAttrGetter, TestObjInternal::reflectedCustomBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1334     // Attribute 'reflectedCustomURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect')
1335     {"reflectedCustomURLAttr", TestObjInternal::reflectedCustomURLAttrAttrGetter, TestObjInternal::reflectedCustomURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1336     // Attribute 'reflectedCustomNonEmptyURLAttr' (Type: 'attribute' ExtAttr: 'URL NonEmpty Reflect')
1337     {"reflectedCustomNonEmptyURLAttr", TestObjInternal::reflectedCustomNonEmptyURLAttrAttrGetter, TestObjInternal::reflectedCustomNonEmptyURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1338     // Attribute 'attrWithGetterException' (Type: 'attribute' ExtAttr: '')
1339     {"attrWithGetterException", TestObjInternal::attrWithGetterExceptionAttrGetter, TestObjInternal::attrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1340     // Attribute 'attrWithSetterException' (Type: 'attribute' ExtAttr: '')
1341     {"attrWithSetterException", TestObjInternal::attrWithSetterExceptionAttrGetter, TestObjInternal::attrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1342     // Attribute 'stringAttrWithGetterException' (Type: 'attribute' ExtAttr: '')
1343     {"stringAttrWithGetterException", TestObjInternal::stringAttrWithGetterExceptionAttrGetter, TestObjInternal::stringAttrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1344     // Attribute 'stringAttrWithSetterException' (Type: 'attribute' ExtAttr: '')
1345     {"stringAttrWithSetterException", TestObjInternal::stringAttrWithSetterExceptionAttrGetter, TestObjInternal::stringAttrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1346     // Attribute 'customAttr' (Type: 'attribute' ExtAttr: 'Custom')
1347     {"customAttr", V8TestObj::customAttrAccessorGetter, V8TestObj::customAttrAccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1348     // Attribute 'scriptStringAttr' (Type: 'readonly attribute' ExtAttr: 'ConvertScriptString')
1349     {"scriptStringAttr", TestObjInternal::scriptStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1350 #if ENABLE(Condition1)
1351     // Attribute 'conditionalAttr1' (Type: 'attribute' ExtAttr: 'Conditional')
1352     {"conditionalAttr1", TestObjInternal::conditionalAttr1AttrGetter, TestObjInternal::conditionalAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1353 #endif // ENABLE(Condition1)
1354 #if ENABLE(Condition1) && ENABLE(Condition2)
1355     // Attribute 'conditionalAttr2' (Type: 'attribute' ExtAttr: 'Conditional')
1356     {"conditionalAttr2", TestObjInternal::conditionalAttr2AttrGetter, TestObjInternal::conditionalAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1357 #endif // ENABLE(Condition1) && ENABLE(Condition2)
1358 #if ENABLE(Condition1) || ENABLE(Condition2)
1359     // Attribute 'conditionalAttr3' (Type: 'attribute' ExtAttr: 'Conditional')
1360     {"conditionalAttr3", TestObjInternal::conditionalAttr3AttrGetter, TestObjInternal::conditionalAttr3AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1361 #endif // ENABLE(Condition1) || ENABLE(Condition2)
1362 #if ENABLE(Condition1)
1363     // Attribute 'conditionalAttr4' (Type: 'attribute' ExtAttr: 'Conditional')
1364     {"conditionalAttr4", TestObjInternal::TestObjConstructorGetter, 0, &V8TestObjectA::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */},
1365 #endif // ENABLE(Condition1)
1366 #if ENABLE(Condition1) && ENABLE(Condition2)
1367     // Attribute 'conditionalAttr5' (Type: 'attribute' ExtAttr: 'Conditional')
1368     {"conditionalAttr5", TestObjInternal::TestObjConstructorGetter, 0, &V8TestObjectB::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */},
1369 #endif // ENABLE(Condition1) && ENABLE(Condition2)
1370 #if ENABLE(Condition1) || ENABLE(Condition2)
1371     // Attribute 'conditionalAttr6' (Type: 'attribute' ExtAttr: 'Conditional')
1372     {"conditionalAttr6", TestObjInternal::TestObjConstructorGetter, 0, &V8TestObjectC::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */},
1373 #endif // ENABLE(Condition1) || ENABLE(Condition2)
1374     // Attribute 'cachedAttribute1' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute')
1375     {"cachedAttribute1", TestObjInternal::cachedAttribute1AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1376     // Attribute 'cachedAttribute2' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute')
1377     {"cachedAttribute2", TestObjInternal::cachedAttribute2AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1378     // Attribute 'description' (Type: 'readonly attribute' ExtAttr: '')
1379     {"description", TestObjInternal::descriptionAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1380     // Attribute 'id' (Type: 'attribute' ExtAttr: '')
1381     {"id", TestObjInternal::idAttrGetter, TestObjInternal::idAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1382     // Attribute 'hash' (Type: 'readonly attribute' ExtAttr: '')
1383     {"hash", TestObjInternal::hashAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1384 };
1385
1386 static const BatchedCallback TestObjCallbacks[] = {
1387     {"voidMethod", TestObjInternal::voidMethodCallback},
1388     {"intMethod", TestObjInternal::intMethodCallback},
1389     {"objMethod", TestObjInternal::objMethodCallback},
1390     {"serializedValue", TestObjInternal::serializedValueCallback},
1391     {"idbKey", TestObjInternal::idbKeyCallback},
1392     {"optionsObject", TestObjInternal::optionsObjectCallback},
1393     {"methodWithException", TestObjInternal::methodWithExceptionCallback},
1394     {"customMethod", V8TestObj::customMethodCallback},
1395     {"customMethodWithArgs", V8TestObj::customMethodWithArgsCallback},
1396     {"addEventListener", TestObjInternal::addEventListenerCallback},
1397     {"removeEventListener", TestObjInternal::removeEventListenerCallback},
1398     {"withDynamicFrame", TestObjInternal::withDynamicFrameCallback},
1399     {"withDynamicFrameAndArg", TestObjInternal::withDynamicFrameAndArgCallback},
1400     {"withDynamicFrameAndOptionalArg", TestObjInternal::withDynamicFrameAndOptionalArgCallback},
1401     {"withDynamicFrameAndUserGesture", TestObjInternal::withDynamicFrameAndUserGestureCallback},
1402     {"withDynamicFrameAndUserGestureASAD", TestObjInternal::withDynamicFrameAndUserGestureASADCallback},
1403     {"withScriptStateVoid", TestObjInternal::withScriptStateVoidCallback},
1404     {"withScriptStateObj", TestObjInternal::withScriptStateObjCallback},
1405     {"withScriptStateVoidException", TestObjInternal::withScriptStateVoidExceptionCallback},
1406     {"withScriptStateObjException", TestObjInternal::withScriptStateObjExceptionCallback},
1407     {"withScriptExecutionContext", TestObjInternal::withScriptExecutionContextCallback},
1408     {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback},
1409     {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback},
1410     {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback},
1411     {"methodWithCallbackArg", TestObjInternal::methodWithCallbackArgCallback},
1412     {"methodWithNonCallbackArgAndCallbackArg", TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback},
1413     {"methodWithCallbackAndOptionalArg", TestObjInternal::methodWithCallbackAndOptionalArgCallback},
1414 #if ENABLE(Condition1)
1415     {"conditionalMethod1", TestObjInternal::conditionalMethod1Callback},
1416 #endif
1417 #if ENABLE(Condition1) && ENABLE(Condition2)
1418     {"conditionalMethod2", TestObjInternal::conditionalMethod2Callback},
1419 #endif
1420 #if ENABLE(Condition1) || ENABLE(Condition2)
1421     {"conditionalMethod3", TestObjInternal::conditionalMethod3Callback},
1422 #endif
1423     {"overloadedMethod", TestObjInternal::overloadedMethodCallback},
1424 };
1425
1426 static const BatchedConstant TestObjConsts[] = {
1427     {"CONST_VALUE_0", static_cast<signed int>(0)},
1428     {"CONST_VALUE_1", static_cast<signed int>(1)},
1429     {"CONST_VALUE_2", static_cast<signed int>(2)},
1430     {"CONST_VALUE_4", static_cast<signed int>(4)},
1431     {"CONST_VALUE_8", static_cast<signed int>(8)},
1432     {"CONST_VALUE_9", static_cast<signed int>(-1)},
1433     {"CONST_VALUE_10", static_cast<signed int>("my constant string")},
1434     {"CONST_VALUE_11", static_cast<signed int>(0xffffffff)},
1435     {"CONST_VALUE_12", static_cast<signed int>(0x01)},
1436     {"CONST_VALUE_13", static_cast<signed int>(0X20)},
1437     {"CONST_VALUE_14", static_cast<signed int>(0x1abc)},
1438     {"CONST_JAVASCRIPT", static_cast<signed int>(15)},
1439 };
1440
1441
1442 COMPILE_ASSERT(0 == TestObj::CONST_VALUE_0, TestObjEnumCONST_VALUE_0IsWrongUseDontCheckEnums);
1443 COMPILE_ASSERT(1 == TestObj::CONST_VALUE_1, TestObjEnumCONST_VALUE_1IsWrongUseDontCheckEnums);
1444 COMPILE_ASSERT(2 == TestObj::CONST_VALUE_2, TestObjEnumCONST_VALUE_2IsWrongUseDontCheckEnums);
1445 COMPILE_ASSERT(4 == TestObj::CONST_VALUE_4, TestObjEnumCONST_VALUE_4IsWrongUseDontCheckEnums);
1446 COMPILE_ASSERT(8 == TestObj::CONST_VALUE_8, TestObjEnumCONST_VALUE_8IsWrongUseDontCheckEnums);
1447 COMPILE_ASSERT(-1 == TestObj::CONST_VALUE_9, TestObjEnumCONST_VALUE_9IsWrongUseDontCheckEnums);
1448 COMPILE_ASSERT("my constant string" == TestObj::CONST_VALUE_10, TestObjEnumCONST_VALUE_10IsWrongUseDontCheckEnums);
1449 COMPILE_ASSERT(0xffffffff == TestObj::CONST_VALUE_11, TestObjEnumCONST_VALUE_11IsWrongUseDontCheckEnums);
1450 COMPILE_ASSERT(0x01 == TestObj::CONST_VALUE_12, TestObjEnumCONST_VALUE_12IsWrongUseDontCheckEnums);
1451 COMPILE_ASSERT(0X20 == TestObj::CONST_VALUE_13, TestObjEnumCONST_VALUE_13IsWrongUseDontCheckEnums);
1452 COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWrongUseDontCheckEnums);
1453 COMPILE_ASSERT(15 == TestObj::CONST_IMPL, TestObjEnumCONST_IMPLIsWrongUseDontCheckEnums);
1454
1455 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persistent<v8::FunctionTemplate> desc)
1456 {
1457     desc->ReadOnlyPrototype();
1458
1459     v8::Local<v8::Signature> defaultSignature;
1460     defaultSignature = configureTemplate(desc, "TestObj", v8::Persistent<v8::FunctionTemplate>(), V8TestObj::internalFieldCount,
1461         TestObjAttrs, WTF_ARRAY_LENGTH(TestObjAttrs),
1462         TestObjCallbacks, WTF_ARRAY_LENGTH(TestObjCallbacks));
1463     UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
1464     v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
1465     v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
1466     UNUSED_PARAM(instance); // In some cases, it will not be used.
1467     UNUSED_PARAM(proto); // In some cases, it will not be used.
1468     
1469     if (RuntimeEnabledFeatures::enabledAtRuntimeAttr1Enabled()) {
1470         static const BatchedAttribute attrData =\
1471         // Attribute 'enabledAtRuntimeAttr1' (Type: 'attribute' ExtAttr: 'EnabledAtRuntime')
1472         {"enabledAtRuntimeAttr1", TestObjInternal::enabledAtRuntimeAttr1AttrGetter, TestObjInternal::enabledAtRuntimeAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1473         configureAttribute(instance, proto, attrData);
1474     }
1475     if (RuntimeEnabledFeatures::featureNameEnabled()) {
1476         static const BatchedAttribute attrData =\
1477         // Attribute 'enabledAtRuntimeAttr2' (Type: 'attribute' ExtAttr: 'EnabledAtRuntime')
1478         {"enabledAtRuntimeAttr2", TestObjInternal::enabledAtRuntimeAttr2AttrGetter, TestObjInternal::enabledAtRuntimeAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1479         configureAttribute(instance, proto, attrData);
1480     }
1481
1482     // Custom Signature 'voidMethodWithArgs'
1483     const int voidMethodWithArgsArgc = 3;
1484     v8::Handle<v8::FunctionTemplate> voidMethodWithArgsArgv[voidMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1485     v8::Handle<v8::Signature> voidMethodWithArgsSignature = v8::Signature::New(desc, voidMethodWithArgsArgc, voidMethodWithArgsArgv);
1486     proto->Set(v8::String::New("voidMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::voidMethodWithArgsCallback, v8::Handle<v8::Value>(), voidMethodWithArgsSignature));
1487
1488     // Custom Signature 'intMethodWithArgs'
1489     const int intMethodWithArgsArgc = 3;
1490     v8::Handle<v8::FunctionTemplate> intMethodWithArgsArgv[intMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1491     v8::Handle<v8::Signature> intMethodWithArgsSignature = v8::Signature::New(desc, intMethodWithArgsArgc, intMethodWithArgsArgv);
1492     proto->Set(v8::String::New("intMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::intMethodWithArgsCallback, v8::Handle<v8::Value>(), intMethodWithArgsSignature));
1493
1494     // Custom Signature 'objMethodWithArgs'
1495     const int objMethodWithArgsArgc = 3;
1496     v8::Handle<v8::FunctionTemplate> objMethodWithArgsArgv[objMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1497     v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(desc, objMethodWithArgsArgc, objMethodWithArgsArgv);
1498     proto->Set(v8::String::New("objMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::objMethodWithArgsCallback, v8::Handle<v8::Value>(), objMethodWithArgsSignature));
1499
1500     // Custom Signature 'methodThatRequiresAllArgs'
1501     const int methodThatRequiresAllArgsArgc = 2;
1502     v8::Handle<v8::FunctionTemplate> methodThatRequiresAllArgsArgv[methodThatRequiresAllArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1503     v8::Handle<v8::Signature> methodThatRequiresAllArgsSignature = v8::Signature::New(desc, methodThatRequiresAllArgsArgc, methodThatRequiresAllArgsArgv);
1504     proto->Set(v8::String::New("methodThatRequiresAllArgs"), v8::FunctionTemplate::New(TestObjInternal::methodThatRequiresAllArgsCallback, v8::Handle<v8::Value>(), methodThatRequiresAllArgsSignature));
1505
1506     // Custom Signature 'methodThatRequiresAllArgsAndThrows'
1507     const int methodThatRequiresAllArgsAndThrowsArgc = 2;
1508     v8::Handle<v8::FunctionTemplate> methodThatRequiresAllArgsAndThrowsArgv[methodThatRequiresAllArgsAndThrowsArgc] = { v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1509     v8::Handle<v8::Signature> methodThatRequiresAllArgsAndThrowsSignature = v8::Signature::New(desc, methodThatRequiresAllArgsAndThrowsArgc, methodThatRequiresAllArgsAndThrowsArgv);
1510     proto->Set(v8::String::New("methodThatRequiresAllArgsAndThrows"), v8::FunctionTemplate::New(TestObjInternal::methodThatRequiresAllArgsAndThrowsCallback, v8::Handle<v8::Value>(), methodThatRequiresAllArgsAndThrowsSignature));
1511
1512     // Custom Signature 'customArgsAndException'
1513     const int customArgsAndExceptionArgc = 1;
1514     v8::Handle<v8::FunctionTemplate> customArgsAndExceptionArgv[customArgsAndExceptionArgc] = { V8log::GetRawTemplate() };
1515     v8::Handle<v8::Signature> customArgsAndExceptionSignature = v8::Signature::New(desc, customArgsAndExceptionArgc, customArgsAndExceptionArgv);
1516     proto->Set(v8::String::New("customArgsAndException"), v8::FunctionTemplate::New(TestObjInternal::customArgsAndExceptionCallback, v8::Handle<v8::Value>(), customArgsAndExceptionSignature));
1517     desc->Set(v8::String::New("classMethod"), v8::FunctionTemplate::New(TestObjInternal::classMethodCallback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
1518     desc->Set(v8::String::New("classMethodWithOptional"), v8::FunctionTemplate::New(TestObjInternal::classMethodWithOptionalCallback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
1519     if (RuntimeEnabledFeatures::enabledAtRuntimeMethod1Enabled())
1520         proto->Set(v8::String::New("enabledAtRuntimeMethod1"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod1Callback, v8::Handle<v8::Value>(), defaultSignature));
1521     if (RuntimeEnabledFeatures::featureNameEnabled())
1522         proto->Set(v8::String::New("enabledAtRuntimeMethod2"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod2Callback, v8::Handle<v8::Value>(), defaultSignature));
1523     batchConfigureConstants(desc, proto, TestObjConsts, WTF_ARRAY_LENGTH(TestObjConsts));
1524
1525     // Custom toString template
1526     desc->Set(getToStringName(), getToStringTemplate());
1527     return desc;
1528 }
1529
1530 v8::Persistent<v8::FunctionTemplate> V8TestObj::GetRawTemplate()
1531 {
1532     V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
1533     V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info);
1534     if (result != data->rawTemplateMap().end())
1535         return result->second;
1536
1537     v8::HandleScope handleScope;
1538     v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
1539     data->rawTemplateMap().add(&info, templ);
1540     return templ;
1541 }
1542
1543 v8::Persistent<v8::FunctionTemplate> V8TestObj::GetTemplate()
1544 {
1545     V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
1546     V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info);
1547     if (result != data->templateMap().end())
1548         return result->second;
1549
1550     v8::HandleScope handleScope;
1551     v8::Persistent<v8::FunctionTemplate> templ =
1552         ConfigureV8TestObjTemplate(GetRawTemplate());
1553     data->templateMap().add(&info, templ);
1554     return templ;
1555 }
1556
1557 bool V8TestObj::HasInstance(v8::Handle<v8::Value> value)
1558 {
1559     return GetRawTemplate()->HasInstance(value);
1560 }
1561
1562
1563 v8::Handle<v8::Object> V8TestObj::wrapSlow(TestObj* impl)
1564 {
1565     v8::Handle<v8::Object> wrapper;
1566     V8Proxy* proxy = 0;
1567     wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
1568     if (wrapper.IsEmpty())
1569         return wrapper;
1570
1571     impl->ref();
1572     v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
1573
1574     if (!hasDependentLifetime)
1575         wrapperHandle.MarkIndependent();
1576     getDOMObjectMap().set(impl, wrapperHandle);
1577     return wrapper;
1578 }
1579
1580 void V8TestObj::derefObject(void* object)
1581 {
1582     static_cast<TestObj*>(object)->deref();
1583 }
1584
1585 } // namespace WebCore