| Index: test/mjsunit/stack-traces.js
|
| diff --git a/test/mjsunit/stack-traces.js b/test/mjsunit/stack-traces.js
|
| index 438eec979d1766ed831a45c594bc29b8e9beab7a..b5d58fa0759f3086bce84d139824114d0b80d505 100644
|
| --- a/test/mjsunit/stack-traces.js
|
| +++ b/test/mjsunit/stack-traces.js
|
| @@ -288,4 +288,42 @@ testOmittedBuiltin(function(){ [thrower, 2].sort(function (a,b) {
|
| }, "QuickSort");
|
|
|
| // Omitted because ADD from runtime.js is non-native builtin.
|
| -testOmittedBuiltin(function(){ thrower + 2; }, "ADD");
|
| +testOmittedBuiltin(function(){ thrower + 2; }, "ADD");
|
| +
|
| +var error = new Error();
|
| +error.toString = function() { assertUnreachable(); };
|
| +error.stack;
|
| +
|
| +error = new Error();
|
| +error.name = { toString: function() { assertUnreachable(); }};
|
| +error.message = { toString: function() { assertUnreachable(); }};
|
| +error.stack;
|
| +
|
| +error = new Error();
|
| +Array.prototype.push = function(x) { assertUnreachable(); };
|
| +Array.prototype.join = function(x) { assertUnreachable(); };
|
| +error.stack;
|
| +
|
| +var fired = false;
|
| +error = new Error({ toString: function() { fired = true; } });
|
| +assertTrue(fired);
|
| +error.stack;
|
| +assertTrue(fired);
|
| +
|
| +// Check that throwing exception in a custom stack trace formatting function
|
| +// does not lead to recursion.
|
| +Error.prepareStackTrace = function() { throw new Error("abc"); };
|
| +var message;
|
| +try {
|
| + throw new Error();
|
| +} catch (e) {
|
| + message = e.message;
|
| +}
|
| +
|
| +assertEquals("abc", message);
|
| +
|
| +// Test that modifying Error.prepareStackTrace by itself works.
|
| +Error.prepareStackTrace = function() { Error.prepareStackTrace = "custom"; };
|
| +new Error();
|
| +
|
| +assertEquals("custom", Error.prepareStackTrace);
|
|
|