OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 var o = [ function f0() { throw new Error(); }, | 59 var o = [ function f0() { throw new Error(); }, |
60 function f1() { o[0](); }, | 60 function f1() { o[0](); }, |
61 function f2() { "use strict"; o[1](); }, | 61 function f2() { "use strict"; o[1](); }, |
62 function f3() { o[2](); } ]; | 62 function f3() { o[2](); } ]; |
63 | 63 |
64 Error.prepareStackTrace = function(error, frames) { | 64 Error.prepareStackTrace = function(error, frames) { |
65 Error.prepareStackTrace = undefined; // Prevent recursion. | 65 Error.prepareStackTrace = undefined; // Prevent recursion. |
66 try { | 66 try { |
67 assertEquals(5, frames.length); | 67 assertEquals(5, frames.length); |
68 for (var i = 0; i < 2; i++) { | 68 for (var i = 0; i < 2; i++) { |
69 // The first two frames are still classic mode. | 69 // The first two frames are still sloppy mode. |
70 assertEquals(o[i], frames[i].getFunction()); | 70 assertEquals(o[i], frames[i].getFunction()); |
71 assertEquals(o, frames[i].getThis()); | 71 assertEquals(o, frames[i].getThis()); |
72 } | 72 } |
73 for (var i = 2; i < frames.length; i++) { | 73 for (var i = 2; i < frames.length; i++) { |
74 // The rest are poisoned by the first strict mode function. | 74 // The rest are poisoned by the first strict mode function. |
75 assertEquals(undefined, frames[i].getFunction()); | 75 assertEquals(undefined, frames[i].getFunction()); |
76 assertEquals(undefined, frames[i].getThis()); | 76 assertEquals(undefined, frames[i].getThis()); |
77 } | 77 } |
78 for (var i = 0; i < frames.length - 1; i++) { | 78 for (var i = 0; i < frames.length - 1; i++) { |
79 // Function name remains accessible. | 79 // Function name remains accessible. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } catch (e) { | 113 } catch (e) { |
114 return e; | 114 return e; |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 try { | 118 try { |
119 o[3](); | 119 o[3](); |
120 } catch (e) { | 120 } catch (e) { |
121 assertEquals("success", e.stack); | 121 assertEquals("success", e.stack); |
122 }; | 122 }; |
OLD | NEW |