Diff
Modified: trunk/Source/WebCore/ChangeLog (111003 => 111004)
--- trunk/Source/WebCore/ChangeLog 2012-03-16 13:50:33 UTC (rev 111003)
+++ trunk/Source/WebCore/ChangeLog 2012-03-16 14:01:09 UTC (rev 111004)
@@ -1,3 +1,58 @@
+2012-03-16 Kentaro Hara <[email protected]>
+
+ The IDL parser should support sequence<T> type
+ https://bugs.webkit.org/show_bug.cgi?id=81345
+
+ Reviewed by Adam Barth.
+
+ This patch makes the IDL parser support sequence<T> type.
+ This patch just makes sequence<T> parseable, and the generated code
+ for sequence<T> is wrong. This issue will be soon fixed in bug 80696.
+ This is a preparing patch for bug 80696.
+
+ Test: bindings/scripts/test/TestObj.idl
+
+ * bindings/scripts/test/TestObj.idl: Added tests for sequence<T>.
+
+ * bindings/scripts/IDLStructure.pm: Updated the regular expressions to support sequence<T>.
+
+ * bindings/scripts/test/CPP/WebDOMTestObj.cpp: Updated run-bindings-tests results.
+ (WebDOMTestObj::sequenceAttr):
+ (WebDOMTestObj::setSequenceAttr):
+ (WebDOMTestObj::methodWithSequenceArg):
+ (WebDOMTestObj::methodReturningSequence):
+ * bindings/scripts/test/CPP/WebDOMTestObj.h:
+ * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+ (webkit_dom_test_obj_method_with_sequence_arg):
+ (webkit_dom_test_obj_method_returning_sequence):
+ (webkit_dom_test_obj_get_sequence_attr):
+ (webkit_dom_test_obj_set_sequence_attr):
+ (webkit_dom_test_obj_get_property):
+ (webkit_dom_test_obj_class_init):
+ * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore):
+ (WebCore::jsTestObjSequenceAttr):
+ (WebCore::setJSTestObjSequenceAttr):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithSequenceArg):
+ (WebCore::jsTestObjPrototypeFunctionMethodReturningSequence):
+ * bindings/scripts/test/JS/JSTestObj.h:
+ (WebCore):
+ * bindings/scripts/test/ObjC/DOMTestObj.h:
+ * bindings/scripts/test/ObjC/DOMTestObj.mm:
+ (-[DOMTestObj sequenceAttr]):
+ (-[DOMTestObj setSequenceAttr:]):
+ (-[DOMTestObj methodWithSequenceArg:]):
+ (-[DOMTestObj methodReturningSequence:]):
+ * bindings/scripts/test/V8/V8TestObj.cpp:
+ (WebCore::TestObjInternal::sequenceAttrAttrGetter):
+ (TestObjInternal):
+ (WebCore::TestObjInternal::sequenceAttrAttrSetter):
+ (WebCore::TestObjInternal::methodWithSequenceArgCallback):
+ (WebCore::TestObjInternal::methodReturningSequenceCallback):
+ (WebCore):
+ (WebCore::ConfigureV8TestObjTemplate):
+
2012-03-16 Ilya Tikhonovsky <[email protected]>
Web Inspector: HeapSnapshot: merge two long operations into one.
Modified: trunk/Source/WebCore/bindings/scripts/IDLStructure.pm (111003 => 111004)
--- trunk/Source/WebCore/bindings/scripts/IDLStructure.pm 2012-03-16 13:50:33 UTC (rev 111003)
+++ trunk/Source/WebCore/bindings/scripts/IDLStructure.pm 2012-03-16 14:01:09 UTC (rev 111004)
@@ -88,7 +88,7 @@
our $idlDataType = '[a-zA-Z0-9\ ]'; # Generic data type identifier
# Magic IDL parsing regular expressions
-my $supportedTypes = "((?:(?:unsigned )?(?:int|short|(?:long )?long)|(?:$idlIdNs*))(?:\\[\\])?)";
+my $supportedTypes = "((?:(?:unsigned )?(?:int|short|(?:long )?long)|(?:$idlIdNs*))(?:\\[\\]|<(?:$idlIdNs*)>)?)";
# Special IDL notations. This regular _expression_ extracts the string between the first [ and its corresponding ].
our $extendedAttributeSyntax = qr/\[[^\[\]]*(?:(??{$IDLStructure::extendedAttributeSyntax})[^\[\]]*)*\]/x; # Used for extended attributes
@@ -103,7 +103,7 @@
our $typeNamespaceSelector = '((?:' . $idlId . '*::)*)\s*(' . $idlDataType . '*)';
-our $interfaceSelector = 'interface\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([-a-zA-Z0-9_"=\s(),;:\[\]&\|]*)';
+our $interfaceSelector = 'interface\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([-a-zA-Z0-9_"=\s(),;:\[\]<>&\|]*)';
our $interfaceMethodSelector = '\s*((?:' . $extendedAttributeSyntax . ' )?)(static\s+)?' . $supportedTypes . '\s*(' . $idlIdNs . '*)\s*\(\s*([a-zA-Z0-9:\s,=\[\]]*)';
our $interfaceParameterSelector = '(in|out)\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)';
Modified: trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp (111003 => 111004)
--- trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp 2012-03-16 13:50:33 UTC (rev 111003)
+++ trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp 2012-03-16 14:01:09 UTC (rev 111004)
@@ -40,6 +40,8 @@
#include "WebDOMc.h"
#include "WebDOMd.h"
#include "WebDOMe.h"
+#include "WebDOMsequence.h"
+#include "WebDOMsequence<ScriptProfile>.h"
#include "WebExceptionHandler.h"
#include "WebNativeEventListener.h"
#include "a.h"
@@ -48,6 +50,8 @@
#include "c.h"
#include "d.h"
#include "e.h"
+#include "sequence.h"
+#include "sequence<ScriptProfile>.h"
#include "wtf/text/AtomicString.h"
#include <wtf/GetPtr.h>
#include <wtf/RefPtr.h>
@@ -233,6 +237,22 @@
impl()->setTestObjAttr(toWebCore(newTestObjAttr));
}
+WebDOMsequence<ScriptProfile> WebDOMTestObj::sequenceAttr() const
+{
+ if (!impl())
+ return WebDOMsequence<ScriptProfile>();
+
+ return toWebKit(WTF::getPtr(impl()->sequenceAttr()));
+}
+
+void WebDOMTestObj::setSequenceAttr(const WebDOMsequence<ScriptProfile>& newSequenceAttr)
+{
+ if (!impl())
+ return;
+
+ impl()->setSequenceAttr(toWebCore(newSequenceAttr));
+}
+
WebDOMTestObj WebDOMTestObj::XMLObjAttr() const
{
if (!impl())
@@ -677,6 +697,22 @@
return toWebKit(WTF::getPtr(impl()->objMethodWithArgs(intArg, strArg, toWebCore(objArg))));
}
+void WebDOMTestObj::methodWithSequenceArg(const WebDOMsequence& )
+{
+ if (!impl())
+ return;
+
+ impl()->methodWithSequenceArg(toWebCore());
+}
+
+WebDOMsequence<ScriptProfile> WebDOMTestObj::methodReturningSequence(int intArg)
+{
+ if (!impl())
+ return WebDOMsequence<ScriptProfile>();
+
+ return toWebKit(WTF::getPtr(impl()->methodReturningSequence(intArg)));
+}
+
WebDOMTestObj WebDOMTestObj::methodThatRequiresAllArgsAndThrows(const WebDOMString& strArg, const WebDOMTestObj& objArg)
{
if (!impl())
Modified: trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h (111003 => 111004)
--- trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h 2012-03-16 13:50:33 UTC (rev 111003)
+++ trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h 2012-03-16 14:01:09 UTC (rev 111004)
@@ -43,6 +43,8 @@
class WebDOMc;
class WebDOMd;
class WebDOMe;
+class WebDOMsequence;
+class WebDOMsequence<ScriptProfile>;
class WebDOMTestObj : public WebDOMObject {
public:
@@ -87,6 +89,8 @@
void setStringAttr(const WebDOMString&);
WebDOMTestObj testObjAttr() const;
void setTestObjAttr(const WebDOMTestObj&);
+ WebDOMsequence<ScriptProfile> sequenceAttr() const;
+ void setSequenceAttr(const WebDOMsequence<ScriptProfile>&);
WebDOMTestObj XMLObjAttr() const;
void setXMLObjAttr(const WebDOMTestObj&);
bool create() const;
@@ -147,6 +151,8 @@
int intMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg);
WebDOMTestObj objMethod();
WebDOMTestObj objMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg);
+ void methodWithSequenceArg(const WebDOMsequence& );
+ WebDOMsequence<ScriptProfile> methodReturningSequence(int intArg);
WebDOMTestObj methodThatRequiresAllArgsAndThrows(const WebDOMString& strArg, const WebDOMTestObj& objArg);
void serializedValue(const WebDOMString& serializedArg);
void idbKey(const WebDOMIDBKey& key);
Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (111003 => 111004)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp 2012-03-16 13:50:33 UTC (rev 111003)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp 2012-03-16 14:01:09 UTC (rev 111004)
@@ -33,6 +33,7 @@
#include "WebKitDOMBinding.h"
#include "bool.h"
#include "gobject/ConvertToUTF8String.h"
+#include "sequence<ScriptProfile>.h"
#include "webkit/WebKitDOMDictionary.h"
#include "webkit/WebKitDOMDictionaryPrivate.h"
#include "webkit/WebKitDOMDocument.h"
@@ -57,6 +58,10 @@
#include "webkit/WebKitDOMdPrivate.h"
#include "webkit/WebKitDOMe.h"
#include "webkit/WebKitDOMePrivate.h"
+#include "webkit/WebKitDOMsequence.h"
+#include "webkit/WebKitDOMsequence<ScriptProfile>.h"
+#include "webkit/WebKitDOMsequence<ScriptProfile>Private.h"
+#include "webkit/WebKitDOMsequencePrivate.h"
#include "webkitdefines.h"
#include "webkitglobalsprivate.h"
#include "webkitmarshal.h"
@@ -159,6 +164,32 @@
return res;
}
+void
+webkit_dom_test_obj_method_with_sequence_arg(WebKitDOMTestObj* self, WebKitDOMsequence* )
+{
+ g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
+ WebCore::TestObj * item = WebKit::core(self);
+ g_return_if_fail();
+ WebCore::sequence * converted_ = NULL;
+ if ( != NULL) {
+ converted_ = WebKit::core();
+ g_return_if_fail(converted_);
+ }
+ item->methodWithSequenceArg(converted_);
+}
+
+WebKitDOMsequence<ScriptProfile>*
+webkit_dom_test_obj_method_returning_sequence(WebKitDOMTestObj* self, glong int_arg)
+{
+ g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
+ WebCore::TestObj * item = WebKit::core(self);
+ PassRefPtr<WebCore::sequence<ScriptProfile>> g_res = WTF::getPtr(item->methodReturningSequence(int_arg));
+ WebKitDOMsequence<ScriptProfile>* res = WebKit::kit(g_res.get());
+ return res;
+}
+
WebKitDOMTestObj*
webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* self, const gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error)
{
@@ -779,6 +810,32 @@
item->setTestObjAttr(converted_value);
}
+WebKitDOMsequence<ScriptProfile>*
+webkit_dom_test_obj_get_sequence_attr(WebKitDOMTestObj* self)
+{
+ g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
+ WebCore::TestObj * item = WebKit::core(self);
+ PassRefPtr<WebCore::sequence<ScriptProfile>> g_res = WTF::getPtr(item->sequenceAttr());
+ WebKitDOMsequence<ScriptProfile>* res = WebKit::kit(g_res.get());
+ return res;
+}
+
+void
+webkit_dom_test_obj_set_sequence_attr(WebKitDOMTestObj* self, WebKitDOMsequence<ScriptProfile>* value)
+{
+ g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
+ WebCore::TestObj * item = WebKit::core(self);
+ g_return_if_fail(value);
+ WebCore::sequence<ScriptProfile> * converted_value = NULL;
+ if (value != NULL) {
+ converted_value = WebKit::core(value);
+ g_return_if_fail(converted_value);
+ }
+ item->setSequenceAttr(converted_value);
+}
+
WebKitDOMTestObj*
webkit_dom_test_obj_get_xml_obj_attr(WebKitDOMTestObj* self)
{
@@ -1538,6 +1595,7 @@
PROP_UNSIGNED_LONG_LONG_ATTR,
PROP_STRING_ATTR,
PROP_TEST_OBJ_ATTR,
+ PROP_SEQUENCE_ATTR,
PROP_XML_OBJ_ATTR,
PROP_CREATE,
PROP_REFLECTED_STRING_ATTR,
@@ -1797,6 +1855,12 @@
g_value_set_object(value, WebKit::kit(ptr.get()));
break;
}
+ case PROP_SEQUENCE_ATTR:
+ {
+ RefPtr<WebCore::sequence<ScriptProfile>> ptr = coreSelf->sequenceAttr();
+ g_value_set_object(value, WebKit::kit(ptr.get()));
+ break;
+ }
case PROP_XML_OBJ_ATTR:
{
RefPtr<WebCore::TestObj> ptr = coreSelf->xmlObjAttr();
@@ -2089,6 +2153,13 @@
WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(gobjectClass,
+ PROP_SEQUENCE_ATTR,
+ g_param_spec_object("sequence-attr", /* name */
+ "test_obj_sequence-attr", /* short description */
+ "read-write WebKitDOMsequence<ScriptProfile>* TestObj.sequence-attr", /* longer - could do with some extra doc stuff here */
+ WEBKIT_TYPE_DOM_SEQUENCE<SCRIPT_PROFILE>, /* gobject type */
+ WEBKIT_PARAM_READWRITE));
+ g_object_class_install_property(gobjectClass,
PROP_XML_OBJ_ATTR,
g_param_spec_object("xml-obj-attr", /* name */
"test_obj_xml-obj-attr", /* short description */
Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h (111003 => 111004)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h 2012-03-16 13:50:33 UTC (rev 111003)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h 2012-03-16 14:01:09 UTC (rev 111004)
@@ -116,6 +116,28 @@
webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, const gchar* str_arg, WebKitDOMTestObj* obj_arg);
/**
+ * webkit_dom_test_obj_method_with_sequence_arg:
+ * @self: A #WebKitDOMTestObj
+ * @: A #WebKitDOMsequence
+ *
+ * Returns:
+ *
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_sequence_arg(WebKitDOMTestObj* self, WebKitDOMsequence* );
+
+/**
+ * webkit_dom_test_obj_method_returning_sequence:
+ * @self: A #WebKitDOMTestObj
+ * @int_arg: A #glong
+ *
+ * Returns: (transfer none):
+ *
+**/
+WEBKIT_API WebKitDOMsequence<ScriptProfile>*
+webkit_dom_test_obj_method_returning_sequence(WebKitDOMTestObj* self, glong int_arg);
+
+/**
* webkit_dom_test_obj_method_that_requires_all_args_and_throws:
* @self: A #WebKitDOMTestObj
* @str_arg: A #gchar
@@ -675,6 +697,27 @@
webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value);
/**
+ * webkit_dom_test_obj_get_sequence_attr:
+ * @self: A #WebKitDOMTestObj
+ *
+ * Returns: (transfer none):
+ *
+**/
+WEBKIT_API WebKitDOMsequence<ScriptProfile>*
+webkit_dom_test_obj_get_sequence_attr(WebKitDOMTestObj* self);
+
+/**
+ * webkit_dom_test_obj_set_sequence_attr:
+ * @self: A #WebKitDOMTestObj
+ * @value: A #WebKitDOMsequence<ScriptProfile>
+ *
+ * Returns: (transfer none):
+ *
+**/
+WEBKIT_API void
+webkit_dom_test_obj_set_sequence_attr(WebKitDOMTestObj* self, WebKitDOMsequence<ScriptProfile>* value);
+
+/**
* webkit_dom_test_obj_get_xml_obj_attr:
* @self: A #WebKitDOMTestObj
*
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (111003 => 111004)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2012-03-16 13:50:33 UTC (rev 111003)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2012-03-16 14:01:09 UTC (rev 111004)
@@ -42,6 +42,8 @@
#include "JSd.h"
#include "JSe.h"
#include "JSint.h"
+#include "JSsequence.h"
+#include "JSsequence<ScriptProfile>.h"
#include "KURL.h"
#include "SVGDocument.h"
#include "SVGStaticPropertyTearOff.h"
@@ -51,6 +53,7 @@
#include "SerializedScriptValue.h"
#include "TestObj.h"
#include "bool.h"
+#include "sequence<ScriptProfile>.h"
#include <runtime/Error.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
@@ -86,6 +89,7 @@
{ "unsignedLongLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnsignedLongLongAttr), (intptr_t)setJSTestObjUnsignedLongLongAttr, NoIntrinsic },
{ "stringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttr), (intptr_t)setJSTestObjStringAttr, NoIntrinsic },
{ "testObjAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjTestObjAttr), (intptr_t)setJSTestObjTestObjAttr, NoIntrinsic },
+ { "sequenceAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjSequenceAttr), (intptr_t)setJSTestObjSequenceAttr, NoIntrinsic },
{ "XMLObjAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjXMLObjAttr), (intptr_t)setJSTestObjXMLObjAttr, NoIntrinsic },
{ "create", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCreate), (intptr_t)setJSTestObjCreate, NoIntrinsic },
{ "reflectedStringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedStringAttr), (intptr_t)setJSTestObjReflectedStringAttr, NoIntrinsic },
@@ -251,6 +255,8 @@
{ "intMethodWithArgs", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionIntMethodWithArgs), (intptr_t)3, NoIntrinsic },
{ "objMethod", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionObjMethod), (intptr_t)0, NoIntrinsic },
{ "objMethodWithArgs", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionObjMethodWithArgs), (intptr_t)3, NoIntrinsic },
+ { "methodWithSequenceArg", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithSequenceArg), (intptr_t)1, NoIntrinsic },
+ { "methodReturningSequence", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodReturningSequence), (intptr_t)1, NoIntrinsic },
{ "methodThatRequiresAllArgsAndThrows", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows), (intptr_t)2, NoIntrinsic },
{ "serializedValue", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionSerializedValue), (intptr_t)1, NoIntrinsic },
{ "idbKey", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionIdbKey), (intptr_t)1, NoIntrinsic },
@@ -466,6 +472,16 @@
}
+JSValue jsTestObjSequenceAttr(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
+ UNUSED_PARAM(exec);
+ TestObj* impl = static_cast<TestObj*>(castedThis->impl());
+ JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->sequenceAttr()));
+ return result;
+}
+
+
JSValue jsTestObjXMLObjAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
@@ -945,6 +961,14 @@
}
+void setJSTestObjSequenceAttr(ExecState* exec, JSObject* thisObject, JSValue value)
+{
+ JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
+ TestObj* impl = static_cast<TestObj*>(castedThis->impl());
+ impl->setSequenceAttr(tosequence<ScriptProfile>(value));
+}
+
+
void setJSTestObjXMLObjAttr(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
@@ -1368,6 +1392,41 @@
return JSValue::encode(result);
}
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithSequenceArg(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&JSTestObj::s_info))
+ return throwVMTypeError(exec);
+ JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
+ ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
+ TestObj* impl = static_cast<TestObj*>(castedThis->impl());
+ if (exec->argumentCount() < 1)
+ return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
+ sequence* (tosequence(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+ impl->methodWithSequenceArg();
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodReturningSequence(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&JSTestObj::s_info))
+ return throwVMTypeError(exec);
+ JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
+ ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
+ TestObj* impl = static_cast<TestObj*>(castedThis->impl());
+ if (exec->argumentCount() < 1)
+ return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
+ int intArg(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInt32(exec));
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->methodReturningSequence(intArg)));
+ return JSValue::encode(result);
+}
+
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h (111003 => 111004)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h 2012-03-16 13:50:33 UTC (rev 111003)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h 2012-03-16 14:01:09 UTC (rev 111004)
@@ -158,6 +158,8 @@
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithSequenceArg(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodReturningSequence(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIdbKey(JSC::ExecState*);
@@ -231,6 +233,8 @@
void setJSTestObjStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjTestObjAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSTestObjTestObjAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
+JSC::JSValue jsTestObjSequenceAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+void setJSTestObjSequenceAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjXMLObjAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSTestObjXMLObjAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjCreate(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (111003 => 111004)
--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h 2012-03-16 13:50:33 UTC (rev 111003)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h 2012-03-16 14:01:09 UTC (rev 111004)
@@ -43,6 +43,8 @@
@class DOMc;
@class DOMd;
@class DOMe;
+@class DOMsequence;
+@class DOMsequence<ScriptProfile>;
@class NSString;
@protocol DOMEventListener;
@@ -82,6 +84,8 @@
- (void)setStringAttr:(NSString *)newStringAttr;
- (DOMTestObj *)testObjAttr;
- (void)setTestObjAttr:(DOMTestObj *)newTestObjAttr;
+- (DOMsequence<ScriptProfile> *)sequenceAttr;
+- (void)setSequenceAttr:(DOMsequence<ScriptProfile> *)newSequenceAttr;
- (DOMTestObj *)XMLObjAttr;
- (void)setXMLObjAttr:(DOMTestObj *)newXMLObjAttr;
- (BOOL)create;
@@ -171,6 +175,8 @@
- (int)intMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg;
- (DOMTestObj *)objMethod;
- (DOMTestObj *)objMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg;
+- (void)methodWithSequenceArg:(DOMsequence *);
+- (DOMsequence<ScriptProfile> *)methodReturningSequence:(int)intArg;
- (DOMTestObj *)methodThatRequiresAllArgsAndThrows:(NSString *)strArg objArg:(DOMTestObj *)objArg;
- (void)serializedValue:(NSString *)serializedArg;
- (void)idbKey:(DOMIDBKey *)key;
Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm (111003 => 111004)
--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm 2012-03-16 13:50:33 UTC (rev 111003)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm 2012-03-16 14:01:09 UTC (rev 111004)
@@ -50,6 +50,8 @@
#import "DOMcInternal.h"
#import "DOMdInternal.h"
#import "DOMeInternal.h"
+#import "DOMsequence<ScriptProfile>Internal.h"
+#import "DOMsequenceInternal.h"
#import "Dictionary.h"
#import "Document.h"
#import "EventListener.h"
@@ -75,6 +77,8 @@
#import "c.h"
#import "d.h"
#import "e.h"
+#import "sequence.h"
+#import "sequence<ScriptProfile>.h"
#import <wtf/GetPtr.h>
#define IMPL reinterpret_cast<WebCore::TestObj*>(_internal)
@@ -202,6 +206,20 @@
IMPL->setTestObjAttr(core(newTestObjAttr));
}
+- (DOMsequence<ScriptProfile> *)sequenceAttr
+{
+ WebCore::JSMainThreadNullState state;
+ return kit(WTF::getPtr(IMPL->sequenceAttr()));
+}
+
+- (void)setSequenceAttr:(DOMsequence<ScriptProfile> *)newSequenceAttr
+{
+ WebCore::JSMainThreadNullState state;
+ ASSERT(newSequenceAttr);
+
+ IMPL->setSequenceAttr(core(newSequenceAttr));
+}
+
- (DOMTestObj *)XMLObjAttr
{
WebCore::JSMainThreadNullState state;
@@ -731,6 +749,18 @@
return kit(WTF::getPtr(IMPL->objMethodWithArgs(intArg, strArg, core(objArg))));
}
+- (void)methodWithSequenceArg:(DOMsequence *)
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->methodWithSequenceArg(core());
+}
+
+- (DOMsequence<ScriptProfile> *)methodReturningSequence:(int)intArg
+{
+ WebCore::JSMainThreadNullState state;
+ return kit(WTF::getPtr(IMPL->methodReturningSequence(intArg)));
+}
+
- (DOMTestObj *)methodThatRequiresAllArgsAndThrows:(NSString *)strArg objArg:(DOMTestObj *)objArg
{
WebCore::JSMainThreadNullState state;
Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (111003 => 111004)
--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2012-03-16 13:50:33 UTC (rev 111003)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2012-03-16 14:01:09 UTC (rev 111004)
@@ -45,6 +45,7 @@
attribute unsigned long long unsignedLongLongAttr;
attribute DOMString stringAttr;
attribute TestObj testObjAttr;
+ attribute sequence<ScriptProfile> sequenceAttr;
JS, V8
// WK_ucfirst, WK_lcfirst exceptional cases.
@@ -70,6 +71,9 @@
TestObj objMethod();
TestObj objMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg);
+ void methodWithSequenceArg(in sequence<ScriptProfile> sequenceArg);
+ sequence<ScriptProfile> methodReturningSequence(in long intArg);
+
TestObj methodThatRequiresAllArgsAndThrows(in DOMString strArg, in TestObj objArg)
raises(DOMException);
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (111003 => 111004)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-03-16 13:50:33 UTC (rev 111003)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-03-16 14:01:09 UTC (rev 111004)
@@ -51,6 +51,8 @@
#include "V8d.h"
#include "V8e.h"
#include "V8int.h"
+#include "V8sequence.h"
+#include "V8sequence<ScriptProfile>.h"
#include <wtf/GetPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
@@ -217,6 +219,22 @@
return;
}
+static v8::Handle<v8::Value> sequenceAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.sequenceAttr._get");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ return toV8(imp->sequenceAttr());
+}
+
+static void sequenceAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.sequenceAttr._set");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ sequence<ScriptProfile>* v = V8sequence<ScriptProfile>::HasInstance(value) ? V8sequence<ScriptProfile>::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
+ imp->setSequenceAttr(WTF::getPtr(v));
+ return;
+}
+
static v8::Handle<v8::Value> XMLObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.TestObj.XMLObjAttr._get");
@@ -1035,6 +1053,27 @@
return toV8(imp->objMethodWithArgs(intArg, strArg, objArg));
}
+static v8::Handle<v8::Value> methodWithSequenceArgCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.TestObj.methodWithSequenceArg");
+ if (args.Length() < 1)
+ return throwError("Not enough arguments", V8Proxy::TypeError);
+ TestObj* imp = V8TestObj::toNative(args.Holder());
+ EXCEPTION_BLOCK(sequence*, , V8sequence::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8sequence::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
+ imp->methodWithSequenceArg();
+ return v8::Handle<v8::Value>();
+}
+
+static v8::Handle<v8::Value> methodReturningSequenceCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.TestObj.methodReturningSequence");
+ if (args.Length() < 1)
+ return throwError("Not enough arguments", V8Proxy::TypeError);
+ TestObj* imp = V8TestObj::toNative(args.Holder());
+ EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
+ return toV8(imp->methodReturningSequence(intArg));
+}
+
static v8::Handle<v8::Value> methodThatRequiresAllArgsAndThrowsCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TestObj.methodThatRequiresAllArgsAndThrows");
@@ -1761,6 +1800,8 @@
{"stringAttr", TestObjInternal::stringAttrAttrGetter, TestObjInternal::stringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: '')
{"testObjAttr", TestObjInternal::testObjAttrAttrGetter, TestObjInternal::testObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
+ // Attribute 'sequenceAttr' (Type: 'attribute' ExtAttr: '')
+ {"sequenceAttr", TestObjInternal::sequenceAttrAttrGetter, TestObjInternal::sequenceAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'XMLObjAttr' (Type: 'attribute' ExtAttr: '')
{"XMLObjAttr", TestObjInternal::XMLObjAttrAttrGetter, TestObjInternal::XMLObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'create' (Type: 'attribute' ExtAttr: '')
@@ -1861,6 +1902,7 @@
{"voidMethod", TestObjInternal::voidMethodCallback},
{"intMethod", TestObjInternal::intMethodCallback},
{"objMethod", TestObjInternal::objMethodCallback},
+ {"methodReturningSequence", TestObjInternal::methodReturningSequenceCallback},
{"serializedValue", TestObjInternal::serializedValueCallback},
{"idbKey", TestObjInternal::idbKeyCallback},
{"optionsObject", TestObjInternal::optionsObjectCallback},
@@ -2004,6 +2046,12 @@
v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(desc, objMethodWithArgsArgc, objMethodWithArgsArgv);
proto->Set(v8::String::New("objMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::objMethodWithArgsCallback, v8::Handle<v8::Value>(), objMethodWithArgsSignature));
+ // Custom Signature 'methodWithSequenceArg'
+ const int methodWithSequenceArgArgc = 1;
+ v8::Handle<v8::FunctionTemplate> methodWithSequenceArgArgv[methodWithSequenceArgArgc] = { V8sequence::GetRawTemplate() };
+ v8::Handle<v8::Signature> methodWithSequenceArgSignature = v8::Signature::New(desc, methodWithSequenceArgArgc, methodWithSequenceArgArgv);
+ proto->Set(v8::String::New("methodWithSequenceArg"), v8::FunctionTemplate::New(TestObjInternal::methodWithSequenceArgCallback, v8::Handle<v8::Value>(), methodWithSequenceArgSignature));
+
// Custom Signature 'methodThatRequiresAllArgsAndThrows'
const int methodThatRequiresAllArgsAndThrowsArgc = 2;
v8::Handle<v8::FunctionTemplate> methodThatRequiresAllArgsAndThrowsArgv[methodThatRequiresAllArgsAndThrowsArgc] = { v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };