Changeset 58295 in webkit


Ignore:
Timestamp:
Apr 27, 2010 12:15:44 AM (14 years ago)
Author:
abarth@webkit.org
Message:

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:
Location:
trunk/WebCore
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r58290 r58295  
     12010-04-26  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Add CallWith=DynamicFrame to CodeGenerator
     6        https://bugs.webkit.org/show_bug.cgi?id=38174
     7
     8        I've only used this in one instance, but this is infrastructure that I
     9        think will help remove a bunch of custom bindings code.  Also, added a
     10        few tests of tricky argument cases.
     11
     12        * bindings/js/JSHTMLFormElementCustom.cpp:
     13        * bindings/scripts/CodeGeneratorJS.pm:
     14        * bindings/scripts/CodeGeneratorV8.pm:
     15        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
     16        (webkit_dom_test_obj_with_dynamic_frame):
     17        (webkit_dom_test_obj_with_dynamic_frame_and_arg):
     18        (webkit_dom_test_obj_with_dynamic_frame_and_optional_arg):
     19        (webkit_dom_test_obj_with_dynamic_frame_and_user_gesture):
     20        (webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad):
     21        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
     22        * bindings/scripts/test/JS/JSTestObj.cpp:
     23        (WebCore::):
     24        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrame):
     25        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndArg):
     26        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg):
     27        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture):
     28        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD):
     29        * bindings/scripts/test/JS/JSTestObj.h:
     30        * bindings/scripts/test/ObjC/DOMTestObj.h:
     31        * bindings/scripts/test/ObjC/DOMTestObj.mm:
     32        (-[DOMTestObj withDynamicFrame]):
     33        (-[DOMTestObj withDynamicFrameAndArg:]):
     34        (-[DOMTestObj withDynamicFrameAndOptionalArg:optionalArg:]):
     35        (-[DOMTestObj withDynamicFrameAndUserGesture:]):
     36        (-[DOMTestObj withDynamicFrameAndUserGestureASAD:optionalArg:]):
     37        * bindings/scripts/test/TestObj.idl:
     38        * bindings/scripts/test/V8/V8TestObj.cpp:
     39        (WebCore::TestObjInternal::withDynamicFrameCallback):
     40        (WebCore::TestObjInternal::withDynamicFrameAndArgCallback):
     41        (WebCore::TestObjInternal::withDynamicFrameAndOptionalArgCallback):
     42        (WebCore::TestObjInternal::withDynamicFrameAndUserGestureCallback):
     43        (WebCore::TestObjInternal::withDynamicFrameAndUserGestureASADCallback):
     44        (WebCore::):
     45        * bindings/v8/custom/V8HTMLFormElementCustom.cpp:
     46        * html/HTMLFormElement.idl:
     47
    1482010-04-26  Adam Barth  <abarth@webkit.org>
    249
  • trunk/WebCore/bindings/js/JSHTMLFormElementCustom.cpp

    r57766 r58295  
    6262}
    6363
    64 JSValue JSHTMLFormElement::submit(ExecState* exec, const ArgList&)
    65 {
    66     Frame* activeFrame = asJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
    67     if (!activeFrame)
    68         return jsUndefined();
    69     static_cast<HTMLFormElement*>(impl())->submit(activeFrame);
    70     return jsUndefined();
    7164}
    72 
    73 }
  • trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r58286 r58295  
    16921692                }
    16931693
     1694                my $callWith = $function->signature->extendedAttributes->{"CallWith"};
     1695                if ($callWith && $callWith eq "DynamicFrame") {
     1696                    push(@implContent, "    Frame* dynamicFrame = toDynamicFrame(exec);\n");
     1697                    push(@implContent, "    if (!dynamicFrame)\n");
     1698                    push(@implContent, "        return jsUndefined();\n");
     1699                    $functionString .= ", " if $paramIndex;
     1700                    $functionString .= "dynamicFrame";
     1701                    $paramIndex++;
     1702                }
     1703
    16941704                foreach my $parameter (@{$function->parameters}) {
    16951705                    if (!$hasOptionalArguments && $parameter->extendedAttributes->{"Optional"}) {
  • trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r58193 r58295  
    23332333    }
    23342334
    2335     my $first = 1;
    23362335    my $index = 0;
     2336
     2337    my $callWith = $function->signature->extendedAttributes->{"CallWith"};
     2338    if ($callWith && $callWith eq "DynamicFrame") {
     2339        $result .= $indent . "Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();\n";
     2340        $result .= $indent . "if (!enteredFrame)\n";
     2341        $result .= $indent . "    return v8::Undefined();\n";
     2342        $functionString .= ", " if $index;
     2343        $functionString .= "enteredFrame";
     2344        $index++;
     2345        $numberOfParameters++
     2346    }
    23372347
    23382348    foreach my $parameter (@{$function->parameters}) {
     
    23402350            last;
    23412351        }
    2342         if ($first) { $first = 0; }
    2343         else { $functionString .= ", "; }
     2352        $functionString .= ", " if $index;
    23442353        my $paramName = $parameter->name;
    23452354        my $paramType = $parameter->type;
     
    23602369
    23612370    if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
    2362         $functionString .= ", " if not $first;
     2371        $functionString .= ", " if $index;
    23632372        $functionString .= "callStack.get()";
    2364         if ($first) { $first = 0; }
     2373        $index++;
    23652374    }
    23662375
    23672376    if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) {
    2368         $functionString .= ", " if not $first;
     2377        $functionString .= ", " if $index;
    23692378        # FIXME: We need to pass DOMWrapperWorld as a parameter.
    23702379        # See http://trac.webkit.org/changeset/54182
    23712380        $functionString .= "processingUserGesture()";
    2372         if ($first) { $first = 0; }
     2381        $index++;
    23732382    }
    23742383
    23752384    if (@{$function->raisesExceptions}) {
    2376         $functionString .= ", " if not $first;
     2385        $functionString .= ", " if $index;
    23772386        $functionString .= "ec";
     2387        $index++;
    23782388    }
    23792389    $functionString .= ")";
  • trunk/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp

    r58289 r58295  
    3030#include "webkit/WebKitDOMTestObj.h"
    3131#include "webkit/WebKitDOMTestObjPrivate.h"
     32#include "webkit/WebKitDOMlog.h"
     33#include "webkit/WebKitDOMlogPrivate.h"
    3234#include "webkitmarshal.h"
    3335#include "webkitprivate.h"
     
    134136        g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
    135137    }
     138
     139}
     140
     141
     142/* TODO: custom function webkit_dom_test_obj_custom_args_and_exception */
     143
     144void
     145webkit_dom_test_obj_with_dynamic_frame (WebKitDOMTestObj *self)
     146{
     147    g_return_if_fail (self);
     148    WebCore::TestObj * item = WebKit::core(self);
     149    item->withDynamicFrame();
     150
     151}
     152
     153void
     154webkit_dom_test_obj_with_dynamic_frame_and_arg (WebKitDOMTestObj *self, glong int_arg)
     155{
     156    g_return_if_fail (self);
     157    WebCore::TestObj * item = WebKit::core(self);
     158    item->withDynamicFrameAndArg(int_arg);
     159
     160}
     161
     162void
     163webkit_dom_test_obj_with_dynamic_frame_and_optional_arg (WebKitDOMTestObj *self, glong int_arg, glong optional_arg)
     164{
     165    g_return_if_fail (self);
     166    WebCore::TestObj * item = WebKit::core(self);
     167    item->withDynamicFrameAndOptionalArg(int_arg, optional_arg);
     168
     169}
     170
     171void
     172webkit_dom_test_obj_with_dynamic_frame_and_user_gesture (WebKitDOMTestObj *self, glong int_arg)
     173{
     174    g_return_if_fail (self);
     175    WebCore::TestObj * item = WebKit::core(self);
     176    item->withDynamicFrameAndUserGesture(int_arg);
     177
     178}
     179
     180void
     181webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *self, glong int_arg, glong optional_arg)
     182{
     183    g_return_if_fail (self);
     184    WebCore::TestObj * item = WebKit::core(self);
     185    item->withDynamicFrameAndUserGestureASAD(int_arg, optional_arg);
    136186
    137187}
  • trunk/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h

    r58289 r58295  
    6868webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **error);
    6969
     70
     71/* TODO: custom function webkit_dom_test_obj_custom_args_and_exception */
     72
     73WEBKIT_API void
     74webkit_dom_test_obj_with_dynamic_frame (WebKitDOMTestObj *self);
     75
     76WEBKIT_API void
     77webkit_dom_test_obj_with_dynamic_frame_and_arg (WebKitDOMTestObj *self, glong int_arg);
     78
     79WEBKIT_API void
     80webkit_dom_test_obj_with_dynamic_frame_and_optional_arg (WebKitDOMTestObj *self, glong int_arg, glong optional_arg);
     81
     82WEBKIT_API void
     83webkit_dom_test_obj_with_dynamic_frame_and_user_gesture (WebKitDOMTestObj *self, glong int_arg);
     84
     85WEBKIT_API void
     86webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *self, glong int_arg, glong optional_arg);
     87
    7088WEBKIT_API void
    7189webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt);
  • trunk/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r58288 r58295  
    2323
    2424#include "JSTestObj.h"
     25#include "JSlog.h"
    2526#include "KURL.h"
     27#include "ScriptCallStack.h"
    2628#include "TestObj.h"
    2729#include <runtime/Error.h>
     
    127129#endif
    128130
    129 static const HashTableValue JSTestObjPrototypeTableValues[13] =
     131static const HashTableValue JSTestObjPrototypeTableValues[19] =
    130132{
    131133    { "voidMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethod), (intptr_t)0 THUNK_GENERATOR(0) },
     
    138140    { "customMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethod), (intptr_t)0 THUNK_GENERATOR(0) },
    139141    { "customMethodWithArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) },
     142    { "customArgsAndException", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomArgsAndException), (intptr_t)1 THUNK_GENERATOR(0) },
     143    { "withDynamicFrame", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrame), (intptr_t)0 THUNK_GENERATOR(0) },
     144    { "withDynamicFrameAndArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndArg), (intptr_t)1 THUNK_GENERATOR(0) },
     145    { "withDynamicFrameAndOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) },
     146    { "withDynamicFrameAndUserGesture", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture), (intptr_t)1 THUNK_GENERATOR(0) },
     147    { "withDynamicFrameAndUserGestureASAD", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD), (intptr_t)2 THUNK_GENERATOR(0) },
    140148    { "methodWithOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) },
    141149    { "methodWithNonOptionalArgAndOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) },
     
    147155static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable =
    148156#if ENABLE(PERFECT_HASH_SIZE)
    149     { 2047, JSTestObjPrototypeTableValues, 0 };
     157    { 8191, JSTestObjPrototypeTableValues, 0 };
    150158#else
    151     { 35, 31, JSTestObjPrototypeTableValues, 0 };
     159    { 66, 63, JSTestObjPrototypeTableValues, 0 };
    152160#endif
    153161
     
    463471}
    464472
     473JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
     474{
     475    UNUSED_PARAM(args);
     476    if (!thisValue.inherits(&JSTestObj::s_info))
     477        return throwError(exec, TypeError);
     478    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
     479    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
     480    ExceptionCode ec = 0;
     481    ScriptCallStack callStack(exec, args, 1);
     482    log* intArg = tolog(args.at(0));
     483
     484    imp->customArgsAndException(intArg, &callStack, ec);
     485    setDOMException(exec, ec);
     486    return jsUndefined();
     487}
     488
     489JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
     490{
     491    UNUSED_PARAM(args);
     492    if (!thisValue.inherits(&JSTestObj::s_info))
     493        return throwError(exec, TypeError);
     494    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
     495    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
     496    Frame* dynamicFrame = toDynamicFrame(exec);
     497    if (!dynamicFrame)
     498        return jsUndefined();
     499
     500    imp->withDynamicFrame(dynamicFrame);
     501    return jsUndefined();
     502}
     503
     504JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
     505{
     506    UNUSED_PARAM(args);
     507    if (!thisValue.inherits(&JSTestObj::s_info))
     508        return throwError(exec, TypeError);
     509    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
     510    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
     511    Frame* dynamicFrame = toDynamicFrame(exec);
     512    if (!dynamicFrame)
     513        return jsUndefined();
     514    int intArg = args.at(1).toInt32(exec);
     515
     516    imp->withDynamicFrameAndArg(dynamicFrame, intArg);
     517    return jsUndefined();
     518}
     519
     520JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
     521{
     522    UNUSED_PARAM(args);
     523    if (!thisValue.inherits(&JSTestObj::s_info))
     524        return throwError(exec, TypeError);
     525    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
     526    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
     527    Frame* dynamicFrame = toDynamicFrame(exec);
     528    if (!dynamicFrame)
     529        return jsUndefined();
     530    int intArg = args.at(1).toInt32(exec);
     531
     532    int argsCount = args.size();
     533    if (argsCount < 3) {
     534        imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg);
     535        return jsUndefined();
     536    }
     537
     538    int optionalArg = args.at(2).toInt32(exec);
     539
     540    imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg);
     541    return jsUndefined();
     542}
     543
     544JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
     545{
     546    UNUSED_PARAM(args);
     547    if (!thisValue.inherits(&JSTestObj::s_info))
     548        return throwError(exec, TypeError);
     549    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
     550    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
     551    Frame* dynamicFrame = toDynamicFrame(exec);
     552    if (!dynamicFrame)
     553        return jsUndefined();
     554    int intArg = args.at(1).toInt32(exec);
     555
     556    imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec));
     557    return jsUndefined();
     558}
     559
     560JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
     561{
     562    UNUSED_PARAM(args);
     563    if (!thisValue.inherits(&JSTestObj::s_info))
     564        return throwError(exec, TypeError);
     565    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
     566    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
     567    Frame* dynamicFrame = toDynamicFrame(exec);
     568    if (!dynamicFrame)
     569        return jsUndefined();
     570    int intArg = args.at(1).toInt32(exec);
     571
     572    int argsCount = args.size();
     573    if (argsCount < 3) {
     574        imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg);
     575        return jsUndefined();
     576    }
     577
     578    int optionalArg = args.at(2).toInt32(exec);
     579
     580    imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec));
     581    return jsUndefined();
     582}
     583
    465584JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
    466585{
  • trunk/WebCore/bindings/scripts/test/JS/JSTestObj.h

    r58288 r58295  
    9595JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
    9696JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
     97JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
     98JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
     99JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
     100JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
     101JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
     102JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
    97103JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
    98104JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
  • trunk/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h

    r58289 r58295  
    3030
    3131@class DOMTestObj;
     32@class DOMlog;
    3233@class NSString;
    3334
     
    5960- (void)customMethod;
    6061- (void)customMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg;
     62- (void)customArgsAndException:(DOMlog *)intArg;
     63- (void)withDynamicFrame;
     64- (void)withDynamicFrameAndArg:(int)intArg;
     65- (void)withDynamicFrameAndOptionalArg:(int)intArg optionalArg:(int)optionalArg;
     66- (void)withDynamicFrameAndUserGesture:(int)intArg;
     67- (void)withDynamicFrameAndUserGestureASAD:(int)intArg optionalArg:(int)optionalArg;
    6168- (void)methodWithOptionalArg:(int)opt;
    6269- (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt;
  • trunk/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm

    r58289 r58295  
    3737#import "DOMStyleSheetInternal.h"
    3838#import "DOMTestObjInternal.h"
     39#import "DOMlogInternal.h"
    3940#import "ExceptionHandlers.h"
    4041#import "KURL.h"
     
    4344#import "WebCoreObjCExtras.h"
    4445#import "WebScriptObjectPrivate.h"
     46#import "log.h"
    4547#import <wtf/GetPtr.h>
    4648
     
    198200{
    199201    IMPL->customMethodWithArgs(intArg, strArg, core(objArg));
     202}
     203
     204- (void)customArgsAndException:(DOMlog *)intArg
     205{
     206    WebCore::ExceptionCode ec = 0;
     207    IMPL->customArgsAndException(core(intArg), ec);
     208    WebCore::raiseOnDOMError(ec);
     209}
     210
     211- (void)withDynamicFrame
     212{
     213    IMPL->withDynamicFrame();
     214}
     215
     216- (void)withDynamicFrameAndArg:(int)intArg
     217{
     218    IMPL->withDynamicFrameAndArg(intArg);
     219}
     220
     221- (void)withDynamicFrameAndOptionalArg:(int)intArg optionalArg:(int)optionalArg
     222{
     223    IMPL->withDynamicFrameAndOptionalArg(intArg, optionalArg);
     224}
     225
     226- (void)withDynamicFrameAndUserGesture:(int)intArg
     227{
     228    IMPL->withDynamicFrameAndUserGesture(intArg);
     229}
     230
     231- (void)withDynamicFrameAndUserGestureASAD:(int)intArg optionalArg:(int)optionalArg
     232{
     233    IMPL->withDynamicFrameAndUserGestureASAD(intArg, optionalArg);
    200234}
    201235
  • trunk/WebCore/bindings/scripts/test/TestObj.idl

    r58290 r58295  
    5858        [Custom] void customMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg);
    5959
     60        [CustomArgumentHandling] void customArgsAndException(in log intArg)
     61            raises(DOMException);
     62
     63        // 'CallWith' extended attribute
     64        [CallWith=DynamicFrame] void withDynamicFrame();
     65        [CallWith=DynamicFrame] void withDynamicFrameAndArg(in long intArg);
     66        [CallWith=DynamicFrame] void withDynamicFrameAndOptionalArg(in long intArg, in [Optional] long optionalArg);
     67        [NeedsUserGestureCheck, CallWith=DynamicFrame] void withDynamicFrameAndUserGesture(in long intArg);
     68        [NeedsUserGestureCheck, CallWith=DynamicFrame] void withDynamicFrameAndUserGestureASAD(in long intArg, in [Optional] long optionalArg);
     69
    6070        // 'Optional' extended attribute
    6171        void    methodWithOptionalArg(in [Optional] long opt);
  • trunk/WebCore/bindings/scripts/test/V8/V8TestObj.cpp

    r58288 r58295  
    2424#include "ExceptionCode.h"
    2525#include "RuntimeEnabledFeatures.h"
     26#include "ScriptCallStack.h"
    2627#include "V8Binding.h"
    2728#include "V8BindingState.h"
     
    2930#include "V8IsolatedContext.h"
    3031#include "V8Proxy.h"
     32#include "V8log.h"
    3133#include <wtf/GetPtr.h>
    3234#include <wtf/RefCounted.h>
     
    231233    fail:
    232234    V8Proxy::setDOMException(ec);
     235    return v8::Handle<v8::Value>();
     236}
     237
     238static v8::Handle<v8::Value> customArgsAndExceptionCallback(const v8::Arguments& args)
     239{
     240    INC_STATS("DOM.TestObj.customArgsAndException");
     241    TestObj* imp = V8TestObj::toNative(args.Holder());
     242    ExceptionCode ec = 0;
     243    {
     244    OwnPtr<ScriptCallStack> callStack(ScriptCallStack::create(args, 1));
     245    if (!callStack)
     246        return v8::Undefined();
     247    log* intArg = V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     248    imp->customArgsAndException(intArg, callStack.get(), ec);
     249    if (UNLIKELY(ec))
     250        goto fail;
     251    return v8::Handle<v8::Value>();
     252    }
     253    fail:
     254    V8Proxy::setDOMException(ec);
     255    return v8::Handle<v8::Value>();
     256}
     257
     258static v8::Handle<v8::Value> withDynamicFrameCallback(const v8::Arguments& args)
     259{
     260    INC_STATS("DOM.TestObj.withDynamicFrame");
     261    TestObj* imp = V8TestObj::toNative(args.Holder());
     262    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
     263    if (!enteredFrame)
     264        return v8::Undefined();
     265    imp->withDynamicFrame(enteredFrame);
     266    return v8::Handle<v8::Value>();
     267}
     268
     269static v8::Handle<v8::Value> withDynamicFrameAndArgCallback(const v8::Arguments& args)
     270{
     271    INC_STATS("DOM.TestObj.withDynamicFrameAndArg");
     272    TestObj* imp = V8TestObj::toNative(args.Holder());
     273    int intArg = toInt32(args[0]);
     274    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
     275    if (!enteredFrame)
     276        return v8::Undefined();
     277    imp->withDynamicFrameAndArg(enteredFrame, intArg);
     278    return v8::Handle<v8::Value>();
     279}
     280
     281static v8::Handle<v8::Value> withDynamicFrameAndOptionalArgCallback(const v8::Arguments& args)
     282{
     283    INC_STATS("DOM.TestObj.withDynamicFrameAndOptionalArg");
     284    TestObj* imp = V8TestObj::toNative(args.Holder());
     285    int intArg = toInt32(args[0]);
     286    if (args.Length() <= 1) {
     287        Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
     288        if (!enteredFrame)
     289            return v8::Undefined();
     290        imp->withDynamicFrameAndOptionalArg(enteredFrame, intArg);
     291        return v8::Handle<v8::Value>();
     292    }
     293    int optionalArg = toInt32(args[1]);
     294    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
     295    if (!enteredFrame)
     296        return v8::Undefined();
     297    imp->withDynamicFrameAndOptionalArg(enteredFrame, intArg, optionalArg);
     298    return v8::Handle<v8::Value>();
     299}
     300
     301static v8::Handle<v8::Value> withDynamicFrameAndUserGestureCallback(const v8::Arguments& args)
     302{
     303    INC_STATS("DOM.TestObj.withDynamicFrameAndUserGesture");
     304    TestObj* imp = V8TestObj::toNative(args.Holder());
     305    int intArg = toInt32(args[0]);
     306    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
     307    if (!enteredFrame)
     308        return v8::Undefined();
     309    imp->withDynamicFrameAndUserGesture(enteredFrame, intArg, processingUserGesture());
     310    return v8::Handle<v8::Value>();
     311}
     312
     313static v8::Handle<v8::Value> withDynamicFrameAndUserGestureASADCallback(const v8::Arguments& args)
     314{
     315    INC_STATS("DOM.TestObj.withDynamicFrameAndUserGestureASAD");
     316    TestObj* imp = V8TestObj::toNative(args.Holder());
     317    int intArg = toInt32(args[0]);
     318    if (args.Length() <= 1) {
     319        Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
     320        if (!enteredFrame)
     321            return v8::Undefined();
     322        imp->withDynamicFrameAndUserGestureASAD(enteredFrame, intArg, processingUserGesture());
     323        return v8::Handle<v8::Value>();
     324    }
     325    int optionalArg = toInt32(args[1]);
     326    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
     327    if (!enteredFrame)
     328        return v8::Undefined();
     329    imp->withDynamicFrameAndUserGestureASAD(enteredFrame, intArg, optionalArg, processingUserGesture());
    233330    return v8::Handle<v8::Value>();
    234331}
     
    364461    {"customMethod", V8TestObj::customMethodCallback},
    365462    {"customMethodWithArgs", V8TestObj::customMethodWithArgsCallback},
     463    {"withDynamicFrame", TestObjInternal::withDynamicFrameCallback},
     464    {"withDynamicFrameAndArg", TestObjInternal::withDynamicFrameAndArgCallback},
     465    {"withDynamicFrameAndOptionalArg", TestObjInternal::withDynamicFrameAndOptionalArgCallback},
     466    {"withDynamicFrameAndUserGesture", TestObjInternal::withDynamicFrameAndUserGestureCallback},
     467    {"withDynamicFrameAndUserGestureASAD", TestObjInternal::withDynamicFrameAndUserGestureASADCallback},
    366468    {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback},
    367469    {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback},
     
    395497    v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(desc, objMethodWithArgsArgc, objMethodWithArgsArgv);
    396498    proto->Set(v8::String::New("objMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::objMethodWithArgsCallback, v8::Handle<v8::Value>(), objMethodWithArgsSignature));
     499
     500    // Custom Signature 'customArgsAndException'
     501    const int customArgsAndExceptionArgc = 1;
     502    v8::Handle<v8::FunctionTemplate> customArgsAndExceptionArgv[customArgsAndExceptionArgc] = { V8log::GetRawTemplate() };
     503    v8::Handle<v8::Signature> customArgsAndExceptionSignature = v8::Signature::New(desc, customArgsAndExceptionArgc, customArgsAndExceptionArgv);
     504    proto->Set(v8::String::New("customArgsAndException"), v8::FunctionTemplate::New(TestObjInternal::customArgsAndExceptionCallback, v8::Handle<v8::Value>(), customArgsAndExceptionSignature));
    397505
    398506    // Custom toString template
  • trunk/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp

    r54305 r58295  
    8282}
    8383
    84 v8::Handle<v8::Value> V8HTMLFormElement::submitCallback(const v8::Arguments& args)
    85 {
    86     INC_STATS("DOM.HTMLFormElement.submit()");
    87     HTMLFormElement* form = V8HTMLFormElement::toNative(args.Holder());
    88     Frame* frame = V8Proxy::retrieveFrameForEnteredContext();
    89     if (!frame)
    90         return v8::Undefined();
    91 
    92     form->submit(frame);
    93     return v8::Undefined();
    94 }
    95 
    9684} // namespace WebCore
  • trunk/WebCore/html/HTMLFormElement.idl

    r52921 r58295  
    3636                 attribute [ConvertNullToNullString] DOMString       target;
    3737       
    38         [Custom] void submit();
     38        [CallWith=DynamicFrame] void submit();
    3939        void reset();
    4040        boolean  checkValidity();
Note: See TracChangeset for help on using the changeset viewer.