2010-04-26 Adam Barth <abarth@webkit.org>
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Apr 2010 07:15:44 +0000 (07:15 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Apr 2010 07:15:44 +0000 (07:15 +0000)
        Reviewed by Eric Seidel.

        Add CallWith=DynamicFrame to CodeGenerator
        https://bugs.webkit.org/show_bug.cgi?id=38174

        I've only used this in one instance, but this is infrastructure that I
        think will help remove a bunch of custom bindings code.  Also, added a
        few tests of tricky argument cases.

        * bindings/js/JSHTMLFormElementCustom.cpp:
        * bindings/scripts/CodeGeneratorJS.pm:
        * bindings/scripts/CodeGeneratorV8.pm:
        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
        (webkit_dom_test_obj_with_dynamic_frame):
        (webkit_dom_test_obj_with_dynamic_frame_and_arg):
        (webkit_dom_test_obj_with_dynamic_frame_and_optional_arg):
        (webkit_dom_test_obj_with_dynamic_frame_and_user_gesture):
        (webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad):
        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
        * bindings/scripts/test/JS/JSTestObj.cpp:
        (WebCore::):
        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrame):
        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndArg):
        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg):
        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture):
        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD):
        * bindings/scripts/test/JS/JSTestObj.h:
        * bindings/scripts/test/ObjC/DOMTestObj.h:
        * bindings/scripts/test/ObjC/DOMTestObj.mm:
        (-[DOMTestObj withDynamicFrame]):
        (-[DOMTestObj withDynamicFrameAndArg:]):
        (-[DOMTestObj withDynamicFrameAndOptionalArg:optionalArg:]):
        (-[DOMTestObj withDynamicFrameAndUserGesture:]):
        (-[DOMTestObj withDynamicFrameAndUserGestureASAD:optionalArg:]):
        * bindings/scripts/test/TestObj.idl:
        * bindings/scripts/test/V8/V8TestObj.cpp:
        (WebCore::TestObjInternal::withDynamicFrameCallback):
        (WebCore::TestObjInternal::withDynamicFrameAndArgCallback):
        (WebCore::TestObjInternal::withDynamicFrameAndOptionalArgCallback):
        (WebCore::TestObjInternal::withDynamicFrameAndUserGestureCallback):
        (WebCore::TestObjInternal::withDynamicFrameAndUserGestureASADCallback):
        (WebCore::):
        * bindings/v8/custom/V8HTMLFormElementCustom.cpp:
        * html/HTMLFormElement.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@58295 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
WebCore/ChangeLog
WebCore/bindings/js/JSHTMLFormElementCustom.cpp
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/bindings/scripts/CodeGeneratorV8.pm
WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
WebCore/bindings/scripts/test/JS/JSTestObj.cpp
WebCore/bindings/scripts/test/JS/JSTestObj.h
WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
WebCore/bindings/scripts/test/TestObj.idl
WebCore/bindings/scripts/test/V8/V8TestObj.cpp
WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
WebCore/html/HTMLFormElement.idl

index 983c9bc..d94abc4 100644 (file)
@@ -1,5 +1,52 @@
 2010-04-26  Adam Barth  <abarth@webkit.org>
 
+        Reviewed by Eric Seidel.
+
+        Add CallWith=DynamicFrame to CodeGenerator
+        https://bugs.webkit.org/show_bug.cgi?id=38174
+
+        I've only used this in one instance, but this is infrastructure that I
+        think will help remove a bunch of custom bindings code.  Also, added a
+        few tests of tricky argument cases.
+
+        * bindings/js/JSHTMLFormElementCustom.cpp:
+        * bindings/scripts/CodeGeneratorJS.pm:
+        * bindings/scripts/CodeGeneratorV8.pm:
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+        (webkit_dom_test_obj_with_dynamic_frame):
+        (webkit_dom_test_obj_with_dynamic_frame_and_arg):
+        (webkit_dom_test_obj_with_dynamic_frame_and_optional_arg):
+        (webkit_dom_test_obj_with_dynamic_frame_and_user_gesture):
+        (webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad):
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::):
+        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrame):
+        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndArg):
+        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg):
+        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture):
+        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD):
+        * bindings/scripts/test/JS/JSTestObj.h:
+        * bindings/scripts/test/ObjC/DOMTestObj.h:
+        * bindings/scripts/test/ObjC/DOMTestObj.mm:
+        (-[DOMTestObj withDynamicFrame]):
+        (-[DOMTestObj withDynamicFrameAndArg:]):
+        (-[DOMTestObj withDynamicFrameAndOptionalArg:optionalArg:]):
+        (-[DOMTestObj withDynamicFrameAndUserGesture:]):
+        (-[DOMTestObj withDynamicFrameAndUserGestureASAD:optionalArg:]):
+        * bindings/scripts/test/TestObj.idl:
+        * bindings/scripts/test/V8/V8TestObj.cpp:
+        (WebCore::TestObjInternal::withDynamicFrameCallback):
+        (WebCore::TestObjInternal::withDynamicFrameAndArgCallback):
+        (WebCore::TestObjInternal::withDynamicFrameAndOptionalArgCallback):
+        (WebCore::TestObjInternal::withDynamicFrameAndUserGestureCallback):
+        (WebCore::TestObjInternal::withDynamicFrameAndUserGestureASADCallback):
+        (WebCore::):
+        * bindings/v8/custom/V8HTMLFormElementCustom.cpp:
+        * html/HTMLFormElement.idl:
+
+2010-04-26  Adam Barth  <abarth@webkit.org>
+
         Unreviewed.  Update comment to better reflect reality.
 
         * bindings/scripts/test/TestObj.idl:
index 2e7522c..4dd0b81 100644 (file)
@@ -61,13 +61,4 @@ JSValue JSHTMLFormElement::nameGetter(ExecState* exec, JSValue slotBase, const I
     return toJS(exec, jsForm->globalObject(), StaticNodeList::adopt(namedItems).get());
 }
 
-JSValue JSHTMLFormElement::submit(ExecState* exec, const ArgList&)
-{
-    Frame* activeFrame = asJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
-    if (!activeFrame)
-        return jsUndefined();
-    static_cast<HTMLFormElement*>(impl())->submit(activeFrame);
-    return jsUndefined();
-}
-
 }
index 3cc3cc5..a7e795b 100644 (file)
@@ -1691,6 +1691,16 @@ sub GenerateImplementation
                     $implIncludes{"ScriptCallStack.h"} = 1;
                 }
 
+                my $callWith = $function->signature->extendedAttributes->{"CallWith"};
+                if ($callWith && $callWith eq "DynamicFrame") {
+                    push(@implContent, "    Frame* dynamicFrame = toDynamicFrame(exec);\n");
+                    push(@implContent, "    if (!dynamicFrame)\n");
+                    push(@implContent, "        return jsUndefined();\n");
+                    $functionString .= ", " if $paramIndex;
+                    $functionString .= "dynamicFrame";
+                    $paramIndex++;
+                }
+
                 foreach my $parameter (@{$function->parameters}) {
                     if (!$hasOptionalArguments && $parameter->extendedAttributes->{"Optional"}) {
                         push(@implContent, "\n    int argsCount = args.size();\n");
index f2b9604..2eaaff8 100644 (file)
@@ -2332,15 +2332,24 @@ sub GenerateFunctionCallString()
         $functionString = "listImp->${name}(";
     }
 
-    my $first = 1;
     my $index = 0;
 
+    my $callWith = $function->signature->extendedAttributes->{"CallWith"};
+    if ($callWith && $callWith eq "DynamicFrame") {
+        $result .= $indent . "Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();\n";
+        $result .= $indent . "if (!enteredFrame)\n";
+        $result .= $indent . "    return v8::Undefined();\n";
+        $functionString .= ", " if $index;
+        $functionString .= "enteredFrame";
+        $index++;
+        $numberOfParameters++
+    }
+
     foreach my $parameter (@{$function->parameters}) {
         if ($index eq $numberOfParameters) {
             last;
         }
-        if ($first) { $first = 0; }
-        else { $functionString .= ", "; }
+        $functionString .= ", " if $index;
         my $paramName = $parameter->name;
         my $paramType = $parameter->type;
 
@@ -2359,22 +2368,23 @@ sub GenerateFunctionCallString()
     }
 
     if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
-        $functionString .= ", " if not $first;
+        $functionString .= ", " if $index;
         $functionString .= "callStack.get()";
-        if ($first) { $first = 0; }
+        $index++;
     }
 
     if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) {
-        $functionString .= ", " if not $first;
+        $functionString .= ", " if $index;
         # FIXME: We need to pass DOMWrapperWorld as a parameter.
         # See http://trac.webkit.org/changeset/54182
         $functionString .= "processingUserGesture()";
-        if ($first) { $first = 0; }
+        $index++;
     }
 
     if (@{$function->raisesExceptions}) {
-        $functionString .= ", " if not $first;
+        $functionString .= ", " if $index;
         $functionString .= "ec";
+        $index++;
     }
     $functionString .= ")";
 
index e264da6..38eda4d 100644 (file)
@@ -29,6 +29,8 @@
 #include "gobject/ConvertToUTF8String.h"
 #include "webkit/WebKitDOMTestObj.h"
 #include "webkit/WebKitDOMTestObjPrivate.h"
+#include "webkit/WebKitDOMlog.h"
+#include "webkit/WebKitDOMlogPrivate.h"
 #include "webkitmarshal.h"
 #include "webkitprivate.h"
 
@@ -136,6 +138,54 @@ webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **erro
 
 }
 
+
+/* TODO: custom function webkit_dom_test_obj_custom_args_and_exception */
+
+void
+webkit_dom_test_obj_with_dynamic_frame (WebKitDOMTestObj *self)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    item->withDynamicFrame();
+
+}
+
+void
+webkit_dom_test_obj_with_dynamic_frame_and_arg (WebKitDOMTestObj *self, glong int_arg)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    item->withDynamicFrameAndArg(int_arg);
+
+}
+
+void
+webkit_dom_test_obj_with_dynamic_frame_and_optional_arg (WebKitDOMTestObj *self, glong int_arg, glong optional_arg)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    item->withDynamicFrameAndOptionalArg(int_arg, optional_arg);
+
+}
+
+void
+webkit_dom_test_obj_with_dynamic_frame_and_user_gesture (WebKitDOMTestObj *self, glong int_arg)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    item->withDynamicFrameAndUserGesture(int_arg);
+
+}
+
+void
+webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *self, glong int_arg, glong optional_arg)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    item->withDynamicFrameAndUserGestureASAD(int_arg, optional_arg);
+
+}
+
 void
 webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt)
 {
index aeb573a..c75a9e0 100644 (file)
@@ -67,6 +67,24 @@ webkit_dom_test_obj_obj_method_with_args (WebKitDOMTestObj *self, glong int_arg,
 WEBKIT_API void
 webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **error);
 
+
+/* TODO: custom function webkit_dom_test_obj_custom_args_and_exception */
+
+WEBKIT_API void
+webkit_dom_test_obj_with_dynamic_frame (WebKitDOMTestObj *self);
+
+WEBKIT_API void
+webkit_dom_test_obj_with_dynamic_frame_and_arg (WebKitDOMTestObj *self, glong int_arg);
+
+WEBKIT_API void
+webkit_dom_test_obj_with_dynamic_frame_and_optional_arg (WebKitDOMTestObj *self, glong int_arg, glong optional_arg);
+
+WEBKIT_API void
+webkit_dom_test_obj_with_dynamic_frame_and_user_gesture (WebKitDOMTestObj *self, glong int_arg);
+
+WEBKIT_API void
+webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *self, glong int_arg, glong optional_arg);
+
 WEBKIT_API void
 webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt);
 
index 8f8da7d..973a100 100644 (file)
@@ -22,7 +22,9 @@
 #include "JSTestObj.h"
 
 #include "JSTestObj.h"
+#include "JSlog.h"
 #include "KURL.h"
+#include "ScriptCallStack.h"
 #include "TestObj.h"
 #include <runtime/Error.h>
 #include <runtime/JSNumberCell.h>
@@ -126,7 +128,7 @@ bool JSTestObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Ident
 #define THUNK_GENERATOR(generator)
 #endif
 
