diff -r 000000000000 -r 6474c204b198 js/src/jit-test/tests/basic/bug649939.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/src/jit-test/tests/basic/bug649939.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,27 @@ +// This was the actual bug +assertRaises(StopIteration, function() { + Iterator.prototype.next(); + Iterator.prototype.next(); +}); + +// The error should have triggered here, but was masked by a latent bug +assertRaises(StopIteration, function() { + Iterator.prototype.next(); +}); + +// Found by fuzzing +assertRaises(StopIteration, function() { + (new Iterator({})).__proto__.next(); +}); + + +function assertRaises(exc, callback) { + var caught = false; + try { + callback(); + } catch (e) { + assertEq(e instanceof StopIteration, true); + caught = true; + } + assertEq(caught, true); +}