IndexedDB: Passing empty array to IDBDatabase.transaction should raise exception
[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     EXCEPTION_BLOCK(int, opt2, toInt32(MAYBE_MISSING_PARAMETER(args, 2, MissingIsUndefined)));
1046     imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
1047     return v8::Handle<v8::Value>();
1048 }
1049
1050 static v8::Handle<v8::Value> methodWithCallbackArgCallback(const v8::Arguments& args)
1051 {
1052     INC_STATS("DOM.TestObj.methodWithCallbackArg");
1053     TestObj* imp = V8TestObj::toNative(args.Holder());
1054     if (args.Length() <= 0 || !args[0]->IsObject())
1055         return throwError(TYPE_MISMATCH_ERR);
1056     RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1057     imp->methodWithCallbackArg(callback);
1058     return v8::Handle<v8::Value>();
1059 }
1060
1061 static v8::Handle<v8::Value> methodWithNonCallbackArgAndCallbackArgCallback(const v8::Arguments& args)
1062 {
1063     INC_STATS("DOM.TestObj.methodWithNonCallbackArgAndCallbackArg");
1064     TestObj* imp = V8TestObj::toNative(args.Holder());
1065     EXCEPTION_BLOCK(int, nonCallback, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1066     if (args.Length() <= 1 || !args[1]->IsObject())
1067         return throwError(TYPE_MISMATCH_ERR);
1068     RefPtr<TestCallback> callback = V8TestCallback::create(args[1], getScriptExecutionContext());
1069     imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
1070     return v8::Handle<v8::Value>();
1071 }
1072
1073 static v8::Handle<v8::Value> methodWithCallbackAndOptionalArgCallback(const v8::Arguments& args)
1074 {
1075     INC_STATS("DOM.TestObj.methodWithCallbackAndOptionalArg");
1076     TestObj* imp = V8TestObj::toNative(args.Holder());
1077     RefPtr<TestCallback> callback;
1078     if (args.Length() > 0 && !args[0]->IsNull() && !args[0]->IsUndefined()) {
1079         if (!args[0]->IsObject())
1080             return throwError(TYPE_MISMATCH_ERR);
1081         callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1082     }
1083     imp->methodWithCallbackAndOptionalArg(callback);
1084     return v8::Handle<v8::Value>();
1085 }
1086
1087 static v8::Handle<v8::Value> conditionalMethod1Callback(const v8::Arguments& args)
1088 {
1089     INC_STATS("DOM.TestObj.conditionalMethod1");
1090     TestObj* imp = V8TestObj::toNative(args.Holder());
1091     return v8String(imp->conditionalMethod1());
1092 }
1093
1094 static v8::Handle<v8::Value> conditionalMethod2Callback(const v8::Arguments& args)
1095 {
1096     INC_STATS("DOM.TestObj.conditionalMethod2");
1097     TestObj* imp = V8TestObj::toNative(args.Holder());
1098     imp->conditionalMethod2();
1099     return v8::Handle<v8::Value>();
1100 }
1101
1102 static v8::Handle<v8::Value> conditionalMethod3Callback(const v8::Arguments& args)
1103 {
1104     INC_STATS("DOM.TestObj.conditionalMethod3");
1105     TestObj* imp = V8TestObj::toNative(args.Holder());
1106     imp->conditionalMethod3();
1107     return v8::Handle<v8::Value>();
1108 }
1109
1110 static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args)
1111 {
1112     INC_STATS("DOM.TestObj.overloadedMethod1");
1113     TestObj* imp = V8TestObj::toNative(args.Holder());
1114     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);
1115     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined));
1116     imp->overloadedMethod(objArg, strArg);
1117     return v8::Handle<v8::Value>();
1118 }
1119
1120 static v8::Handle<v8::Value> overloadedMethod2Callback(const v8::Arguments& args)
1121 {
1122     INC_STATS("DOM.TestObj.overloadedMethod2");
1123     TestObj* imp = V8TestObj::toNative(args.Holder());
1124     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);
1125     if (args.Length() <= 1) {
1126         imp->overloadedMethod(objArg);
1127         return v8::Handle<v8::Value>();
1128     }
1129     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)));
1130     imp->overloadedMethod(objArg, intArg);
1131     return v8::Handle<v8::Value>();
1132 }
1133
1134 static v8::Handle<v8::Value> overloadedMethod3Callback(const v8::Arguments& args)
1135 {
1136     INC_STATS("DOM.TestObj.overloadedMethod3");
1137     TestObj* imp = V8TestObj::toNative(args.Holder());
1138     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined));
1139     imp->overloadedMethod(strArg);
1140     return v8::Handle<v8::Value>();
1141 }
1142
1143 static v8::Handle<v8::Value> overloadedMethod4Callback(const v8::Arguments& args)
1144 {
1145     INC_STATS("DOM.TestObj.overloadedMethod4");
1146     TestObj* imp = V8TestObj::toNative(args.Holder());
1147     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1148     imp->overloadedMethod(intArg);
1149     return v8::Handle<v8::Value>();
1150 }
1151
1152 static v8::Handle<v8::Value> overloadedMethod5Callback(const v8::Arguments& args)
1153 {
1154     INC_STATS("DOM.TestObj.overloadedMethod5");
1155     TestObj* imp = V8TestObj::toNative(args.Holder());
1156     if (args.Length() <= 0 || !args[0]->IsObject())
1157         return throwError(TYPE_MISMATCH_ERR);
1158     RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1159     imp->overloadedMethod(callback);
1160     return v8::Handle<v8::Value>();
1161 }
1162
1163 static v8::Handle<v8::Value> overloadedMethod6Callback(const v8::Arguments& args)
1164 {
1165     INC_STATS("DOM.TestObj.overloadedMethod6");
1166     TestObj* imp = V8TestObj::toNative(args.Holder());
1167     EXCEPTION_BLOCK(RefPtr<DOMStringList>, listArg, v8ValueToWebCoreDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1168     imp->overloadedMethod(listArg);
1169     return v8::Handle<v8::Value>();
1170 }
1171
1172 static v8::Handle<v8::Value> overloadedMethod7Callback(const v8::Arguments& args)
1173 {
1174     INC_STATS("DOM.TestObj.overloadedMethod7");
1175     TestObj* imp = V8TestObj::toNative(args.Holder());
1176     EXCEPTION_BLOCK(RefPtr<DOMStringList>, arrayArg, v8ValueToWebCoreDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1177     imp->overloadedMethod(arrayArg);
1178     return v8::Handle<v8::Value>();
1179 }
1180
1181 static v8::Handle<v8::Value> overloadedMethodCallback(const v8::Arguments& args)
1182 {
1183     INC_STATS("DOM.TestObj.overloadedMethod");
1184     if ((args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0])) && (args[1]->IsNull() || args[1]->IsUndefined() || args[1]->IsString() || args[1]->IsObject())))
1185         return overloadedMethod1Callback(args);
1186     if ((args.Length() == 1 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0]))) || (args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0]))))
1187         return overloadedMethod2Callback(args);
1188     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject())))
1189         return overloadedMethod3Callback(args);
1190     if (args.Length() == 1)
1191         return overloadedMethod4Callback(args);
1192     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsObject())))
1193         return overloadedMethod5Callback(args);
1194     if ((args.Length() == 1 && (args[0]->IsNull() || V8DOMStringList::HasInstance(args[0]))))
1195         return overloadedMethod6Callback(args);
1196     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsArray())))
1197         return overloadedMethod7Callback(args);
1198     V8Proxy::throwTypeError();
1199     return notHandledByInterceptor();
1200 }
1201
1202 static v8::Handle<v8::Value> classMethodCallback(const v8::Arguments& args)
1203 {
1204     INC_STATS("DOM.TestObj.classMethod");
1205     TestObj::classMethod();
1206     return v8::Handle<v8::Value>();
1207 }
1208
1209 static v8::Handle<v8::Value> classMethodWithOptionalCallback(const v8::Arguments& args)
1210 {
1211     INC_STATS("DOM.TestObj.classMethodWithOptional");
1212     if (args.Length() <= 0) {
1213         return v8::Integer::New(TestObj::classMethodWithOptional());
1214     }
1215     EXCEPTION_BLOCK(int, arg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
1216     return v8::Integer::New(TestObj::classMethodWithOptional(arg));
1217 }
1218
1219 static v8::Handle<v8::Value> enabledAtRuntimeMethod1Callback(const v8::Arguments& args)
1220 {
1221     INC_STATS("DOM.TestObj.enabledAtRuntimeMethod1");
1222     TestObj* imp = V8TestObj::toNative(args.Holder());
1223     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);
1224     imp->enabledAtRuntimeMethod1(intArg);
1225     return v8::Handle<v8::Value>();
1226 }
1227
1228 static v8::Handle<v8::Value> enabledAtRuntimeMethod2Callback(const v8::Arguments& args)
1229 {
1230     INC_STATS("DOM.TestObj.enabledAtRuntimeMethod2");
1231     TestObj* imp = V8TestObj::toNative(args.Holder());
1232     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);
1233     imp->enabledAtRuntimeMethod2(intArg);
1234     return v8::Handle<v8::Value>();
1235 }
1236
1237 } // namespace TestObjInternal
1238
1239 static const BatchedAttribute TestObjAttrs[] = {
1240     // Attribute 'readOnlyIntAttr' (Type: 'readonly attribute' ExtAttr: '')
1241     {"readOnlyIntAttr", TestObjInternal::readOnlyIntAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1242     // Attribute 'readOnlyStringAttr' (Type: 'readonly attribute' ExtAttr: '')
1243     {"readOnlyStringAttr", TestObjInternal::readOnlyStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1244     // Attribute 'readOnlyTestObjAttr' (Type: 'readonly attribute' ExtAttr: '')
1245     {"readOnlyTestObjAttr", TestObjInternal::readOnlyTestObjAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1246     // Attribute 'shortAttr' (Type: 'attribute' ExtAttr: '')
1247     {"shortAttr", TestObjInternal::shortAttrAttrGetter, TestObjInternal::shortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1248     // Attribute 'unsignedShortAttr' (Type: 'attribute' ExtAttr: '')
1249     {"unsignedShortAttr", TestObjInternal::unsignedShortAttrAttrGetter, TestObjInternal::unsignedShortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1250     // Attribute 'intAttr' (Type: 'attribute' ExtAttr: '')
1251     {"intAttr", TestObjInternal::intAttrAttrGetter, TestObjInternal::intAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1252     // Attribute 'longLongAttr' (Type: 'attribute' ExtAttr: '')
1253     {"longLongAttr", TestObjInternal::longLongAttrAttrGetter, TestObjInternal::longLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1254     // Attribute 'unsignedLongLongAttr' (Type: 'attribute' ExtAttr: '')
1255     {"unsignedLongLongAttr", TestObjInternal::unsignedLongLongAttrAttrGetter, TestObjInternal::unsignedLongLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1256     // Attribute 'stringAttr' (Type: 'attribute' ExtAttr: '')
1257     {"stringAttr", TestObjInternal::stringAttrAttrGetter, TestObjInternal::stringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1258     // Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: '')
1259     {"testObjAttr", TestObjInternal::testObjAttrAttrGetter, TestObjInternal::testObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1260     // Attribute 'XMLObjAttr' (Type: 'attribute' ExtAttr: '')
1261     {"XMLObjAttr", TestObjInternal::XMLObjAttrAttrGetter, TestObjInternal::XMLObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1262     // Attribute 'create' (Type: 'attribute' ExtAttr: '')
1263     {"create", TestObjInternal::createAttrGetter, TestObjInternal::createAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1264     // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1265     {"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1266     // Attribute 'reflectedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1267     {"reflectedIntegralAttr", TestObjInternal::reflectedIntegralAttrAttrGetter, TestObjInternal::reflectedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1268     // Attribute 'reflectedUnsignedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1269     {"reflectedUnsignedIntegralAttr", TestObjInternal::reflectedUnsignedIntegralAttrAttrGetter, TestObjInternal::reflectedUnsignedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1270     // Attribute 'reflectedBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1271     {"reflectedBooleanAttr", TestObjInternal::reflectedBooleanAttrAttrGetter, TestObjInternal::reflectedBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1272     // Attribute 'reflectedURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect')
1273     {"reflectedURLAttr", TestObjInternal::reflectedURLAttrAttrGetter, TestObjInternal::reflectedURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1274     // Attribute 'reflectedNonEmptyURLAttr' (Type: 'attribute' ExtAttr: 'URL NonEmpty Reflect')
1275     {"reflectedNonEmptyURLAttr", TestObjInternal::reflectedNonEmptyURLAttrAttrGetter, TestObjInternal::reflectedNonEmptyURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1276     // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1277     {"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1278     // Attribute 'reflectedCustomIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1279     {"reflectedCustomIntegralAttr", TestObjInternal::reflectedCustomIntegralAttrAttrGetter, TestObjInternal::reflectedCustomIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1280     // Attribute 'reflectedCustomBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1281     {"reflectedCustomBooleanAttr", TestObjInternal::reflectedCustomBooleanAttrAttrGetter, TestObjInternal::reflectedCustomBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1282     // Attribute 'reflectedCustomURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect')
1283     {"reflectedCustomURLAttr", TestObjInternal::reflectedCustomURLAttrAttrGetter, TestObjInternal::reflectedCustomURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1284     // Attribute 'reflectedCustomNonEmptyURLAttr' (Type: 'attribute' ExtAttr: 'URL NonEmpty Reflect')
1285     {"reflectedCustomNonEmptyURLAttr", TestObjInternal::reflectedCustomNonEmptyURLAttrAttrGetter, TestObjInternal::reflectedCustomNonEmptyURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1286     // Attribute 'attrWithGetterException' (Type: 'attribute' ExtAttr: '')
1287     {"attrWithGetterException", TestObjInternal::attrWithGetterExceptionAttrGetter, TestObjInternal::attrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1288     // Attribute 'attrWithSetterException' (Type: 'attribute' ExtAttr: '')
1289     {"attrWithSetterException", TestObjInternal::attrWithSetterExceptionAttrGetter, TestObjInternal::attrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1290     // Attribute 'stringAttrWithGetterException' (Type: 'attribute' ExtAttr: '')
1291     {"stringAttrWithGetterException", TestObjInternal::stringAttrWithGetterExceptionAttrGetter, TestObjInternal::stringAttrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1292     // Attribute 'stringAttrWithSetterException' (Type: 'attribute' ExtAttr: '')
1293     {"stringAttrWithSetterException", TestObjInternal::stringAttrWithSetterExceptionAttrGetter, TestObjInternal::stringAttrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1294     // Attribute 'customAttr' (Type: 'attribute' ExtAttr: 'Custom')
1295     {"customAttr", V8TestObj::customAttrAccessorGetter, V8TestObj::customAttrAccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1296     // Attribute 'scriptStringAttr' (Type: 'readonly attribute' ExtAttr: 'ConvertScriptString')
1297     {"scriptStringAttr", TestObjInternal::scriptStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1298 #if ENABLE(Condition1)
1299     // Attribute 'conditionalAttr1' (Type: 'attribute' ExtAttr: 'Conditional')
1300     {"conditionalAttr1", TestObjInternal::conditionalAttr1AttrGetter, TestObjInternal::conditionalAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1301 #endif // ENABLE(Condition1)
1302 #if ENABLE(Condition1) && ENABLE(Condition2)
1303     // Attribute 'conditionalAttr2' (Type: 'attribute' ExtAttr: 'Conditional')
1304     {"conditionalAttr2", TestObjInternal::conditionalAttr2AttrGetter, TestObjInternal::conditionalAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1305 #endif // ENABLE(Condition1) && ENABLE(Condition2)
1306 #if ENABLE(Condition1) || ENABLE(Condition2)
1307     // Attribute 'conditionalAttr3' (Type: 'attribute' ExtAttr: 'Conditional')
1308     {"conditionalAttr3", TestObjInternal::conditionalAttr3AttrGetter, TestObjInternal::conditionalAttr3AttrSetter, 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)
1311     // Attribute 'conditionalAttr4' (Type: 'attribute' ExtAttr: 'Conditional')
1312     {"conditionalAttr4", TestObjInternal::TestObjConstructorGetter, 0, &V8TestObjectA::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */},
1313 #endif // ENABLE(Condition1)
1314 #if ENABLE(Condition1) && ENABLE(Condition2)
1315     // Attribute 'conditionalAttr5' (Type: 'attribute' ExtAttr: 'Conditional')
1316     {"conditionalAttr5", TestObjInternal::TestObjConstructorGetter, 0, &V8TestObjectB::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */},
1317 #endif // ENABLE(Condition1) && ENABLE(Condition2)
1318 #if ENABLE(Condition1) || ENABLE(Condition2)
1319     // Attribute 'conditionalAttr6' (Type: 'attribute' ExtAttr: 'Conditional')
1320     {"conditionalAttr6", TestObjInternal::TestObjConstructorGetter, 0, &V8TestObjectC::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */},
1321 #endif // ENABLE(Condition1) || ENABLE(Condition2)
1322     // Attribute 'cachedAttribute1' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute')
1323     {"cachedAttribute1", TestObjInternal::cachedAttribute1AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1324     // Attribute 'cachedAttribute2' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute')
1325     {"cachedAttribute2", TestObjInternal::cachedAttribute2AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1326     // Attribute 'description' (Type: 'readonly attribute' ExtAttr: '')
1327     {"description", TestObjInternal::descriptionAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1328     // Attribute 'id' (Type: 'attribute' ExtAttr: '')
1329     {"id", TestObjInternal::idAttrGetter, TestObjInternal::idAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1330     // Attribute 'hash' (Type: 'readonly attribute' ExtAttr: '')
1331     {"hash", TestObjInternal::hashAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1332 };
1333
1334 static const BatchedCallback TestObjCallbacks[] = {
1335     {"voidMethod", TestObjInternal::voidMethodCallback},
1336     {"intMethod", TestObjInternal::intMethodCallback},
1337     {"objMethod", TestObjInternal::objMethodCallback},
1338     {"serializedValue", TestObjInternal::serializedValueCallback},
1339     {"idbKey", TestObjInternal::idbKeyCallback},
1340     {"optionsObject", TestObjInternal::optionsObjectCallback},
1341     {"methodWithException", TestObjInternal::methodWithExceptionCallback},
1342     {"customMethod", V8TestObj::customMethodCallback},
1343     {"customMethodWithArgs", V8TestObj::customMethodWithArgsCallback},
1344     {"addEventListener", TestObjInternal::addEventListenerCallback},
1345     {"removeEventListener", TestObjInternal::removeEventListenerCallback},
1346     {"withDynamicFrame", TestObjInternal::withDynamicFrameCallback},
1347     {"withDynamicFrameAndArg", TestObjInternal::withDynamicFrameAndArgCallback},
1348     {"withDynamicFrameAndOptionalArg", TestObjInternal::withDynamicFrameAndOptionalArgCallback},
1349     {"withDynamicFrameAndUserGesture", TestObjInternal::withDynamicFrameAndUserGestureCallback},
1350     {"withDynamicFrameAndUserGestureASAD", TestObjInternal::withDynamicFrameAndUserGestureASADCallback},
1351     {"withScriptStateVoid", TestObjInternal::withScriptStateVoidCallback},
1352     {"withScriptStateObj", TestObjInternal::withScriptStateObjCallback},
1353     {"withScriptStateVoidException", TestObjInternal::withScriptStateVoidExceptionCallback},
1354     {"withScriptStateObjException", TestObjInternal::withScriptStateObjExceptionCallback},
1355     {"withScriptExecutionContext", TestObjInternal::withScriptExecutionContextCallback},
1356     {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback},
1357     {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback},
1358     {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback},
1359     {"methodWithCallbackArg", TestObjInternal::methodWithCallbackArgCallback},
1360     {"methodWithNonCallbackArgAndCallbackArg", TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback},
1361     {"methodWithCallbackAndOptionalArg", TestObjInternal::methodWithCallbackAndOptionalArgCallback},
1362 #if ENABLE(Condition1)
1363     {"conditionalMethod1", TestObjInternal::conditionalMethod1Callback},
1364 #endif
1365 #if ENABLE(Condition1) && ENABLE(Condition2)
1366     {"conditionalMethod2", TestObjInternal::conditionalMethod2Callback},
1367 #endif
1368 #if ENABLE(Condition1) || ENABLE(Condition2)
1369     {"conditionalMethod3", TestObjInternal::conditionalMethod3Callback},
1370 #endif
1371     {"overloadedMethod", TestObjInternal::overloadedMethodCallback},
1372 };
1373
1374 static const BatchedConstant TestObjConsts[] = {
1375     {"CONST_VALUE_0", static_cast<signed int>(0)},
1376     {"CONST_VALUE_1", static_cast<signed int>(1)},
1377     {"CONST_VALUE_2", static_cast<signed int>(2)},
1378     {"CONST_VALUE_4", static_cast<signed int>(4)},
1379     {"CONST_VALUE_8", static_cast<signed int>(8)},
1380     {"CONST_VALUE_9", static_cast<signed int>(-1)},
1381     {"CONST_VALUE_10", static_cast<signed int>("my constant string")},
1382     {"CONST_VALUE_11", static_cast<signed int>(0xffffffff)},
1383     {"CONST_VALUE_12", static_cast<signed int>(0x01)},
1384     {"CONST_VALUE_13", static_cast<signed int>(0X20)},
1385     {"CONST_VALUE_14", static_cast<signed int>(0x1abc)},
1386 };
1387
1388
1389 COMPILE_ASSERT(0 == TestObj::CONST_VALUE_0, TestObjEnumCONST_VALUE_0IsWrongUseDontCheckEnums);
1390 COMPILE_ASSERT(1 == TestObj::CONST_VALUE_1, TestObjEnumCONST_VALUE_1IsWrongUseDontCheckEnums);
1391 COMPILE_ASSERT(2 == TestObj::CONST_VALUE_2, TestObjEnumCONST_VALUE_2IsWrongUseDontCheckEnums);
1392 COMPILE_ASSERT(4 == TestObj::CONST_VALUE_4, TestObjEnumCONST_VALUE_4IsWrongUseDontCheckEnums);
1393 COMPILE_ASSERT(8 == TestObj::CONST_VALUE_8, TestObjEnumCONST_VALUE_8IsWrongUseDontCheckEnums);
1394 COMPILE_ASSERT(-1 == TestObj::CONST_VALUE_9, TestObjEnumCONST_VALUE_9IsWrongUseDontCheckEnums);
1395 COMPILE_ASSERT("my constant string" == TestObj::CONST_VALUE_10, TestObjEnumCONST_VALUE_10IsWrongUseDontCheckEnums);
1396 COMPILE_ASSERT(0xffffffff == TestObj::CONST_VALUE_11, TestObjEnumCONST_VALUE_11IsWrongUseDontCheckEnums);
1397 COMPILE_ASSERT(0x01 == TestObj::CONST_VALUE_12, TestObjEnumCONST_VALUE_12IsWrongUseDontCheckEnums);
1398 COMPILE_ASSERT(0X20 == TestObj::CONST_VALUE_13, TestObjEnumCONST_VALUE_13IsWrongUseDontCheckEnums);
1399 COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWrongUseDontCheckEnums);
1400
1401 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persistent<v8::FunctionTemplate> desc)
1402 {
1403     desc->ReadOnlyPrototype();
1404
1405     v8::Local<v8::Signature> defaultSignature;
1406     defaultSignature = configureTemplate(desc, "TestObj", v8::Persistent<v8::FunctionTemplate>(), V8TestObj::internalFieldCount,
1407         TestObjAttrs, WTF_ARRAY_LENGTH(TestObjAttrs),
1408         TestObjCallbacks, WTF_ARRAY_LENGTH(TestObjCallbacks));
1409     UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
1410     v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
1411     v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
1412     UNUSED_PARAM(instance); // In some cases, it will not be used.
1413     UNUSED_PARAM(proto); // In some cases, it will not be used.
1414     
1415     if (RuntimeEnabledFeatures::enabledAtRuntimeAttr1Enabled()) {
1416         static const BatchedAttribute attrData =\
1417         // Attribute 'enabledAtRuntimeAttr1' (Type: 'attribute' ExtAttr: 'EnabledAtRuntime')
1418         {"enabledAtRuntimeAttr1", TestObjInternal::enabledAtRuntimeAttr1AttrGetter, TestObjInternal::enabledAtRuntimeAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1419         configureAttribute(instance, proto, attrData);
1420     }
1421     if (RuntimeEnabledFeatures::featureNameEnabled()) {
1422         static const BatchedAttribute attrData =\
1423         // Attribute 'enabledAtRuntimeAttr2' (Type: 'attribute' ExtAttr: 'EnabledAtRuntime')
1424         {"enabledAtRuntimeAttr2", TestObjInternal::enabledAtRuntimeAttr2AttrGetter, TestObjInternal::enabledAtRuntimeAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1425         configureAttribute(instance, proto, attrData);
1426     }
1427
1428     // Custom Signature 'voidMethodWithArgs'
1429     const int voidMethodWithArgsArgc = 3;
1430     v8::Handle<v8::FunctionTemplate> voidMethodWithArgsArgv[voidMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1431     v8::Handle<v8::Signature> voidMethodWithArgsSignature = v8::Signature::New(desc, voidMethodWithArgsArgc, voidMethodWithArgsArgv);
1432     proto->Set(v8::String::New("voidMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::voidMethodWithArgsCallback, v8::Handle<v8::Value>(), voidMethodWithArgsSignature));
1433
1434     // Custom Signature 'intMethodWithArgs'
1435     const int intMethodWithArgsArgc = 3;
1436     v8::Handle<v8::FunctionTemplate> intMethodWithArgsArgv[intMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1437     v8::Handle<v8::Signature> intMethodWithArgsSignature = v8::Signature::New(desc, intMethodWithArgsArgc, intMethodWithArgsArgv);
1438     proto->Set(v8::String::New("intMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::intMethodWithArgsCallback, v8::Handle<v8::Value>(), intMethodWithArgsSignature));
1439
1440     // Custom Signature 'objMethodWithArgs'
1441     const int objMethodWithArgsArgc = 3;
1442     v8::Handle<v8::FunctionTemplate> objMethodWithArgsArgv[objMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1443     v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(desc, objMethodWithArgsArgc, objMethodWithArgsArgv);
1444     proto->Set(v8::String::New("objMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::objMethodWithArgsCallback, v8::Handle<v8::Value>(), objMethodWithArgsSignature));
1445
1446     // Custom Signature 'methodThatRequiresAllArgs'
1447     const int methodThatRequiresAllArgsArgc = 2;
1448     v8::Handle<v8::FunctionTemplate> methodThatRequiresAllArgsArgv[methodThatRequiresAllArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1449     v8::Handle<v8::Signature> methodThatRequiresAllArgsSignature = v8::Signature::New(desc, methodThatRequiresAllArgsArgc, methodThatRequiresAllArgsArgv);
1450     proto->Set(v8::String::New("methodThatRequiresAllArgs"), v8::FunctionTemplate::New(TestObjInternal::methodThatRequiresAllArgsCallback, v8::Handle<v8::Value>(), methodThatRequiresAllArgsSignature));
1451
1452     // Custom Signature 'methodThatRequiresAllArgsAndThrows'
1453     const int methodThatRequiresAllArgsAndThrowsArgc = 2;
1454     v8::Handle<v8::FunctionTemplate> methodThatRequiresAllArgsAndThrowsArgv[methodThatRequiresAllArgsAndThrowsArgc] = { v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1455     v8::Handle<v8::Signature> methodThatRequiresAllArgsAndThrowsSignature = v8::Signature::New(desc, methodThatRequiresAllArgsAndThrowsArgc, methodThatRequiresAllArgsAndThrowsArgv);
1456     proto->Set(v8::String::New("methodThatRequiresAllArgsAndThrows"), v8::FunctionTemplate::New(TestObjInternal::methodThatRequiresAllArgsAndThrowsCallback, v8::Handle<v8::Value>(), methodThatRequiresAllArgsAndThrowsSignature));
1457
1458     // Custom Signature 'customArgsAndException'
1459     const int customArgsAndExceptionArgc = 1;
1460     v8::Handle<v8::FunctionTemplate> customArgsAndExceptionArgv[customArgsAndExceptionArgc] = { V8log::GetRawTemplate() };
1461     v8::Handle<v8::Signature> customArgsAndExceptionSignature = v8::Signature::New(desc, customArgsAndExceptionArgc, customArgsAndExceptionArgv);
1462     proto->Set(v8::String::New("customArgsAndException"), v8::FunctionTemplate::New(TestObjInternal::customArgsAndExceptionCallback, v8::Handle<v8::Value>(), customArgsAndExceptionSignature));
1463     desc->Set(v8::String::New("classMethod"), v8::FunctionTemplate::New(TestObjInternal::classMethodCallback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
1464     desc->Set(v8::String::New("classMethodWithOptional"), v8::FunctionTemplate::New(TestObjInternal::classMethodWithOptionalCallback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
1465     if (RuntimeEnabledFeatures::enabledAtRuntimeMethod1Enabled())
1466         proto->Set(v8::String::New("enabledAtRuntimeMethod1"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod1Callback, v8::Handle<v8::Value>(), defaultSignature));
1467     if (RuntimeEnabledFeatures::featureNameEnabled())
1468         proto->Set(v8::String::New("enabledAtRuntimeMethod2"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod2Callback, v8::Handle<v8::Value>(), defaultSignature));
1469     batchConfigureConstants(desc, proto, TestObjConsts, WTF_ARRAY_LENGTH(TestObjConsts));
1470
1471     // Custom toString template
1472     desc->Set(getToStringName(), getToStringTemplate());
1473     return desc;
1474 }
1475
1476 v8::Persistent<v8::FunctionTemplate> V8TestObj::GetRawTemplate()
1477 {
1478     V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
1479     V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info);
1480     if (result != data->rawTemplateMap().end())
1481         return result->second;
1482
1483     v8::HandleScope handleScope;
1484     v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
1485     data->rawTemplateMap().add(&info, templ);
1486     return templ;
1487 }
1488
1489 v8::Persistent<v8::FunctionTemplate> V8TestObj::GetTemplate()
1490 {
1491     V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
1492     V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info);
1493     if (result != data->templateMap().end())
1494         return result->second;
1495
1496     v8::HandleScope handleScope;
1497     v8::Persistent<v8::FunctionTemplate> templ =
1498         ConfigureV8TestObjTemplate(GetRawTemplate());
1499     data->templateMap().add(&info, templ);
1500     return templ;
1501 }
1502
1503 bool V8TestObj::HasInstance(v8::Handle<v8::Value> value)
1504 {
1505     return GetRawTemplate()->HasInstance(value);
1506 }
1507
1508
1509 v8::Handle<v8::Object> V8TestObj::wrapSlow(TestObj* impl)
1510 {
1511     v8::Handle<v8::Object> wrapper;
1512     V8Proxy* proxy = 0;
1513     wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
1514     if (wrapper.IsEmpty())
1515         return wrapper;
1516
1517     impl->ref();
1518     v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
1519
1520     if (!hasDependentLifetime)
1521         wrapperHandle.MarkIndependent();
1522     getDOMObjectMap().set(impl, wrapperHandle);
1523     return wrapper;
1524 }
1525
1526 void V8TestObj::derefObject(void* object)
1527 {
1528     static_cast<TestObj*>(object)->deref();
1529 }
1530
1531 } // namespace WebCore