Return null when shouldAllowAccessToNode() fails
[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 "Dictionary.h"
25 #include "ExceptionCode.h"
26 #include "HTMLNames.h"
27 #include "IDBBindingUtilities.h"
28 #include "IDBKey.h"
29 #include "RuntimeEnabledFeatures.h"
30 #include "SVGPropertyTearOff.h"
31 #include "SVGStaticPropertyTearOff.h"
32 #include "ScriptArguments.h"
33 #include "ScriptCallStack.h"
34 #include "ScriptCallStackFactory.h"
35 #include "SerializedScriptValue.h"
36 #include "V8Binding.h"
37 #include "V8BindingMacros.h"
38 #include "V8BindingState.h"
39 #include "V8DOMWrapper.h"
40 #include "V8Document.h"
41 #include "V8IsolatedContext.h"
42 #include "V8Proxy.h"
43 #include "V8SVGDocument.h"
44 #include "V8SVGPoint.h"
45 #include "V8TestCallback.h"
46 #include "V8a.h"
47 #include "V8any.h"
48 #include "V8b.h"
49 #include "V8bool.h"
50 #include "V8c.h"
51 #include "V8d.h"
52 #include "V8e.h"
53 #include "V8int.h"
54 #include <wtf/GetPtr.h>
55 #include <wtf/RefCounted.h>
56 #include <wtf/RefPtr.h>
57 #include <wtf/UnusedParam.h>
58 #include <wtf/Vector.h>
59
60 #if ENABLE(Condition1)
61 #include "V8TestObjectA.h"
62 #endif
63
64 #if ENABLE(Condition1) && ENABLE(Condition2)
65 #include "V8TestObjectB.h"
66 #endif
67
68 #if ENABLE(Condition1) || ENABLE(Condition2)
69 #include "V8TestObjectC.h"
70 #endif
71
72 namespace WebCore {
73
74 WrapperTypeInfo V8TestObj::info = { V8TestObj::GetTemplate, V8TestObj::derefObject, 0, 0, 0 };
75
76 namespace TestObjInternal {
77
78 template <typename T> void V8_USE(T) { }
79
80 static v8::Handle<v8::Value> readOnlyIntAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
81 {
82     INC_STATS("DOM.TestObj.readOnlyIntAttr._get");
83     TestObj* imp = V8TestObj::toNative(info.Holder());
84     return v8::Integer::New(imp->readOnlyIntAttr());
85 }
86
87 static v8::Handle<v8::Value> readOnlyStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
88 {
89     INC_STATS("DOM.TestObj.readOnlyStringAttr._get");
90     TestObj* imp = V8TestObj::toNative(info.Holder());
91     return v8String(imp->readOnlyStringAttr());
92 }
93
94 static v8::Handle<v8::Value> readOnlyTestObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
95 {
96     INC_STATS("DOM.TestObj.readOnlyTestObjAttr._get");
97     TestObj* imp = V8TestObj::toNative(info.Holder());
98     RefPtr<TestObj> result = imp->readOnlyTestObjAttr();
99     v8::Handle<v8::Value> wrapper = result.get() ? getDOMObjectMap().get(result.get()) : v8::Handle<v8::Object>();
100     if (wrapper.IsEmpty()) {
101         wrapper = toV8(result.get());
102         if (!wrapper.IsEmpty())
103             V8DOMWrapper::setNamedHiddenReference(info.Holder(), "readOnlyTestObjAttr", wrapper);
104     }
105     return wrapper;
106 }
107
108 static v8::Handle<v8::Value> shortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
109 {
110     INC_STATS("DOM.TestObj.shortAttr._get");
111     TestObj* imp = V8TestObj::toNative(info.Holder());
112     return v8::Integer::New(imp->shortAttr());
113 }
114
115 static void shortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
116 {
117     INC_STATS("DOM.TestObj.shortAttr._set");
118     TestObj* imp = V8TestObj::toNative(info.Holder());
119     int v = toInt32(value);
120     imp->setShortAttr(v);
121     return;
122 }
123
124 static v8::Handle<v8::Value> unsignedShortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
125 {
126     INC_STATS("DOM.TestObj.unsignedShortAttr._get");
127     TestObj* imp = V8TestObj::toNative(info.Holder());
128     return v8::Integer::New(imp->unsignedShortAttr());
129 }
130
131 static void unsignedShortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
132 {
133     INC_STATS("DOM.TestObj.unsignedShortAttr._set");
134     TestObj* imp = V8TestObj::toNative(info.Holder());
135     int v = toUInt32(value);
136     imp->setUnsignedShortAttr(v);
137     return;
138 }
139
140 static v8::Handle<v8::Value> intAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
141 {
142     INC_STATS("DOM.TestObj.intAttr._get");
143     TestObj* imp = V8TestObj::toNative(info.Holder());
144     return v8::Integer::New(imp->intAttr());
145 }
146
147 static void intAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
148 {
149     INC_STATS("DOM.TestObj.intAttr._set");
150     TestObj* imp = V8TestObj::toNative(info.Holder());
151     int v = toInt32(value);
152     imp->setIntAttr(v);
153     return;
154 }
155
156 static v8::Handle<v8::Value> longLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
157 {
158     INC_STATS("DOM.TestObj.longLongAttr._get");
159     TestObj* imp = V8TestObj::toNative(info.Holder());
160     return v8::Number::New(static_cast<double>(imp->longLongAttr()));
161 }
162
163 static void longLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
164 {
165     INC_STATS("DOM.TestObj.longLongAttr._set");
166     TestObj* imp = V8TestObj::toNative(info.Holder());
167     long long v = toInt64(value);
168     imp->setLongLongAttr(WTF::getPtr(v));
169     return;
170 }
171
172 static v8::Handle<v8::Value> unsignedLongLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
173 {
174     INC_STATS("DOM.TestObj.unsignedLongLongAttr._get");
175     TestObj* imp = V8TestObj::toNative(info.Holder());
176     return v8::Number::New(static_cast<double>(imp->unsignedLongLongAttr()));
177 }
178
179 static void unsignedLongLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
180 {
181     INC_STATS("DOM.TestObj.unsignedLongLongAttr._set");
182     TestObj* imp = V8TestObj::toNative(info.Holder());
183     unsigned long long v = toInt64(value);
184     imp->setUnsignedLongLongAttr(WTF::getPtr(v));
185     return;
186 }
187
188 static v8::Handle<v8::Value> stringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
189 {
190     INC_STATS("DOM.TestObj.stringAttr._get");
191     TestObj* imp = V8TestObj::toNative(info.Holder());
192     return v8String(imp->stringAttr());
193 }
194
195 static void stringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
196 {
197     INC_STATS("DOM.TestObj.stringAttr._set");
198     TestObj* imp = V8TestObj::toNative(info.Holder());
199     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value);
200     imp->setStringAttr(v);
201     return;
202 }
203
204 static v8::Handle<v8::Value> testObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
205 {
206     INC_STATS("DOM.TestObj.testObjAttr._get");
207     TestObj* imp = V8TestObj::toNative(info.Holder());
208     return toV8(imp->testObjAttr());
209 }
210
211 static void testObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
212 {
213     INC_STATS("DOM.TestObj.testObjAttr._set");
214     TestObj* imp = V8TestObj::toNative(info.Holder());
215     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
216     imp->setTestObjAttr(WTF::getPtr(v));
217     return;
218 }
219
220 static v8::Handle<v8::Value> XMLObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
221 {
222     INC_STATS("DOM.TestObj.XMLObjAttr._get");
223     TestObj* imp = V8TestObj::toNative(info.Holder());
224     return toV8(imp->xmlObjAttr());
225 }
226
227 static void XMLObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
228 {
229     INC_STATS("DOM.TestObj.XMLObjAttr._set");
230     TestObj* imp = V8TestObj::toNative(info.Holder());
231     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
232     imp->setXMLObjAttr(WTF::getPtr(v));
233     return;
234 }
235
236 static v8::Handle<v8::Value> createAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
237 {
238     INC_STATS("DOM.TestObj.create._get");
239     TestObj* imp = V8TestObj::toNative(info.Holder());
240     return v8Boolean(imp->isCreate());
241 }
242
243 static void createAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
244 {
245     INC_STATS("DOM.TestObj.create._set");
246     TestObj* imp = V8TestObj::toNative(info.Holder());
247     bool v = value->BooleanValue();
248     imp->setCreate(v);
249     return;
250 }
251
252 static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
253 {
254     INC_STATS("DOM.TestObj.reflectedStringAttr._get");
255     TestObj* imp = V8TestObj::toNative(info.Holder());
256     return v8String(imp->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr));
257 }
258
259 static void reflectedStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
260 {
261     INC_STATS("DOM.TestObj.reflectedStringAttr._set");
262     TestObj* imp = V8TestObj::toNative(info.Holder());
263     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
264     imp->setAttribute(WebCore::HTMLNames::reflectedstringattrAttr, v);
265     return;
266 }
267
268 static v8::Handle<v8::Value> reflectedIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
269 {
270     INC_STATS("DOM.TestObj.reflectedIntegralAttr._get");
271     TestObj* imp = V8TestObj::toNative(info.Holder());
272     return v8::Integer::New(imp->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr));
273 }
274
275 static void reflectedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
276 {
277     INC_STATS("DOM.TestObj.reflectedIntegralAttr._set");
278     TestObj* imp = V8TestObj::toNative(info.Holder());
279     int v = toInt32(value);
280     imp->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, v);
281     return;
282 }
283
284 static v8::Handle<v8::Value> reflectedUnsignedIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
285 {
286     INC_STATS("DOM.TestObj.reflectedUnsignedIntegralAttr._get");
287     TestObj* imp = V8TestObj::toNative(info.Holder());
288     return v8::Integer::NewFromUnsigned(std::max(0, imp->getIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr)));
289 }
290
291 static void reflectedUnsignedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
292 {
293     INC_STATS("DOM.TestObj.reflectedUnsignedIntegralAttr._set");
294     TestObj* imp = V8TestObj::toNative(info.Holder());
295     unsigned v = toUInt32(value);
296     imp->setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, v);
297     return;
298 }
299
300 static v8::Handle<v8::Value> reflectedBooleanAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
301 {
302     INC_STATS("DOM.TestObj.reflectedBooleanAttr._get");
303     TestObj* imp = V8TestObj::toNative(info.Holder());
304     return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr));
305 }
306
307 static void reflectedBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
308 {
309     INC_STATS("DOM.TestObj.reflectedBooleanAttr._set");
310     TestObj* imp = V8TestObj::toNative(info.Holder());
311     bool v = value->BooleanValue();
312     imp->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, v);
313     return;
314 }
315
316 static v8::Handle<v8::Value> reflectedURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
317 {
318     INC_STATS("DOM.TestObj.reflectedURLAttr._get");
319     TestObj* imp = V8TestObj::toNative(info.Holder());
320     return v8String(imp->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr));
321 }
322
323 static void reflectedURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
324 {
325     INC_STATS("DOM.TestObj.reflectedURLAttr._set");
326     TestObj* imp = V8TestObj::toNative(info.Holder());
327     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
328     imp->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, v);
329     return;
330 }
331
332 static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
333 {
334     INC_STATS("DOM.TestObj.reflectedStringAttr._get");
335     TestObj* imp = V8TestObj::toNative(info.Holder());
336     return v8String(imp->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr));
337 }
338
339 static void reflectedStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
340 {
341     INC_STATS("DOM.TestObj.reflectedStringAttr._set");
342     TestObj* imp = V8TestObj::toNative(info.Holder());
343     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
344     imp->setAttribute(WebCore::HTMLNames::customContentStringAttrAttr, v);
345     return;
346 }
347
348 static v8::Handle<v8::Value> reflectedCustomIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
349 {
350     INC_STATS("DOM.TestObj.reflectedCustomIntegralAttr._get");
351     TestObj* imp = V8TestObj::toNative(info.Holder());
352     return v8::Integer::New(imp->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr));
353 }
354
355 static void reflectedCustomIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
356 {
357     INC_STATS("DOM.TestObj.reflectedCustomIntegralAttr._set");
358     TestObj* imp = V8TestObj::toNative(info.Holder());
359     int v = toInt32(value);
360     imp->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, v);
361     return;
362 }
363
364 static v8::Handle<v8::Value> reflectedCustomBooleanAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
365 {
366     INC_STATS("DOM.TestObj.reflectedCustomBooleanAttr._get");
367     TestObj* imp = V8TestObj::toNative(info.Holder());
368     return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr));
369 }
370
371 static void reflectedCustomBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
372 {
373     INC_STATS("DOM.TestObj.reflectedCustomBooleanAttr._set");
374     TestObj* imp = V8TestObj::toNative(info.Holder());
375     bool v = value->BooleanValue();
376     imp->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, v);
377     return;
378 }
379
380 static v8::Handle<v8::Value> reflectedCustomURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
381 {
382     INC_STATS("DOM.TestObj.reflectedCustomURLAttr._get");
383     TestObj* imp = V8TestObj::toNative(info.Holder());
384     return v8String(imp->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr));
385 }
386
387 static void reflectedCustomURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
388 {
389     INC_STATS("DOM.TestObj.reflectedCustomURLAttr._set");
390     TestObj* imp = V8TestObj::toNative(info.Holder());
391     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value);
392     imp->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, v);
393     return;
394 }
395
396 static v8::Handle<v8::Value> attrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
397 {
398     INC_STATS("DOM.TestObj.attrWithGetterException._get");
399     TestObj* imp = V8TestObj::toNative(info.Holder());
400     ExceptionCode ec = 0;
401     int v = imp->attrWithGetterException(ec);
402     if (UNLIKELY(ec)) {
403         V8Proxy::setDOMException(ec);
404         return v8::Handle<v8::Value>();
405     }
406     return v8::Integer::New(v);
407 }
408
409 static void attrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
410 {
411     INC_STATS("DOM.TestObj.attrWithGetterException._set");
412     TestObj* imp = V8TestObj::toNative(info.Holder());
413     int v = toInt32(value);
414     ExceptionCode ec = 0;
415     imp->setAttrWithGetterException(v, ec);
416     if (UNLIKELY(ec))
417         V8Proxy::setDOMException(ec);
418     return;
419 }
420
421 static v8::Handle<v8::Value> attrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
422 {
423     INC_STATS("DOM.TestObj.attrWithSetterException._get");
424     TestObj* imp = V8TestObj::toNative(info.Holder());
425     return v8::Integer::New(imp->attrWithSetterException());
426 }
427
428 static void attrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
429 {
430     INC_STATS("DOM.TestObj.attrWithSetterException._set");
431     TestObj* imp = V8TestObj::toNative(info.Holder());
432     int v = toInt32(value);
433     ExceptionCode ec = 0;
434     imp->setAttrWithSetterException(v, ec);
435     if (UNLIKELY(ec))
436         V8Proxy::setDOMException(ec);
437     return;
438 }
439
440 static v8::Handle<v8::Value> stringAttrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
441 {
442     INC_STATS("DOM.TestObj.stringAttrWithGetterException._get");
443     TestObj* imp = V8TestObj::toNative(info.Holder());
444     ExceptionCode ec = 0;
445     String v = imp->stringAttrWithGetterException(ec);
446     if (UNLIKELY(ec)) {
447         V8Proxy::setDOMException(ec);
448         return v8::Handle<v8::Value>();
449     }
450     return v8String(v);
451 }
452
453 static void stringAttrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
454 {
455     INC_STATS("DOM.TestObj.stringAttrWithGetterException._set");
456     TestObj* imp = V8TestObj::toNative(info.Holder());
457     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value);
458     ExceptionCode ec = 0;
459     imp->setStringAttrWithGetterException(v, ec);
460     if (UNLIKELY(ec))
461         V8Proxy::setDOMException(ec);
462     return;
463 }
464
465 static v8::Handle<v8::Value> stringAttrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
466 {
467     INC_STATS("DOM.TestObj.stringAttrWithSetterException._get");
468     TestObj* imp = V8TestObj::toNative(info.Holder());
469     return v8String(imp->stringAttrWithSetterException());
470 }
471
472 static void stringAttrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
473 {
474     INC_STATS("DOM.TestObj.stringAttrWithSetterException._set");
475     TestObj* imp = V8TestObj::toNative(info.Holder());
476     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value);
477     ExceptionCode ec = 0;
478     imp->setStringAttrWithSetterException(v, ec);
479     if (UNLIKELY(ec))
480         V8Proxy::setDOMException(ec);
481     return;
482 }
483
484 static v8::Handle<v8::Value> withScriptStateAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
485 {
486     INC_STATS("DOM.TestObj.withScriptStateAttribute._get");
487     TestObj* imp = V8TestObj::toNative(info.Holder());
488     ScriptState* state = ScriptState::current();
489     if (!state)
490         return v8::Undefined();
491     return v8::Integer::New(imp->withScriptStateAttribute(state));
492 }
493
494 static void withScriptStateAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
495 {
496     INC_STATS("DOM.TestObj.withScriptStateAttribute._set");
497     TestObj* imp = V8TestObj::toNative(info.Holder());
498     int v = toInt32(value);
499     ScriptState* state = ScriptState::current();
500     if (!state)
501         return;
502     imp->setWithScriptStateAttribute(state, v);
503     if (state.hadException())
504         throwError(state.exception());
505     return;
506 }
507
508 static v8::Handle<v8::Value> withScriptExecutionContextAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
509 {
510     INC_STATS("DOM.TestObj.withScriptExecutionContextAttribute._get");
511     TestObj* imp = V8TestObj::toNative(info.Holder());
512     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
513     if (!scriptContext)
514         return v8::Undefined();
515     return toV8(imp->withScriptExecutionContextAttribute(scriptContext));
516 }
517
518 static void withScriptExecutionContextAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
519 {
520     INC_STATS("DOM.TestObj.withScriptExecutionContextAttribute._set");
521     TestObj* imp = V8TestObj::toNative(info.Holder());
522     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
523     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
524     if (!scriptContext)
525         return;
526     imp->setWithScriptExecutionContextAttribute(scriptContext, WTF::getPtr(v));
527     return;
528 }
529
530 static v8::Handle<v8::Value> withScriptStateAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
531 {
532     INC_STATS("DOM.TestObj.withScriptStateAttributeRaises._get");
533     TestObj* imp = V8TestObj::toNative(info.Holder());
534     ExceptionCode ec = 0;
535     ScriptState* state = ScriptState::current();
536     if (!state)
537         return v8::Undefined();
538     RefPtr<TestObj> v = imp->withScriptStateAttributeRaises(state, ec);
539     if (UNLIKELY(ec)) {
540         V8Proxy::setDOMException(ec);
541         return v8::Handle<v8::Value>();
542     }
543     if (state.hadException())
544         return throwError(state.exception());
545     return toV8(v.release());
546 }
547
548 static void withScriptStateAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
549 {
550     INC_STATS("DOM.TestObj.withScriptStateAttributeRaises._set");
551     TestObj* imp = V8TestObj::toNative(info.Holder());
552     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
553     ExceptionCode ec = 0;
554     ScriptState* state = ScriptState::current();
555     if (!state)
556         return;
557     imp->setWithScriptStateAttributeRaises(state, WTF::getPtr(v), ec);
558     if (UNLIKELY(ec))
559         V8Proxy::setDOMException(ec);
560     if (state.hadException())
561         throwError(state.exception());
562     return;
563 }
564
565 static v8::Handle<v8::Value> withScriptExecutionContextAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
566 {
567     INC_STATS("DOM.TestObj.withScriptExecutionContextAttributeRaises._get");
568     TestObj* imp = V8TestObj::toNative(info.Holder());
569     ExceptionCode ec = 0;
570     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
571     if (!scriptContext)
572         return v8::Undefined();
573     RefPtr<TestObj> v = imp->withScriptExecutionContextAttributeRaises(scriptContext, ec);
574     if (UNLIKELY(ec)) {
575         V8Proxy::setDOMException(ec);
576         return v8::Handle<v8::Value>();
577     }
578     return toV8(v.release());
579 }
580
581 static void withScriptExecutionContextAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
582 {
583     INC_STATS("DOM.TestObj.withScriptExecutionContextAttributeRaises._set");
584     TestObj* imp = V8TestObj::toNative(info.Holder());
585     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
586     ExceptionCode ec = 0;
587     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
588     if (!scriptContext)
589         return;
590     imp->setWithScriptExecutionContextAttributeRaises(scriptContext, WTF::getPtr(v), ec);
591     if (UNLIKELY(ec))
592         V8Proxy::setDOMException(ec);
593     return;
594 }
595
596 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
597 {
598     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateAttribute._get");
599     TestObj* imp = V8TestObj::toNative(info.Holder());
600     ScriptState* state = ScriptState::current();
601     if (!state)
602         return v8::Undefined();
603     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
604     if (!scriptContext)
605         return v8::Undefined();
606     return toV8(imp->withScriptExecutionContextAndScriptStateAttribute(state, scriptContext));
607 }
608
609 static void withScriptExecutionContextAndScriptStateAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
610 {
611     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateAttribute._set");
612     TestObj* imp = V8TestObj::toNative(info.Holder());
613     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
614     ScriptState* state = ScriptState::current();
615     if (!state)
616         return;
617     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
618     if (!scriptContext)
619         return;
620     imp->setWithScriptExecutionContextAndScriptStateAttribute(state, scriptContext, WTF::getPtr(v));
621     if (state.hadException())
622         throwError(state.exception());
623     return;
624 }
625
626 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
627 {
628     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateAttributeRaises._get");
629     TestObj* imp = V8TestObj::toNative(info.Holder());
630     ExceptionCode ec = 0;
631     ScriptState* state = ScriptState::current();
632     if (!state)
633         return v8::Undefined();
634     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
635     if (!scriptContext)
636         return v8::Undefined();
637     RefPtr<TestObj> v = imp->withScriptExecutionContextAndScriptStateAttributeRaises(state, scriptContext, ec);
638     if (UNLIKELY(ec)) {
639         V8Proxy::setDOMException(ec);
640         return v8::Handle<v8::Value>();
641     }
642     if (state.hadException())
643         return throwError(state.exception());
644     return toV8(v.release());
645 }
646
647 static void withScriptExecutionContextAndScriptStateAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
648 {
649     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateAttributeRaises._set");
650     TestObj* imp = V8TestObj::toNative(info.Holder());
651     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
652     ExceptionCode ec = 0;
653     ScriptState* state = ScriptState::current();
654     if (!state)
655         return;
656     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
657     if (!scriptContext)
658         return;
659     imp->setWithScriptExecutionContextAndScriptStateAttributeRaises(state, scriptContext, WTF::getPtr(v), ec);
660     if (UNLIKELY(ec))
661         V8Proxy::setDOMException(ec);
662     if (state.hadException())
663         throwError(state.exception());
664     return;
665 }
666
667 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
668 {
669     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateWithSpacesAttribute._get");
670     TestObj* imp = V8TestObj::toNative(info.Holder());
671     ScriptState* state = ScriptState::current();
672     if (!state)
673         return v8::Undefined();
674     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
675     if (!scriptContext)
676         return v8::Undefined();
677     return toV8(imp->withScriptExecutionContextAndScriptStateWithSpacesAttribute(state, scriptContext));
678 }
679
680 static void withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
681 {
682     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateWithSpacesAttribute._set");
683     TestObj* imp = V8TestObj::toNative(info.Holder());
684     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
685     ScriptState* state = ScriptState::current();
686     if (!state)
687         return;
688     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
689     if (!scriptContext)
690         return;
691     imp->setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(state, scriptContext, WTF::getPtr(v));
692     if (state.hadException())
693         throwError(state.exception());
694     return;
695 }
696
697 static v8::Handle<v8::Value> withScriptArgumentsAndCallStackAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
698 {
699     INC_STATS("DOM.TestObj.withScriptArgumentsAndCallStackAttribute._get");
700     TestObj* imp = V8TestObj::toNative(info.Holder());
701     RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector());
702     if (!callStack)
703         return v8::Undefined();
704     return toV8(imp->withScriptArgumentsAndCallStackAttribute(callStack));
705 }
706
707 static void withScriptArgumentsAndCallStackAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
708 {
709     INC_STATS("DOM.TestObj.withScriptArgumentsAndCallStackAttribute._set");
710     TestObj* imp = V8TestObj::toNative(info.Holder());
711     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
712     RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector());
713     if (!callStack)
714         return v8::Undefined();
715     imp->setWithScriptArgumentsAndCallStackAttribute(callStack, WTF::getPtr(v));
716     return;
717 }
718
719 #if ENABLE(Condition1)
720
721 static v8::Handle<v8::Value> conditionalAttr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
722 {
723     INC_STATS("DOM.TestObj.conditionalAttr1._get");
724     TestObj* imp = V8TestObj::toNative(info.Holder());
725     return v8::Integer::New(imp->conditionalAttr1());
726 }
727
728 #endif // ENABLE(Condition1)
729
730 #if ENABLE(Condition1)
731
732 static void conditionalAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
733 {
734     INC_STATS("DOM.TestObj.conditionalAttr1._set");
735     TestObj* imp = V8TestObj::toNative(info.Holder());
736     int v = toInt32(value);
737     imp->setConditionalAttr1(v);
738     return;
739 }
740
741 #endif // ENABLE(Condition1)
742
743 #if ENABLE(Condition1) && ENABLE(Condition2)
744
745 static v8::Handle<v8::Value> conditionalAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
746 {
747     INC_STATS("DOM.TestObj.conditionalAttr2._get");
748     TestObj* imp = V8TestObj::toNative(info.Holder());
749     return v8::Integer::New(imp->conditionalAttr2());
750 }
751
752 #endif // ENABLE(Condition1) && ENABLE(Condition2)
753
754 #if ENABLE(Condition1) && ENABLE(Condition2)
755
756 static void conditionalAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
757 {
758     INC_STATS("DOM.TestObj.conditionalAttr2._set");
759     TestObj* imp = V8TestObj::toNative(info.Holder());
760     int v = toInt32(value);
761     imp->setConditionalAttr2(v);
762     return;
763 }
764
765 #endif // ENABLE(Condition1) && ENABLE(Condition2)
766
767 #if ENABLE(Condition1) || ENABLE(Condition2)
768
769 static v8::Handle<v8::Value> conditionalAttr3AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
770 {
771     INC_STATS("DOM.TestObj.conditionalAttr3._get");
772     TestObj* imp = V8TestObj::toNative(info.Holder());
773     return v8::Integer::New(imp->conditionalAttr3());
774 }
775
776 #endif // ENABLE(Condition1) || ENABLE(Condition2)
777
778 #if ENABLE(Condition1) || ENABLE(Condition2)
779
780 static void conditionalAttr3AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
781 {
782     INC_STATS("DOM.TestObj.conditionalAttr3._set");
783     TestObj* imp = V8TestObj::toNative(info.Holder());
784     int v = toInt32(value);
785     imp->setConditionalAttr3(v);
786     return;
787 }
788
789 #endif // ENABLE(Condition1) || ENABLE(Condition2)
790
791 static v8::Handle<v8::Value> cachedAttribute1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
792 {
793     INC_STATS("DOM.TestObj.cachedAttribute1._get");
794     TestObj* imp = V8TestObj::toNative(info.Holder());
795     RefPtr<any> result = imp->cachedAttribute1();
796     v8::Handle<v8::Value> wrapper = result.get() ? getDOMObjectMap().get(result.get()) : v8::Handle<v8::Object>();
797     if (wrapper.IsEmpty()) {
798         wrapper = toV8(result.get());
799         if (!wrapper.IsEmpty())
800             V8DOMWrapper::setNamedHiddenReference(info.Holder(), "cachedAttribute1", wrapper);
801     }
802     return wrapper;
803 }
804
805 static v8::Handle<v8::Value> cachedAttribute2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
806 {
807     INC_STATS("DOM.TestObj.cachedAttribute2._get");
808     TestObj* imp = V8TestObj::toNative(info.Holder());
809     RefPtr<any> result = imp->cachedAttribute2();
810     v8::Handle<v8::Value> wrapper = result.get() ? getDOMObjectMap().get(result.get()) : v8::Handle<v8::Object>();
811     if (wrapper.IsEmpty()) {
812         wrapper = toV8(result.get());
813         if (!wrapper.IsEmpty())
814             V8DOMWrapper::setNamedHiddenReference(info.Holder(), "cachedAttribute2", wrapper);
815     }
816     return wrapper;
817 }
818
819 static v8::Handle<v8::Value> enabledAtRuntimeAttr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
820 {
821     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr1._get");
822     TestObj* imp = V8TestObj::toNative(info.Holder());
823     return v8::Integer::New(imp->enabledAtRuntimeAttr1());
824 }
825
826 static void enabledAtRuntimeAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
827 {
828     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr1._set");
829     TestObj* imp = V8TestObj::toNative(info.Holder());
830     int v = toInt32(value);
831     imp->setEnabledAtRuntimeAttr1(v);
832     return;
833 }
834
835 static v8::Handle<v8::Value> enabledAtRuntimeAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
836 {
837     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr2._get");
838     TestObj* imp = V8TestObj::toNative(info.Holder());
839     return v8::Integer::New(imp->enabledAtRuntimeAttr2());
840 }
841
842 static void enabledAtRuntimeAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
843 {
844     INC_STATS("DOM.TestObj.enabledAtRuntimeAttr2._set");
845     TestObj* imp = V8TestObj::toNative(info.Holder());
846     int v = toInt32(value);
847     imp->setEnabledAtRuntimeAttr2(v);
848     return;
849 }
850
851 static v8::Handle<v8::Value> floatArrayAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
852 {
853     INC_STATS("DOM.TestObj.floatArray._get");
854     TestObj* imp = V8TestObj::toNative(info.Holder());
855     return v8NumberArray(imp->floatArray());
856 }
857
858 static void floatArrayAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
859 {
860     INC_STATS("DOM.TestObj.floatArray._set");
861     TestObj* imp = V8TestObj::toNative(info.Holder());
862     Vector<float> v = v8NumberArrayToVector<float>(value);
863     imp->setFloatArray(v);
864     return;
865 }
866
867 static v8::Handle<v8::Value> doubleArrayAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
868 {
869     INC_STATS("DOM.TestObj.doubleArray._get");
870     TestObj* imp = V8TestObj::toNative(info.Holder());
871     return v8NumberArray(imp->doubleArray());
872 }
873
874 static void doubleArrayAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
875 {
876     INC_STATS("DOM.TestObj.doubleArray._set");
877     TestObj* imp = V8TestObj::toNative(info.Holder());
878     Vector<double> v = v8NumberArrayToVector<double>(value);
879     imp->setDoubleArray(v);
880     return;
881 }
882
883 static v8::Handle<v8::Value> contentDocumentAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
884 {
885     INC_STATS("DOM.TestObj.contentDocument._get");
886     TestObj* imp = V8TestObj::toNative(info.Holder());
887     if (!V8BindingSecurity::shouldAllowAccessToNode(V8BindingState::Only(), imp->contentDocument()))
888         return v8::Handle<v8::Value>(v8::Null());
889
890     return toV8(imp->contentDocument());
891 }
892
893 static v8::Handle<v8::Value> mutablePointAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
894 {
895     INC_STATS("DOM.TestObj.mutablePoint._get");
896     TestObj* imp = V8TestObj::toNative(info.Holder());
897     return toV8(WTF::getPtr(SVGStaticPropertyTearOff<TestObj, FloatPoint>::create(imp, imp->mutablePoint(), &TestObj::updateMutablePoint)));
898 }
899
900 static void mutablePointAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
901 {
902     INC_STATS("DOM.TestObj.mutablePoint._set");
903     TestObj* imp = V8TestObj::toNative(info.Holder());
904     RefPtr<SVGPropertyTearOff<FloatPoint> > v = V8SVGPoint::HasInstance(value) ? V8SVGPoint::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
905     imp->setMutablePoint(WTF::getPtr(v));
906     return;
907 }
908
909 static v8::Handle<v8::Value> immutablePointAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
910 {
911     INC_STATS("DOM.TestObj.immutablePoint._get");
912     TestObj* imp = V8TestObj::toNative(info.Holder());
913     return toV8(WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(imp->immutablePoint())));
914 }
915
916 static void immutablePointAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
917 {
918     INC_STATS("DOM.TestObj.immutablePoint._set");
919     TestObj* imp = V8TestObj::toNative(info.Holder());
920     RefPtr<SVGPropertyTearOff<FloatPoint> > v = V8SVGPoint::HasInstance(value) ? V8SVGPoint::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
921     imp->setImmutablePoint(WTF::getPtr(v));
922     return;
923 }
924
925 static v8::Handle<v8::Value> strictFloatAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
926 {
927     INC_STATS("DOM.TestObj.strictFloat._get");
928     TestObj* imp = V8TestObj::toNative(info.Holder());
929     return v8::Number::New(imp->strictFloat());
930 }
931
932 static void strictFloatAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
933 {
934     INC_STATS("DOM.TestObj.strictFloat._set");
935     TestObj* imp = V8TestObj::toNative(info.Holder());
936     float v = static_cast<float>(value->NumberValue());
937     imp->setStrictFloat(v);
938     return;
939 }
940
941 static v8::Handle<v8::Value> descriptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
942 {
943     INC_STATS("DOM.TestObj.description._get");
944     TestObj* imp = V8TestObj::toNative(info.Holder());
945     return v8::Integer::New(imp->description());
946 }
947
948 static v8::Handle<v8::Value> idAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
949 {
950     INC_STATS("DOM.TestObj.id._get");
951     TestObj* imp = V8TestObj::toNative(info.Holder());
952     return v8::Integer::New(imp->id());
953 }
954
955 static void idAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
956 {
957     INC_STATS("DOM.TestObj.id._set");
958     TestObj* imp = V8TestObj::toNative(info.Holder());
959     int v = toInt32(value);
960     imp->setId(v);
961     return;
962 }
963
964 static v8::Handle<v8::Value> hashAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
965 {
966     INC_STATS("DOM.TestObj.hash._get");
967     TestObj* imp = V8TestObj::toNative(info.Holder());
968     return v8String(imp->hash());
969 }
970
971 static v8::Handle<v8::Value> TestObjConstructorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
972 {
973     INC_STATS("DOM.TestObj.constructors._get");
974     v8::Handle<v8::Value> data = info.Data();
975     ASSERT(data->IsExternal() || data->IsNumber());
976     WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data);
977     return v8::Handle<v8::Value>();}
978
979 static v8::Handle<v8::Value> voidMethodCallback(const v8::Arguments& args)
980 {
981     INC_STATS("DOM.TestObj.voidMethod");
982     TestObj* imp = V8TestObj::toNative(args.Holder());
983     imp->voidMethod();
984     return v8::Handle<v8::Value>();
985 }
986
987 static v8::Handle<v8::Value> voidMethodWithArgsCallback(const v8::Arguments& args)
988 {
989     INC_STATS("DOM.TestObj.voidMethodWithArgs");
990     if (args.Length() < 3)
991         return throwError("Not enough arguments", V8Proxy::TypeError);
992     TestObj* imp = V8TestObj::toNative(args.Holder());
993     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
994     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
995     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))) : 0);
996     imp->voidMethodWithArgs(intArg, strArg, objArg);
997     return v8::Handle<v8::Value>();
998 }
999
1000 static v8::Handle<v8::Value> intMethodCallback(const v8::Arguments& args)
1001 {
1002     INC_STATS("DOM.TestObj.intMethod");
1003     TestObj* imp = V8TestObj::toNative(args.Holder());
1004     return v8::Integer::New(imp->intMethod());
1005 }
1006
1007 static v8::Handle<v8::Value> intMethodWithArgsCallback(const v8::Arguments& args)
1008 {
1009     INC_STATS("DOM.TestObj.intMethodWithArgs");
1010     if (args.Length() < 3)
1011         return throwError("Not enough arguments", V8Proxy::TypeError);
1012     TestObj* imp = V8TestObj::toNative(args.Holder());
1013     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1014     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
1015     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))) : 0);
1016     return v8::Integer::New(imp->intMethodWithArgs(intArg, strArg, objArg));
1017 }
1018
1019 static v8::Handle<v8::Value> objMethodCallback(const v8::Arguments& args)
1020 {
1021     INC_STATS("DOM.TestObj.objMethod");
1022     TestObj* imp = V8TestObj::toNative(args.Holder());
1023     return toV8(imp->objMethod());
1024 }
1025
1026 static v8::Handle<v8::Value> objMethodWithArgsCallback(const v8::Arguments& args)
1027 {
1028     INC_STATS("DOM.TestObj.objMethodWithArgs");
1029     if (args.Length() < 3)
1030         return throwError("Not enough arguments", V8Proxy::TypeError);
1031     TestObj* imp = V8TestObj::toNative(args.Holder());
1032     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1033     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
1034     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))) : 0);
1035     return toV8(imp->objMethodWithArgs(intArg, strArg, objArg));
1036 }
1037
1038 static v8::Handle<v8::Value> methodThatRequiresAllArgsAndThrowsCallback(const v8::Arguments& args)
1039 {
1040     INC_STATS("DOM.TestObj.methodThatRequiresAllArgsAndThrows");
1041     if (args.Length() < 2)
1042         return throwError("Not enough arguments", V8Proxy::TypeError);
1043     TestObj* imp = V8TestObj::toNative(args.Holder());
1044     ExceptionCode ec = 0;
1045     {
1046     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1047     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined))) : 0);
1048     RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec);
1049     if (UNLIKELY(ec))
1050         goto fail;
1051     return toV8(result.release());
1052     }
1053     fail:
1054     V8Proxy::setDOMException(ec);
1055     return v8::Handle<v8::Value>();
1056 }
1057
1058 static v8::Handle<v8::Value> serializedValueCallback(const v8::Arguments& args)
1059 {
1060     INC_STATS("DOM.TestObj.serializedValue");
1061     if (args.Length() < 1)
1062         return throwError("Not enough arguments", V8Proxy::TypeError);
1063     TestObj* imp = V8TestObj::toNative(args.Holder());
1064     bool serializedArgDidThrow = false;
1065     RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(args[0], 0, 0, serializedArgDidThrow);
1066     if (serializedArgDidThrow)
1067         return v8::Undefined();
1068     imp->serializedValue(serializedArg);
1069     return v8::Handle<v8::Value>();
1070 }
1071
1072 static v8::Handle<v8::Value> idbKeyCallback(const v8::Arguments& args)
1073 {
1074     INC_STATS("DOM.TestObj.idbKey");
1075     if (args.Length() < 1)
1076         return throwError("Not enough arguments", V8Proxy::TypeError);
1077     TestObj* imp = V8TestObj::toNative(args.Holder());
1078     EXCEPTION_BLOCK(RefPtr<IDBKey>, key, createIDBKeyFromValue(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1079     imp->idbKey(key.get());
1080     return v8::Handle<v8::Value>();
1081 }
1082
1083 static v8::Handle<v8::Value> optionsObjectCallback(const v8::Arguments& args)
1084 {
1085     INC_STATS("DOM.TestObj.optionsObject");
1086     if (args.Length() < 1)
1087         return throwError("Not enough arguments", V8Proxy::TypeError);
1088     TestObj* imp = V8TestObj::toNative(args.Holder());
1089     EXCEPTION_BLOCK(Dictionary, oo, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1090     if (args.Length() > 0 && !oo.isUndefinedOrNull() && !oo.isObject()) {
1091         ec = TYPE_MISMATCH_ERR;
1092         V8Proxy::setDOMException(ec);
1093         return throwError("Not an object.", V8Proxy::TypeError);
1094     }
1095     if (args.Length() <= 1) {
1096         imp->optionsObject(oo);
1097         return v8::Handle<v8::Value>();
1098     }
1099     EXCEPTION_BLOCK(Dictionary, ooo, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
1100     if (args.Length() > 1 && !ooo.isUndefinedOrNull() && !ooo.isObject()) {
1101         ec = TYPE_MISMATCH_ERR;
1102         V8Proxy::setDOMException(ec);
1103         return throwError("Not an object.", V8Proxy::TypeError);
1104     }
1105     imp->optionsObject(oo, ooo);
1106     return v8::Handle<v8::Value>();
1107 }
1108
1109 static v8::Handle<v8::Value> methodWithExceptionCallback(const v8::Arguments& args)
1110 {
1111     INC_STATS("DOM.TestObj.methodWithException");
1112     TestObj* imp = V8TestObj::toNative(args.Holder());
1113     ExceptionCode ec = 0;
1114     {
1115     imp->methodWithException(ec);
1116     if (UNLIKELY(ec))
1117         goto fail;
1118     return v8::Handle<v8::Value>();
1119     }
1120     fail:
1121     V8Proxy::setDOMException(ec);
1122     return v8::Handle<v8::Value>();
1123 }
1124
1125 static v8::Handle<v8::Value> addEventListenerCallback(const v8::Arguments& args)
1126 {
1127     INC_STATS("DOM.TestObj.addEventListener()");
1128     RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOrCreate);
1129     if (listener) {
1130         V8TestObj::toNative(args.Holder())->addEventListener(v8ValueToAtomicWebCoreString(args[0]), listener, args[2]->BooleanValue());
1131         createHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex);
1132     }
1133     return v8::Undefined();
1134 }
1135
1136 static v8::Handle<v8::Value> removeEventListenerCallback(const v8::Arguments& args)
1137 {
1138     INC_STATS("DOM.TestObj.removeEventListener()");
1139     RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOnly);
1140     if (listener) {
1141         V8TestObj::toNative(args.Holder())->removeEventListener(v8ValueToAtomicWebCoreString(args[0]), listener.get(), args[2]->BooleanValue());
1142         removeHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex);
1143     }
1144     return v8::Undefined();
1145 }
1146
1147 static v8::Handle<v8::Value> withScriptStateVoidCallback(const v8::Arguments& args)
1148 {
1149     INC_STATS("DOM.TestObj.withScriptStateVoid");
1150     TestObj* imp = V8TestObj::toNative(args.Holder());
1151     EmptyScriptState state;
1152     imp->withScriptStateVoid(&state);
1153     if (state.hadException())
1154         return throwError(state.exception());
1155     return v8::Handle<v8::Value>();
1156 }
1157
1158 static v8::Handle<v8::Value> withScriptStateObjCallback(const v8::Arguments& args)
1159 {
1160     INC_STATS("DOM.TestObj.withScriptStateObj");
1161     TestObj* imp = V8TestObj::toNative(args.Holder());
1162     EmptyScriptState state;
1163     RefPtr<TestObj> result = imp->withScriptStateObj(&state);
1164     if (state.hadException())
1165         return throwError(state.exception());
1166     return toV8(result.release());
1167 }
1168
1169 static v8::Handle<v8::Value> withScriptStateVoidExceptionCallback(const v8::Arguments& args)
1170 {
1171     INC_STATS("DOM.TestObj.withScriptStateVoidException");
1172     TestObj* imp = V8TestObj::toNative(args.Holder());
1173     ExceptionCode ec = 0;
1174     {
1175     EmptyScriptState state;
1176     imp->withScriptStateVoidException(&state, ec);
1177     if (UNLIKELY(ec))
1178         goto fail;
1179     if (state.hadException())
1180         return throwError(state.exception());
1181     return v8::Handle<v8::Value>();
1182     }
1183     fail:
1184     V8Proxy::setDOMException(ec);
1185     return v8::Handle<v8::Value>();
1186 }
1187
1188 static v8::Handle<v8::Value> withScriptStateObjExceptionCallback(const v8::Arguments& args)
1189 {
1190     INC_STATS("DOM.TestObj.withScriptStateObjException");
1191     TestObj* imp = V8TestObj::toNative(args.Holder());
1192     ExceptionCode ec = 0;
1193     {
1194     EmptyScriptState state;
1195     RefPtr<TestObj> result = imp->withScriptStateObjException(&state, ec);
1196     if (UNLIKELY(ec))
1197         goto fail;
1198     if (state.hadException())
1199         return throwError(state.exception());
1200     return toV8(result.release());
1201     }
1202     fail:
1203     V8Proxy::setDOMException(ec);
1204     return v8::Handle<v8::Value>();
1205 }
1206
1207 static v8::Handle<v8::Value> withScriptExecutionContextCallback(const v8::Arguments& args)
1208 {
1209     INC_STATS("DOM.TestObj.withScriptExecutionContext");
1210     TestObj* imp = V8TestObj::toNative(args.Holder());
1211     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
1212     if (!scriptContext)
1213         return v8::Undefined();
1214     imp->withScriptExecutionContext(scriptContext);
1215     return v8::Handle<v8::Value>();
1216 }
1217
1218 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateCallback(const v8::Arguments& args)
1219 {
1220     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptState");
1221     TestObj* imp = V8TestObj::toNative(args.Holder());
1222     EmptyScriptState state;
1223     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
1224     if (!scriptContext)
1225         return v8::Undefined();
1226     imp->withScriptExecutionContextAndScriptState(&state, scriptContext);
1227     if (state.hadException())
1228         return throwError(state.exception());
1229     return v8::Handle<v8::Value>();
1230 }
1231
1232 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateObjExceptionCallback(const v8::Arguments& args)
1233 {
1234     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateObjException");
1235     TestObj* imp = V8TestObj::toNative(args.Holder());
1236     ExceptionCode ec = 0;
1237     {
1238     EmptyScriptState state;
1239     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
1240     if (!scriptContext)
1241         return v8::Undefined();
1242     RefPtr<TestObj> result = imp->withScriptExecutionContextAndScriptStateObjException(&state, scriptContext, ec);
1243     if (UNLIKELY(ec))
1244         goto fail;
1245     if (state.hadException())
1246         return throwError(state.exception());
1247     return toV8(result.release());
1248     }
1249     fail:
1250     V8Proxy::setDOMException(ec);
1251     return v8::Handle<v8::Value>();
1252 }
1253
1254 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateWithSpacesCallback(const v8::Arguments& args)
1255 {
1256     INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateWithSpaces");
1257     TestObj* imp = V8TestObj::toNative(args.Holder());
1258     EmptyScriptState state;
1259     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
1260     if (!scriptContext)
1261         return v8::Undefined();
1262     RefPtr<TestObj> result = imp->withScriptExecutionContextAndScriptStateWithSpaces(&state, scriptContext);
1263     if (state.hadException())
1264         return throwError(state.exception());
1265     return toV8(result.release());
1266 }
1267
1268 static v8::Handle<v8::Value> withScriptArgumentsAndCallStackCallback(const v8::Arguments& args)
1269 {
1270     INC_STATS("DOM.TestObj.withScriptArgumentsAndCallStack");
1271     TestObj* imp = V8TestObj::toNative(args.Holder());
1272     RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 0));
1273     RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector());
1274     if (!callStack)
1275         return v8::Undefined();
1276     imp->withScriptArgumentsAndCallStack(scriptArguments, callStack);
1277     return v8::Handle<v8::Value>();
1278 }
1279
1280 static v8::Handle<v8::Value> methodWithOptionalArgCallback(const v8::Arguments& args)
1281 {
1282     INC_STATS("DOM.TestObj.methodWithOptionalArg");
1283     TestObj* imp = V8TestObj::toNative(args.Holder());
1284     if (args.Length() <= 0) {
1285         imp->methodWithOptionalArg();
1286         return v8::Handle<v8::Value>();
1287     }
1288     EXCEPTION_BLOCK(int, opt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1289     imp->methodWithOptionalArg(opt);
1290     return v8::Handle<v8::Value>();
1291 }
1292
1293 static v8::Handle<v8::Value> methodWithNonOptionalArgAndOptionalArgCallback(const v8::Arguments& args)
1294 {
1295     INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndOptionalArg");
1296     if (args.Length() < 1)
1297         return throwError("Not enough arguments", V8Proxy::TypeError);
1298     TestObj* imp = V8TestObj::toNative(args.Holder());
1299     EXCEPTION_BLOCK(int, nonOpt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1300     if (args.Length() <= 1) {
1301         imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
1302         return v8::Handle<v8::Value>();
1303     }
1304     EXCEPTION_BLOCK(int, opt, toInt32(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)));
1305     imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
1306     return v8::Handle<v8::Value>();
1307 }
1308
1309 static v8::Handle<v8::Value> methodWithNonOptionalArgAndTwoOptionalArgsCallback(const v8::Arguments& args)
1310 {
1311     INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndTwoOptionalArgs");
1312     if (args.Length() < 1)
1313         return throwError("Not enough arguments", V8Proxy::TypeError);
1314     TestObj* imp = V8TestObj::toNative(args.Holder());
1315     EXCEPTION_BLOCK(int, nonOpt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1316     if (args.Length() <= 1) {
1317         imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
1318         return v8::Handle<v8::Value>();
1319     }
1320     EXCEPTION_BLOCK(int, opt1, toInt32(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)));
1321     if (args.Length() <= 2) {
1322         imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1);
1323         return v8::Handle<v8::Value>();
1324     }
1325     EXCEPTION_BLOCK(int, opt2, toInt32(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)));
1326     imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
1327     return v8::Handle<v8::Value>();
1328 }
1329
1330 static v8::Handle<v8::Value> methodWithOptionalStringCallback(const v8::Arguments& args)
1331 {
1332     INC_STATS("DOM.TestObj.methodWithOptionalString");
1333     TestObj* imp = V8TestObj::toNative(args.Holder());
1334     if (args.Length() <= 0) {
1335         imp->methodWithOptionalString();
1336         return v8::Handle<v8::Value>();
1337     }
1338     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1339     imp->methodWithOptionalString(str);
1340     return v8::Handle<v8::Value>();
1341 }
1342
1343 static v8::Handle<v8::Value> methodWithOptionalStringIsUndefinedCallback(const v8::Arguments& args)
1344 {
1345     INC_STATS("DOM.TestObj.methodWithOptionalStringIsUndefined");
1346     TestObj* imp = V8TestObj::toNative(args.Holder());
1347     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1348     imp->methodWithOptionalStringIsUndefined(str);
1349     return v8::Handle<v8::Value>();
1350 }
1351
1352 static v8::Handle<v8::Value> methodWithOptionalStringIsNullStringCallback(const v8::Arguments& args)
1353 {
1354     INC_STATS("DOM.TestObj.methodWithOptionalStringIsNullString");
1355     TestObj* imp = V8TestObj::toNative(args.Holder());
1356     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsNullString));
1357     imp->methodWithOptionalStringIsNullString(str);
1358     return v8::Handle<v8::Value>();
1359 }
1360
1361 static v8::Handle<v8::Value> methodWithCallbackArgCallback(const v8::Arguments& args)
1362 {
1363     INC_STATS("DOM.TestObj.methodWithCallbackArg");
1364     if (args.Length() < 1)
1365         return throwError("Not enough arguments", V8Proxy::TypeError);
1366     TestObj* imp = V8TestObj::toNative(args.Holder());
1367     if (args.Length() <= 0 || !args[0]->IsObject())
1368         return throwError(TYPE_MISMATCH_ERR);
1369     RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1370     imp->methodWithCallbackArg(callback);
1371     return v8::Handle<v8::Value>();
1372 }
1373
1374 static v8::Handle<v8::Value> methodWithNonCallbackArgAndCallbackArgCallback(const v8::Arguments& args)
1375 {
1376     INC_STATS("DOM.TestObj.methodWithNonCallbackArgAndCallbackArg");
1377     if (args.Length() < 2)
1378         return throwError("Not enough arguments", V8Proxy::TypeError);
1379     TestObj* imp = V8TestObj::toNative(args.Holder());
1380     EXCEPTION_BLOCK(int, nonCallback, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1381     if (args.Length() <= 1 || !args[1]->IsObject())
1382         return throwError(TYPE_MISMATCH_ERR);
1383     RefPtr<TestCallback> callback = V8TestCallback::create(args[1], getScriptExecutionContext());
1384     imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
1385     return v8::Handle<v8::Value>();
1386 }
1387
1388 static v8::Handle<v8::Value> methodWithCallbackAndOptionalArgCallback(const v8::Arguments& args)
1389 {
1390     INC_STATS("DOM.TestObj.methodWithCallbackAndOptionalArg");
1391     TestObj* imp = V8TestObj::toNative(args.Holder());
1392     RefPtr<TestCallback> callback;
1393     if (args.Length() > 0 && !args[0]->IsNull() && !args[0]->IsUndefined()) {
1394         if (!args[0]->IsObject())
1395             return throwError(TYPE_MISMATCH_ERR);
1396         callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1397     }
1398     imp->methodWithCallbackAndOptionalArg(callback);
1399     return v8::Handle<v8::Value>();
1400 }
1401
1402 #if ENABLE(Condition1)
1403
1404 static v8::Handle<v8::Value> conditionalMethod1Callback(const v8::Arguments& args)
1405 {
1406     INC_STATS("DOM.TestObj.conditionalMethod1");
1407     TestObj* imp = V8TestObj::toNative(args.Holder());
1408     return v8String(imp->conditionalMethod1());
1409 }
1410
1411 #endif // ENABLE(Condition1)
1412
1413 #if ENABLE(Condition1) && ENABLE(Condition2)
1414
1415 static v8::Handle<v8::Value> conditionalMethod2Callback(const v8::Arguments& args)
1416 {
1417     INC_STATS("DOM.TestObj.conditionalMethod2");
1418     TestObj* imp = V8TestObj::toNative(args.Holder());
1419     imp->conditionalMethod2();
1420     return v8::Handle<v8::Value>();
1421 }
1422
1423 #endif // ENABLE(Condition1) && ENABLE(Condition2)
1424
1425 #if ENABLE(Condition1) || ENABLE(Condition2)
1426
1427 static v8::Handle<v8::Value> conditionalMethod3Callback(const v8::Arguments& args)
1428 {
1429     INC_STATS("DOM.TestObj.conditionalMethod3");
1430     TestObj* imp = V8TestObj::toNative(args.Holder());
1431     imp->conditionalMethod3();
1432     return v8::Handle<v8::Value>();
1433 }
1434
1435 #endif // ENABLE(Condition1) || ENABLE(Condition2)
1436
1437 static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args)
1438 {
1439     INC_STATS("DOM.TestObj.overloadedMethod1");
1440     if (args.Length() < 2)
1441         return throwError("Not enough arguments", V8Proxy::TypeError);
1442     TestObj* imp = V8TestObj::toNative(args.Holder());
1443     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1444     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
1445     imp->overloadedMethod(objArg, strArg);
1446     return v8::Handle<v8::Value>();
1447 }
1448
1449 static v8::Handle<v8::Value> overloadedMethod2Callback(const v8::Arguments& args)
1450 {
1451     INC_STATS("DOM.TestObj.overloadedMethod2");
1452     if (args.Length() < 1)
1453         return throwError("Not enough arguments", V8Proxy::TypeError);
1454     TestObj* imp = V8TestObj::toNative(args.Holder());
1455     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1456     if (args.Length() <= 1) {
1457         imp->overloadedMethod(objArg);
1458         return v8::Handle<v8::Value>();
1459     }
1460     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)));
1461     imp->overloadedMethod(objArg, intArg);
1462     return v8::Handle<v8::Value>();
1463 }
1464
1465 static v8::Handle<v8::Value> overloadedMethod3Callback(const v8::Arguments& args)
1466 {
1467     INC_STATS("DOM.TestObj.overloadedMethod3");
1468     if (args.Length() < 1)
1469         return throwError("Not enough arguments", V8Proxy::TypeError);
1470     TestObj* imp = V8TestObj::toNative(args.Holder());
1471     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1472     imp->overloadedMethod(strArg);
1473     return v8::Handle<v8::Value>();
1474 }
1475
1476 static v8::Handle<v8::Value> overloadedMethod4Callback(const v8::Arguments& args)
1477 {
1478     INC_STATS("DOM.TestObj.overloadedMethod4");
1479     if (args.Length() < 1)
1480         return throwError("Not enough arguments", V8Proxy::TypeError);
1481     TestObj* imp = V8TestObj::toNative(args.Holder());
1482     EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1483     imp->overloadedMethod(intArg);
1484     return v8::Handle<v8::Value>();
1485 }
1486
1487 static v8::Handle<v8::Value> overloadedMethod5Callback(const v8::Arguments& args)
1488 {
1489     INC_STATS("DOM.TestObj.overloadedMethod5");
1490     if (args.Length() < 1)
1491         return throwError("Not enough arguments", V8Proxy::TypeError);
1492     TestObj* imp = V8TestObj::toNative(args.Holder());
1493     if (args.Length() <= 0 || !args[0]->IsObject())
1494         return throwError(TYPE_MISMATCH_ERR);
1495     RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
1496     imp->overloadedMethod(callback);
1497     return v8::Handle<v8::Value>();
1498 }
1499
1500 static v8::Handle<v8::Value> overloadedMethod6Callback(const v8::Arguments& args)
1501 {
1502     INC_STATS("DOM.TestObj.overloadedMethod6");
1503     if (args.Length() < 1)
1504         return throwError("Not enough arguments", V8Proxy::TypeError);
1505     TestObj* imp = V8TestObj::toNative(args.Holder());
1506     EXCEPTION_BLOCK(RefPtr<DOMStringList>, listArg, v8ValueToWebCoreDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1507     imp->overloadedMethod(listArg);
1508     return v8::Handle<v8::Value>();
1509 }
1510
1511 static v8::Handle<v8::Value> overloadedMethod7Callback(const v8::Arguments& args)
1512 {
1513     INC_STATS("DOM.TestObj.overloadedMethod7");
1514     if (args.Length() < 1)
1515         return throwError("Not enough arguments", V8Proxy::TypeError);
1516     TestObj* imp = V8TestObj::toNative(args.Holder());
1517     EXCEPTION_BLOCK(RefPtr<DOMStringList>, arrayArg, v8ValueToWebCoreDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1518     imp->overloadedMethod(arrayArg);
1519     return v8::Handle<v8::Value>();
1520 }
1521
1522 static v8::Handle<v8::Value> overloadedMethodCallback(const v8::Arguments& args)
1523 {
1524     INC_STATS("DOM.TestObj.overloadedMethod");
1525     if ((args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0])) && (args[1]->IsNull() || args[1]->IsUndefined() || args[1]->IsString() || args[1]->IsObject())))
1526         return overloadedMethod1Callback(args);
1527     if ((args.Length() == 1 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0]))) || (args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0]))))
1528         return overloadedMethod2Callback(args);
1529     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject())))
1530         return overloadedMethod3Callback(args);
1531     if (args.Length() == 1)
1532         return overloadedMethod4Callback(args);
1533     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsObject())))
1534         return overloadedMethod5Callback(args);
1535     if ((args.Length() == 1 && (args[0]->IsNull() || V8DOMStringList::HasInstance(args[0]))))
1536         return overloadedMethod6Callback(args);
1537     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsArray())))
1538         return overloadedMethod7Callback(args);
1539     V8Proxy::throwTypeError();
1540     return notHandledByInterceptor();
1541 }
1542
1543 static v8::Handle<v8::Value> classMethodCallback(const v8::Arguments& args)
1544 {
1545     INC_STATS("DOM.TestObj.classMethod");
1546     TestObj::classMethod();
1547     return v8::Handle<v8::Value>();
1548 }
1549
1550 static v8::Handle<v8::Value> classMethodWithOptionalCallback(const v8::Arguments& args)
1551 {
1552     INC_STATS("DOM.TestObj.classMethodWithOptional");
1553     if (args.Length() <= 0) {
1554         return v8::Integer::New(TestObj::classMethodWithOptional());
1555     }
1556     EXCEPTION_BLOCK(int, arg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1557     return v8::Integer::New(TestObj::classMethodWithOptional(arg));
1558 }
1559
1560 #if ENABLE(Condition1)
1561
1562 static v8::Handle<v8::Value> overloadedMethod11Callback(const v8::Arguments& args)
1563 {
1564     INC_STATS("DOM.TestObj.overloadedMethod11");
1565     if (args.Length() < 1)
1566         return throwError("Not enough arguments", V8Proxy::TypeError);
1567     EXCEPTION_BLOCK(int, arg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1568     TestObj::overloadedMethod1(arg);
1569     return v8::Handle<v8::Value>();
1570 }
1571
1572 #endif // ENABLE(Condition1)
1573
1574 #if ENABLE(Condition1)
1575
1576 static v8::Handle<v8::Value> overloadedMethod12Callback(const v8::Arguments& args)
1577 {
1578     INC_STATS("DOM.TestObj.overloadedMethod12");
1579     if (args.Length() < 1)
1580         return throwError("Not enough arguments", V8Proxy::TypeError);
1581     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, type, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1582     TestObj::overloadedMethod1(type);
1583     return v8::Handle<v8::Value>();
1584 }
1585
1586 #endif // ENABLE(Condition1)
1587
1588 #if ENABLE(Condition1)
1589
1590 static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args)
1591 {
1592     INC_STATS("DOM.TestObj.overloadedMethod1");
1593     if (args.Length() == 1)
1594         return overloadedMethod11Callback(args);
1595     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject())))
1596         return overloadedMethod12Callback(args);
1597     V8Proxy::throwTypeError();
1598     return notHandledByInterceptor();
1599 }
1600
1601 #endif // ENABLE(Condition1)
1602
1603 static v8::Handle<v8::Value> enabledAtRuntimeMethod1Callback(const v8::Arguments& args)
1604 {
1605     INC_STATS("DOM.TestObj.enabledAtRuntimeMethod1");
1606     if (args.Length() < 1)
1607         return throwError("Not enough arguments", V8Proxy::TypeError);
1608     TestObj* imp = V8TestObj::toNative(args.Holder());
1609     EXCEPTION_BLOCK(int, intArg, V8int::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8int::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1610     imp->enabledAtRuntimeMethod1(intArg);
1611     return v8::Handle<v8::Value>();
1612 }
1613
1614 static v8::Handle<v8::Value> enabledAtRuntimeMethod2Callback(const v8::Arguments& args)
1615 {
1616     INC_STATS("DOM.TestObj.enabledAtRuntimeMethod2");
1617     if (args.Length() < 1)
1618         return throwError("Not enough arguments", V8Proxy::TypeError);
1619     TestObj* imp = V8TestObj::toNative(args.Holder());
1620     EXCEPTION_BLOCK(int, intArg, V8int::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8int::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1621     imp->enabledAtRuntimeMethod2(intArg);
1622     return v8::Handle<v8::Value>();
1623 }
1624
1625 static v8::Handle<v8::Value> getSVGDocumentCallback(const v8::Arguments& args)
1626 {
1627     INC_STATS("DOM.TestObj.getSVGDocument");
1628     TestObj* imp = V8TestObj::toNative(args.Holder());
1629     ExceptionCode ec = 0;
1630     {
1631     if (!V8BindingSecurity::shouldAllowAccessToNode(V8BindingState::Only(), imp->getSVGDocument(ec)))
1632         return v8::Handle<v8::Value>(v8::Null());
1633     RefPtr<SVGDocument> result = imp->getSVGDocument(ec);
1634     if (UNLIKELY(ec))
1635         goto fail;
1636     return toV8(result.release());
1637     }
1638     fail:
1639     V8Proxy::setDOMException(ec);
1640     return v8::Handle<v8::Value>();
1641 }
1642
1643 static v8::Handle<v8::Value> convert1Callback(const v8::Arguments& args)
1644 {
1645     INC_STATS("DOM.TestObj.convert1");
1646     if (args.Length() < 1)
1647         return throwError("Not enough arguments", V8Proxy::TypeError);
1648     TestObj* imp = V8TestObj::toNative(args.Holder());
1649     EXCEPTION_BLOCK(a*, , V8a::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8a::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1650     imp->convert1();
1651     return v8::Handle<v8::Value>();
1652 }
1653
1654 static v8::Handle<v8::Value> convert2Callback(const v8::Arguments& args)
1655 {
1656     INC_STATS("DOM.TestObj.convert2");
1657     if (args.Length() < 1)
1658         return throwError("Not enough arguments", V8Proxy::TypeError);
1659     TestObj* imp = V8TestObj::toNative(args.Holder());
1660     EXCEPTION_BLOCK(b*, , V8b::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8b::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1661     imp->convert2();
1662     return v8::Handle<v8::Value>();
1663 }
1664
1665 static v8::Handle<v8::Value> convert3Callback(const v8::Arguments& args)
1666 {
1667     INC_STATS("DOM.TestObj.convert3");
1668     if (args.Length() < 1)
1669         return throwError("Not enough arguments", V8Proxy::TypeError);
1670     TestObj* imp = V8TestObj::toNative(args.Holder());
1671     EXCEPTION_BLOCK(c*, , V8c::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8c::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1672     imp->convert3();
1673     return v8::Handle<v8::Value>();
1674 }
1675
1676 static v8::Handle<v8::Value> convert4Callback(const v8::Arguments& args)
1677 {
1678     INC_STATS("DOM.TestObj.convert4");
1679     if (args.Length() < 1)
1680         return throwError("Not enough arguments", V8Proxy::TypeError);
1681     TestObj* imp = V8TestObj::toNative(args.Holder());
1682     EXCEPTION_BLOCK(d*, , V8d::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8d::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1683     imp->convert4();
1684     return v8::Handle<v8::Value>();
1685 }
1686
1687 static v8::Handle<v8::Value> convert5Callback(const v8::Arguments& args)
1688 {
1689     INC_STATS("DOM.TestObj.convert5");
1690     if (args.Length() < 1)
1691         return throwError("Not enough arguments", V8Proxy::TypeError);
1692     TestObj* imp = V8TestObj::toNative(args.Holder());
1693     EXCEPTION_BLOCK(e*, , V8e::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8e::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
1694     imp->convert5();
1695     return v8::Handle<v8::Value>();
1696 }
1697
1698 static v8::Handle<v8::Value> mutablePointFunctionCallback(const v8::Arguments& args)
1699 {
1700     INC_STATS("DOM.TestObj.mutablePointFunction");
1701     TestObj* imp = V8TestObj::toNative(args.Holder());
1702     return toV8(WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(imp->mutablePointFunction())));
1703 }
1704
1705 static v8::Handle<v8::Value> immutablePointFunctionCallback(const v8::Arguments& args)
1706 {
1707     INC_STATS("DOM.TestObj.immutablePointFunction");
1708     TestObj* imp = V8TestObj::toNative(args.Holder());
1709     return toV8(WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(imp->immutablePointFunction())));
1710 }
1711
1712 static v8::Handle<v8::Value> orangeCallback(const v8::Arguments& args)
1713 {
1714     INC_STATS("DOM.TestObj.orange");
1715     TestObj* imp = V8TestObj::toNative(args.Holder());
1716     imp->banana();
1717     return v8::Handle<v8::Value>();
1718 }
1719
1720 static v8::Handle<v8::Value> strictFunctionCallback(const v8::Arguments& args)
1721 {
1722     INC_STATS("DOM.TestObj.strictFunction");
1723     if (args.Length() < 3)
1724         return throwError("Not enough arguments", V8Proxy::TypeError);
1725     TestObj* imp = V8TestObj::toNative(args.Holder());
1726     ExceptionCode ec = 0;
1727     {
1728     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1729     EXCEPTION_BLOCK(float, a, static_cast<float>(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)->NumberValue()));
1730     EXCEPTION_BLOCK(int, b, V8int::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)) ? V8int::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))) : 0);
1731     RefPtr<bool> result = imp->strictFunction(str, a, b, ec);
1732     if (UNLIKELY(ec))
1733         goto fail;
1734     return toV8(result.release());
1735     }
1736     fail:
1737     V8Proxy::setDOMException(ec);
1738     return v8::Handle<v8::Value>();
1739 }
1740
1741 } // namespace TestObjInternal
1742
1743 static const BatchedAttribute TestObjAttrs[] = {
1744     // Attribute 'readOnlyIntAttr' (Type: 'readonly attribute' ExtAttr: '')
1745     {"readOnlyIntAttr", TestObjInternal::readOnlyIntAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1746     // Attribute 'readOnlyStringAttr' (Type: 'readonly attribute' ExtAttr: '')
1747     {"readOnlyStringAttr", TestObjInternal::readOnlyStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1748     // Attribute 'readOnlyTestObjAttr' (Type: 'readonly attribute' ExtAttr: '')
1749     {"readOnlyTestObjAttr", TestObjInternal::readOnlyTestObjAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1750     // Attribute 'shortAttr' (Type: 'attribute' ExtAttr: '')
1751     {"shortAttr", TestObjInternal::shortAttrAttrGetter, TestObjInternal::shortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1752     // Attribute 'unsignedShortAttr' (Type: 'attribute' ExtAttr: '')
1753     {"unsignedShortAttr", TestObjInternal::unsignedShortAttrAttrGetter, TestObjInternal::unsignedShortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1754     // Attribute 'intAttr' (Type: 'attribute' ExtAttr: '')
1755     {"intAttr", TestObjInternal::intAttrAttrGetter, TestObjInternal::intAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1756     // Attribute 'longLongAttr' (Type: 'attribute' ExtAttr: '')
1757     {"longLongAttr", TestObjInternal::longLongAttrAttrGetter, TestObjInternal::longLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1758     // Attribute 'unsignedLongLongAttr' (Type: 'attribute' ExtAttr: '')
1759     {"unsignedLongLongAttr", TestObjInternal::unsignedLongLongAttrAttrGetter, TestObjInternal::unsignedLongLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1760     // Attribute 'stringAttr' (Type: 'attribute' ExtAttr: '')
1761     {"stringAttr", TestObjInternal::stringAttrAttrGetter, TestObjInternal::stringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1762     // Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: '')
1763     {"testObjAttr", TestObjInternal::testObjAttrAttrGetter, TestObjInternal::testObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1764     // Attribute 'XMLObjAttr' (Type: 'attribute' ExtAttr: '')
1765     {"XMLObjAttr", TestObjInternal::XMLObjAttrAttrGetter, TestObjInternal::XMLObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1766     // Attribute 'create' (Type: 'attribute' ExtAttr: '')
1767     {"create", TestObjInternal::createAttrGetter, TestObjInternal::createAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1768     // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1769     {"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1770     // Attribute 'reflectedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1771     {"reflectedIntegralAttr", TestObjInternal::reflectedIntegralAttrAttrGetter, TestObjInternal::reflectedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1772     // Attribute 'reflectedUnsignedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1773     {"reflectedUnsignedIntegralAttr", TestObjInternal::reflectedUnsignedIntegralAttrAttrGetter, TestObjInternal::reflectedUnsignedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1774     // Attribute 'reflectedBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1775     {"reflectedBooleanAttr", TestObjInternal::reflectedBooleanAttrAttrGetter, TestObjInternal::reflectedBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1776     // Attribute 'reflectedURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect')
1777     {"reflectedURLAttr", TestObjInternal::reflectedURLAttrAttrGetter, TestObjInternal::reflectedURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1778     // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1779     {"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1780     // Attribute 'reflectedCustomIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1781     {"reflectedCustomIntegralAttr", TestObjInternal::reflectedCustomIntegralAttrAttrGetter, TestObjInternal::reflectedCustomIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1782     // Attribute 'reflectedCustomBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect')
1783     {"reflectedCustomBooleanAttr", TestObjInternal::reflectedCustomBooleanAttrAttrGetter, TestObjInternal::reflectedCustomBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1784     // Attribute 'reflectedCustomURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect')
1785     {"reflectedCustomURLAttr", TestObjInternal::reflectedCustomURLAttrAttrGetter, TestObjInternal::reflectedCustomURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1786     // Attribute 'attrWithGetterException' (Type: 'attribute' ExtAttr: '')
1787     {"attrWithGetterException", TestObjInternal::attrWithGetterExceptionAttrGetter, TestObjInternal::attrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1788     // Attribute 'attrWithSetterException' (Type: 'attribute' ExtAttr: '')
1789     {"attrWithSetterException", TestObjInternal::attrWithSetterExceptionAttrGetter, TestObjInternal::attrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1790     // Attribute 'stringAttrWithGetterException' (Type: 'attribute' ExtAttr: '')
1791     {"stringAttrWithGetterException", TestObjInternal::stringAttrWithGetterExceptionAttrGetter, TestObjInternal::stringAttrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1792     // Attribute 'stringAttrWithSetterException' (Type: 'attribute' ExtAttr: '')
1793     {"stringAttrWithSetterException", TestObjInternal::stringAttrWithSetterExceptionAttrGetter, TestObjInternal::stringAttrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1794     // Attribute 'customAttr' (Type: 'attribute' ExtAttr: 'Custom')
1795     {"customAttr", V8TestObj::customAttrAccessorGetter, V8TestObj::customAttrAccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1796     // Attribute 'withScriptStateAttribute' (Type: 'attribute' ExtAttr: 'CallWith')
1797     {"withScriptStateAttribute", TestObjInternal::withScriptStateAttributeAttrGetter, TestObjInternal::withScriptStateAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1798     // Attribute 'withScriptExecutionContextAttribute' (Type: 'attribute' ExtAttr: 'CallWith')
1799     {"withScriptExecutionContextAttribute", TestObjInternal::withScriptExecutionContextAttributeAttrGetter, TestObjInternal::withScriptExecutionContextAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1800     // Attribute 'withScriptStateAttributeRaises' (Type: 'attribute' ExtAttr: 'CallWith')
1801     {"withScriptStateAttributeRaises", TestObjInternal::withScriptStateAttributeRaisesAttrGetter, TestObjInternal::withScriptStateAttributeRaisesAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1802     // Attribute 'withScriptExecutionContextAttributeRaises' (Type: 'attribute' ExtAttr: 'CallWith')
1803     {"withScriptExecutionContextAttributeRaises", TestObjInternal::withScriptExecutionContextAttributeRaisesAttrGetter, TestObjInternal::withScriptExecutionContextAttributeRaisesAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1804     // Attribute 'withScriptExecutionContextAndScriptStateAttribute' (Type: 'attribute' ExtAttr: 'CallWith')
1805     {"withScriptExecutionContextAndScriptStateAttribute", TestObjInternal::withScriptExecutionContextAndScriptStateAttributeAttrGetter, TestObjInternal::withScriptExecutionContextAndScriptStateAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1806     // Attribute 'withScriptExecutionContextAndScriptStateAttributeRaises' (Type: 'attribute' ExtAttr: 'CallWith')
1807     {"withScriptExecutionContextAndScriptStateAttributeRaises", TestObjInternal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrGetter, TestObjInternal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1808     // Attribute 'withScriptExecutionContextAndScriptStateWithSpacesAttribute' (Type: 'attribute' ExtAttr: 'CallWith')
1809     {"withScriptExecutionContextAndScriptStateWithSpacesAttribute", TestObjInternal::withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrGetter, TestObjInternal::withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1810     // Attribute 'withScriptArgumentsAndCallStackAttribute' (Type: 'attribute' ExtAttr: 'CallWith')
1811     {"withScriptArgumentsAndCallStackAttribute", TestObjInternal::withScriptArgumentsAndCallStackAttributeAttrGetter, TestObjInternal::withScriptArgumentsAndCallStackAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1812 #if ENABLE(Condition1)
1813     // Attribute 'conditionalAttr1' (Type: 'attribute' ExtAttr: 'Conditional')
1814     {"conditionalAttr1", TestObjInternal::conditionalAttr1AttrGetter, TestObjInternal::conditionalAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1815 #endif // ENABLE(Condition1)
1816 #if ENABLE(Condition1) && ENABLE(Condition2)
1817     // Attribute 'conditionalAttr2' (Type: 'attribute' ExtAttr: 'Conditional')
1818     {"conditionalAttr2", TestObjInternal::conditionalAttr2AttrGetter, TestObjInternal::conditionalAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1819 #endif // ENABLE(Condition1) && ENABLE(Condition2)
1820 #if ENABLE(Condition1) || ENABLE(Condition2)
1821     // Attribute 'conditionalAttr3' (Type: 'attribute' ExtAttr: 'Conditional')
1822     {"conditionalAttr3", TestObjInternal::conditionalAttr3AttrGetter, TestObjInternal::conditionalAttr3AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1823 #endif // ENABLE(Condition1) || ENABLE(Condition2)
1824 #if ENABLE(Condition1)
1825     // Attribute 'conditionalAttr4' (Type: 'attribute' ExtAttr: 'Conditional')
1826     {"conditionalAttr4", TestObjInternal::TestObjConstructorGetter, 0, &V8TestObjectA::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */},
1827 #endif // ENABLE(Condition1)
1828 #if ENABLE(Condition1) && ENABLE(Condition2)
1829     // Attribute 'conditionalAttr5' (Type: 'attribute' ExtAttr: 'Conditional')
1830     {"conditionalAttr5", TestObjInternal::TestObjConstructorGetter, 0, &V8TestObjectB::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */},
1831 #endif // ENABLE(Condition1) && ENABLE(Condition2)
1832 #if ENABLE(Condition1) || ENABLE(Condition2)
1833     // Attribute 'conditionalAttr6' (Type: 'attribute' ExtAttr: 'Conditional')
1834     {"conditionalAttr6", TestObjInternal::TestObjConstructorGetter, 0, &V8TestObjectC::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */},
1835 #endif // ENABLE(Condition1) || ENABLE(Condition2)
1836     // Attribute 'cachedAttribute1' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute')
1837     {"cachedAttribute1", TestObjInternal::cachedAttribute1AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1838     // Attribute 'cachedAttribute2' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute')
1839     {"cachedAttribute2", TestObjInternal::cachedAttribute2AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1840     // Attribute 'floatArray' (Type: 'attribute' ExtAttr: '')
1841     {"floatArray", TestObjInternal::floatArrayAttrGetter, TestObjInternal::floatArrayAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1842     // Attribute 'doubleArray' (Type: 'attribute' ExtAttr: '')
1843     {"doubleArray", TestObjInternal::doubleArrayAttrGetter, TestObjInternal::doubleArrayAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1844     // Attribute 'contentDocument' (Type: 'readonly attribute' ExtAttr: 'CheckSecurityForNode')
1845     {"contentDocument", TestObjInternal::contentDocumentAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1846     // Attribute 'mutablePoint' (Type: 'attribute' ExtAttr: '')
1847     {"mutablePoint", TestObjInternal::mutablePointAttrGetter, TestObjInternal::mutablePointAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1848     // Attribute 'immutablePoint' (Type: 'attribute' ExtAttr: 'Immutable')
1849     {"immutablePoint", TestObjInternal::immutablePointAttrGetter, TestObjInternal::immutablePointAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1850     // Attribute 'strictFloat' (Type: 'attribute' ExtAttr: 'StrictTypeChecking')
1851     {"strictFloat", TestObjInternal::strictFloatAttrGetter, TestObjInternal::strictFloatAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1852     // Attribute 'description' (Type: 'readonly attribute' ExtAttr: '')
1853     {"description", TestObjInternal::descriptionAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1854     // Attribute 'id' (Type: 'attribute' ExtAttr: '')
1855     {"id", TestObjInternal::idAttrGetter, TestObjInternal::idAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1856     // Attribute 'hash' (Type: 'readonly attribute' ExtAttr: '')
1857     {"hash", TestObjInternal::hashAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
1858 };
1859
1860 static const BatchedCallback TestObjCallbacks[] = {
1861     {"voidMethod", TestObjInternal::voidMethodCallback},
1862     {"intMethod", TestObjInternal::intMethodCallback},
1863     {"objMethod", TestObjInternal::objMethodCallback},
1864     {"serializedValue", TestObjInternal::serializedValueCallback},
1865     {"idbKey", TestObjInternal::idbKeyCallback},
1866     {"optionsObject", TestObjInternal::optionsObjectCallback},
1867     {"methodWithException", TestObjInternal::methodWithExceptionCallback},
1868     {"customMethod", V8TestObj::customMethodCallback},
1869     {"customMethodWithArgs", V8TestObj::customMethodWithArgsCallback},
1870     {"addEventListener", TestObjInternal::addEventListenerCallback},
1871     {"removeEventListener", TestObjInternal::removeEventListenerCallback},
1872     {"withScriptStateVoid", TestObjInternal::withScriptStateVoidCallback},
1873     {"withScriptStateObj", TestObjInternal::withScriptStateObjCallback},
1874     {"withScriptStateVoidException", TestObjInternal::withScriptStateVoidExceptionCallback},
1875     {"withScriptStateObjException", TestObjInternal::withScriptStateObjExceptionCallback},
1876     {"withScriptExecutionContext", TestObjInternal::withScriptExecutionContextCallback},
1877     {"withScriptExecutionContextAndScriptState", TestObjInternal::withScriptExecutionContextAndScriptStateCallback},
1878     {"withScriptExecutionContextAndScriptStateObjException", TestObjInternal::withScriptExecutionContextAndScriptStateObjExceptionCallback},
1879     {"withScriptExecutionContextAndScriptStateWithSpaces", TestObjInternal::withScriptExecutionContextAndScriptStateWithSpacesCallback},
1880     {"withScriptArgumentsAndCallStack", TestObjInternal::withScriptArgumentsAndCallStackCallback},
1881     {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback},
1882     {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback},
1883     {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback},
1884     {"methodWithOptionalString", TestObjInternal::methodWithOptionalStringCallback},
1885     {"methodWithOptionalStringIsUndefined", TestObjInternal::methodWithOptionalStringIsUndefinedCallback},
1886     {"methodWithOptionalStringIsNullString", TestObjInternal::methodWithOptionalStringIsNullStringCallback},
1887     {"methodWithCallbackArg", TestObjInternal::methodWithCallbackArgCallback},
1888     {"methodWithNonCallbackArgAndCallbackArg", TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback},
1889     {"methodWithCallbackAndOptionalArg", TestObjInternal::methodWithCallbackAndOptionalArgCallback},
1890 #if ENABLE(Condition1)
1891     {"conditionalMethod1", TestObjInternal::conditionalMethod1Callback},
1892 #endif
1893 #if ENABLE(Condition1) && ENABLE(Condition2)
1894     {"conditionalMethod2", TestObjInternal::conditionalMethod2Callback},
1895 #endif
1896 #if ENABLE(Condition1) || ENABLE(Condition2)
1897     {"conditionalMethod3", TestObjInternal::conditionalMethod3Callback},
1898 #endif
1899     {"overloadedMethod", TestObjInternal::overloadedMethodCallback},
1900     {"getSVGDocument", TestObjInternal::getSVGDocumentCallback},
1901     {"mutablePointFunction", TestObjInternal::mutablePointFunctionCallback},
1902     {"immutablePointFunction", TestObjInternal::immutablePointFunctionCallback},
1903     {"orange", TestObjInternal::orangeCallback},
1904     {"strictFunction", TestObjInternal::strictFunctionCallback},
1905 };
1906
1907 static const BatchedConstant TestObjConsts[] = {
1908 #if ENABLE(Condition1)
1909     {"CONDITIONAL_CONST", static_cast<signed int>(0)},
1910 #endif
1911     {"CONST_VALUE_0", static_cast<signed int>(0)},
1912     {"CONST_VALUE_1", static_cast<signed int>(1)},
1913     {"CONST_VALUE_2", static_cast<signed int>(2)},
1914     {"CONST_VALUE_4", static_cast<signed int>(4)},
1915     {"CONST_VALUE_8", static_cast<signed int>(8)},
1916     {"CONST_VALUE_9", static_cast<signed int>(-1)},
1917     {"CONST_VALUE_10", static_cast<signed int>("my constant string")},
1918     {"CONST_VALUE_11", static_cast<signed int>(0xffffffff)},
1919     {"CONST_VALUE_12", static_cast<signed int>(0x01)},
1920     {"CONST_VALUE_13", static_cast<signed int>(0X20)},
1921     {"CONST_VALUE_14", static_cast<signed int>(0x1abc)},
1922     {"CONST_JAVASCRIPT", static_cast<signed int>(15)},
1923 };
1924
1925
1926 #if ENABLE(Condition1)
1927 COMPILE_ASSERT(0 == TestObj::CONDITIONAL_CONST, TestObjEnumCONDITIONAL_CONSTIsWrongUseDoNotCheckConstants);
1928 #endif
1929 COMPILE_ASSERT(0 == TestObj::CONST_VALUE_0, TestObjEnumCONST_VALUE_0IsWrongUseDoNotCheckConstants);
1930 COMPILE_ASSERT(1 == TestObj::CONST_VALUE_1, TestObjEnumCONST_VALUE_1IsWrongUseDoNotCheckConstants);
1931 COMPILE_ASSERT(2 == TestObj::CONST_VALUE_2, TestObjEnumCONST_VALUE_2IsWrongUseDoNotCheckConstants);
1932 COMPILE_ASSERT(4 == TestObj::CONST_VALUE_4, TestObjEnumCONST_VALUE_4IsWrongUseDoNotCheckConstants);
1933 COMPILE_ASSERT(8 == TestObj::CONST_VALUE_8, TestObjEnumCONST_VALUE_8IsWrongUseDoNotCheckConstants);
1934 COMPILE_ASSERT(-1 == TestObj::CONST_VALUE_9, TestObjEnumCONST_VALUE_9IsWrongUseDoNotCheckConstants);
1935 COMPILE_ASSERT("my constant string" == TestObj::CONST_VALUE_10, TestObjEnumCONST_VALUE_10IsWrongUseDoNotCheckConstants);
1936 COMPILE_ASSERT(0xffffffff == TestObj::CONST_VALUE_11, TestObjEnumCONST_VALUE_11IsWrongUseDoNotCheckConstants);
1937 COMPILE_ASSERT(0x01 == TestObj::CONST_VALUE_12, TestObjEnumCONST_VALUE_12IsWrongUseDoNotCheckConstants);
1938 COMPILE_ASSERT(0X20 == TestObj::CONST_VALUE_13, TestObjEnumCONST_VALUE_13IsWrongUseDoNotCheckConstants);
1939 COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWrongUseDoNotCheckConstants);
1940 COMPILE_ASSERT(15 == TestObj::CONST_IMPL, TestObjEnumCONST_IMPLIsWrongUseDoNotCheckConstants);
1941
1942 v8::Handle<v8::Value> V8TestObj::constructorCallback(const v8::Arguments& args)
1943 {
1944     INC_STATS("DOM.TestObj.Constructor");
1945
1946     if (!args.IsConstructCall())
1947         return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
1948
1949     if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
1950         return args.Holder();
1951
1952     RefPtr<TestObj> impl = TestObj::create();
1953     v8::Handle<v8::Object> wrapper = args.Holder();
1954
1955     V8DOMWrapper::setDOMWrapper(wrapper, &info, impl.get());
1956     impl->ref();
1957     V8DOMWrapper::setJSWrapperForDOMObject(impl.get(), v8::Persistent<v8::Object>::New(wrapper));
1958     return args.Holder();
1959 }
1960
1961 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persistent<v8::FunctionTemplate> desc)
1962 {
1963     desc->ReadOnlyPrototype();
1964
1965     v8::Local<v8::Signature> defaultSignature;
1966     defaultSignature = configureTemplate(desc, "TestObject", v8::Persistent<v8::FunctionTemplate>(), V8TestObj::internalFieldCount,
1967         TestObjAttrs, WTF_ARRAY_LENGTH(TestObjAttrs),
1968         TestObjCallbacks, WTF_ARRAY_LENGTH(TestObjCallbacks));
1969     UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
1970     desc->SetCallHandler(V8TestObj::constructorCallback);
1971     v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
1972     v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
1973     UNUSED_PARAM(instance); // In some cases, it will not be used.
1974     UNUSED_PARAM(proto); // In some cases, it will not be used.
1975     
1976     if (RuntimeEnabledFeatures::enabledAtRuntimeAttr1Enabled()) {
1977         static const BatchedAttribute attrData =\
1978         // Attribute 'enabledAtRuntimeAttr1' (Type: 'attribute' ExtAttr: 'V8EnabledAtRuntime')
1979         {"enabledAtRuntimeAttr1", TestObjInternal::enabledAtRuntimeAttr1AttrGetter, TestObjInternal::enabledAtRuntimeAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1980         configureAttribute(instance, proto, attrData);
1981     }
1982     if (RuntimeEnabledFeatures::featureNameEnabled()) {
1983         static const BatchedAttribute attrData =\
1984         // Attribute 'enabledAtRuntimeAttr2' (Type: 'attribute' ExtAttr: 'V8EnabledAtRuntime')
1985         {"enabledAtRuntimeAttr2", TestObjInternal::enabledAtRuntimeAttr2AttrGetter, TestObjInternal::enabledAtRuntimeAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
1986         configureAttribute(instance, proto, attrData);
1987     }
1988
1989     // Custom Signature 'voidMethodWithArgs'
1990     const int voidMethodWithArgsArgc = 3;
1991     v8::Handle<v8::FunctionTemplate> voidMethodWithArgsArgv[voidMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1992     v8::Handle<v8::Signature> voidMethodWithArgsSignature = v8::Signature::New(desc, voidMethodWithArgsArgc, voidMethodWithArgsArgv);
1993     proto->Set(v8::String::New("voidMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::voidMethodWithArgsCallback, v8::Handle<v8::Value>(), voidMethodWithArgsSignature));
1994
1995     // Custom Signature 'intMethodWithArgs'
1996     const int intMethodWithArgsArgc = 3;
1997     v8::Handle<v8::FunctionTemplate> intMethodWithArgsArgv[intMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
1998     v8::Handle<v8::Signature> intMethodWithArgsSignature = v8::Signature::New(desc, intMethodWithArgsArgc, intMethodWithArgsArgv);
1999     proto->Set(v8::String::New("intMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::intMethodWithArgsCallback, v8::Handle<v8::Value>(), intMethodWithArgsSignature));
2000
2001     // Custom Signature 'objMethodWithArgs'
2002     const int objMethodWithArgsArgc = 3;
2003     v8::Handle<v8::FunctionTemplate> objMethodWithArgsArgv[objMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
2004     v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(desc, objMethodWithArgsArgc, objMethodWithArgsArgv);
2005     proto->Set(v8::String::New("objMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::objMethodWithArgsCallback, v8::Handle<v8::Value>(), objMethodWithArgsSignature));
2006
2007     // Custom Signature 'methodThatRequiresAllArgsAndThrows'
2008     const int methodThatRequiresAllArgsAndThrowsArgc = 2;
2009     v8::Handle<v8::FunctionTemplate> methodThatRequiresAllArgsAndThrowsArgv[methodThatRequiresAllArgsAndThrowsArgc] = { v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
2010     v8::Handle<v8::Signature> methodThatRequiresAllArgsAndThrowsSignature = v8::Signature::New(desc, methodThatRequiresAllArgsAndThrowsArgc, methodThatRequiresAllArgsAndThrowsArgv);
2011     proto->Set(v8::String::New("methodThatRequiresAllArgsAndThrows"), v8::FunctionTemplate::New(TestObjInternal::methodThatRequiresAllArgsAndThrowsCallback, v8::Handle<v8::Value>(), methodThatRequiresAllArgsAndThrowsSignature));
2012     desc->Set(v8::String::New("classMethod"), v8::FunctionTemplate::New(TestObjInternal::classMethodCallback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
2013     desc->Set(v8::String::New("classMethodWithOptional"), v8::FunctionTemplate::New(TestObjInternal::classMethodWithOptionalCallback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
2014     desc->Set(v8::String::New("classMethod2"), v8::FunctionTemplate::New(V8TestObj::classMethod2Callback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
2015 #if ENABLE(Condition1)
2016     desc->Set(v8::String::New("overloadedMethod1"), v8::FunctionTemplate::New(TestObjInternal::overloadedMethod1Callback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
2017 #endif // ENABLE(Condition1)
2018     if (RuntimeEnabledFeatures::enabledAtRuntimeMethod1Enabled())
2019         proto->Set(v8::String::New("enabledAtRuntimeMethod1"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod1Callback, v8::Handle<v8::Value>(), defaultSignature));
2020     if (RuntimeEnabledFeatures::featureNameEnabled())
2021         proto->Set(v8::String::New("enabledAtRuntimeMethod2"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod2Callback, v8::Handle<v8::Value>(), defaultSignature));
2022
2023     // Custom Signature 'convert1'
2024     const int convert1Argc = 1;
2025     v8::Handle<v8::FunctionTemplate> convert1Argv[convert1Argc] = { V8a::GetRawTemplate() };
2026     v8::Handle<v8::Signature> convert1Signature = v8::Signature::New(desc, convert1Argc, convert1Argv);
2027     proto->Set(v8::String::New("convert1"), v8::FunctionTemplate::New(TestObjInternal::convert1Callback, v8::Handle<v8::Value>(), convert1Signature));
2028
2029     // Custom Signature 'convert2'
2030     const int convert2Argc = 1;
2031     v8::Handle<v8::FunctionTemplate> convert2Argv[convert2Argc] = { V8b::GetRawTemplate() };
2032     v8::Handle<v8::Signature> convert2Signature = v8::Signature::New(desc, convert2Argc, convert2Argv);
2033     proto->Set(v8::String::New("convert2"), v8::FunctionTemplate::New(TestObjInternal::convert2Callback, v8::Handle<v8::Value>(), convert2Signature));
2034
2035     // Custom Signature 'convert3'
2036     const int convert3Argc = 1;
2037     v8::Handle<v8::FunctionTemplate> convert3Argv[convert3Argc] = { V8c::GetRawTemplate() };
2038     v8::Handle<v8::Signature> convert3Signature = v8::Signature::New(desc, convert3Argc, convert3Argv);
2039     proto->Set(v8::String::New("convert3"), v8::FunctionTemplate::New(TestObjInternal::convert3Callback, v8::Handle<v8::Value>(), convert3Signature));
2040
2041     // Custom Signature 'convert4'
2042     const int convert4Argc = 1;
2043     v8::Handle<v8::FunctionTemplate> convert4Argv[convert4Argc] = { V8d::GetRawTemplate() };
2044     v8::Handle<v8::Signature> convert4Signature = v8::Signature::New(desc, convert4Argc, convert4Argv);
2045     proto->Set(v8::String::New("convert4"), v8::FunctionTemplate::New(TestObjInternal::convert4Callback, v8::Handle<v8::Value>(), convert4Signature));
2046
2047     // Custom Signature 'convert5'
2048     const int convert5Argc = 1;
2049     v8::Handle<v8::FunctionTemplate> convert5Argv[convert5Argc] = { V8e::GetRawTemplate() };
2050     v8::Handle<v8::Signature> convert5Signature = v8::Signature::New(desc, convert5Argc, convert5Argv);
2051     proto->Set(v8::String::New("convert5"), v8::FunctionTemplate::New(TestObjInternal::convert5Callback, v8::Handle<v8::Value>(), convert5Signature));
2052     batchConfigureConstants(desc, proto, TestObjConsts, WTF_ARRAY_LENGTH(TestObjConsts));
2053
2054     // Custom toString template
2055     desc->Set(getToStringName(), getToStringTemplate());
2056     return desc;
2057 }
2058
2059 v8::Persistent<v8::FunctionTemplate> V8TestObj::GetRawTemplate()
2060 {
2061     V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
2062     V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info);
2063     if (result != data->rawTemplateMap().end())
2064         return result->second;
2065
2066     v8::HandleScope handleScope;
2067     v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
2068     data->rawTemplateMap().add(&info, templ);
2069     return templ;
2070 }
2071
2072 v8::Persistent<v8::FunctionTemplate> V8TestObj::GetTemplate()
2073 {
2074     V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
2075     V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info);
2076     if (result != data->templateMap().end())
2077         return result->second;
2078
2079     v8::HandleScope handleScope;
2080     v8::Persistent<v8::FunctionTemplate> templ =
2081         ConfigureV8TestObjTemplate(GetRawTemplate());
2082     data->templateMap().add(&info, templ);
2083     return templ;
2084 }
2085
2086 bool V8TestObj::HasInstance(v8::Handle<v8::Value> value)
2087 {
2088     return GetRawTemplate()->HasInstance(value);
2089 }
2090
2091
2092 v8::Handle<v8::Object> V8TestObj::wrapSlow(TestObj* impl)
2093 {
2094     v8::Handle<v8::Object> wrapper;
2095     V8Proxy* proxy = 0;
2096     wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
2097     if (UNLIKELY(wrapper.IsEmpty()))
2098         return wrapper;
2099
2100     impl->ref();
2101     v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
2102
2103     if (!hasDependentLifetime)
2104         wrapperHandle.MarkIndependent();
2105     getDOMObjectMap().set(impl, wrapperHandle);
2106     return wrapper;
2107 }
2108
2109 void V8TestObj::derefObject(void* object)
2110 {
2111     static_cast<TestObj*>(object)->deref();
2112 }
2113
2114 } // namespace WebCore