Index: test/mjsunit/stack-traces.js |
diff --git a/test/mjsunit/stack-traces.js b/test/mjsunit/stack-traces.js |
index 9d9fd23ccfc7cdde7b649991536090f197ccedc3..bd7909383fc29a63e77f67f8e1a942476a765718 100644 |
--- a/test/mjsunit/stack-traces.js |
+++ b/test/mjsunit/stack-traces.js |
@@ -411,3 +411,15 @@ try { |
} catch (e) { |
assertEquals(undefined, e.stack); |
} |
+ |
+// Check that a tight recursion in prepareStackTrace fails gracefully, i.e. |
+// a range error is thrown and printed (but without showing the actual stack). |
+ |
+Error.prepareStackTrace = () => Error.prepareStackTrace(); |
+try { |
+ new Error().stack; |
+} catch (e) { |
+ assertTrue( |
+ e.stack.indexOf("RangeError: Maximum call stack size exceeded") != -1); |
+ assertTrue(e.stack.indexOf("prepareStackTrace") == -1); |
+} |