2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
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.
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.
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.
22 #include "V8TestObj.h"
24 #include "Dictionary.h"
25 #include "ExceptionCode.h"
26 #include "HTMLNames.h"
27 #include "IDBBindingUtilities.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"
43 #include "V8SVGDocument.h"
44 #include "V8SVGPoint.h"
45 #include "V8TestCallback.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>
60 #if ENABLE(Condition1)
61 #include "V8TestObjectA.h"
64 #if ENABLE(Condition1) && ENABLE(Condition2)
65 #include "V8TestObjectB.h"
68 #if ENABLE(Condition1) || ENABLE(Condition2)
69 #include "V8TestObjectC.h"
74 WrapperTypeInfo V8TestObj::info = { V8TestObj::GetTemplate, V8TestObj::derefObject, 0, 0 };
76 namespace TestObjInternal {
78 template <typename T> void V8_USE(T) { }
80 static v8::Handle<v8::Value> readOnlyIntAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
82 INC_STATS("DOM.TestObj.readOnlyIntAttr._get");
83 TestObj* imp = V8TestObj::toNative(info.Holder());
84 return v8::Integer::New(imp->readOnlyIntAttr());
87 static v8::Handle<v8::Value> readOnlyStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
89 INC_STATS("DOM.TestObj.readOnlyStringAttr._get");
90 TestObj* imp = V8TestObj::toNative(info.Holder());
91 return v8String(imp->readOnlyStringAttr());
94 static v8::Handle<v8::Value> readOnlyTestObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
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);
108 static v8::Handle<v8::Value> shortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
110 INC_STATS("DOM.TestObj.shortAttr._get");
111 TestObj* imp = V8TestObj::toNative(info.Holder());
112 return v8::Integer::New(imp->shortAttr());
115 static void shortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
117 INC_STATS("DOM.TestObj.shortAttr._set");
118 TestObj* imp = V8TestObj::toNative(info.Holder());
119 int v = toInt32(value);
120 imp->setShortAttr(v);
124 static v8::Handle<v8::Value> unsignedShortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
126 INC_STATS("DOM.TestObj.unsignedShortAttr._get");
127 TestObj* imp = V8TestObj::toNative(info.Holder());
128 return v8::Integer::New(imp->unsignedShortAttr());
131 static void unsignedShortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
133 INC_STATS("DOM.TestObj.unsignedShortAttr._set");
134 TestObj* imp = V8TestObj::toNative(info.Holder());
135 int v = toUInt32(value);
136 imp->setUnsignedShortAttr(v);
140 static v8::Handle<v8::Value> intAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
142 INC_STATS("DOM.TestObj.intAttr._get");
143 TestObj* imp = V8TestObj::toNative(info.Holder());
144 return v8::Integer::New(imp->intAttr());
147 static void intAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
149 INC_STATS("DOM.TestObj.intAttr._set");
150 TestObj* imp = V8TestObj::toNative(info.Holder());
151 int v = toInt32(value);
156 static v8::Handle<v8::Value> longLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
158 INC_STATS("DOM.TestObj.longLongAttr._get");
159 TestObj* imp = V8TestObj::toNative(info.Holder());
160 return v8::Number::New(static_cast<double>(imp->longLongAttr()));
163 static void longLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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));
172 static v8::Handle<v8::Value> unsignedLongLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
174 INC_STATS("DOM.TestObj.unsignedLongLongAttr._get");
175 TestObj* imp = V8TestObj::toNative(info.Holder());
176 return v8::Number::New(static_cast<double>(imp->unsignedLongLongAttr()));
179 static void unsignedLongLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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));
188 static v8::Handle<v8::Value> stringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
190 INC_STATS("DOM.TestObj.stringAttr._get");
191 TestObj* imp = V8TestObj::toNative(info.Holder());
192 return v8String(imp->stringAttr());
195 static void stringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
204 static v8::Handle<v8::Value> testObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
206 INC_STATS("DOM.TestObj.testObjAttr._get");
207 TestObj* imp = V8TestObj::toNative(info.Holder());
208 return toV8(imp->testObjAttr());
211 static void testObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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));
220 static v8::Handle<v8::Value> XMLObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
222 INC_STATS("DOM.TestObj.XMLObjAttr._get");
223 TestObj* imp = V8TestObj::toNative(info.Holder());
224 return toV8(imp->xmlObjAttr());
227 static void XMLObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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));
236 static v8::Handle<v8::Value> createAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
238 INC_STATS("DOM.TestObj.create._get");
239 TestObj* imp = V8TestObj::toNative(info.Holder());
240 return v8Boolean(imp->isCreate());
243 static void createAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
245 INC_STATS("DOM.TestObj.create._set");
246 TestObj* imp = V8TestObj::toNative(info.Holder());
247 bool v = value->BooleanValue();
252 static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
254 INC_STATS("DOM.TestObj.reflectedStringAttr._get");
255 TestObj* imp = V8TestObj::toNative(info.Holder());
256 return v8String(imp->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr));
259 static void reflectedStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
268 static v8::Handle<v8::Value> reflectedIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
270 INC_STATS("DOM.TestObj.reflectedIntegralAttr._get");
271 TestObj* imp = V8TestObj::toNative(info.Holder());
272 return v8::Integer::New(imp->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr));
275 static void reflectedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
284 static v8::Handle<v8::Value> reflectedUnsignedIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
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)));
291 static void reflectedUnsignedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
300 static v8::Handle<v8::Value> reflectedBooleanAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
302 INC_STATS("DOM.TestObj.reflectedBooleanAttr._get");
303 TestObj* imp = V8TestObj::toNative(info.Holder());
304 return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr));
307 static void reflectedBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
316 static v8::Handle<v8::Value> reflectedURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
318 INC_STATS("DOM.TestObj.reflectedURLAttr._get");
319 TestObj* imp = V8TestObj::toNative(info.Holder());
320 return v8String(imp->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr));
323 static void reflectedURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
332 static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
334 INC_STATS("DOM.TestObj.reflectedStringAttr._get");
335 TestObj* imp = V8TestObj::toNative(info.Holder());
336 return v8String(imp->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr));
339 static void reflectedStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
348 static v8::Handle<v8::Value> reflectedCustomIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
350 INC_STATS("DOM.TestObj.reflectedCustomIntegralAttr._get");
351 TestObj* imp = V8TestObj::toNative(info.Holder());
352 return v8::Integer::New(imp->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr));
355 static void reflectedCustomIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
364 static v8::Handle<v8::Value> reflectedCustomBooleanAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
366 INC_STATS("DOM.TestObj.reflectedCustomBooleanAttr._get");
367 TestObj* imp = V8TestObj::toNative(info.Holder());
368 return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr));
371 static void reflectedCustomBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
380 static v8::Handle<v8::Value> reflectedCustomURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
382 INC_STATS("DOM.TestObj.reflectedCustomURLAttr._get");
383 TestObj* imp = V8TestObj::toNative(info.Holder());
384 return v8String(imp->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr));
387 static void reflectedCustomURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
396 static v8::Handle<v8::Value> attrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
398 INC_STATS("DOM.TestObj.attrWithGetterException._get");
399 TestObj* imp = V8TestObj::toNative(info.Holder());
400 ExceptionCode ec = 0;
401 int v = imp->attrWithGetterException(ec);
403 V8Proxy::setDOMException(ec);
404 return v8::Handle<v8::Value>();
406 return v8::Integer::New(v);
409 static void attrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
417 V8Proxy::setDOMException(ec);
421 static v8::Handle<v8::Value> attrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
423 INC_STATS("DOM.TestObj.attrWithSetterException._get");
424 TestObj* imp = V8TestObj::toNative(info.Holder());
425 return v8::Integer::New(imp->attrWithSetterException());
428 static void attrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
436 V8Proxy::setDOMException(ec);
440 static v8::Handle<v8::Value> stringAttrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
442 INC_STATS("DOM.TestObj.stringAttrWithGetterException._get");
443 TestObj* imp = V8TestObj::toNative(info.Holder());
444 ExceptionCode ec = 0;
445 String v = imp->stringAttrWithGetterException(ec);
447 V8Proxy::setDOMException(ec);
448 return v8::Handle<v8::Value>();
453 static void stringAttrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
461 V8Proxy::setDOMException(ec);
465 static v8::Handle<v8::Value> stringAttrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
467 INC_STATS("DOM.TestObj.stringAttrWithSetterException._get");
468 TestObj* imp = V8TestObj::toNative(info.Holder());
469 return v8String(imp->stringAttrWithSetterException());
472 static void stringAttrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
480 V8Proxy::setDOMException(ec);
484 static v8::Handle<v8::Value> withScriptStateAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
486 INC_STATS("DOM.TestObj.withScriptStateAttribute._get");
487 TestObj* imp = V8TestObj::toNative(info.Holder());
488 ScriptState* state = ScriptState::current();
490 return v8::Undefined();
491 return v8::Integer::New(imp->withScriptStateAttribute(state));
494 static void withScriptStateAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
496 INC_STATS("DOM.TestObj.withScriptStateAttribute._set");
497 TestObj* imp = V8TestObj::toNative(info.Holder());
498 int v = toInt32(value);
499 ScriptState* state = ScriptState::current();
502 imp->setWithScriptStateAttribute(state, v);
503 if (state.hadException())
504 throwError(state.exception());
508 static v8::Handle<v8::Value> withScriptExecutionContextAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
510 INC_STATS("DOM.TestObj.withScriptExecutionContextAttribute._get");
511 TestObj* imp = V8TestObj::toNative(info.Holder());
512 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
514 return v8::Undefined();
515 return toV8(imp->withScriptExecutionContextAttribute(scriptContext));
518 static void withScriptExecutionContextAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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();
526 imp->setWithScriptExecutionContextAttribute(scriptContext, WTF::getPtr(v));
530 static v8::Handle<v8::Value> withScriptStateAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
532 INC_STATS("DOM.TestObj.withScriptStateAttributeRaises._get");
533 TestObj* imp = V8TestObj::toNative(info.Holder());
534 ExceptionCode ec = 0;
535 ScriptState* state = ScriptState::current();
537 return v8::Undefined();
538 RefPtr<TestObj> v = imp->withScriptStateAttributeRaises(state, ec);
540 V8Proxy::setDOMException(ec);
541 return v8::Handle<v8::Value>();
543 if (state.hadException())
544 return throwError(state.exception());
545 return toV8(v.release());
548 static void withScriptStateAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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();
557 imp->setWithScriptStateAttributeRaises(state, WTF::getPtr(v), ec);
559 V8Proxy::setDOMException(ec);
560 if (state.hadException())
561 throwError(state.exception());
565 static v8::Handle<v8::Value> withScriptExecutionContextAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
567 INC_STATS("DOM.TestObj.withScriptExecutionContextAttributeRaises._get");
568 TestObj* imp = V8TestObj::toNative(info.Holder());
569 ExceptionCode ec = 0;
570 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
572 return v8::Undefined();
573 RefPtr<TestObj> v = imp->withScriptExecutionContextAttributeRaises(scriptContext, ec);
575 V8Proxy::setDOMException(ec);
576 return v8::Handle<v8::Value>();
578 return toV8(v.release());
581 static void withScriptExecutionContextAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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();
590 imp->setWithScriptExecutionContextAttributeRaises(scriptContext, WTF::getPtr(v), ec);
592 V8Proxy::setDOMException(ec);
596 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
598 INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateAttribute._get");
599 TestObj* imp = V8TestObj::toNative(info.Holder());
600 ScriptState* state = ScriptState::current();
602 return v8::Undefined();
603 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
605 return v8::Undefined();
606 return toV8(imp->withScriptExecutionContextAndScriptStateAttribute(state, scriptContext));
609 static void withScriptExecutionContextAndScriptStateAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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();
617 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
620 imp->setWithScriptExecutionContextAndScriptStateAttribute(state, scriptContext, WTF::getPtr(v));
621 if (state.hadException())
622 throwError(state.exception());
626 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
628 INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateAttributeRaises._get");
629 TestObj* imp = V8TestObj::toNative(info.Holder());
630 ExceptionCode ec = 0;
631 ScriptState* state = ScriptState::current();
633 return v8::Undefined();
634 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
636 return v8::Undefined();
637 RefPtr<TestObj> v = imp->withScriptExecutionContextAndScriptStateAttributeRaises(state, scriptContext, ec);
639 V8Proxy::setDOMException(ec);
640 return v8::Handle<v8::Value>();
642 if (state.hadException())
643 return throwError(state.exception());
644 return toV8(v.release());
647 static void withScriptExecutionContextAndScriptStateAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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();
656 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
659 imp->setWithScriptExecutionContextAndScriptStateAttributeRaises(state, scriptContext, WTF::getPtr(v), ec);
661 V8Proxy::setDOMException(ec);
662 if (state.hadException())
663 throwError(state.exception());
667 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
669 INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateWithSpacesAttribute._get");
670 TestObj* imp = V8TestObj::toNative(info.Holder());
671 ScriptState* state = ScriptState::current();
673 return v8::Undefined();
674 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
676 return v8::Undefined();
677 return toV8(imp->withScriptExecutionContextAndScriptStateWithSpacesAttribute(state, scriptContext));
680 static void withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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();
688 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
691 imp->setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(state, scriptContext, WTF::getPtr(v));
692 if (state.hadException())
693 throwError(state.exception());
697 static v8::Handle<v8::Value> withScriptArgumentsAndCallStackAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
699 INC_STATS("DOM.TestObj.withScriptArgumentsAndCallStackAttribute._get");
700 TestObj* imp = V8TestObj::toNative(info.Holder());
701 RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector());
703 return v8::Undefined();
704 return toV8(imp->withScriptArgumentsAndCallStackAttribute(callStack));
707 static void withScriptArgumentsAndCallStackAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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());
714 return v8::Undefined();
715 imp->setWithScriptArgumentsAndCallStackAttribute(callStack, WTF::getPtr(v));
719 #if ENABLE(Condition1)
721 static v8::Handle<v8::Value> conditionalAttr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
723 INC_STATS("DOM.TestObj.conditionalAttr1._get");
724 TestObj* imp = V8TestObj::toNative(info.Holder());
725 return v8::Integer::New(imp->conditionalAttr1());
728 #endif // ENABLE(Condition1)
730 #if ENABLE(Condition1)
732 static void conditionalAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
734 INC_STATS("DOM.TestObj.conditionalAttr1._set");
735 TestObj* imp = V8TestObj::toNative(info.Holder());
736 int v = toInt32(value);
737 imp->setConditionalAttr1(v);
741 #endif // ENABLE(Condition1)
743 #if ENABLE(Condition1) && ENABLE(Condition2)
745 static v8::Handle<v8::Value> conditionalAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
747 INC_STATS("DOM.TestObj.conditionalAttr2._get");
748 TestObj* imp = V8TestObj::toNative(info.Holder());
749 return v8::Integer::New(imp->conditionalAttr2());
752 #endif // ENABLE(Condition1) && ENABLE(Condition2)
754 #if ENABLE(Condition1) && ENABLE(Condition2)
756 static void conditionalAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
758 INC_STATS("DOM.TestObj.conditionalAttr2._set");
759 TestObj* imp = V8TestObj::toNative(info.Holder());
760 int v = toInt32(value);
761 imp->setConditionalAttr2(v);
765 #endif // ENABLE(Condition1) && ENABLE(Condition2)
767 #if ENABLE(Condition1) || ENABLE(Condition2)
769 static v8::Handle<v8::Value> conditionalAttr3AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
771 INC_STATS("DOM.TestObj.conditionalAttr3._get");
772 TestObj* imp = V8TestObj::toNative(info.Holder());
773 return v8::Integer::New(imp->conditionalAttr3());
776 #endif // ENABLE(Condition1) || ENABLE(Condition2)
778 #if ENABLE(Condition1) || ENABLE(Condition2)
780 static void conditionalAttr3AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
782 INC_STATS("DOM.TestObj.conditionalAttr3._set");
783 TestObj* imp = V8TestObj::toNative(info.Holder());
784 int v = toInt32(value);
785 imp->setConditionalAttr3(v);
789 #endif // ENABLE(Condition1) || ENABLE(Condition2)
791 static v8::Handle<v8::Value> cachedAttribute1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
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);
805 static v8::Handle<v8::Value> cachedAttribute2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
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);
819 static v8::Handle<v8::Value> enabledAtRuntimeAttr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
821 INC_STATS("DOM.TestObj.enabledAtRuntimeAttr1._get");
822 TestObj* imp = V8TestObj::toNative(info.Holder());
823 return v8::Integer::New(imp->enabledAtRuntimeAttr1());
826 static void enabledAtRuntimeAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
828 INC_STATS("DOM.TestObj.enabledAtRuntimeAttr1._set");
829 TestObj* imp = V8TestObj::toNative(info.Holder());
830 int v = toInt32(value);
831 imp->setEnabledAtRuntimeAttr1(v);
835 static v8::Handle<v8::Value> enabledAtRuntimeAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
837 INC_STATS("DOM.TestObj.enabledAtRuntimeAttr2._get");
838 TestObj* imp = V8TestObj::toNative(info.Holder());
839 return v8::Integer::New(imp->enabledAtRuntimeAttr2());
842 static void enabledAtRuntimeAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
844 INC_STATS("DOM.TestObj.enabledAtRuntimeAttr2._set");
845 TestObj* imp = V8TestObj::toNative(info.Holder());
846 int v = toInt32(value);
847 imp->setEnabledAtRuntimeAttr2(v);
851 static v8::Handle<v8::Value> floatArrayAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
853 INC_STATS("DOM.TestObj.floatArray._get");
854 TestObj* imp = V8TestObj::toNative(info.Holder());
855 return v8NumberArray(imp->floatArray());
858 static void floatArrayAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
867 static v8::Handle<v8::Value> doubleArrayAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
869 INC_STATS("DOM.TestObj.doubleArray._get");
870 TestObj* imp = V8TestObj::toNative(info.Holder());
871 return v8NumberArray(imp->doubleArray());
874 static void doubleArrayAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
883 static v8::Handle<v8::Value> contentDocumentAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
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>();
890 return toV8(imp->contentDocument());
893 static v8::Handle<v8::Value> mutablePointAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
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)));
900 static void mutablePointAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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));
909 static v8::Handle<v8::Value> immutablePointAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
911 INC_STATS("DOM.TestObj.immutablePoint._get");
912 TestObj* imp = V8TestObj::toNative(info.Holder());
913 return toV8(WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(imp->immutablePoint())));
916 static void immutablePointAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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));
925 static v8::Handle<v8::Value> strictFloatAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
927 INC_STATS("DOM.TestObj.strictFloat._get");
928 TestObj* imp = V8TestObj::toNative(info.Holder());
929 return v8::Number::New(imp->strictFloat());
932 static void strictFloatAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
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);
941 static v8::Handle<v8::Value> descriptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
943 INC_STATS("DOM.TestObj.description._get");
944 TestObj* imp = V8TestObj::toNative(info.Holder());
945 return v8::Integer::New(imp->description());
948 static v8::Handle<v8::Value> idAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
950 INC_STATS("DOM.TestObj.id._get");
951 TestObj* imp = V8TestObj::toNative(info.Holder());
952 return v8::Integer::New(imp->id());
955 static void idAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
957 INC_STATS("DOM.TestObj.id._set");
958 TestObj* imp = V8TestObj::toNative(info.Holder());
959 int v = toInt32(value);
964 static v8::Handle<v8::Value> hashAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
966 INC_STATS("DOM.TestObj.hash._get");
967 TestObj* imp = V8TestObj::toNative(info.Holder());
968 return v8String(imp->hash());
971 static v8::Handle<v8::Value> TestObjConstructorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
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>();}
979 static v8::Handle<v8::Value> voidMethodCallback(const v8::Arguments& args)
981 INC_STATS("DOM.TestObj.voidMethod");
982 TestObj* imp = V8TestObj::toNative(args.Holder());
984 return v8::Handle<v8::Value>();
987 static v8::Handle<v8::Value> voidMethodWithArgsCallback(const v8::Arguments& args)
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>();
1000 static v8::Handle<v8::Value> intMethodCallback(const v8::Arguments& args)
1002 INC_STATS("DOM.TestObj.intMethod");
1003 TestObj* imp = V8TestObj::toNative(args.Holder());
1004 return v8::Integer::New(imp->intMethod());
1007 static v8::Handle<v8::Value> intMethodWithArgsCallback(const v8::Arguments& args)
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));
1019 static v8::Handle<v8::Value> objMethodCallback(const v8::Arguments& args)
1021 INC_STATS("DOM.TestObj.objMethod");
1022 TestObj* imp = V8TestObj::toNative(args.Holder());
1023 return toV8(imp->objMethod());
1026 static v8::Handle<v8::Value> objMethodWithArgsCallback(const v8::Arguments& args)
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));
1038 static v8::Handle<v8::Value> methodThatRequiresAllArgsAndThrowsCallback(const v8::Arguments& args)
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;
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);
1051 return toV8(result.release());
1054 V8Proxy::setDOMException(ec);
1055 return v8::Handle<v8::Value>();
1058 static v8::Handle<v8::Value> serializedValueCallback(const v8::Arguments& args)
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>();
1072 static v8::Handle<v8::Value> idbKeyCallback(const v8::Arguments& args)
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>();
1083 static v8::Handle<v8::Value> optionsObjectCallback(const v8::Arguments& args)
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);
1095 if (args.Length() <= 1) {
1096 imp->optionsObject(oo);
1097 return v8::Handle<v8::Value>();
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);
1105 imp->optionsObject(oo, ooo);
1106 return v8::Handle<v8::Value>();
1109 static v8::Handle<v8::Value> methodWithExceptionCallback(const v8::Arguments& args)
1111 INC_STATS("DOM.TestObj.methodWithException");
1112 TestObj* imp = V8TestObj::toNative(args.Holder());
1113 ExceptionCode ec = 0;
1115 imp->methodWithException(ec);
1118 return v8::Handle<v8::Value>();
1121 V8Proxy::setDOMException(ec);
1122 return v8::Handle<v8::Value>();
1125 static v8::Handle<v8::Value> addEventListenerCallback(const v8::Arguments& args)
1127 INC_STATS("DOM.TestObj.addEventListener()");
1128 RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOrCreate);
1130 V8TestObj::toNative(args.Holder())->addEventListener(v8ValueToAtomicWebCoreString(args[0]), listener, args[2]->BooleanValue());
1131 createHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex);
1133 return v8::Undefined();
1136 static v8::Handle<v8::Value> removeEventListenerCallback(const v8::Arguments& args)
1138 INC_STATS("DOM.TestObj.removeEventListener()");
1139 RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOnly);
1141 V8TestObj::toNative(args.Holder())->removeEventListener(v8ValueToAtomicWebCoreString(args[0]), listener.get(), args[2]->BooleanValue());
1142 removeHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex);
1144 return v8::Undefined();
1147 static v8::Handle<v8::Value> withScriptStateVoidCallback(const v8::Arguments& args)
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>();
1158 static v8::Handle<v8::Value> withScriptStateObjCallback(const v8::Arguments& args)
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());
1169 static v8::Handle<v8::Value> withScriptStateVoidExceptionCallback(const v8::Arguments& args)
1171 INC_STATS("DOM.TestObj.withScriptStateVoidException");
1172 TestObj* imp = V8TestObj::toNative(args.Holder());
1173 ExceptionCode ec = 0;
1175 EmptyScriptState state;
1176 imp->withScriptStateVoidException(&state, ec);
1179 if (state.hadException())
1180 return throwError(state.exception());
1181 return v8::Handle<v8::Value>();
1184 V8Proxy::setDOMException(ec);
1185 return v8::Handle<v8::Value>();
1188 static v8::Handle<v8::Value> withScriptStateObjExceptionCallback(const v8::Arguments& args)
1190 INC_STATS("DOM.TestObj.withScriptStateObjException");
1191 TestObj* imp = V8TestObj::toNative(args.Holder());
1192 ExceptionCode ec = 0;
1194 EmptyScriptState state;
1195 RefPtr<TestObj> result = imp->withScriptStateObjException(&state, ec);
1198 if (state.hadException())
1199 return throwError(state.exception());
1200 return toV8(result.release());
1203 V8Proxy::setDOMException(ec);
1204 return v8::Handle<v8::Value>();
1207 static v8::Handle<v8::Value> withScriptExecutionContextCallback(const v8::Arguments& args)
1209 INC_STATS("DOM.TestObj.withScriptExecutionContext");
1210 TestObj* imp = V8TestObj::toNative(args.Holder());
1211 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
1213 return v8::Undefined();
1214 imp->withScriptExecutionContext(scriptContext);
1215 return v8::Handle<v8::Value>();
1218 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateCallback(const v8::Arguments& args)
1220 INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptState");
1221 TestObj* imp = V8TestObj::toNative(args.Holder());
1222 EmptyScriptState state;
1223 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
1225 return v8::Undefined();
1226 imp->withScriptExecutionContextAndScriptState(&state, scriptContext);
1227 if (state.hadException())
1228 return throwError(state.exception());
1229 return v8::Handle<v8::Value>();
1232 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateObjExceptionCallback(const v8::Arguments& args)
1234 INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateObjException");
1235 TestObj* imp = V8TestObj::toNative(args.Holder());
1236 ExceptionCode ec = 0;
1238 EmptyScriptState state;
1239 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
1241 return v8::Undefined();
1242 RefPtr<TestObj> result = imp->withScriptExecutionContextAndScriptStateObjException(&state, scriptContext, ec);
1245 if (state.hadException())
1246 return throwError(state.exception());
1247 return toV8(result.release());
1250 V8Proxy::setDOMException(ec);
1251 return v8::Handle<v8::Value>();
1254 static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateWithSpacesCallback(const v8::Arguments& args)
1256 INC_STATS("DOM.TestObj.withScriptExecutionContextAndScriptStateWithSpaces");
1257 TestObj* imp = V8TestObj::toNative(args.Holder());
1258 EmptyScriptState state;
1259 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
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());
1268 static v8::Handle<v8::Value> withScriptArgumentsAndCallStackCallback(const v8::Arguments& args)
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());
1275 return v8::Undefined();
1276 imp->withScriptArgumentsAndCallStack(scriptArguments, callStack);
1277 return v8::Handle<v8::Value>();
1280 static v8::Handle<v8::Value> methodWithOptionalArgCallback(const v8::Arguments& args)
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>();
1288 EXCEPTION_BLOCK(int, opt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1289 imp->methodWithOptionalArg(opt);
1290 return v8::Handle<v8::Value>();
1293 static v8::Handle<v8::Value> methodWithNonOptionalArgAndOptionalArgCallback(const v8::Arguments& args)
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>();
1304 EXCEPTION_BLOCK(int, opt, toInt32(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)));
1305 imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
1306 return v8::Handle<v8::Value>();
1309 static v8::Handle<v8::Value> methodWithNonOptionalArgAndTwoOptionalArgsCallback(const v8::Arguments& args)
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>();
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>();
1325 EXCEPTION_BLOCK(int, opt2, toInt32(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)));
1326 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
1327 return v8::Handle<v8::Value>();
1330 static v8::Handle<v8::Value> methodWithOptionalStringCallback(const v8::Arguments& args)
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>();
1338 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
1339 imp->methodWithOptionalString(str);
1340 return v8::Handle<v8::Value>();
1343 static v8::Handle<v8::Value> methodWithOptionalStringIsUndefinedCallback(const v8::Arguments& args)
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>();
1352 static v8::Handle<v8::Value> methodWithOptionalStringIsNullStringCallback(const v8::Arguments& args)
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>();
1361 static v8::Handle<v8::Value> methodWithCallbackArgCallback(const v8::Arguments& args)
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>();
1374 static v8::Handle<v8::Value> methodWithNonCallbackArgAndCallbackArgCallback(const v8::Arguments& args)
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>();
1388 static v8::Handle<v8::Value> methodWithCallbackAndOptionalArgCallback(const v8::Arguments& args)
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());
1398 imp->methodWithCallbackAndOptionalArg(callback);
1399 return v8::Handle<v8::Value>();
1402 #if ENABLE(Condition1)
1404 static v8::Handle<v8::Value> conditionalMethod1Callback(const v8::Arguments& args)
1406 INC_STATS("DOM.TestObj.conditionalMethod1");
1407 TestObj* imp = V8TestObj::toNative(args.Holder());
1408 return v8String(imp->conditionalMethod1());
1411 #endif // ENABLE(Condition1)
1413 #if ENABLE(Condition1) && ENABLE(Condition2)
1415 static v8::Handle<v8::Value> conditionalMethod2Callback(const v8::Arguments& args)
1417 INC_STATS("DOM.TestObj.conditionalMethod2");
1418 TestObj* imp = V8TestObj::toNative(args.Holder());
1419 imp->conditionalMethod2();
1420 return v8::Handle<v8::Value>();
1423 #endif // ENABLE(Condition1) && ENABLE(Condition2)
1425 #if ENABLE(Condition1) || ENABLE(Condition2)
1427 static v8::Handle<v8::Value> conditionalMethod3Callback(const v8::Arguments& args)
1429 INC_STATS("DOM.TestObj.conditionalMethod3");
1430 TestObj* imp = V8TestObj::toNative(args.Holder());
1431 imp->conditionalMethod3();
1432 return v8::Handle<v8::Value>();
1435 #endif // ENABLE(Condition1) || ENABLE(Condition2)
1437 static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args)
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>();
1449 static v8::Handle<v8::Value> overloadedMethod2Callback(const v8::Arguments& args)
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>();
1460 EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)));
1461 imp->overloadedMethod(objArg, intArg);
1462 return v8::Handle<v8::Value>();
1465 static v8::Handle<v8::Value> overloadedMethod3Callback(const v8::Arguments& args)
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>();
1476 static v8::Handle<v8::Value> overloadedMethod4Callback(const v8::Arguments& args)
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>();
1487 static v8::Handle<v8::Value> overloadedMethod5Callback(const v8::Arguments& args)
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>();
1500 static v8::Handle<v8::Value> overloadedMethod6Callback(const v8::Arguments& args)
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>();
1511 static v8::Handle<v8::Value> overloadedMethod7Callback(const v8::Arguments& args)
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>();
1522 static v8::Handle<v8::Value> overloadedMethodCallback(const v8::Arguments& args)
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();
1543 static v8::Handle<v8::Value> classMethodCallback(const v8::Arguments& args)
1545 INC_STATS("DOM.TestObj.classMethod");
1546 TestObj::classMethod();
1547 return v8::Handle<v8::Value>();
1550 static v8::Handle<v8::Value> classMethodWithOptionalCallback(const v8::Arguments& args)
1552 INC_STATS("DOM.TestObj.classMethodWithOptional");
1553 if (args.Length() <= 0) {
1554 return v8::Integer::New(TestObj::classMethodWithOptional());
1556 EXCEPTION_BLOCK(int, arg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
1557 return v8::Integer::New(TestObj::classMethodWithOptional(arg));
1560 #if ENABLE(Condition1)
1562 static v8::Handle<v8::Value> overloadedMethod11Callback(const v8::Arguments& args)
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>();
1572 #endif // ENABLE(Condition1)
1574 #if ENABLE(Condition1)
1576 static v8::Handle<v8::Value> overloadedMethod12Callback(const v8::Arguments& args)
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>();
1586 #endif // ENABLE(Condition1)
1588 #if ENABLE(Condition1)
1590 static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args)
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();
1601 #endif // ENABLE(Condition1)
1603 static v8::Handle<v8::Value> enabledAtRuntimeMethod1Callback(const v8::Arguments& args)
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>();
1614 static v8::Handle<v8::Value> enabledAtRuntimeMethod2Callback(const v8::Arguments& args)
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>();
1625 static v8::Handle<v8::Value> getSVGDocumentCallback(const v8::Arguments& args)
1627 INC_STATS("DOM.TestObj.getSVGDocument");
1628 TestObj* imp = V8TestObj::toNative(args.Holder());
1629 ExceptionCode ec = 0;
1631 if (!V8BindingSecurity::shouldAllowAccessToNode(V8BindingState::Only(), imp->getSVGDocument(ec)))
1632 return v8::Handle<v8::Value>();
1633 RefPtr<SVGDocument> result = imp->getSVGDocument(ec);
1636 return toV8(result.release());
1639 V8Proxy::setDOMException(ec);
1640 return v8::Handle<v8::Value>();
1643 static v8::Handle<v8::Value> convert1Callback(const v8::Arguments& args)
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);
1651 return v8::Handle<v8::Value>();
1654 static v8::Handle<v8::Value> convert2Callback(const v8::Arguments& args)
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);
1662 return v8::Handle<v8::Value>();
1665 static v8::Handle<v8::Value> convert3Callback(const v8::Arguments& args)
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);
1673 return v8::Handle<v8::Value>();
1676 static v8::Handle<v8::Value> convert4Callback(const v8::Arguments& args)
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);
1684 return v8::Handle<v8::Value>();
1687 static v8::Handle<v8::Value> convert5Callback(const v8::Arguments& args)
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);
1695 return v8::Handle<v8::Value>();
1698 static v8::Handle<v8::Value> mutablePointFunctionCallback(const v8::Arguments& args)
1700 INC_STATS("DOM.TestObj.mutablePointFunction");
1701 TestObj* imp = V8TestObj::toNative(args.Holder());
1702 return toV8(WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(imp->mutablePointFunction())));
1705 static v8::Handle<v8::Value> immutablePointFunctionCallback(const v8::Arguments& args)
1707 INC_STATS("DOM.TestObj.immutablePointFunction");
1708 TestObj* imp = V8TestObj::toNative(args.Holder());
1709 return toV8(WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(imp->immutablePointFunction())));
1712 static v8::Handle<v8::Value> orangeCallback(const v8::Arguments& args)
1714 INC_STATS("DOM.TestObj.orange");
1715 TestObj* imp = V8TestObj::toNative(args.Holder());
1717 return v8::Handle<v8::Value>();
1720 static v8::Handle<v8::Value> strictFunctionCallback(const v8::Arguments& args)
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;
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);
1734 return toV8(result.release());
1737 V8Proxy::setDOMException(ec);
1738 return v8::Handle<v8::Value>();
1741 } // namespace TestObjInternal
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 */},
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},
1893 #if ENABLE(Condition1) && ENABLE(Condition2)
1894 {"conditionalMethod2", TestObjInternal::conditionalMethod2Callback},
1896 #if ENABLE(Condition1) || ENABLE(Condition2)
1897 {"conditionalMethod3", TestObjInternal::conditionalMethod3Callback},
1899 {"overloadedMethod", TestObjInternal::overloadedMethodCallback},
1900 {"getSVGDocument", TestObjInternal::getSVGDocumentCallback},
1901 {"mutablePointFunction", TestObjInternal::mutablePointFunctionCallback},
1902 {"immutablePointFunction", TestObjInternal::immutablePointFunctionCallback},
1903 {"orange", TestObjInternal::orangeCallback},
1904 {"strictFunction", TestObjInternal::strictFunctionCallback},
1907 static const BatchedConstant TestObjConsts[] = {
1908 #if ENABLE(Condition1)
1909 {"CONDITIONAL_CONST", static_cast<signed int>(0)},
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)},
1926 #if ENABLE(Condition1)
1927 COMPILE_ASSERT(0 == TestObj::CONDITIONAL_CONST, TestObjEnumCONDITIONAL_CONSTIsWrongUseDoNotCheckConstants);
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);
1942 v8::Handle<v8::Value> V8TestObj::constructorCallback(const v8::Arguments& args)
1944 INC_STATS("DOM.TestObj.Constructor");
1946 if (!args.IsConstructCall())
1947 return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
1949 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
1950 return args.Holder();
1952 RefPtr<TestObj> impl = TestObj::create();
1953 v8::Handle<v8::Object> wrapper = args.Holder();
1955 V8DOMWrapper::setDOMWrapper(wrapper, &info, impl.get());
1957 V8DOMWrapper::setJSWrapperForDOMObject(impl.get(), v8::Persistent<v8::Object>::New(wrapper));
1958 return args.Holder();
1961 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persistent<v8::FunctionTemplate> desc)
1963 desc->ReadOnlyPrototype();
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.
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);
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);
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));
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));
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));
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));
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));
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));
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));
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));
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));
2054 // Custom toString template
2055 desc->Set(getToStringName(), getToStringTemplate());
2059 v8::Persistent<v8::FunctionTemplate> V8TestObj::GetRawTemplate()
2061 V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
2062 V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info);
2063 if (result != data->rawTemplateMap().end())
2064 return result->second;
2066 v8::HandleScope handleScope;
2067 v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
2068 data->rawTemplateMap().add(&info, templ);
2072 v8::Persistent<v8::FunctionTemplate> V8TestObj::GetTemplate()
2074 V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
2075 V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info);
2076 if (result != data->templateMap().end())
2077 return result->second;
2079 v8::HandleScope handleScope;
2080 v8::Persistent<v8::FunctionTemplate> templ =
2081 ConfigureV8TestObjTemplate(GetRawTemplate());
2082 data->templateMap().add(&info, templ);
2086 bool V8TestObj::HasInstance(v8::Handle<v8::Value> value)
2088 return GetRawTemplate()->HasInstance(value);
2092 v8::Handle<v8::Object> V8TestObj::wrapSlow(TestObj* impl)
2094 v8::Handle<v8::Object> wrapper;
2096 wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
2097 if (UNLIKELY(wrapper.IsEmpty()))
2101 v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
2103 if (!hasDependentLifetime)
2104 wrapperHandle.MarkIndependent();
2105 getDOMObjectMap().set(impl, wrapperHandle);
2109 void V8TestObj::derefObject(void* object)
2111 static_cast<TestObj*>(object)->deref();
2114 } // namespace WebCore