Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: test/mjsunit/stack-traces-overflow.js

Issue 349033007: Reland "Fix stack trace accessor behavior." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/stack-traces.js ('k') | tools/generate-runtime-tests.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } catch (e) { 54 } catch (e) {
55 assertTrue(e.stack.indexOf("rec1") > 0); 55 assertTrue(e.stack.indexOf("rec1") > 0);
56 assertInstanceof(e, RangeError); 56 assertInstanceof(e, RangeError);
57 } 57 }
58 58
59 59
60 // Check setting/getting stack property on the prototype chain. 60 // Check setting/getting stack property on the prototype chain.
61 function testErrorPrototype(prototype) { 61 function testErrorPrototype(prototype) {
62 var object = {}; 62 var object = {};
63 object.__proto__ = prototype; 63 object.__proto__ = prototype;
64 object.stack = "123"; 64 object.stack = "123"; // Overwriting stack property fails.
65 assertEquals("123", object.stack); 65 assertEquals(prototype.stack, object.stack);
66 assertTrue("123" != prototype.stack); 66 assertTrue("123" != prototype.stack);
67 } 67 }
68 68
69 try { 69 try {
70 rec1(0); 70 rec1(0);
71 } catch (e) { 71 } catch (e) {
72 e.stack; 72 e.stack;
73 testErrorPrototype(e); 73 testErrorPrototype(e);
74 } 74 }
75 75
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 rec1(0); 119 rec1(0);
120 } catch (e) { 120 } catch (e) {
121 assertTrue(e.stack.split('\n').length > 100); 121 assertTrue(e.stack.split('\n').length > 100);
122 } 122 }
123 123
124 Error.stackTraceLimit = "not a number"; 124 Error.stackTraceLimit = "not a number";
125 try { 125 try {
126 rec1(0); 126 rec1(0);
127 } catch (e) { 127 } catch (e) {
128 assertEquals(undefined, e.stack); 128 assertEquals(undefined, e.stack);
129 e.stack = "abc";
130 assertEquals("abc", e.stack);
129 } 131 }
130 132
131 Error.stackTraceLimit = 3; 133 Error.stackTraceLimit = 3;
132 Error = ""; // Overwrite Error in the global object. 134 Error = ""; // Overwrite Error in the global object.
133 try { 135 try {
134 rec1(0); 136 rec1(0);
135 } catch (e) { 137 } catch (e) {
136 assertEquals(4, e.stack.split('\n').length); 138 assertEquals(4, e.stack.split('\n').length);
137 } 139 }
OLDNEW
« no previous file with comments | « test/mjsunit/stack-traces.js ('k') | tools/generate-runtime-tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698