This test checks whether funky scope chains created by catch blocks
are properly protected from GC. It should not crash.
<script>
if (window.testRunner)
testRunner.dumpAsText();
function Test_Error() {
for( var i = 0; i <= 5000; i++ ) {
try {
throw new Error("Ungraceful Error");
}
catch (e) {
try {
throw new Error("Graceful Error");
}
catch (e) {
Test_Error_isPrime(147457); //Do something CPU-intensive
}
finally{
Test_Error_isPrime(147457); //Do something CPU-intensive
}
}
}
}
function Test_Error_isPrime(PrimeTest) {
for(var i=2;i<=Math.sqrt(147457)+1;i++) {
if (PrimeTest % i == 0) {
return false;
}
}
return true;
}
Test_Error();
</script>