NeedsUserGestureCheck IDL attribute is no longer used
[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 "SerializedScriptValue.h"
34 #include "V8Binding.h"
35 #include "V8BindingMacros.h"
36 #include "V8BindingState.h"
37 #include "V8DOMWrapper.h"
38 #include "V8IsolatedContext.h"
39 #include "V8Proxy.h"
40 #include "V8TestCallback.h"
41 #include "V8any.h"
42 #include "V8int.h"
43 #include "V8log.h"
44 #include <wtf/GetPtr.h>
45 #include <wtf/RefCounted.h>
46 #include <wtf/RefPtr.h>
47 #include <wtf/UnusedParam.h>
48 #include <wtf/Vector.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> floatArrayAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
646 {
647     INC_STATS("DOM.TestObj.floatArray._get");
648     TestObj* imp = V8TestObj::toNative(info.Holder());
649     return v8NumberArray(imp->floatArray());
650 }
651
652 static void floatArrayAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
653 {
654     INC_STATS("DOM.TestObj.floatArray._set");
655     TestObj* imp = V8TestObj::toNative(info.Holder());
656     Vector<float> v = v8NumberArrayToVector<float>(value);
657     imp->setFloatArray(v);
658     return;
659 }
660
661 static v8::Handle<v8::Value> doubleArrayAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
662 {
663     INC_STATS("DOM.TestObj.doubleArray._get");
664     TestObj* imp = V8TestObj::toNative(info.Holder());
665     return v8NumberArray(imp->doubleArray());
666 }
667
668 static void doubleArrayAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
669 {
670     INC_STATS("DOM.TestObj.doubleArray._set");
671     TestObj* imp = V8TestObj::toNative(info.Holder());
672     Vector<double> v = v8NumberArrayToVector<double>(value);
673     imp->setDoubleArray(v);
674     return;
675 }
676
677 static v8::Handle<v8::Value> descriptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
678 {
679     INC_STATS("DOM.TestObj.description._get");
680     TestObj* imp = V8TestObj::toNative(info.Holder());
681     return v8::Integer::New(imp->description());
682 }
683
684 static v8::Handle<v8::Value> idAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
685 {
686     INC_STATS("DOM.TestObj.id._get");
687     TestObj* imp = V8TestObj::toNative(info.Holder());
688     return v8::Integer::New(imp->id());
689 }
690
691 static void idAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
692 {
693     INC_STATS("DOM.TestObj.id._set");
694     TestObj* imp = V8TestObj::toNative(info.Holder());
695     int v = toInt32(value);
696     imp->setId(v);
697     return;
698 }
699
700 static v8::Handle<v8::Value> hashAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
701 {
702     INC_STATS("DOM.TestObj.hash._get");
703     TestObj* imp = V8TestObj::toNative(info.Holder());
704     return v8String(imp->hash());
705 }
706
707 static v8::Handle<v8::Value> TestObjConstructorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
708 {
709     INC_STATS("DOM.TestObj.constructors._get");
710     v8::Handle<v8::Value> data = info.Data();
711     ASSERT(data->IsExternal() || data->IsNumber());
712     WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data);
713     return v8::Handle<v8::Value>();}
714
715 static v8::Handle<v8::Value> voidMethodCallback(const v8::Arguments& args)
716 {
717     INC_STATS("DOM.TestObj.voidMethod");
718     TestObj* imp = V8TestObj::toNative(args.Holder());
719     imp->voidMethod();
720     return v8::Handle<v8::Value>();
721 }
722
723 static v8::Handle<v8::Value> voidMethodWithArgsCallback(const v8::Arguments& args)
724 {
725     INC_STATS("DOM.TestObj.voidMethodWithArgs");
726     if (args.Length() < 3)
727         return throwError("Not enough arguments", V8Proxy::TypeError);
728     TestObj* imp = V8TestObj::toNative(args.Holder());
729     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
730     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined));
731     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);
732     imp->voidMethodWithArgs(intArg, strArg, objArg);
733     return v8::Handle<v8::Value>();
734 }
735
736 static v8::Handle<v8::Value> intMethodCallback(const v8::Arguments& args)
737 {
738     INC_STATS("DOM.TestObj.intMethod");
739     TestObj* imp = V8TestObj::toNative(args.Holder());
740     return v8::Integer::New(imp->intMethod());
741 }
742
743 static v8::Handle<v8::Value> intMethodWithArgsCallback(const v8::Arguments& args)
744 {
745     INC_STATS("DOM.TestObj.intMethodWithArgs");
746     if (args.Length() < 3)
747         return throwError("Not enough arguments", V8Proxy::TypeError);
748     TestObj* imp = V8TestObj::toNative(args.Holder());
749     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
750     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined));
751     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);
752     return v8::Integer::New(imp->intMethodWithArgs(intArg, strArg, objArg));
753 }
754
755 static v8::Handle<v8::Value> objMethodCallback(const v8::Arguments& args)
756 {
757     INC_STATS("DOM.TestObj.objMethod");
758     TestObj* imp = V8TestObj::toNative(args.Holder());
759     return toV8(imp->objMethod());
760 }
761
762 static v8::Handle<v8::Value> objMethodWithArgsCallback(const v8::Arguments& args)
763 {
764     INC_STATS("DOM.TestObj.objMethodWithArgs");
765     if (args.Length() < 3)
766         return throwError("Not enough arguments", V8Proxy::TypeError);
767     TestObj* imp = V8TestObj::toNative(args.Holder());
768     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
769     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined));
770     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);
771     return toV8(imp->objMethodWithArgs(intArg, strArg, objArg));
772 }
773
774 static v8::Handle<v8::Value> methodThatRequiresAllArgsAndThrowsCallback(const v8::Arguments& args)
775 {
776     INC_STATS("DOM.TestObj.methodThatRequiresAllArgsAndThrows");
777     if (args.Length() < 2)
778         return throwError("Not enough arguments", V8Proxy::TypeError);
779     TestObj* imp = V8TestObj::toNative(args.Holder());
780     ExceptionCode ec = 0;
781     {
782     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined));
783     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);
784     RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec);
785     if (UNLIKELY(ec))
786         goto fail;
787     return toV8(result.release());
788     }
789     fail:
790     V8Proxy::setDOMException(ec);
791     return v8::Handle<v8::Value>();
792 }
793
794 static v8::Handle<v8::Value> serializedValueCallback(const v8::Arguments& args)
795 {
796     INC_STATS("DOM.TestObj.serializedValue");
797     if (args.Length() < 1)
798         return throwError("Not enough arguments", V8Proxy::TypeError);
799     TestObj* imp = V8TestObj::toNative(args.Holder());
800     bool serializedArgDidThrow = false;
801     RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(args[0], 0, 0, serializedArgDidThrow);
802     if (serializedArgDidThrow)
803         return v8::Undefined();
804     imp->serializedValue(serializedArg);
805     return v8::Handle<v8::Value>();
806 }
807
808 static v8::Handle<v8::Value> idbKeyCallback(const v8::Arguments& args)
809 {
810     INC_STATS("DOM.TestObj.idbKey");
811     if (args.Length() < 1)
812         return throwError("Not enough arguments", V8Proxy::TypeError);
813     TestObj* imp = V8TestObj::toNative(args.Holder());
814     EXCEPTION_BLOCK(RefPtr<IDBKey>, key, createIDBKeyFromValue(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
815     imp->idbKey(key);
816     return v8::Handle<v8::Value>();
817 }
818
819 static v8::Handle<v8::Value> optionsObjectCallback(const v8::Arguments& args)
820 {
821     INC_STATS("DOM.TestObj.optionsObject");
822     if (args.Length() < 1)
823         return throwError("Not enough arguments", V8Proxy::TypeError);
824     TestObj* imp = V8TestObj::toNative(args.Holder());
825     EXCEPTION_BLOCK(OptionsObject, oo, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined));
826     if (args.Length() <= 1) {
827         imp->optionsObject(oo);
828         return v8::Handle<v8::Value>();
829     }
830     EXCEPTION_BLOCK(OptionsObject, ooo, MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined));
831     imp->optionsObject(oo, ooo);
832     return v8::Handle<v8::Value>();
833 }
834
835 static v8::Handle<v8::Value> methodWithExceptionCallback(const v8::Arguments& args)
836 {
837     INC_STATS("DOM.TestObj.methodWithException");
838     TestObj* imp = V8TestObj::toNative(args.Holder());
839     ExceptionCode ec = 0;
840     {
841     imp->methodWithException(ec);
842     if (UNLIKELY(ec))
843         goto fail;
844     return v8::Handle<v8::Value>();
845     }
846     fail:
847     V8Proxy::setDOMException(ec);
848     return v8::Handle<v8::Value>();
849 }
850
851 static v8::Handle<v8::Value> customArgsAndExceptionCallback(const v8::Arguments& args)
852 {
853     INC_STATS("DOM.TestObj.customArgsAndException");
854     if (args.Length() < 1)
855         return throwError("Not enough arguments", V8Proxy::TypeError);
856     TestObj* imp = V8TestObj::toNative(args.Holder());
857     ExceptionCode ec = 0;
858     {
859     RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1));
860     RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector());
861     if (!callStack)
862         return v8::Undefined();
863     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);
864     imp->customArgsAndException(intArg, scriptArguments, callStack, ec);
865     if (UNLIKELY(ec))
866         goto fail;
867     return v8::Handle<v8::Value>();
868     }
869     fail:
870     V8Proxy::setDOMException(ec);
871     return v8::Handle<v8::Value>();
872 }
873
874 static v8::Handle<v8::Value> addEventListenerCallback(const v8::Arguments& args)
875 {
876     INC_STATS("DOM.TestObj.addEventListener()");
877     RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOrCreate);
878     if (listener) {
879         V8TestObj::toNative(args.Holder())->addEventListener(v8ValueToAtomicWebCoreString(args[0]), listener, args[2]->BooleanValue());
880         createHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex);
881     }
882     return v8::Undefined();
883 }
884
885 static v8::Handle<v8::Value> removeEventListenerCallback(const v8::Arguments& args)
886 {
887     INC_STATS("DOM.TestObj.removeEventListener()");
888     RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOnly);
889     if (listener) {
890         V8TestObj::toNative(args.Holder())->removeEventListener(v8ValueToAtomicWebCoreString(args[0]), listener.get(), args[2]->BooleanValue());
891         removeHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex);
892     }
893     return v8::Undefined();
894 }
895
896 static v8::Handle<v8::Value> withDynamicFrameCallback(const v8::Arguments& args)
897 {
898     INC_STATS("DOM.TestObj.withDynamicFrame");
899     TestObj* imp = V8TestObj::toNative(args.Holder());
900     Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
901     if (!enteredFrame)
902         return v8::Undefined();
903     imp->withDynamicFrame(enteredFrame);
904     return v8::Handle<v8::Value>();
905 }
906
907 static v8::Handle<v8::Value> withDynamicFrameAndArgCallback(const v8::Arguments& args)
908 {
909     INC_STATS("DOM.TestObj.withDynamicFrameAndArg");
910     if (args.Length() < 1)
911         return throwError("Not enough arguments", V8Proxy::TypeError);
912     TestObj* imp = V8TestObj::toNative(args.Holder());
913     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
914     Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
915     if (!enteredFrame)
916         return v8::Undefined();
917     imp->withDynamicFrameAndArg(enteredFrame, intArg);
918     return v8::Handle<v8::Value>();
919 }
920
921 static v8::Handle<v8::Value> withDynamicFrameAndOptionalArgCallback(const v8::Arguments& args)
922 {
923     INC_STATS("DOM.TestObj.withDynamicFrameAndOptionalArg");
924     if (args.Length() < 1)
925         return throwError("Not enough arguments", V8Proxy::TypeError);
926     TestObj* imp = V8TestObj::toNative(args.Holder());
927     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
928     if (args.Length() <= 1) {
929         Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
930         if (!enteredFrame)
931             return v8::Undefined();
932         imp->withDynamicFrameAndOptionalArg(enteredFrame, intArg);
933         return v8::Handle<v8::Value>();
934     }
935     EXCEPTION_BLOCK(int, optionalArg, toInt32(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)));
936     Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
937     if (!enteredFrame)
938         return v8::Undefined();
939     imp->withDynamicFrameAndOptionalArg(enteredFrame, intArg, optionalArg);
940     return v8::Handle<v8::Value>();
941 }
942
943 static v8::Handle<v8::Value> withScriptStateVoidCallback(const v8::Arguments& args)
944 {
945     INC_STATS("DOM.TestObj.withScriptStateVoid");
946     TestObj* imp = V8TestObj::toNative(args.Holder());
947     EmptyScriptState state;
948     imp->withScriptStateVoid(&state);
949     if (state.hadException())
950         return throwError(state.exception());
951     return v8::Handle<v8::Value>();
952 }
953
954 static v8::Handle<v8::Value> withScriptStateObjCallback(const v8::Arguments& args)
955 {
956     INC_STATS("DOM.TestObj.withScriptStateObj");
957     TestObj* imp = V8TestObj::toNative(args.Holder());
958     EmptyScriptState state;
959     RefPtr<TestObj> result = imp->withScriptStateObj(&state);
960     if (state.hadException())
961         return throwError(state.exception());
962     return toV8(result.release());
963 }
964
965 static v8::Handle<v8::Value> withScriptStateVoidExceptionCallback(const v8::Arguments& args)
966 {
967     INC_STATS("DOM.TestObj.withScriptStateVoidException");
968     TestObj* imp = V8TestObj::toNative(args.Holder());
969     ExceptionCode ec = 0;
970     {
971     EmptyScriptState state;
972     imp->withScriptStateVoidException(&state, ec);
973     if (UNLIKELY(ec))
974         goto fail;
975     if (state.hadException())
976         return throwError(state.exception());
977     return v8::Handle<v8::Value>();
978     }
979     fail:
980     V8Proxy::setDOMException(ec);
981     return v8::Handle<v8::Value>();
982 }
983
984 static v8::Handle<v8::Value> withScriptStateObjExceptionCallback(const v8::Arguments& args)
985 {
986     INC_STATS("DOM.TestObj.withScriptStateObjException");
987     TestObj* imp = V8TestObj::toNative(args.Holder());
988     ExceptionCode ec = 0;
989     {
990     EmptyScriptState state;
991     RefPtr<TestObj> result = imp->withScriptStateObjException(&state, ec);
992     if (UNLIKELY(ec))
993         goto fail;
994     if (state.hadException())
995         return throwError(state.exception());
996     return toV8(result.release());
997     }
998     fail:
999     V8Proxy::setDOMException(ec);
1000     return v8::Handle<v8::Value>();
1001 }
1002
1003 static v8::Handle<v8::Value> withScriptExecutionContextCallback(const v8::Arguments& args)
1004 {
1005     INC_STATS("DOM.TestObj.withScriptExecutionContext");
1006     TestObj* imp = V8TestObj::toNative(args.Holder());
1007     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
1008     if (!scriptContext)
1009         return v8::Undefined();
1010     imp->withScriptExecutionContext(scriptContext);
1011     return v8::Handle<v8::Value>();
1012 }
1013
1014 static v8::Handle<v8::Value> methodWithOptionalArgCallback(const v8::Arguments& args)
1015 {
1016     INC_STATS("DOM.TestObj.methodWithOptionalArg");
1017     TestObj* imp = V8TestObj::toNative(args.Holder());
1018     if (args.Length() <= 0) {
1019         imp->methodWithOptionalArg();
1020         return v8::Handle<v8::Value>();
1021     }
1022     EXCEPTION_BLOCK(int, opt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1023     imp->methodWithOptionalArg(opt);
1024     return v8::Handle<v8::Value>();
1025 }
1026
1027 static v8::Handle<v8::Value> methodWithNonOptionalArgAndOptionalArgCallback(const v8::Arguments& args)
1028 {
1029     INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndOptionalArg");
1030     if (args.Length() < 1)
1031         return throwError("Not enough arguments", V8Proxy::TypeError);
1032     TestObj* imp = V8TestObj::toNative(args.Holder());
1033     EXCEPTION_BLOCK(int, nonOpt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1034     if (args.Length() <= 1) {
1035         imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
1036         return v8::Handle<v8::Value>();
1037     }
1038     EXCEPTION_BLOCK(int, opt, toInt32(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)));
1039     imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
1040     return v8::Handle<v8::Value>();
1041 }
1042
1043 static v8::Handle<v8::Value> methodWithNonOptionalArgAndTwoOptionalArgsCallback(const v8::Arguments& args)
1044 {
1045     INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndTwoOptionalArgs");
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->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
1052         return v8::Handle<v8::Value>();
1053     }
1054     EXCEPTION_BLOCK(int, opt1, toInt32(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)));
1055     if (args.Length() <= 2) {
1056         imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1);
1057         return v8::Handle<v8::Value>();
1058     }
1059     EXCEPTION_BLOCK(int, opt2, toInt32(MAYBE_MISSING_PARAMETER(args, 2, MissingIsUndefined)));
1060     imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
1061     return v8::Handle<v8::Value>();
1062 }
1063
1064 static v8::Handle<v8::Value> methodWithCallbackArgCallback(const v8::Arguments& args)
1065 {
1066     INC_STATS("DOM.TestObj.methodWithCallbackArg");
1067     if (args.Length() < 1)
1068         return throwError("Not enough arguments", V8Proxy::TypeError);
1069     TestObj* imp = V8TestObj::toNative(args.Holder());
1070     if (args.Length() <= 0 || !args[0]->IsObject())
1071         return throwError(TYPE_MISMATCH_ERR);
1072     RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1073     imp->methodWithCallbackArg(callback);
1074     return v8::Handle<v8::Value>();
1075 }
1076
1077 static v8::Handle<v8::Value> methodWithNonCallbackArgAndCallbackArgCallback(const v8::Arguments& args)
1078 {
1079     INC_STATS("DOM.TestObj.methodWithNonCallbackArgAndCallbackArg");
1080     if (args.Length() < 2)
1081         return throwError("Not enough arguments", V8Proxy::TypeError);
1082     TestObj* imp = V8TestObj::toNative(args.Holder());
1083     EXCEPTION_BLOCK(int, nonCallback, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1084     if (args.Length() <= 1 || !args[1]->IsObject())
1085         return throwError(TYPE_MISMATCH_ERR);
1086     RefPtr<TestCallback> callback = V8TestCallback::create(args[1], getScriptExecutionContext());
1087     imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
1088     return v8::Handle<v8::Value>();
1089 }
1090
1091 static v8::Handle<v8::Value> methodWithCallbackAndOptionalArgCallback(const v8::Arguments& args)
1092 {
1093     INC_STATS("DOM.TestObj.methodWithCallbackAndOptionalArg");
1094     TestObj* imp = V8TestObj::toNative(args.Holder());
1095     RefPtr<TestCallback> callback;
1096     if (args.Length() > 0 && !args[0]->IsNull() && !args[0]->IsUndefined()) {
1097         if (!args[0]->IsObject())
1098             return throwError(TYPE_MISMATCH_ERR);
1099         callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1100     }
1101     imp->methodWithCallbackAndOptionalArg(callback);
1102     return v8::Handle<v8::Value>();
1103 }
1104
1105 #if ENABLE(Condition1)
1106
1107 static v8::Handle<v8::Value> conditionalMethod1Callback(const v8::Arguments& args)
1108 {
1109     INC_STATS("DOM.TestObj.conditionalMethod1");
1110     TestObj* imp = V8TestObj::toNative(args.Holder());
1111     return v8String(imp->conditionalMethod1());
1112 }
1113
1114 #endif // ENABLE(Condition1)
1115
1116 #if ENABLE(Condition1) && ENABLE(Condition2)
1117
1118 static v8::Handle<v8::Value> conditionalMethod2Callback(const v8::Arguments& args)
1119 {
1120     INC_STATS("DOM.TestObj.conditionalMethod2");
1121     TestObj* imp = V8TestObj::toNative(args.Holder());
1122     imp->conditionalMethod2();
1123     return v8::Handle<v8::Value>();
1124 }
1125
1126 #endif // ENABLE(Condition1) && ENABLE(Condition2)
1127
1128 #if ENABLE(Condition1) || ENABLE(Condition2)
1129
1130 static v8::Handle<v8::Value> conditionalMethod3Callback(const v8::Arguments& args)
1131 {
1132     INC_STATS("DOM.TestObj.conditionalMethod3");
1133     TestObj* imp = V8TestObj::toNative(args.Holder());
1134     imp->conditionalMethod3();
1135     return v8::Handle<v8::Value>();
1136 }
1137
1138 #endif // ENABLE(Condition1) || ENABLE(Condition2)
1139
1140 static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args)
1141 {
1142     INC_STATS("DOM.TestObj.overloadedMethod1");
1143     if (args.Length() < 2)
1144         return throwError("Not enough arguments", V8Proxy::TypeError);
1145     TestObj* imp = V8TestObj::toNative(args.Holder());
1146     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);
1147     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined));
1148     imp->overloadedMethod(objArg, strArg);
1149     return v8::Handle<v8::Value>();
1150 }
1151
1152 static v8::Handle<v8::Value> overloadedMethod2Callback(const v8::Arguments& args)
1153 {
1154     INC_STATS("DOM.TestObj.overloadedMethod2");
1155     if (args.Length() < 1)
1156         return throwError("Not enough arguments", V8Proxy::TypeError);
1157     TestObj* imp = V8TestObj::toNative(args.Holder());
1158     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);
1159     if (args.Length() <= 1) {
1160         imp->overloadedMethod(objArg);
1161         return v8::Handle<v8::Value>();
1162     }
1163     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)));
1164     imp->overloadedMethod(objArg, intArg);
1165     return v8::Handle<v8::Value>();
1166 }
1167
1168 static v8::Handle<v8::Value> overloadedMethod3Callback(const v8::Arguments& args)
1169 {
1170     INC_STATS("DOM.TestObj.overloadedMethod3");
1171     if (args.Length() < 1)
1172         return throwError("Not enough arguments", V8Proxy::TypeError);
1173     TestObj* imp = V8TestObj::toNative(args.Holder());
1174     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined));
1175     imp->overloadedMethod(strArg);
1176     return v8::Handle<v8::Value>();
1177 }
1178
1179 static v8::Handle<v8::Value> overloadedMethod4Callback(const v8::Arguments& args)
1180 {
1181     INC_STATS("DOM.TestObj.overloadedMethod4");
1182     if (args.Length() < 1)
1183         return throwError("Not enough arguments", V8Proxy::TypeError);
1184     TestObj* imp = V8TestObj::toNative(args.Holder());
1185     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1186     imp->overloadedMethod(intArg);
1187     return v8::Handle<v8::Value>();
1188 }
1189
1190 static v8::Handle<v8::Value> overloadedMethod5Callback(const v8::Arguments& args)
1191 {
1192     INC_STATS("DOM.TestObj.overloadedMethod5");
1193     if (args.Length() < 1)
1194         return throwError("Not enough arguments", V8Proxy::TypeError);
1195     TestObj* imp = V8TestObj::toNative(args.Holder());
1196     if (args.Length() <= 0 || !args[0]->IsObject())
1197         return throwError(TYPE_MISMATCH_ERR);
1198     RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1199     imp->overloadedMethod(callback);
1200     return v8::Handle<v8::Value>();
1201 }
1202
1203 static v8::Handle<v8::Value> overloadedMethod6Callback(const v8::Arguments& args)
1204 {
1205     INC_STATS("DOM.TestObj.overloadedMethod6");
1206     if (args.Length() < 1)
1207         return throwError("Not enough arguments", V8Proxy::TypeError);
1208     TestObj* imp = V8TestObj::toNative(args.Holder());
1209     EXCEPTION_BLOCK(RefPtr<DOMStringList>, listArg, v8ValueToWebCoreDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1210     imp->overloadedMethod(listArg);
1211     return v8::Handle<v8::Value>();
1212 }
1213
1214 static v8::Handle<v8::Value> overloadedMethod7Callback(const v8::Arguments& args)
1215 {
1216     INC_STATS("DOM.TestObj.overloadedMethod7");
1217     if (args.Length() < 1)
1218         return throwError("Not enough arguments", V8Proxy::TypeError);
1219     TestObj* imp = V8TestObj::toNative(args.Holder());
1220     EXCEPTION_BLOCK(RefPtr<DOMStringList>, arrayArg, v8ValueToWebCoreDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1221     imp->overloadedMethod(arrayArg);
1222     return v8::Handle<v8::Value>();
1223 }
1224
1225 static v8::Handle<v8::Value> overloadedMethodCallback(const v8::Arguments& args)
1226 {
1227     INC_STATS("DOM.TestObj.overloadedMethod");
1228     if ((args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0])) && (args[1]->IsNull() || args[1]->IsUndefined() || args[1]->IsString() || args[1]->IsObject())))
1229         return overloadedMethod1Callback(args);
1230     if ((args.Length() == 1 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0]))) || (args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0]))))
1231         return overloadedMethod2Callback(args);
1232     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject())))
1233         return overloadedMethod3Callback(args);
1234     if (args.Length() == 1)
1235         return overloadedMethod4Callback(args);
1236     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsObject())))
1237         return overloadedMethod5Callback(args);
1238     if ((args.Length() == 1 && (args[0]->IsNull() || V8DOMStringList::HasInstance(args[0]))))
1239         return overloadedMethod6Callback(args);
1240     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsArray())))
1241         return overloadedMethod7Callback(args);
1242     V8Proxy::throwTypeError();
1243     return notHandledByInterceptor();
1244 }
1245
1246 static v8::Handle<v8::Value> classMethodCallback(const v8::Arguments& args)
1247 {
1248     INC_STATS("DOM.TestObj.classMethod");
1249     TestObj::classMethod();
1250     return v8::Handle<v8::Value>();
1251 }
1252
1253 static v8::Handle<v8::Value> classMethodWithOptionalCallback(const v8::Arguments& args)
1254 {
1255     INC_STATS("DOM.TestObj.classMethodWithOptional");
1256     if (args.Length() <= 0) {
1257         return v8::Integer::New(TestObj::classMethodWithOptional());
1258     }
1259     EXCEPTION_BLOCK(int, arg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1260     return v8::Integer::New(TestObj::classMethodWithOptional(arg));
1261 }
1262
1263 #if ENABLE(Condition1)
1264
1265 static v8::Handle<v8::Value> overloadedMethod11Callback(const v8::Arguments& args)
1266 {
1267     INC_STATS("DOM.TestObj.overloadedMethod11");
1268     if (args.Length() < 1)
1269         return throwError("Not enough arguments", V8Proxy::TypeError);
1270     EXCEPTION_BLOCK(int, arg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1271     TestObj::overloadedMethod1(arg);
1272     return v8::Handle<v8::Value>();
1273 }
1274
1275 #endif // ENABLE(Condition1)
1276
1277 #if ENABLE(Condition1)
1278
1279 static v8::Handle<v8::Value> overloadedMethod12Callback(const v8::Arguments& args)
1280 {
1281     INC_STATS("DOM.TestObj.overloadedMethod12");
1282     if (args.Length() < 1)
1283         return throwError("Not enough arguments", V8Proxy::TypeError);
1284     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, type, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined));
1285     TestObj::overloadedMethod1(type);
1286     return v8::Handle<v8::Value>();
1287 }
1288
1289 #endif // ENABLE(Condition1)
1290
1291 #if ENABLE(Condition1)
1292
1293 static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args)
1294 {
1295     INC_STATS("DOM.TestObj.overloadedMethod1");
1296     if (args.Length() == 1)
1297         return overloadedMethod11Callback(args);
1298     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject())))
1299         return overloadedMethod12Callback(args);
1300     V8Proxy::throwTypeError();
1301     return notHandledByInterceptor();
1302 }
1303
1304 #endif // ENABLE(Condition1)
1305
1306 static v8::Handle<v8::Value> enabledAtRuntimeMethod1Callback(const v8::Arguments& args)
1307 {
1308     INC_STATS("DOM.TestObj.enabledAtRuntimeMethod1");
1309     if (args.Length() < 1)
1310         return throwError("Not enough arguments", V8Proxy::TypeError);
1311     TestObj* imp = V8TestObj::toNative(args.Holder());
1312     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);
1313     imp->enabledAtRuntimeMethod1(intArg);
1314     return v8::Handle<v8::Value>();
1315 }
1316
1317 static v8::Handle<v8::Value> enabledAtRuntimeMethod2Callback(const v8::Arguments& args)
1318 {
1319     INC_STATS("DOM.TestObj.enabledAtRuntimeMethod2");
1320     if (args.Length() < 1)
1321         return throwError("Not enough arguments", V8Proxy::TypeError);
1322     TestObj* imp = V8TestObj::toNative(args.Holder());
1323     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);
1324     imp->enabledAtRuntimeMethod2(intArg);
1325     return v8::Handle<v8::Value>();
1326 }
1327
1328 } // namespace TestObjInternal
1329
1330 static const BatchedAttribute TestObjAttrs[] = {
1331     // Attribute 'readOnlyIntAttr' (Type: 'readonly attribute' ExtAttr: '')
1332     {"readOnlyIntAttr", TestObjInternal::readOnlyIntAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1333     // Attribute 'readOnlyStringAttr' (Type: 'readonly attribute' ExtAttr: '')
1334     {"readOnlyStringAttr", TestObjInternal::readOnlyStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1335     // Attribute 'readOnlyTestObjAttr' (Type: 'readonly attribute' ExtAttr: '')
1336     {"readOnlyTestObjAttr", TestObjInternal::readOnlyTestObjAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1337     // Attribute 'shortAttr' (Type: 'attribute' ExtAttr: '')
1338     {"shortAttr", TestObjInternal::shortAttrAttrGetter, TestObjInternal::shortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1339     // Attribute 'unsignedShortAttr' (Type: 'attribute' ExtAttr: '')
1340     {"unsignedShortAttr", TestObjInternal::unsignedShortAttrAttrGetter, TestObjInternal::unsignedShortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1341     // Attribute 'intAttr' (Type: 'attribute' ExtAttr: '')
1342     {"intAttr", TestObjInternal::intAttrAttrGetter, TestObjInternal::intAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1343     // Attribute 'longLongAttr' (Type: 'attribute' ExtAttr: '')
1344     {"longLongAttr", TestObjInternal::longLongAttrAttrGetter, TestObjInternal::longLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1345     // Attribute 'unsignedLongLongAttr' (Type: 'attribute' ExtAttr: '')
1346     {"unsignedLongLongAttr", TestObjInternal::unsignedLongLongAttrAttrGetter, TestObjInternal::unsignedLongLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1347     // Attribute 'stringAttr' (Type: 'attribute' ExtAttr: '')
1348     {"stringAttr", TestObjInternal::stringAttrAttrGetter, TestObjInternal::stringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1349     // Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: '')
1350     {"testObjAttr", TestObjInternal::testObjAttrAttrGetter, TestObjInternal::testObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1351     // Attribute 'XMLObjAttr' (Type: 'attribute' ExtAttr: '')
1352     {"XMLObjAttr", TestObjInternal::XMLObjAttrAttrGetter, TestObjInternal::XMLObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1353     // Attribute 'create' (Type: 'attribute' ExtAttr: '')
1354     {"create", TestObjInternal::createAttrGetter, TestObjInternal::createAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1355     // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1356     {"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1357     // Attribute 'reflectedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1358     {"reflectedIntegralAttr", TestObjInternal::reflectedIntegralAttrAttrGetter, TestObjInternal::reflectedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1359     // Attribute 'reflectedUnsignedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1360     {"reflectedUnsignedIntegralAttr", TestObjInternal::reflectedUnsignedIntegralAttrAttrGetter, TestObjInternal::reflectedUnsignedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1361     // Attribute 'reflectedBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1362     {"reflectedBooleanAttr", TestObjInternal::reflectedBooleanAttrAttrGetter, TestObjInternal::reflectedBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1363     // Attribute 'reflectedURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect')
1364     {"reflectedURLAttr", TestObjInternal::reflectedURLAttrAttrGetter, TestObjInternal::reflectedURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1365     // Attribute 'reflectedNonEmptyURLAttr' (Type: 'attribute' ExtAttr: 'URL NonEmpty Reflect')
1366     {"reflectedNonEmptyURLAttr", TestObjInternal::reflectedNonEmptyURLAttrAttrGetter, TestObjInternal::reflectedNonEmptyURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1367     // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1368     {"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1369     // Attribute 'reflectedCustomIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1370     {"reflectedCustomIntegralAttr", TestObjInternal::reflectedCustomIntegralAttrAttrGetter, TestObjInternal::reflectedCustomIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1371     // Attribute 'reflectedCustomBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1372     {"reflectedCustomBooleanAttr", TestObjInternal::reflectedCustomBooleanAttrAttrGetter, TestObjInternal::reflectedCustomBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1373     // Attribute 'reflectedCustomURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect')
1374     {"reflectedCustomURLAttr", TestObjInternal::reflectedCustomURLAttrAttrGetter, TestObjInternal::reflectedCustomURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1375     // Attribute 'reflectedCustomNonEmptyURLAttr' (Type: 'attribute' ExtAttr: 'URL NonEmpty Reflect')
1376     {"reflectedCustomNonEmptyURLAttr", TestObjInternal::reflectedCustomNonEmptyURLAttrAttrGetter, TestObjInternal::reflectedCustomNonEmptyURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1377     // Attribute 'attrWithGetterException' (Type: 'attribute' ExtAttr: '')
1378     {"attrWithGetterException", TestObjInternal::attrWithGetterExceptionAttrGetter, TestObjInternal::attrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1379     // Attribute 'attrWithSetterException' (Type: 'attribute' ExtAttr: '')
1380     {"attrWithSetterException", TestObjInternal::attrWithSetterExceptionAttrGetter, TestObjInternal::attrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1381     // Attribute 'stringAttrWithGetterException' (Type: 'attribute' ExtAttr: '')
1382     {"stringAttrWithGetterException", TestObjInternal::stringAttrWithGetterExceptionAttrGetter, TestObjInternal::stringAttrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1383     // Attribute 'stringAttrWithSetterException' (Type: 'attribute' ExtAttr: '')
1384     {"stringAttrWithSetterException", TestObjInternal::stringAttrWithSetterExceptionAttrGetter, TestObjInternal::stringAttrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1385     // Attribute 'customAttr' (Type: 'attribute' ExtAttr: 'Custom')
1386     {"customAttr", V8TestObj::customAttrAccessorGetter, V8TestObj::customAttrAccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1387     // Attribute 'scriptStringAttr' (Type: 'readonly attribute' ExtAttr: 'ConvertScriptString')
1388     {"scriptStringAttr", TestObjInternal::scriptStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1389 #if ENABLE(Condition1)
1390     // Attribute 'conditionalAttr1' (Type: 'attribute' ExtAttr: 'Conditional')
1391     {"conditionalAttr1", TestObjInternal::conditionalAttr1AttrGetter, TestObjInternal::conditionalAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1392 #endif // ENABLE(Condition1)
1393 #if ENABLE(Condition1) && ENABLE(Condition2)
1394     // Attribute 'conditionalAttr2' (Type: 'attribute' ExtAttr: 'Conditional')
1395     {"conditionalAttr2", TestObjInternal::conditionalAttr2AttrGetter, TestObjInternal::conditionalAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1396 #endif // ENABLE(Condition1) && ENABLE(Condition2)
1397 #if ENABLE(Condition1) || ENABLE(Condition2)
1398     // Attribute 'conditionalAttr3' (Type: 'attribute' ExtAttr: 'Conditional')
1399     {"conditionalAttr3", TestObjInternal::conditionalAttr3AttrGetter, TestObjInternal::conditionalAttr3AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1400 #endif // ENABLE(Condition1) || ENABLE(Condition2)
1401 #if ENABLE(Condition1)
1402     // Attribute 'conditionalAttr4' (Type: 'attribute' ExtAttr: 'Conditional')
1403     {"conditionalAttr4", TestObjInternal::TestObjConstructorGetter, 0, &V8TestObjectA::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */},
1404 #endif // ENABLE(Condition1)
1405 #if ENABLE(Condition1) && ENABLE(Condition2)
1406     // Attribute 'conditionalAttr5' (Type: 'attribute' ExtAttr: 'Conditional')
1407     {"conditionalAttr5", TestObjInternal::TestObjConstructorGetter, 0, &V8TestObjectB::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */},
1408 #endif // ENABLE(Condition1) && ENABLE(Condition2)
1409 #if ENABLE(Condition1) || ENABLE(Condition2)
1410     // Attribute 'conditionalAttr6' (Type: 'attribute' ExtAttr: 'Conditional')
1411     {"conditionalAttr6", TestObjInternal::TestObjConstructorGetter, 0, &V8TestObjectC::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */},
1412 #endif // ENABLE(Condition1) || ENABLE(Condition2)
1413     // Attribute 'cachedAttribute1' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute')
1414     {"cachedAttribute1", TestObjInternal::cachedAttribute1AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1415     // Attribute 'cachedAttribute2' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute')
1416     {"cachedAttribute2", TestObjInternal::cachedAttribute2AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1417     // Attribute 'floatArray' (Type: 'attribute' ExtAttr: '')
1418     {"floatArray", TestObjInternal::floatArrayAttrGetter, TestObjInternal::floatArrayAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1419     // Attribute 'doubleArray' (Type: 'attribute' ExtAttr: '')
1420     {"doubleArray", TestObjInternal::doubleArrayAttrGetter, TestObjInternal::doubleArrayAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1421     // Attribute 'description' (Type: 'readonly attribute' ExtAttr: '')
1422     {"description", TestObjInternal::descriptionAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1423     // Attribute 'id' (Type: 'attribute' ExtAttr: '')
1424     {"id", TestObjInternal::idAttrGetter, TestObjInternal::idAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1425     // Attribute 'hash' (Type: 'readonly attribute' ExtAttr: '')
1426     {"hash", TestObjInternal::hashAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1427 };
1428
1429 static const BatchedCallback TestObjCallbacks[] = {
1430     {"voidMethod", TestObjInternal::voidMethodCallback},
1431     {"intMethod", TestObjInternal::intMethodCallback},
1432     {"objMethod", TestObjInternal::objMethodCallback},
1433     {"serializedValue", TestObjInternal::serializedValueCallback},
1434     {"idbKey", TestObjInternal::idbKeyCallback},
1435     {"optionsObject", TestObjInternal::optionsObjectCallback},
1436     {"methodWithException", TestObjInternal::methodWithExceptionCallback},
1437     {"customMethod", V8TestObj::customMethodCallback},
1438     {"customMethodWithArgs", V8TestObj::customMethodWithArgsCallback},
1439     {"addEventListener", TestObjInternal::addEventListenerCallback},
1440     {"removeEventListener", TestObjInternal::removeEventListenerCallback},
1441     {"withDynamicFrame", TestObjInternal::withDynamicFrameCallback},
1442     {"withDynamicFrameAndArg", TestObjInternal::withDynamicFrameAndArgCallback},
1443     {"withDynamicFrameAndOptionalArg", TestObjInternal::withDynamicFrameAndOptionalArgCallback},
1444     {"withScriptStateVoid", TestObjInternal::withScriptStateVoidCallback},
1445     {"withScriptStateObj", TestObjInternal::withScriptStateObjCallback},
1446     {"withScriptStateVoidException", TestObjInternal::withScriptStateVoidExceptionCallback},
1447     {"withScriptStateObjException", TestObjInternal::withScriptStateObjExceptionCallback},
1448     {"withScriptExecutionContext", TestObjInternal::withScriptExecutionContextCallback},
1449     {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback},
1450     {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback},
1451     {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback},
1452     {"methodWithCallbackArg", TestObjInternal::methodWithCallbackArgCallback},
1453     {"methodWithNonCallbackArgAndCallbackArg", TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback},
1454     {"methodWithCallbackAndOptionalArg", TestObjInternal::methodWithCallbackAndOptionalArgCallback},
1455 #if ENABLE(Condition1)
1456     {"conditionalMethod1", TestObjInternal::conditionalMethod1Callback},
1457 #endif
1458 #if ENABLE(Condition1) && ENABLE(Condition2)
1459     {"conditionalMethod2", TestObjInternal::conditionalMethod2Callback},
1460 #endif
1461 #if ENABLE(Condition1) || ENABLE(Condition2)
1462     {"conditionalMethod3", TestObjInternal::conditionalMethod3Callback},
1463 #endif
1464     {"overloadedMethod", TestObjInternal::overloadedMethodCallback},
1465 };
1466
1467 static const BatchedConstant TestObjConsts[] = {
1468 #if ENABLE(Condition1)
1469     {"CONDITIONAL_CONST", static_cast<signed int>(0)},
1470 #endif
1471     {"CONST_VALUE_0", static_cast<signed int>(0)},
1472     {"CONST_VALUE_1", static_cast<signed int>(1)},
1473     {"CONST_VALUE_2", static_cast<signed int>(2)},
1474     {"CONST_VALUE_4", static_cast<signed int>(4)},
1475     {"CONST_VALUE_8", static_cast<signed int>(8)},
1476     {"CONST_VALUE_9", static_cast<signed int>(-1)},
1477     {"CONST_VALUE_10", static_cast<signed int>("my constant string")},
1478     {"CONST_VALUE_11", static_cast<signed int>(0xffffffff)},
1479     {"CONST_VALUE_12", static_cast<signed int>(0x01)},
1480     {"CONST_VALUE_13", static_cast<signed int>(0X20)},
1481     {"CONST_VALUE_14", static_cast<signed int>(0x1abc)},
1482     {"CONST_JAVASCRIPT", static_cast<signed int>(15)},
1483 };
1484
1485
1486 #if ENABLE(Condition1)
1487 COMPILE_ASSERT(0 == TestObj::CONDITIONAL_CONST, TestObjEnumCONDITIONAL_CONSTIsWrongUseDontCheckEnums);
1488 #endif
1489 COMPILE_ASSERT(0 == TestObj::CONST_VALUE_0, TestObjEnumCONST_VALUE_0IsWrongUseDontCheckEnums);
1490 COMPILE_ASSERT(1 == TestObj::CONST_VALUE_1, TestObjEnumCONST_VALUE_1IsWrongUseDontCheckEnums);
1491 COMPILE_ASSERT(2 == TestObj::CONST_VALUE_2, TestObjEnumCONST_VALUE_2IsWrongUseDontCheckEnums);
1492 COMPILE_ASSERT(4 == TestObj::CONST_VALUE_4, TestObjEnumCONST_VALUE_4IsWrongUseDontCheckEnums);
1493 COMPILE_ASSERT(8 == TestObj::CONST_VALUE_8, TestObjEnumCONST_VALUE_8IsWrongUseDontCheckEnums);
1494 COMPILE_ASSERT(-1 == TestObj::CONST_VALUE_9, TestObjEnumCONST_VALUE_9IsWrongUseDontCheckEnums);
1495 COMPILE_ASSERT("my constant string" == TestObj::CONST_VALUE_10, TestObjEnumCONST_VALUE_10IsWrongUseDontCheckEnums);
1496 COMPILE_ASSERT(0xffffffff == TestObj::CONST_VALUE_11, TestObjEnumCONST_VALUE_11IsWrongUseDontCheckEnums);
1497 COMPILE_ASSERT(0x01 == TestObj::CONST_VALUE_12, TestObjEnumCONST_VALUE_12IsWrongUseDontCheckEnums);
1498 COMPILE_ASSERT(0X20 == TestObj::CONST_VALUE_13, TestObjEnumCONST_VALUE_13IsWrongUseDontCheckEnums);
1499 COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWrongUseDontCheckEnums);
1500 COMPILE_ASSERT(15 == TestObj::CONST_IMPL, TestObjEnumCONST_IMPLIsWrongUseDontCheckEnums);
1501
1502 v8::Handle<v8::Value> V8TestObj::constructorCallback(const v8::Arguments& args)
1503 {
1504     INC_STATS("DOM.TestObj.Constructor");
1505
1506     if (!args.IsConstructCall())
1507         return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
1508
1509     if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
1510         return args.Holder();
1511
1512     RefPtr<TestObj> impl = TestObj::create();
1513     v8::Handle<v8::Object> wrapper = args.Holder();
1514
1515     V8DOMWrapper::setDOMWrapper(wrapper, &info, impl.get());
1516     impl->ref();
1517     V8DOMWrapper::setJSWrapperForDOMObject(impl.get(), v8::Persistent<v8::Object>::New(wrapper));
1518     return args.Holder();
1519 }
1520
1521 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persistent<v8::FunctionTemplate> desc)
1522 {
1523     desc->ReadOnlyPrototype();
1524
1525     v8::Local<v8::Signature> defaultSignature;
1526     defaultSignature = configureTemplate(desc, "TestObj", v8::Persistent<v8::FunctionTemplate>(), V8TestObj::internalFieldCount,
1527         TestObjAttrs, WTF_ARRAY_LENGTH(TestObjAttrs),
1528         TestObjCallbacks, WTF_ARRAY_LENGTH(TestObjCallbacks));
1529     UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
1530     desc->SetCallHandler(V8TestObj::constructorCallback);
1531     v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
1532     v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
1533     UNUSED_PARAM(instance); // In some cases, it will not be used.
1534     UNUSED_PARAM(proto); // In some cases, it will not be used.
1535     
1536     if (RuntimeEnabledFeatures::enabledAtRuntimeAttr1Enabled()) {
1537         static const BatchedAttribute attrData =\
1538         // Attribute 'enabledAtRuntimeAttr1' (Type: 'attribute' ExtAttr: 'EnabledAtRuntime')
1539         {"enabledAtRuntimeAttr1", TestObjInternal::enabledAtRuntimeAttr1AttrGetter, TestObjInternal::enabledAtRuntimeAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1540         configureAttribute(instance, proto, attrData);
1541     }
1542     if (RuntimeEnabledFeatures::featureNameEnabled()) {
1543         static const BatchedAttribute attrData =\
1544         // Attribute 'enabledAtRuntimeAttr2' (Type: 'attribute' ExtAttr: 'EnabledAtRuntime')
1545         {"enabledAtRuntimeAttr2", TestObjInternal::enabledAtRuntimeAttr2AttrGetter, TestObjInternal::enabledAtRuntimeAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1546         configureAttribute(instance, proto, attrData);
1547     }
1548
1549     // Custom Signature 'voidMethodWithArgs'
1550     const int voidMethodWithArgsArgc = 3;
1551     v8::Handle<v8::FunctionTemplate> voidMethodWithArgsArgv[voidMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1552     v8::Handle<v8::Signature> voidMethodWithArgsSignature = v8::Signature::New(desc, voidMethodWithArgsArgc, voidMethodWithArgsArgv);
1553     proto->Set(v8::String::New("voidMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::voidMethodWithArgsCallback, v8::Handle<v8::Value>(), voidMethodWithArgsSignature));
1554
1555     // Custom Signature 'intMethodWithArgs'
1556     const int intMethodWithArgsArgc = 3;
1557     v8::Handle<v8::FunctionTemplate> intMethodWithArgsArgv[intMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1558     v8::Handle<v8::Signature> intMethodWithArgsSignature = v8::Signature::New(desc, intMethodWithArgsArgc, intMethodWithArgsArgv);
1559     proto->Set(v8::String::New("intMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::intMethodWithArgsCallback, v8::Handle<v8::Value>(), intMethodWithArgsSignature));
1560
1561     // Custom Signature 'objMethodWithArgs'
1562     const int objMethodWithArgsArgc = 3;
1563     v8::Handle<v8::FunctionTemplate> objMethodWithArgsArgv[objMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1564     v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(desc, objMethodWithArgsArgc, objMethodWithArgsArgv);
1565     proto->Set(v8::String::New("objMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::objMethodWithArgsCallback, v8::Handle<v8::Value>(), objMethodWithArgsSignature));
1566
1567     // Custom Signature 'methodThatRequiresAllArgsAndThrows'
1568     const int methodThatRequiresAllArgsAndThrowsArgc = 2;
1569     v8::Handle<v8::FunctionTemplate> methodThatRequiresAllArgsAndThrowsArgv[methodThatRequiresAllArgsAndThrowsArgc] = { v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1570     v8::Handle<v8::Signature> methodThatRequiresAllArgsAndThrowsSignature = v8::Signature::New(desc, methodThatRequiresAllArgsAndThrowsArgc, methodThatRequiresAllArgsAndThrowsArgv);
1571     proto->Set(v8::String::New("methodThatRequiresAllArgsAndThrows"), v8::FunctionTemplate::New(TestObjInternal::methodThatRequiresAllArgsAndThrowsCallback, v8::Handle<v8::Value>(), methodThatRequiresAllArgsAndThrowsSignature));
1572
1573     // Custom Signature 'customArgsAndException'
1574     const int customArgsAndExceptionArgc = 1;
1575     v8::Handle<v8::FunctionTemplate> customArgsAndExceptionArgv[customArgsAndExceptionArgc] = { V8log::GetRawTemplate() };
1576     v8::Handle<v8::Signature> customArgsAndExceptionSignature = v8::Signature::New(desc, customArgsAndExceptionArgc, customArgsAndExceptionArgv);
1577     proto->Set(v8::String::New("customArgsAndException"), v8::FunctionTemplate::New(TestObjInternal::customArgsAndExceptionCallback, v8::Handle<v8::Value>(), customArgsAndExceptionSignature));
1578     desc->Set(v8::String::New("classMethod"), v8::FunctionTemplate::New(TestObjInternal::classMethodCallback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
1579     desc->Set(v8::String::New("classMethodWithOptional"), v8::FunctionTemplate::New(TestObjInternal::classMethodWithOptionalCallback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
1580 #if ENABLE(Condition1)
1581     desc->Set(v8::String::New("overloadedMethod1"), v8::FunctionTemplate::New(TestObjInternal::overloadedMethod1Callback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
1582 #endif // ENABLE(Condition1)
1583     if (RuntimeEnabledFeatures::enabledAtRuntimeMethod1Enabled())
1584         proto->Set(v8::String::New("enabledAtRuntimeMethod1"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod1Callback, v8::Handle<v8::Value>(), defaultSignature));
1585     if (RuntimeEnabledFeatures::featureNameEnabled())
1586         proto->Set(v8::String::New("enabledAtRuntimeMethod2"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod2Callback, v8::Handle<v8::Value>(), defaultSignature));
1587     batchConfigureConstants(desc, proto, TestObjConsts, WTF_ARRAY_LENGTH(TestObjConsts));
1588
1589     // Custom toString template
1590     desc->Set(getToStringName(), getToStringTemplate());
1591     return desc;
1592 }
1593
1594 v8::Persistent<v8::FunctionTemplate> V8TestObj::GetRawTemplate()
1595 {
1596     V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
1597     V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info);
1598     if (result != data->rawTemplateMap().end())
1599         return result->second;
1600
1601     v8::HandleScope handleScope;
1602     v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
1603     data->rawTemplateMap().add(&info, templ);
1604     return templ;
1605 }
1606
1607 v8::Persistent<v8::FunctionTemplate> V8TestObj::GetTemplate()
1608 {
1609     V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
1610     V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info);
1611     if (result != data->templateMap().end())
1612         return result->second;
1613
1614     v8::HandleScope handleScope;
1615     v8::Persistent<v8::FunctionTemplate> templ =
1616         ConfigureV8TestObjTemplate(GetRawTemplate());
1617     data->templateMap().add(&info, templ);
1618     return templ;
1619 }
1620
1621 bool V8TestObj::HasInstance(v8::Handle<v8::Value> value)
1622 {
1623     return GetRawTemplate()->HasInstance(value);
1624 }
1625
1626
1627 v8::Handle<v8::Object> V8TestObj::wrapSlow(TestObj* impl)
1628 {
1629     v8::Handle<v8::Object> wrapper;
1630     V8Proxy* proxy = 0;
1631     wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
1632     if (wrapper.IsEmpty())
1633         return wrapper;
1634
1635     impl->ref();
1636     v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
1637
1638     if (!hasDependentLifetime)
1639         wrapperHandle.MarkIndependent();
1640     getDOMObjectMap().set(impl, wrapperHandle);
1641     return wrapper;
1642 }
1643
1644 void V8TestObj::derefObject(void* object)
1645 {
1646     static_cast<TestObj*>(object)->deref();
1647 }
1648
1649 } // namespace WebCore