-static const HashTableValue JSTestObjPrototypeTableValues[13] =
+static const HashTableValue JSTestObjPrototypeTableValues[19] =
 {
     { "voidMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethod), (intptr_t)0 THUNK_GENERATOR(0) },
     { "voidMethodWithArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) },
@@ -137,6 +139,12 @@ static const HashTableValue JSTestObjPrototypeTableValues[13] =
     { "methodWithException", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithException), (intptr_t)0 THUNK_GENERATOR(0) },
     { "customMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethod), (intptr_t)0 THUNK_GENERATOR(0) },
     { "customMethodWithArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) },
+    { "customArgsAndException", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomArgsAndException), (intptr_t)1 THUNK_GENERATOR(0) },
+    { "withDynamicFrame", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrame), (intptr_t)0 THUNK_GENERATOR(0) },
+    { "withDynamicFrameAndArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndArg), (intptr_t)1 THUNK_GENERATOR(0) },
+    { "withDynamicFrameAndOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) },
+    { "withDynamicFrameAndUserGesture", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture), (intptr_t)1 THUNK_GENERATOR(0) },
+    { "withDynamicFrameAndUserGestureASAD", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD), (intptr_t)2 THUNK_GENERATOR(0) },
     { "methodWithOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) },
     { "methodWithNonOptionalArgAndOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) },
     { "methodWithNonOptionalArgAndTwoOptionalArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs), (intptr_t)3 THUNK_GENERATOR(0) },
@@ -146,9 +154,9 @@ static const HashTableValue JSTestObjPrototypeTableValues[13] =
 #undef THUNK_GENERATOR
 static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable =
 #if ENABLE(PERFECT_HASH_SIZE)
-    { 2047, JSTestObjPrototypeTableValues, 0 };
+    { 8191, JSTestObjPrototypeTableValues, 0 };
 #else
-    { 35, 31, JSTestObjPrototypeTableValues, 0 };
+    { 66, 63, JSTestObjPrototypeTableValues, 0 };
 #endif
 
 const ClassInfo JSTestObjPrototype::s_info = { "TestObjPrototype", 0, &JSTestObjPrototypeTable, 0 };
@@ -462,6 +470,117 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(ExecState*
     return castedThisObj->customMethodWithArgs(exec, args);
 }
 
+JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
+{
+    UNUSED_PARAM(args);
+    if (!thisValue.inherits(&JSTestObj::s_info))
+        return throwError(exec, TypeError);
+    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
+    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
+    ExceptionCode ec = 0;
+    ScriptCallStack callStack(exec, args, 1);
+    log* intArg = tolog(args.at(0));
+
+    imp->customArgsAndException(intArg, &callStack, ec);
+    setDOMException(exec, ec);
+    return jsUndefined();
+}
+
+JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
+{
+    UNUSED_PARAM(args);
+    if (!thisValue.inherits(&JSTestObj::s_info))
+        return throwError(exec, TypeError);
+    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
+    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
+    Frame* dynamicFrame = toDynamicFrame(exec);
+    if (!dynamicFrame)
+        return jsUndefined();
+
+    imp->withDynamicFrame(dynamicFrame);
+    return jsUndefined();
+}
+
+JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
+{
+    UNUSED_PARAM(args);
+    if (!thisValue.inherits(&JSTestObj::s_info))
+        return throwError(exec, TypeError);
+    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
+    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
+    Frame* dynamicFrame = toDynamicFrame(exec);
+    if (!dynamicFrame)
+        return jsUndefined();
+    int intArg = args.at(1).toInt32(exec);
+
+    imp->withDynamicFrameAndArg(dynamicFrame, intArg);
+    return jsUndefined();
+}
+
+JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
+{
+    UNUSED_PARAM(args);
+    if (!thisValue.inherits(&JSTestObj::s_info))
+        return throwError(exec, TypeError);
+    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
+    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
+    Frame* dynamicFrame = toDynamicFrame(exec);
+    if (!dynamicFrame)
+        return jsUndefined();
+    int intArg = args.at(1).toInt32(exec);
+
+    int argsCount = args.size();
+    if (argsCount < 3) {
+        imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg);
+        return jsUndefined();
+    }
+
+    int optionalArg = args.at(2).toInt32(exec);
+
+    imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg);
+    return jsUndefined();
+}
+
+JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
+{
+    UNUSED_PARAM(args);
+    if (!thisValue.inherits(&JSTestObj::s_info))
+        return throwError(exec, TypeError);
+    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
+    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
+    Frame* dynamicFrame = toDynamicFrame(exec);
+    if (!dynamicFrame)
+        return jsUndefined();
+    int intArg = args.at(1).toInt32(exec);
+
+    imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec));
+    return jsUndefined();
+}
+
+JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
+{
+    UNUSED_PARAM(args);
+    if (!thisValue.inherits(&JSTestObj::s_info))
+        return throwError(exec, TypeError);
+    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
+    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
+    Frame* dynamicFrame = toDynamicFrame(exec);
+    if (!dynamicFrame)
+        return jsUndefined();
+    int intArg = args.at(1).toInt32(exec);
+
+    int argsCount = args.size();
+    if (argsCount < 3) {
+        imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg);
+        return jsUndefined();
+    }
+
+    int optionalArg = args.at(2).toInt32(exec);
+
+    imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec));
+    return jsUndefined();
+}
+
 JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
 {
     UNUSED_PARAM(args);
index e74178f..594a38f 100644 (file)
@@ -94,6 +94,12 @@ JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(JSC::Exec
 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
+JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
+JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
+JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
+JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
+JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
+JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
index 8be807b..145927e 100644 (file)
@@ -29,6 +29,7 @@
 #if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST
 
 @class DOMTestObj;
+@class DOMlog;
 @class NSString;
 
 @interface DOMTestObj : DOMObject
 - (void)methodWithException;
 - (void)customMethod;
 - (void)customMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg;
+- (void)customArgsAndException:(DOMlog *)intArg;
+- (void)withDynamicFrame;
+- (void)withDynamicFrameAndArg:(int)intArg;
+- (void)withDynamicFrameAndOptionalArg:(int)intArg optionalArg:(int)optionalArg;
+- (void)withDynamicFrameAndUserGesture:(int)intArg;
+- (void)withDynamicFrameAndUserGestureASAD:(int)intArg optionalArg:(int)optionalArg;
 - (void)methodWithOptionalArg:(int)opt;
 - (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt;
 - (void)methodWithNonOptionalArgAndTwoOptionalArgs:(int)nonOpt opt1:(int)opt1 opt2:(int)opt2;
index 57a9ffa..0957d12 100644 (file)
 #import "DOMNodeInternal.h"
 #import "DOMStyleSheetInternal.h"
 #import "DOMTestObjInternal.h"
+#import "DOMlogInternal.h"
 #import "ExceptionHandlers.h"
 #import "KURL.h"
 #import "TestObj.h"
 #import "ThreadCheck.h"
 #import "WebCoreObjCExtras.h"
 #import "WebScriptObjectPrivate.h"
+#import "log.h"
 #import <wtf/GetPtr.h>
 
 #define IMPL reinterpret_cast<WebCore::TestObj*>(_internal)
     IMPL->customMethodWithArgs(intArg, strArg, core(objArg));
 }
 
+- (void)customArgsAndException:(DOMlog *)intArg
+{
+    WebCore::ExceptionCode ec = 0;
+    IMPL->customArgsAndException(core(intArg), ec);
+    WebCore::raiseOnDOMError(ec);
+}
+
+- (void)withDynamicFrame
+{
+    IMPL->withDynamicFrame();
+}
+
+- (void)withDynamicFrameAndArg:(int)intArg
+{
+    IMPL->withDynamicFrameAndArg(intArg);
+}
+
+- (void)withDynamicFrameAndOptionalArg:(int)intArg optionalArg:(int)optionalArg
+{
+    IMPL->withDynamicFrameAndOptionalArg(intArg, optionalArg);
+}
+
+- (void)withDynamicFrameAndUserGesture:(int)intArg
+{
+    IMPL->withDynamicFrameAndUserGesture(intArg);
+}
+
+- (void)withDynamicFrameAndUserGestureASAD:(int)intArg optionalArg:(int)optionalArg
+{
+    IMPL->withDynamicFrameAndUserGestureASAD(intArg, optionalArg);
+}
+
 - (void)methodWithOptionalArg:(int)opt
 {
     IMPL->methodWithOptionalArg(opt);
index d2f4027..e662565 100644 (file)
@@ -57,6 +57,16 @@ module test {
         [Custom] void customMethod();
         [Custom] void customMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg);
 
+        [CustomArgumentHandling] void customArgsAndException(in log intArg)
+            raises(DOMException);
+
+        // 'CallWith' extended attribute
+        [CallWith=DynamicFrame] void withDynamicFrame();
+        [CallWith=DynamicFrame] void withDynamicFrameAndArg(in long intArg);
+        [CallWith=DynamicFrame] void withDynamicFrameAndOptionalArg(in long intArg, in [Optional] long optionalArg);
+        [NeedsUserGestureCheck, CallWith=DynamicFrame] void withDynamicFrameAndUserGesture(in long intArg);
+        [NeedsUserGestureCheck, CallWith=DynamicFrame] void withDynamicFrameAndUserGestureASAD(in long intArg, in [Optional] long optionalArg);
+
         // 'Optional' extended attribute
         void    methodWithOptionalArg(in [Optional] long opt);
         void    methodWithNonOptionalArgAndOptionalArg(in long nonOpt, in [Optional] long opt);
index d51884e..538036a 100644 (file)
 
 #include "ExceptionCode.h"
 #include "RuntimeEnabledFeatures.h"
+#include "ScriptCallStack.h"
 #include "V8Binding.h"
 #include "V8BindingState.h"
 #include "V8DOMWrapper.h"
 #include "V8IsolatedContext.h"
 #include "V8Proxy.h"
+#include "V8log.h"
 #include <wtf/GetPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
@@ -233,6 +235,101 @@ static v8::Handle<v8::Value> methodWithExceptionCallback(const v8::Arguments& ar
     return v8::Handle<v8::Value>();
 }
 
+static v8::Handle<v8::Value> customArgsAndExceptionCallback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.customArgsAndException");
+    TestObj* imp = V8TestObj::toNative(args.Holder());
+    ExceptionCode ec = 0;
+    {
+    OwnPtr<ScriptCallStack> callStack(ScriptCallStack::create(args, 1));
+    if (!callStack)
+        return v8::Undefined();
+    log* intArg = V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
+    imp->customArgsAndException(intArg, callStack.get(), ec);
+    if (UNLIKELY(ec))
+        goto fail;
+    return v8::Handle<v8::Value>();
+    }
+    fail:
+    V8Proxy::setDOMException(ec);
+    return v8::Handle<v8::Value>();
+}
+
+static v8::Handle<v8::Value> withDynamicFrameCallback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.withDynamicFrame");
+    TestObj* imp = V8TestObj::toNative(args.Holder());
+    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
+    if (!enteredFrame)
+        return v8::Undefined();
+    imp->withDynamicFrame(enteredFrame);
+    return v8::Handle<v8::Value>();
+}
+
+static v8::Handle<v8::Value> withDynamicFrameAndArgCallback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.withDynamicFrameAndArg");
+    TestObj* imp = V8TestObj::toNative(args.Holder());
+    int intArg = toInt32(args[0]);
+    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
+    if (!enteredFrame)
+        return v8::Undefined();
+    imp->withDynamicFrameAndArg(enteredFrame, intArg);
+    return v8::Handle<v8::Value>();
+}
+
+static v8::Handle<v8::Value> withDynamicFrameAndOptionalArgCallback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.withDynamicFrameAndOptionalArg");
+    TestObj* imp = V8TestObj::toNative(args.Holder());
+    int intArg = toInt32(args[0]);
+    if (args.Length() <= 1) {
+        Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
+        if (!enteredFrame)
+            return v8::Undefined();
+        imp->withDynamicFrameAndOptionalArg(enteredFrame, intArg);
+        return v8::Handle<v8::Value>();
+    }
+    int optionalArg = toInt32(args[1]);
+    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
+    if (!enteredFrame)
+        return v8::Undefined();
+    imp->withDynamicFrameAndOptionalArg(enteredFrame, intArg, optionalArg);
+    return v8::Handle<v8::Value>();
+}
+
+static v8::Handle<v8::Value> withDynamicFrameAndUserGestureCallback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.withDynamicFrameAndUserGesture");
+    TestObj* imp = V8TestObj::toNative(args.Holder());
+    int intArg = toInt32(args[0]);
+    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
+    if (!enteredFrame)
+        return v8::Undefined();
+    imp->withDynamicFrameAndUserGesture(enteredFrame, intArg, processingUserGesture());
+    return v8::Handle<v8::Value>();
+}
+
+static v8::Handle<v8::Value> withDynamicFrameAndUserGestureASADCallback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.withDynamicFrameAndUserGestureASAD");
+    TestObj* imp = V8TestObj::toNative(args.Holder());
+    int intArg = toInt32(args[0]);
+    if (args.Length() <= 1) {
+        Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
+        if (!enteredFrame)
+            return v8::Undefined();
+        imp->withDynamicFrameAndUserGestureASAD(enteredFrame, intArg, processingUserGesture());
+        return v8::Handle<v8::Value>();
+    }
+    int optionalArg = toInt32(args[1]);
+    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
+    if (!enteredFrame)
+        return v8::Undefined();
+    imp->withDynamicFrameAndUserGestureASAD(enteredFrame, intArg, optionalArg, processingUserGesture());
+    return v8::Handle<v8::Value>();
+}
+
 static v8::Handle<v8::Value> methodWithOptionalArgCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.TestObj.methodWithOptionalArg");
