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