Bug 630034 - Throw when attempting to create a radial gradient with negative radii; r=jmuizelaar

This commit is contained in:
Ms2ger 2011-03-31 11:47:00 -04:00
parent 4dfdfe720d
commit 938d8be616
2 changed files with 6 additions and 3 deletions

View File

@ -1657,6 +1657,9 @@ nsCanvasRenderingContext2D::CreateRadialGradient(float x0, float y0, float r0, f
if (!FloatValidate(x0,y0,r0,x1,y1,r1))
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
if (r0 < 0.0 || r1 < 0.0)
return NS_ERROR_DOM_INDEX_SIZE_ERR;
nsRefPtr<gfxPattern> gradpat = new gfxPattern(x0, y0, r0, x1, y1, r1);
if (!gradpat)
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -6647,13 +6647,13 @@ var ctx = canvas.getContext('2d');
var _thrown = undefined; try {
ctx.createRadialGradient(0, 0, -0.1, 0, 0, 1);
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
var _thrown = undefined; try {
ctx.createRadialGradient(0, 0, 1, 0, 0, -0.1);
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
var _thrown = undefined; try {
ctx.createRadialGradient(0, 0, -0.1, 0, 0, -0.1);
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
}