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