Login with your google account

I'd like to share with you a interesting bug of IE, which was found while I am writing my own JSON implementation.


Only 20 lines javascript code cause IE 6 and IE 7 browser crash!


////////////Code start

callback = function(data)
{
 alert(data.Movements);
 document.body.removeChild(scriptNode);

}

 

loop = function()
{
 scriptNode = document.createElement("script");
 scriptNode.type = "text/javascript"
 scriptNode.src = "./crashie7.js";  //The crashie7.js file should contained a call to callback() function with json data)
 document.body.appendChild(scriptNode);


 setTimeout(loop, 700);
}


loop();
////////////Code End

 

It seems remove a script node while codes in it were executing will cause IE browser crash.


I also found a quick fix for that problem:


////////////Code start
callback = function(data)
{
 alert(data.Movements);


       //  A delay to remove the script node.
 setTimeout(function()
 {
  document.body.removeChild(scriptNode);
 }, 3000);
}
////////////Code End

 

 

Running above piece on you IE browser and have crash fun!

Tags: ie, javascript, crash

No Comments 2008-11-04 13:24:58 by Homyu.Shinn

Comments:

You can leave a comment on this post if you login