about my program:

var imgSrc = "XXX.gif";
var texture = gl.createTexture();
texture.image = new Image();
texture.onload = function(){
gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,gl.RGBA,gl.U NSIGNED_BYTE,texture.image);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.bindTexture(gl.TEXTURE_2D, null);
texture.image.src = imgSrc;

the error firefox tell me is happen on the line

"gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,gl.RGBA,gl. UNSIGNED_BYTE,texture.image);

but the URL of the image is correct,so I think the error is on "put image to graphic card's texture space"

but I have no idea how to solve this error