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