Changeset 59582 in webkit
- Timestamp:
- May 16, 2010 2:46:10 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r59581 r59582 1 2010-05-16 Andreas Kling <andreas.kling@nokia.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 Add a test to verify proper handling of invalid arguments to getImageData(). 6 Updated old putImageData() test with correct expectations. 7 8 https://bugs.webkit.org/show_bug.cgi?id=39175 9 10 Spec link: 11 http://www.whatwg.org/specs/web-apps/current-work/#pixel-manipulation 12 13 * fast/canvas/canvas-getImageData-invalid-expected.txt: Added. 14 * fast/canvas/canvas-getImageData-invalid.html: Added. 15 * fast/canvas/canvas-putImageData-expected.txt: 16 * fast/canvas/canvas-putImageData.js: 17 * fast/canvas/script-tests/canvas-getImageData-invalid.js: Added. 18 1 19 2010-05-16 Andreas Kling <andreas.kling@nokia.com> 2 20 -
trunk/LayoutTests/fast/canvas/canvas-putImageData-expected.txt
r30700 r59582 147 147 PASS getPixel(9,9) is [0,128,0,255] 148 148 PASS context.putImageData({}, 0, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. 149 PASS context.putImageData(buffer, NaN, 0, 0, 0, 0, 0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.150 PASS context.putImageData(buffer, 0, NaN, 0, 0, 0, 0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.151 PASS context.putImageData(buffer, 0, 0, NaN, 0, 0, 0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.152 PASS context.putImageData(buffer, 0, 0, 0, NaN, 0, 0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.153 PASS context.putImageData(buffer, 0, 0, 0, 0, NaN, 0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.154 PASS context.putImageData(buffer, 0, 0, 0, 0, 0, NaN) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.155 PASS context.putImageData(buffer, Infinity, 0, 0, 0, 0, 0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.156 PASS context.putImageData(buffer, 0, Infinity, 0, 0, 0, 0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.157 PASS context.putImageData(buffer, 0, 0, Infinity, 0, 0, 0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.158 PASS context.putImageData(buffer, 0, 0, 0, Infinity, 0, 0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.159 PASS context.putImageData(buffer, 0, 0, 0, 0, Infinity, 0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.160 PASS context.putImageData(buffer, 0, 0, 0, 0, 0, Infinity) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.161 PASS context.putImageData(buffer, undefined, 0, 0, 0, 0, 0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.162 PASS context.putImageData(buffer, 0, undefined, 0, 0, 0, 0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.163 PASS context.putImageData(buffer, 0, 0, undefined, 0, 0, 0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.164 PASS context.putImageData(buffer, 0, 0, 0, undefined, 0, 0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.165 PASS context.putImageData(buffer, 0, 0, 0, 0, undefined, 0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.166 PASS context.putImageData(buffer, 0, 0, 0, 0, 0, undefined) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.149 PASS context.putImageData(buffer, NaN, 0, 0, 0, 0, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 150 PASS context.putImageData(buffer, 0, NaN, 0, 0, 0, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 151 PASS context.putImageData(buffer, 0, 0, NaN, 0, 0, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 152 PASS context.putImageData(buffer, 0, 0, 0, NaN, 0, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 153 PASS context.putImageData(buffer, 0, 0, 0, 0, NaN, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 154 PASS context.putImageData(buffer, 0, 0, 0, 0, 0, NaN) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 155 PASS context.putImageData(buffer, Infinity, 0, 0, 0, 0, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 156 PASS context.putImageData(buffer, 0, Infinity, 0, 0, 0, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 157 PASS context.putImageData(buffer, 0, 0, Infinity, 0, 0, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 158 PASS context.putImageData(buffer, 0, 0, 0, Infinity, 0, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 159 PASS context.putImageData(buffer, 0, 0, 0, 0, Infinity, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 160 PASS context.putImageData(buffer, 0, 0, 0, 0, 0, Infinity) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 161 PASS context.putImageData(buffer, undefined, 0, 0, 0, 0, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 162 PASS context.putImageData(buffer, 0, undefined, 0, 0, 0, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 163 PASS context.putImageData(buffer, 0, 0, undefined, 0, 0, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 164 PASS context.putImageData(buffer, 0, 0, 0, undefined, 0, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 165 PASS context.putImageData(buffer, 0, 0, 0, 0, undefined, 0) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 166 PASS context.putImageData(buffer, 0, 0, 0, 0, 0, undefined) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. 167 167 PASS successfullyParsed is true 168 168 -
trunk/LayoutTests/fast/canvas/canvas-putImageData.js
r30710 r59582 203 203 204 204 shouldThrow("context.putImageData({}, 0, 0)", "'Error: TYPE_MISMATCH_ERR: DOM Exception 17'"); 205 shouldThrow("context.putImageData(buffer, NaN, 0, 0, 0, 0, 0)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");206 shouldThrow("context.putImageData(buffer, 0, NaN, 0, 0, 0, 0)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");207 shouldThrow("context.putImageData(buffer, 0, 0, NaN, 0, 0, 0)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");208 shouldThrow("context.putImageData(buffer, 0, 0, 0, NaN, 0, 0)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");209 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, NaN, 0)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");210 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, NaN)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");211 shouldThrow("context.putImageData(buffer, Infinity, 0, 0, 0, 0, 0)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");212 shouldThrow("context.putImageData(buffer, 0, Infinity, 0, 0, 0, 0)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");213 shouldThrow("context.putImageData(buffer, 0, 0, Infinity, 0, 0, 0)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");214 shouldThrow("context.putImageData(buffer, 0, 0, 0, Infinity, 0, 0)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");215 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, Infinity, 0)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");216 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, Infinity)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");217 shouldThrow("context.putImageData(buffer, undefined, 0, 0, 0, 0, 0)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");218 shouldThrow("context.putImageData(buffer, 0, undefined, 0, 0, 0, 0)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");219 shouldThrow("context.putImageData(buffer, 0, 0, undefined, 0, 0, 0)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");220 shouldThrow("context.putImageData(buffer, 0, 0, 0, undefined, 0, 0)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");221 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, undefined, 0)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");222 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, undefined)", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");205 shouldThrow("context.putImageData(buffer, NaN, 0, 0, 0, 0, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 206 shouldThrow("context.putImageData(buffer, 0, NaN, 0, 0, 0, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 207 shouldThrow("context.putImageData(buffer, 0, 0, NaN, 0, 0, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 208 shouldThrow("context.putImageData(buffer, 0, 0, 0, NaN, 0, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 209 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, NaN, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 210 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, NaN)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 211 shouldThrow("context.putImageData(buffer, Infinity, 0, 0, 0, 0, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 212 shouldThrow("context.putImageData(buffer, 0, Infinity, 0, 0, 0, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 213 shouldThrow("context.putImageData(buffer, 0, 0, Infinity, 0, 0, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 214 shouldThrow("context.putImageData(buffer, 0, 0, 0, Infinity, 0, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 215 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, Infinity, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 216 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, Infinity)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 217 shouldThrow("context.putImageData(buffer, undefined, 0, 0, 0, 0, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 218 shouldThrow("context.putImageData(buffer, 0, undefined, 0, 0, 0, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 219 shouldThrow("context.putImageData(buffer, 0, 0, undefined, 0, 0, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 220 shouldThrow("context.putImageData(buffer, 0, 0, 0, undefined, 0, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 221 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, undefined, 0)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 222 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, undefined)", "'Error: NOT_SUPPORTED_ERR: DOM Exception 9'"); 223 223 224 224 // Ensure we don't mess up bounds clipping checks -
trunk/WebCore/ChangeLog
r59581 r59582 1 2010-05-16 Andreas Kling <andreas.kling@nokia.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 Properly handle invalid arguments to CanvasRenderingContext2D's getImageData() and putImageData(). 6 Both should throw NOT_SUPPORTED_ERR when called with nonfinite arguments. 7 getImageData() should throw INDEX_SIZE_ERR if either width or height is 0. 8 9 https://bugs.webkit.org/show_bug.cgi?id=39175 10 11 Spec link: 12 http://www.whatwg.org/specs/web-apps/current-work/#pixel-manipulation 13 14 Test: fast/canvas/canvas-getImageData-invalid.html 15 16 * html/canvas/CanvasRenderingContext2D.cpp: 17 (WebCore::CanvasRenderingContext2D::createImageData): 18 (WebCore::CanvasRenderingContext2D::getImageData): 19 (WebCore::CanvasRenderingContext2D::putImageData): 20 1 21 2010-05-16 Andreas Kling <andreas.kling@nokia.com> 2 22 -
trunk/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r59561 r59582 1346 1346 { 1347 1347 ec = 0; 1348 if (!sw || !sh) { 1349 ec = INDEX_SIZE_ERR; 1350 return 0; 1351 } 1348 1352 if (!isfinite(sw) || !isfinite(sh)) { 1349 1353 ec = NOT_SUPPORTED_ERR; 1350 return 0;1351 }1352 if (!sw || !sh) {1353 ec = INDEX_SIZE_ERR;1354 1354 return 0; 1355 1355 } … … 1371 1371 return 0; 1372 1372 } 1373 1373 if (!sw || !sh) { 1374 ec = INDEX_SIZE_ERR; 1375 return 0; 1376 } 1377 if (!isfinite(sx) || !isfinite(sy) || !isfinite(sw) || !isfinite(sh)) { 1378 ec = NOT_SUPPORTED_ERR; 1379 return 0; 1380 } 1381 1374 1382 FloatRect unscaledRect(sx, sy, sw, sh); 1375 1383 IntRect scaledRect = canvas()->convertLogicalToDevice(unscaledRect); … … 1402 1410 if (!isfinite(dx) || !isfinite(dy) || !isfinite(dirtyX) || 1403 1411 !isfinite(dirtyY) || !isfinite(dirtyWidth) || !isfinite(dirtyHeight)) { 1404 ec = INDEX_SIZE_ERR;1412 ec = NOT_SUPPORTED_ERR; 1405 1413 return; 1406 1414 }
Note: See TracChangeset
for help on using the changeset viewer.