Changeset 98617 in webkit
- Timestamp:
- Oct 27, 2011, 12:22:31 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/canvas/canvas-putImageData-expected.txt (modified) (1 diff)
-
LayoutTests/fast/canvas/canvas-putImageData.js (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp (modified) (1 diff)
-
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (modified) (4 diffs)
-
Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (modified) (6 diffs)
-
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (modified) (1 diff)
-
Source/WebCore/bindings/scripts/test/TestObj.idl (modified) (1 diff)
-
Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (modified) (1 diff)
-
Source/WebCore/html/canvas/CanvasRenderingContext2D.idl (modified) (3 diffs)
-
Source/WebCore/page/DOMWindow.idl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r98616 r98617 1 2011-10-27 Pavel Podivilov <podivilov@chromium.org> 2 3 Get rid of optional parameters in the middle in IDLs. 4 https://bugs.webkit.org/show_bug.cgi?id=70816 5 6 Reviewed by Adam Barth. 7 8 Optional parameters in the middle are prohibited by WebIDL spec. 9 10 * fast/canvas/canvas-putImageData-expected.txt: expectation was wrong, context.putImageData({}, 0, 0) should throw Type Error. 11 * fast/canvas/canvas-putImageData.js: 12 1 13 2011-10-27 John Gregg <johnnyg@google.com> 2 14 -
trunk/LayoutTests/fast/canvas/canvas-putImageData-expected.txt
r98434 r98617 145 145 PASS getPixel(1,1) is [0,128,0,255] 146 146 PASS getPixel(9,9) is [0,128,0,255] 147 PASS context.putImageData({}, 0, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.147 PASS context.putImageData({}, 0, 0) threw exception TypeError: Type error. 148 148 PASS context.putImageData(buffer, NaN, 0, 0, 0, 0, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 149 149 PASS context.putImageData(buffer, 0, NaN, 0, 0, 0, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. -
trunk/LayoutTests/fast/canvas/canvas-putImageData.js
r98434 r98617 202 202 203 203 204 shouldThrow("context.putImageData({}, 0, 0)", "' Error: TYPE_MISMATCH_ERR: DOM Exception 17'");204 shouldThrow("context.putImageData({}, 0, 0)", "'TypeError: Type error'"); 205 205 shouldThrow("context.putImageData(buffer, NaN, 0, 0, 0, 0, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 206 206 shouldThrow("context.putImageData(buffer, 0, NaN, 0, 0, 0, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); -
trunk/Source/WebCore/ChangeLog
r98615 r98617 1 2011-10-27 Pavel Podivilov <podivilov@chromium.org> 2 3 Get rid of optional parameters in the middle in IDLs. 4 https://bugs.webkit.org/show_bug.cgi?id=70816 5 6 Reviewed by Adam Barth. 7 8 Optional parameters in the middle are prohibited by WebIDL spec. 9 10 * bindings/js/JSCanvasRenderingContext2DCustom.cpp: 11 * bindings/scripts/CodeGeneratorJS.pm: 12 (GenerateHeader): 13 (GenerateImplementation): 14 * bindings/scripts/CodeGeneratorV8.pm: 15 (GenerateHeader): 16 (GenerateArgumentsCountCheck): 17 (GenerateImplementation): 18 * bindings/scripts/test/JS/JSTestObj.cpp: 19 (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs): 20 * bindings/scripts/test/TestObj.idl: 21 * bindings/scripts/test/V8/V8TestObj.cpp: 22 (WebCore::TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback): 23 * html/canvas/CanvasRenderingContext2D.idl: 24 * page/DOMWindow.idl: 25 1 26 2011-10-27 Antti Koivisto <antti@apple.com> 2 27 -
trunk/Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp
r96626 r98617 141 141 } 142 142 143 JSValue JSCanvasRenderingContext2D::putImageData(ExecState* exec)144 {145 // putImageData has two variants146 // putImageData(ImageData, x, y)147 // putImageData(ImageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight)148 CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl());149 150 ExceptionCode ec = 0;151 if (exec->argumentCount() >= 7)152 context->putImageData(toImageData(exec->argument(0)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec),153 exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec), exec->argument(5).toFloat(exec), exec->argument(6).toFloat(exec), ec);154 else155 context->putImageData(toImageData(exec->argument(0)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), ec);156 157 setDOMException(exec, ec);158 return jsUndefined();159 }160 161 143 JSValue JSCanvasRenderingContext2D::webkitLineDash(ExecState* exec) const 162 144 { -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r98563 r98617 910 910 push(@headerContent, "\n // Custom functions\n"); 911 911 foreach my $function (@{$dataNode->functions}) { 912 if ($function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCCustom"}) {913 my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementationFunction"} || $codeGenerator->WK_lcfirst($function->signature->name);914 push(@headerContent, " JSC::JSValue " . $functionImplementationName . "(JSC::ExecState*);\n");915 }912 next unless $function->signature->extendedAttributes->{"Custom"} or $function->signature->extendedAttributes->{"JSCCustom"}; 913 next if $function->{overloads} && $function->{overloadIndex} != 1; 914 my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementationFunction"} || $codeGenerator->WK_lcfirst($function->signature->name); 915 push(@headerContent, " JSC::JSValue " . $functionImplementationName . "(JSC::ExecState*);\n"); 916 916 } 917 917 } … … 1949 1949 1950 1950 my $functionName = $codeGenerator->WK_lcfirst($className) . "PrototypeFunction" . $codeGenerator->WK_ucfirst($function->signature->name); 1951 1952 if ($function->{overloads} && @{$function->{overloads}} > 1) { 1951 my $isCustom = $function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCCustom"}; 1952 my $isOverloaded = $function->{overloads} && @{$function->{overloads}} > 1; 1953 1954 next if $isCustom && $isOverloaded && $function->{overloadIndex} > 1; 1955 1956 if (!$isCustom && $isOverloaded) { 1953 1957 # Append a number to an overloaded method's name to make it unique: 1954 1958 $functionName = $functionName . $function->{overloadIndex}; … … 1993 1997 } 1994 1998 1995 if ($ function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCCustom"}) {1999 if ($isCustom) { 1996 2000 push(@implContent, " return JSValue::encode(castedThis->" . $functionImplementationName . "(exec));\n"); 1997 2001 } else { … … 2030 2034 push(@implContent, "}\n\n"); 2031 2035 2032 if ( $function->{overloads} && @{$function->{overloads}} > 1&& $function->{overloadIndex} == @{$function->{overloads}}) {2036 if (!$isCustom && $isOverloaded && $function->{overloadIndex} == @{$function->{overloads}}) { 2033 2037 # Generate a function dispatching call to the rest of the overloads. 2034 2038 GenerateOverloadedPrototypeFunction($function, $dataNode, $implClassName); -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r98563 r98617 265 265 # EventTarget. 266 266 $codeGenerator->AddMethodsConstantsAndAttributesFromParentClasses($dataNode, \@allParents, 1); 267 $codeGenerator->LinkOverloadedFunctions($dataNode); 267 268 268 269 my $hasDependentLifetime = $dataNode->extendedAttributes->{"V8DependentLifetime"} || $dataNode->extendedAttributes->{"ActiveDOMObject"} || $className =~ /SVG/; … … 372 373 my $attrExt = $function->signature->extendedAttributes; 373 374 374 if ( $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) {375 if (($attrExt->{"Custom"} || $attrExt->{"V8Custom"}) && $function->{overloadIndex} == 1) { 375 376 push(@headerContent, <<END); 376 377 static v8::Handle<v8::Value> ${name}Callback(const v8::Arguments&); … … 1385 1386 my $dataNode = shift; 1386 1387 1388 my $numMandatoryParams = 0; 1389 my $optionalSeen = 0; 1390 foreach my $param (@{$function->parameters}) { 1391 if ($param->extendedAttributes->{"Optional"}) { 1392 $optionalSeen = 1; 1393 } else { 1394 die "An argument must not be declared to be optional unless all subsequent arguments to the operation are also optional." if $optionalSeen; 1395 $numMandatoryParams++; 1396 } 1397 } 1398 1387 1399 my $argumentsCountCheckString = ""; 1388 1400 my $requiresAllArguments; … … 1392 1404 } 1393 1405 $requiresAllArguments = $function->signature->extendedAttributes->{"RequiresAllArguments"} || $requiresAllArgumentsDefault; 1394 if ($requiresAllArguments) { 1395 my $numMandatoryParams = @{$function->parameters}; 1396 foreach my $param (reverse(@{$function->parameters})) { 1397 if ($param->extendedAttributes->{"Optional"}) { 1398 $numMandatoryParams--; 1399 } else { 1400 last; 1401 } 1402 } 1403 if ($numMandatoryParams >= 1) { 1404 $argumentsCountCheckString .= " if (args.Length() < $numMandatoryParams)\n"; 1405 if ($requiresAllArguments eq "Raise") { 1406 $argumentsCountCheckString .= " return throwError(\"Not enough arguments\", V8Proxy::TypeError);\n"; 1407 } else { 1408 $argumentsCountCheckString .= " return v8::Handle<v8::Value>();\n"; 1409 } 1406 if ($requiresAllArguments && $numMandatoryParams >= 1) { 1407 $argumentsCountCheckString .= " if (args.Length() < $numMandatoryParams)\n"; 1408 if ($requiresAllArguments eq "Raise") { 1409 $argumentsCountCheckString .= " return throwError(\"Not enough arguments\", V8Proxy::TypeError);\n"; 1410 } else { 1411 $argumentsCountCheckString .= " return v8::Handle<v8::Value>();\n"; 1410 1412 } 1411 1413 } … … 2006 2008 } 2007 2009 2008 $codeGenerator->LinkOverloadedFunctions($dataNode);2009 2010 2010 my $indexer; 2011 2011 my $namedPropertyGetter; 2012 2012 # Generate methods for functions. 2013 2013 foreach my $function (@{$dataNode->functions}) { 2014 if (!($function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"V8Custom"})) { 2014 my $isCustom = $function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"V8Custom"}; 2015 if (!$isCustom) { 2015 2016 GenerateFunctionCallback($function, $dataNode, $implClassName); 2016 2017 if ($function->{overloadIndex} > 1 && $function->{overloadIndex} == @{$function->{overloads}}) { … … 2031 2032 # for different calling context. 2032 2033 if (($dataNode->extendedAttributes->{"CheckDomainSecurity"} || ($interfaceName eq "DOMWindow")) && $function->signature->extendedAttributes->{"DoNotCheckDomainSecurity"}) { 2033 GenerateDomainSafeFunctionGetter($function, $implClassName); 2034 if (!$isCustom || $function->{overloadIndex} == 1) { 2035 GenerateDomainSafeFunctionGetter($function, $implClassName); 2036 } 2034 2037 } 2035 2038 } -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r98563 r98617 1557 1557 if (exec->hadException()) 1558 1558 return JSValue::encode(jsUndefined()); 1559 if (argsCount <= 2) { 1560 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1); 1561 return JSValue::encode(jsUndefined()); 1562 } 1563 1559 1564 int opt2(exec->argument(2).toInt32(exec)); 1560 1565 if (exec->hadException()) -
trunk/Source/WebCore/bindings/scripts/test/TestObj.idl
r98563 r98617 120 120 void methodWithOptionalArg(in [Optional] long opt); 121 121 void methodWithNonOptionalArgAndOptionalArg(in long nonOpt, in [Optional] long opt); 122 void methodWithNonOptionalArgAndTwoOptionalArgs(in long nonOpt, in [Optional] long opt1, in long opt2);122 void methodWithNonOptionalArgAndTwoOptionalArgs(in long nonOpt, in [Optional] long opt1, in [Optional] long opt2); 123 123 124 124 #if defined(TESTING_V8) || defined(TESTING_JS) -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
r98563 r98617 1043 1043 } 1044 1044 EXCEPTION_BLOCK(int, opt1, toInt32(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined))); 1045 if (args.Length() <= 2) { 1046 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1); 1047 return v8::Handle<v8::Value>(); 1048 } 1045 1049 EXCEPTION_BLOCK(int, opt2, toInt32(MAYBE_MISSING_PARAMETER(args, 2, MissingIsUndefined))); 1046 1050 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl
r98434 r98617 153 153 void setShadow(in float width, in float height, in float blur, in float c, in float m, in float y, in float k, in float a); 154 154 155 void putImageData(in ImageData imagedata, in float dx, in float dy) 156 raises(DOMException); 157 void putImageData(in ImageData imagedata, in float dx, in float dy, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight) 158 raises(DOMException); 159 155 160 #if defined(V8_BINDING) && V8_BINDING 156 161 CanvasPattern createPattern(in HTMLCanvasElement canvas, in [ConvertNullToNullString] DOMString repetitionType) … … 158 163 CanvasPattern createPattern(in HTMLImageElement image, in [ConvertNullToNullString] DOMString repetitionType) 159 164 raises (DOMException); 160 void putImageData(in ImageData imagedata, in float dx, in float dy, in [Optional] float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight)161 raises(DOMException);162 165 ImageData createImageData(in ImageData imagedata) 163 166 raises (DOMException); … … 167 170 // FIXME: Remove 'else' once JSC supports overloads too. 168 171 [Custom] void createPattern(/* 2 */); 169 [Custom] void putImageData(/* in ImageData imagedata, in float dx, in float dy [, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight] */);170 172 [Custom] ImageData createImageData(/* 3 */); 171 173 #endif // defined(V8_BINDING) -
trunk/Source/WebCore/page/DOMWindow.idl
r98507 r98617 213 213 // cross-document messaging 214 214 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT 215 [DoNotCheckDomainSecurity, Custom] void postMessage(in SerializedScriptValue message, in [Optional] Array messagePorts, inDOMString targetOrigin)215 [DoNotCheckDomainSecurity, Custom] void postMessage(in SerializedScriptValue message, in DOMString targetOrigin) 216 216 raises(DOMException); 217 [DoNotCheckDomainSecurity, Custom] void webkitPostMessage(in SerializedScriptValue message, in [Optional] Array transferList, in DOMString targetOrigin) 217 [DoNotCheckDomainSecurity, Custom] void postMessage(in SerializedScriptValue message, in Array messagePorts, in DOMString targetOrigin) 218 raises(DOMException); 219 220 [DoNotCheckDomainSecurity, Custom] void webkitPostMessage(in SerializedScriptValue message, in DOMString targetOrigin) 221 raises(DOMException); 222 [DoNotCheckDomainSecurity, Custom] void webkitPostMessage(in SerializedScriptValue message, in Array transferList, in DOMString targetOrigin) 218 223 raises(DOMException); 219 224 #else
Note:
See TracChangeset
for help on using the changeset viewer.