@@ -363,6 +460,11 @@ static const BatchedCallback TestObjCallbacks[] = {
     {"methodWithException", TestObjInternal::methodWithExceptionCallback},
     {"customMethod", V8TestObj::customMethodCallback},
     {"customMethodWithArgs", V8TestObj::customMethodWithArgsCallback},
+    {"withDynamicFrame", TestObjInternal::withDynamicFrameCallback},
+    {"withDynamicFrameAndArg", TestObjInternal::withDynamicFrameAndArgCallback},
+    {"withDynamicFrameAndOptionalArg", TestObjInternal::withDynamicFrameAndOptionalArgCallback},
+    {"withDynamicFrameAndUserGesture", TestObjInternal::withDynamicFrameAndUserGestureCallback},
+    {"withDynamicFrameAndUserGestureASAD", TestObjInternal::withDynamicFrameAndUserGestureASADCallback},
     {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback},
     {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback},
     {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback},
@@ -395,6 +497,12 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persi
     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 'customArgsAndException'
+    const int customArgsAndExceptionArgc = 1;
+    v8::Handle<v8::FunctionTemplate> customArgsAndExceptionArgv[customArgsAndExceptionArgc] = { V8log::GetRawTemplate() };
+    v8::Handle<v8::Signature> customArgsAndExceptionSignature = v8::Signature::New(desc, customArgsAndExceptionArgc, customArgsAndExceptionArgv);
+    proto->Set(v8::String::New("customArgsAndException"), v8::FunctionTemplate::New(TestObjInternal::customArgsAndExceptionCallback, v8::Handle<v8::Value>(), customArgsAndExceptionSignature));
+
     // Custom toString template
     desc->Set(getToStringName(), getToStringTemplate());
     return desc;
index 0a9e8dd..786a96a 100644 (file)
@@ -81,16 +81,4 @@ v8::Handle<v8::Value> V8HTMLFormElement::namedPropertyGetter(v8::Local<v8::Strin
     return toV8(collection);
 }
 
-v8::Handle<v8::Value> V8HTMLFormElement::submitCallback(const v8::Arguments& args)
-{
-    INC_STATS("DOM.HTMLFormElement.submit()");
-    HTMLFormElement* form = V8HTMLFormElement::toNative(args.Holder());
-    Frame* frame = V8Proxy::retrieveFrameForEnteredContext();
-    if (!frame)
-        return v8::Undefined();
-
-    form->submit(frame);
-    return v8::Undefined();
-}
-
 } // namespace WebCore
index d639c34..0654a7d 100644 (file)
@@ -35,7 +35,7 @@ module html {
                  attribute [ConvertNullToNullString] DOMString       method;
                  attribute [ConvertNullToNullString] DOMString       target;
         
-        [Custom] void submit();
+        [CallWith=DynamicFrame] void submit();
         void reset();
         boolean  checkValidity();
     };