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

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

Issue 11971015: Skip stack trace formatting in case the global object is already dead. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix leaks in the setter. Created 7 years, 11 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/mjsunit.status ('k') | test/mjsunit/unbox-double-arrays.js » ('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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 // Test getter to make sure setter does not affect the boilerplate. 51 // Test getter to make sure setter does not affect the boilerplate.
52 try { 52 try {
53 rec1(0); 53 rec1(0);
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 function assertStackAccessors(error_object, type) {
61 assertSame(type,
62 typeof Object.getOwnPropertyDescriptor(error_object, "stack").get);
63 assertSame(type,
64 typeof Object.getOwnPropertyDescriptor(error_object, "stack").set);
65 }
66
60 // Check setting/getting stack property on the prototype chain. 67 // Check setting/getting stack property on the prototype chain.
61 function testErrorPrototype(prototype) { 68 function testErrorPrototype(prototype) {
62 var object = {}; 69 var object = {};
63 object.__proto__ = prototype; 70 object.__proto__ = prototype;
64 object.stack = "123"; 71 object.stack = "123";
65 assertEquals("123", object.stack); 72 assertEquals("123", object.stack);
66 assertTrue("123" != prototype.stack); 73 assertTrue("123" != prototype.stack);
74 // Check that the accessors on the prototype error object are untouched.
75 assertStackAccessors(prototype, "function");
76 assertEquals("123", Object.getOwnPropertyDescriptor(object, "stack").value);
77 prototype.stack = "abc";
78 assertStackAccessors(prototype, "undefined");
67 } 79 }
68 80
69 try { 81 try {
70 rec1(0); 82 rec1(0);
71 } catch (e) { 83 } catch (e) {
72 e.stack; 84 e.stack;
73 testErrorPrototype(e); 85 testErrorPrototype(e);
74 } 86 }
75 87
76 try { 88 try {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 assertEquals(undefined, e.stack); 125 assertEquals(undefined, e.stack);
114 } 126 }
115 127
116 Error.stackTraceLimit = 3; 128 Error.stackTraceLimit = 3;
117 Error = ""; // Overwrite Error in the global object. 129 Error = ""; // Overwrite Error in the global object.
118 try { 130 try {
119 rec1(0); 131 rec1(0);
120 } catch (e) { 132 } catch (e) {
121 assertEquals(4, e.stack.split('\n').length); 133 assertEquals(4, e.stack.split('\n').length);
122 } 134 }
OLDNEW
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | test/mjsunit/unbox-double-arrays.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698