The following test page, when run in IE8 in IE8 Standards mode, will
cause an "out of stack space" error. The conditions that cause this
error are: Both Array.prototype and Function.prototype have non-built-
in functions added to them, and JSON.parse() is passed both a string
containing a JSON array, and any kind of reviver function at all.
This means that any page using a popular javascript framework that
modifies Array.prototype and Function.prototype (such as Prototype or
Ext) will not be able to use a reviver function to handle dates
correctly. The native JSON parsers in Firefox and Chrome do not have
the same issue. Neither does the javascript-based parser json2.
js at
json.org.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
Function.prototype.test1 = function() { };
Array.prototype.test2 = function() { };
window.onload = function()
{
alert(JSON.parse('{ "foo": [1,2,3] }', function(k,v) { return
v; }));
}
</script>
</head>
<body>
</body>
</html>
Incidentally, I tried to post this bug at Microsoft Connect (https://
connect.microsoft.com/IE/Feedback) but it doesn't seem to allow me to
post new items. Is there a better place for IE bug reports than here?
- Joel Mueller