Index: test/mjsunit/stack-traces-overflow.js |
diff --git a/test/mjsunit/regress/regress-117794.js b/test/mjsunit/stack-traces-overflow.js |
similarity index 60% |
copy from test/mjsunit/regress/regress-117794.js |
copy to test/mjsunit/stack-traces-overflow.js |
index 5e11b40035f0d37dcffd4d9eb09debcd785f307d..e56cb119281bc2e3afb2786fd5745923da03bb05 100644 |
--- a/test/mjsunit/regress/regress-117794.js |
+++ b/test/mjsunit/stack-traces-overflow.js |
@@ -25,33 +25,63 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Loads specialized to be from the global object should not omit the |
-// smi check on the receiver. The code below should not crash. |
+function rec1(a) { rec1(a+1); } |
+function rec2(a) { rec3(a+1); } |
+function rec3(a) { rec2(a+1); } |
-print = function() {} |
- |
-function constructor() {}; |
+// Test stack trace getter and setter. |
+try { |
+ rec1(0); |
+} catch (e) { |
+ assertTrue(e.stack.indexOf("rec1") > 0); |
+ e.stack = "123"; |
+ assertEquals("123", e.stack); |
+} |
-function assertHasOwnProperties(object, limit) { |
- for (var i = 0; i < limit; i++) { } |
+// Test setter w/o calling the getter. |
+try { |
+ rec2(0); |
+} catch (e) { |
+ assertTrue(e.stack.indexOf("rec2") > 0); |
+ assertTrue(e.stack.indexOf("rec3") > 0); |
+ e.stack = "123"; |
+ assertEquals("123", e.stack); |
} |
+// Test getter to make sure setter does not affect the boilerplate. |
try { |
- Object.keys(); |
-} catch(exc2) { |
- print(exc2.stack); |
+ rec1(0); |
+} catch (e) { |
+ assertTrue(e.stack.indexOf("rec1") > 0); |
+ assertInstanceof(e, RangeError); |
+} |
+ |
+ |
+// Check setting/getting stack property on the prototype chain. |
+function testErrorPrototype(prototype) { |
+ var object = {}; |
+ object.__proto__ = prototype; |
+ object.stack = "123"; |
+ assertEquals("123", prototype.stack); |
+ assertEquals("123", object.stack); |
} |
-var x1 = new Object(); |
+try { |
+ rec1(0); |
+} catch (e) { |
+ e.stack; |
+ testErrorPrototype(e); |
+} |
try { |
- new Function("A Man Called Horse", x1.d); |
-} catch(exc3) { |
- print(exc3.stack); |
+ rec1(0); |
+} catch (e) { |
+ testErrorPrototype(e); |
} |
try { |
- (-(true)).toPrecision(0x30, 'lib1-f1'); |
-} catch(exc1) { |
- print(exc1.stack); |
+ throw new Error(); |
+} catch (e) { |
+ testErrorPrototype(e); |
} |
+ |