Changeset 58295 in webkit
- Timestamp:
- Apr 27, 2010 12:15:44 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r58290 r58295 1 2010-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 1 48 2010-04-26 Adam Barth <abarth@webkit.org> 2 49 -
trunk/WebCore/bindings/js/JSHTMLFormElementCustom.cpp
r57766 r58295 62 62 } 63 63 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();71 64 } 72 73 } -
trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm
r58286 r58295 1692 1692 } 1693 1693 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 1694 1704 foreach my $parameter (@{$function->parameters}) { 1695 1705 if (!$hasOptionalArguments && $parameter->extendedAttributes->{"Optional"}) { -
trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm
r58193 r58295 2333 2333 } 2334 2334 2335 my $first = 1;2336 2335 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 } 2337 2347 2338 2348 foreach my $parameter (@{$function->parameters}) { … … 2340 2350 last; 2341 2351 } 2342 if ($first) { $first = 0; } 2343 else { $functionString .= ", "; } 2352 $functionString .= ", " if $index; 2344 2353 my $paramName = $parameter->name; 2345 2354 my $paramType = $parameter->type; … … 2360 2369 2361 2370 if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { 2362 $functionString .= ", " if not $first;2371 $functionString .= ", " if $index; 2363 2372 $functionString .= "callStack.get()"; 2364 if ($first) { $first = 0; }2373 $index++; 2365 2374 } 2366 2375 2367 2376 if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) { 2368 $functionString .= ", " if not $first;2377 $functionString .= ", " if $index; 2369 2378 # FIXME: We need to pass DOMWrapperWorld as a parameter. 2370 2379 # See http://trac.webkit.org/changeset/54182 2371 2380 $functionString .= "processingUserGesture()"; 2372 if ($first) { $first = 0; }2381 $index++; 2373 2382 } 2374 2383 2375 2384 if (@{$function->raisesExceptions}) { 2376 $functionString .= ", " if not $first;2385 $functionString .= ", " if $index; 2377 2386 $functionString .= "ec"; 2387 $index++; 2378 2388 } 2379 2389 $functionString .= ")"; -
trunk/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
r58289 r58295 30 30 #include "webkit/WebKitDOMTestObj.h" 31 31 #include "webkit/WebKitDOMTestObjPrivate.h" 32 #include "webkit/WebKitDOMlog.h" 33 #include "webkit/WebKitDOMlogPrivate.h" 32 34 #include "webkitmarshal.h" 33 35 #include "webkitprivate.h" … … 134 136 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 135 137 } 138 139 } 140 141 142 /* TODO: custom function webkit_dom_test_obj_custom_args_and_exception */ 143 144 void 145 webkit_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 153 void 154 webkit_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 162 void 163 webkit_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 171 void 172 webkit_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 180 void 181 webkit_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); 136 186 137 187 } -
trunk/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
r58289 r58295 68 68 webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **error); 69 69 70 71 /* TODO: custom function webkit_dom_test_obj_custom_args_and_exception */ 72 73 WEBKIT_API void 74 webkit_dom_test_obj_with_dynamic_frame (WebKitDOMTestObj *self); 75 76 WEBKIT_API void 77 webkit_dom_test_obj_with_dynamic_frame_and_arg (WebKitDOMTestObj *self, glong int_arg); 78 79 WEBKIT_API void 80 webkit_dom_test_obj_with_dynamic_frame_and_optional_arg (WebKitDOMTestObj *self, glong int_arg, glong optional_arg); 81 82 WEBKIT_API void 83 webkit_dom_test_obj_with_dynamic_frame_and_user_gesture (WebKitDOMTestObj *self, glong int_arg); 84 85 WEBKIT_API void 86 webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *self, glong int_arg, glong optional_arg); 87 70 88 WEBKIT_API void 71 89 webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt); -
trunk/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r58288 r58295 23 23 24 24 #include "JSTestObj.h" 25 #include "JSlog.h" 25 26 #include "KURL.h" 27 #include "ScriptCallStack.h" 26 28 #include "TestObj.h" 27 29 #include <runtime/Error.h> … … 127 129 #endif 128 130 129 static const HashTableValue JSTestObjPrototypeTableValues[1 3] =131 static const HashTableValue JSTestObjPrototypeTableValues[19] = 130 132 { 131 133 { "voidMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethod), (intptr_t)0 THUNK_GENERATOR(0) }, … … 138 140 { "customMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethod), (intptr_t)0 THUNK_GENERATOR(0) }, 139 141 { "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) }, 140 148 { "methodWithOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) }, 141 149 { "methodWithNonOptionalArgAndOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) }, … … 147 155 static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable = 148 156 #if ENABLE(PERFECT_HASH_SIZE) 149 { 2047, JSTestObjPrototypeTableValues, 0 };157 { 8191, JSTestObjPrototypeTableValues, 0 }; 150 158 #else 151 { 35, 31, JSTestObjPrototypeTableValues, 0 };159 { 66, 63, JSTestObjPrototypeTableValues, 0 }; 152 160 #endif 153 161 … … 463 471 } 464 472 473 JSValue 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 489 JSValue 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 504 JSValue 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 520 JSValue 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 544 JSValue 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 560 JSValue 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 465 584 JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) 466 585 { -
trunk/WebCore/bindings/scripts/test/JS/JSTestObj.h
r58288 r58295 95 95 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); 96 96 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); 97 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); 98 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); 99 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); 100 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); 101 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); 102 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); 97 103 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); 98 104 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -
trunk/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
r58289 r58295 30 30 31 31 @class DOMTestObj; 32 @class DOMlog; 32 33 @class NSString; 33 34 … … 59 60 - (void)customMethod; 60 61 - (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; 61 68 - (void)methodWithOptionalArg:(int)opt; 62 69 - (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt; -
trunk/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
r58289 r58295 37 37 #import "DOMStyleSheetInternal.h" 38 38 #import "DOMTestObjInternal.h" 39 #import "DOMlogInternal.h" 39 40 #import "ExceptionHandlers.h" 40 41 #import "KURL.h" … … 43 44 #import "WebCoreObjCExtras.h" 44 45 #import "WebScriptObjectPrivate.h" 46 #import "log.h" 45 47 #import <wtf/GetPtr.h> 46 48 … … 198 200 { 199 201 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); 200 234 } 201 235 -
trunk/WebCore/bindings/scripts/test/TestObj.idl
r58290 r58295 58 58 [Custom] void customMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg); 59 59 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 60 70 // 'Optional' extended attribute 61 71 void methodWithOptionalArg(in [Optional] long opt); -
trunk/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
r58288 r58295 24 24 #include "ExceptionCode.h" 25 25 #include "RuntimeEnabledFeatures.h" 26 #include "ScriptCallStack.h" 26 27 #include "V8Binding.h" 27 28 #include "V8BindingState.h" … … 29 30 #include "V8IsolatedContext.h" 30 31 #include "V8Proxy.h" 32 #include "V8log.h" 31 33 #include <wtf/GetPtr.h> 32 34 #include <wtf/RefCounted.h> … … 231 233 fail: 232 234 V8Proxy::setDOMException(ec); 235 return v8::Handle<v8::Value>(); 236 } 237 238 static 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 258 static 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 269 static 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 281 static 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 301 static 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 313 static 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()); 233 330 return v8::Handle<v8::Value>(); 234 331 } … … 364 461 {"customMethod", V8TestObj::customMethodCallback}, 365 462 {"customMethodWithArgs", V8TestObj::customMethodWithArgsCallback}, 463 {"withDynamicFrame", TestObjInternal::withDynamicFrameCallback}, 464 {"withDynamicFrameAndArg", TestObjInternal::withDynamicFrameAndArgCallback}, 465 {"withDynamicFrameAndOptionalArg", TestObjInternal::withDynamicFrameAndOptionalArgCallback}, 466 {"withDynamicFrameAndUserGesture", TestObjInternal::withDynamicFrameAndUserGestureCallback}, 467 {"withDynamicFrameAndUserGestureASAD", TestObjInternal::withDynamicFrameAndUserGestureASADCallback}, 366 468 {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback}, 367 469 {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback}, … … 395 497 v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(desc, objMethodWithArgsArgc, objMethodWithArgsArgv); 396 498 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)); 397 505 398 506 // Custom toString template -
trunk/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
r54305 r58295 82 82 } 83 83 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 96 84 } // namespace WebCore -
trunk/WebCore/html/HTMLFormElement.idl
r52921 r58295 36 36 attribute [ConvertNullToNullString] DOMString target; 37 37 38 [C ustom] void submit();38 [CallWith=DynamicFrame] void submit(); 39 39 void reset(); 40 40 boolean checkValidity();
Note: See TracChangeset
for help on using the changeset viewer.