mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 17:59:34 +00:00
Bug 630029 - Throw INDEX_SIZE_ERR instead of SYNTAX_ERR when calling CanvasGradient.addColorStop with non-finite values; r=?sicking
This commit is contained in:
parent
7f0465be6b
commit
a544f30f34
@ -220,14 +220,10 @@ public:
|
||||
NS_IMETHOD AddColorStop (float offset,
|
||||
const nsAString& colorstr)
|
||||
{
|
||||
nscolor color;
|
||||
|
||||
if (!FloatValidate(offset))
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
|
||||
if (offset < 0.0 || offset > 1.0)
|
||||
if (!FloatValidate(offset) || offset < 0.0 || offset > 1.0)
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
|
||||
nscolor color;
|
||||
nsCSSParser parser;
|
||||
nsresult rv = parser.ParseColorString(nsString(colorstr),
|
||||
nsnull, 0, &color);
|
||||
|
@ -6108,13 +6108,13 @@ var _thrown = undefined; try {
|
||||
} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
|
||||
var _thrown = undefined; try {
|
||||
g.addColorStop(Infinity, '#000');
|
||||
} 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 {
|
||||
g.addColorStop(-Infinity, '#000');
|
||||
} 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 {
|
||||
g.addColorStop(NaN, '#000');
|
||||
} 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");
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user