Changeset 60952 in webkit
- Timestamp:
- Jun 10, 2010 4:23:13 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r60944 r60952 1 2010-06-09 Andrei Popescu <andreip@google.com> 2 3 Reviewed by Adam Barth. 4 5 CodeGeneratorJS.pm incorrectly increments $paramIndex when a method is declared with [CallWith] 6 https://bugs.webkit.org/show_bug.cgi?id=40372 7 8 Use two variables to keep track of the number of arguments passed from JavaScript vs the number 9 of arguments passed to the corresponding C++ method. These numbers can be different since 10 the parameter declared via [CallWith] is generated in the bindings instead of being passed 11 from JavaScript. 12 13 The layout tests added here test both that the parameters are read correctly as well as 14 tests some basic indexed database functionality. There are also bindings specific 15 tests added in TestObj.idl. 16 17 * storage/indexeddb/idb-objectstore-request-expected.txt: Added. 18 * storage/indexeddb/idb-objectstore-request.html: Added. 19 * storage/indexeddb/script-tests/idb-objectstore-request.js: Added. 20 (openSuccess): 21 (createSuccess): 22 (createObjectStore): 23 (doCreateOrOpen): 24 (test): 25 1 26 2010-06-10 Adam Barth <abarth@webkit.org> 2 27 -
trunk/WebCore/ChangeLog
r60951 r60952 1 2010-06-09 Andrei Popescu <andreip@google.com> 2 3 Reviewed by Adam Barth. 4 5 CodeGeneratorJS.pm incorrectly increments $paramIndex when a method is declared with [CallWith] 6 https://bugs.webkit.org/show_bug.cgi?id=40372 7 8 Use two variables to keep track of the number of arguments passed from JavaScript vs the number 9 of arguments passed to the corresponding C++ method. These numbers can be different since 10 the parameter declared via [CallWith] is generated in the bindings instead of being passed 11 from JavaScript. 12 13 Test: storage/indexeddb/idb-objectstore-request.html 14 15 * bindings/scripts/CodeGeneratorJS.pm: 16 * bindings/scripts/test/CPP/WebDOMTestObj.cpp: 17 (WebDOMTestObj::withScriptExecutionContext): 18 * bindings/scripts/test/CPP/WebDOMTestObj.h: 19 * bindings/scripts/test/JS/JSTestObj.cpp: 20 (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndArg): 21 (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg): 22 (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture): 23 (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD): 24 1 25 2010-06-09 MORITA Hajime <morrita@google.com> 2 26 -
trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm
r60789 r60952 1870 1870 push(@implContent, GenerateEventListenerCall($className, "remove")); 1871 1871 } else { 1872 my $argsIndex = 0; 1872 1873 my $paramIndex = 0; 1873 1874 my $functionString = ($podType ? "podImp." : "imp->") . $functionImplementationName . "("; … … 1908 1909 $hasOptionalArguments = 1; 1909 1910 } 1910 push(@implContent, " if (argsCount < " . ($ paramIndex + 1) . ") {\n");1911 push(@implContent, " if (argsCount < " . ($argsIndex + 1) . ") {\n"); 1911 1912 GenerateImplementationFunctionCall($function, $functionString, $paramIndex, " " x 2, $podType, $implClassName); 1912 1913 push(@implContent, " }\n\n"); … … 1917 1918 if ($parameter->type eq "XPathNSResolver") { 1918 1919 push(@implContent, " RefPtr<XPathNSResolver> customResolver;\n"); 1919 push(@implContent, " XPathNSResolver* resolver = toXPathNSResolver(exec->argument($ paramIndex));\n");1920 push(@implContent, " XPathNSResolver* resolver = toXPathNSResolver(exec->argument($argsIndex));\n"); 1920 1921 push(@implContent, " if (!resolver) {\n"); 1921 push(@implContent, " customResolver = JSCustomXPathNSResolver::create(exec, exec->argument($ paramIndex));\n");1922 push(@implContent, " customResolver = JSCustomXPathNSResolver::create(exec, exec->argument($argsIndex));\n"); 1922 1923 push(@implContent, " if (exec->hadException())\n"); 1923 1924 push(@implContent, " return JSValue::encode(jsUndefined());\n"); … … 1925 1926 push(@implContent, " }\n"); 1926 1927 } else { 1927 push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($ paramIndex)") . ";\n");1928 push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($argsIndex)") . ";\n"); 1928 1929 1929 1930 # If a parameter is "an index" and it's negative it should throw an INDEX_SIZE_ERR exception. … … 1946 1947 $functionString .= $name; 1947 1948 } 1949 $argsIndex++; 1948 1950 $paramIndex++; 1949 1951 } -
trunk/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp
r60784 r60952 399 399 } 400 400 401 void WebDOMTestObj::withScriptExecutionContext() 402 { 403 if (!impl()) 404 return; 405 406 impl()->withScriptExecutionContext(); 407 } 408 401 409 void WebDOMTestObj::methodWithOptionalArg(int opt) 402 410 { -
trunk/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h
r60784 r60952 88 88 void withScriptStateVoidException(); 89 89 WebDOMTestObj withScriptStateObjException(); 90 void withScriptExecutionContext(); 90 91 void methodWithOptionalArg(int opt); 91 92 void methodWithNonOptionalArgAndOptionalArg(int nonOpt, int opt); -
trunk/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r60789 r60952 633 633 if (!dynamicFrame) 634 634 return JSValue::encode(jsUndefined()); 635 int intArg = exec->argument( 1).toInt32(exec);635 int intArg = exec->argument(0).toInt32(exec); 636 636 637 637 imp->withDynamicFrameAndArg(dynamicFrame, intArg); … … 649 649 if (!dynamicFrame) 650 650 return JSValue::encode(jsUndefined()); 651 int intArg = exec->argument( 1).toInt32(exec);651 int intArg = exec->argument(0).toInt32(exec); 652 652 653 653 int argsCount = exec->argumentCount(); 654 if (argsCount < 3) {654 if (argsCount < 2) { 655 655 imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg); 656 656 return JSValue::encode(jsUndefined()); 657 657 } 658 658 659 int optionalArg = exec->argument( 2).toInt32(exec);659 int optionalArg = exec->argument(1).toInt32(exec); 660 660 661 661 imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg); … … 673 673 if (!dynamicFrame) 674 674 return JSValue::encode(jsUndefined()); 675 int intArg = exec->argument( 1).toInt32(exec);675 int intArg = exec->argument(0).toInt32(exec); 676 676 677 677 imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec)); … … 689 689 if (!dynamicFrame) 690 690 return JSValue::encode(jsUndefined()); 691 int intArg = exec->argument( 1).toInt32(exec);691 int intArg = exec->argument(0).toInt32(exec); 692 692 693 693 int argsCount = exec->argumentCount(); 694 if (argsCount < 3) {694 if (argsCount < 2) { 695 695 imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg); 696 696 return JSValue::encode(jsUndefined()); 697 697 } 698 698 699 int optionalArg = exec->argument( 2).toInt32(exec);699 int optionalArg = exec->argument(1).toInt32(exec); 700 700 701 701 imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec));
Note: See TracChangeset
for help on using the changeset viewer.