Bug 632474 - Throw a TYPE_MISMATCH_ERR on drawImage(null); r=sicking

This commit is contained in:
Ms2ger 2011-03-31 15:38:30 -04:00
Родитель 0c8f85c537
Коммит 60a2b4eaa8
2 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -3362,7 +3362,9 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1,
float a6, float a7, float a8,
PRUint8 optional_argc)
{
NS_ENSURE_ARG(imgElt);
if (!imgElt) {
return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
}
double sx,sy,sw,sh;
double dx,dy,dw,dh;

Просмотреть файл

@ -3497,7 +3497,7 @@ var ctx = canvas.getContext('2d');
var _thrown = undefined; try {
ctx.drawImage(null, 0, 0);
} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
}
@ -3669,7 +3669,7 @@ var ctx = canvas.getContext('2d');
var _thrown = undefined; try {
ctx.drawImage(undefined, 0, 0);
} catch (e) { _thrown = e }; ok(_thrown && _thrown.result == Components.results.NS_ERROR_INVALID_ARG, "should throw NS_ERROR_INVALID_ARG");
} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
var _thrown = undefined; try {
ctx.drawImage(0, 0, 0);
} catch (e) { _thrown = e }; ok(_thrown && _thrown.result == Components.results.NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL, "should throw NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL");