Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 1 | // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 5 | var o = { |
| 6 | f: function() { throw new Error(); }, |
| 7 | get j() { o.h(); }, |
| 8 | set k(_) { o.j; }, |
| 9 | }; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 10 | o.g1 = function() { o.f() } |
| 11 | o.g2 = o.g1; |
| 12 | o.h = function() { o.g1() } |
| 13 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 14 | try { |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 15 | o.k = 42; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 16 | } catch (e) { |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 17 | Error.prepareStackTrace = function(e, frames) { return frames; }; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 18 | var frames = e.stack; |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 19 | Error.prepareStackTrace = undefined; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 20 | assertEquals("f", frames[0].getMethodName()); |
| 21 | assertEquals(null, frames[1].getMethodName()); |
| 22 | assertEquals("h", frames[2].getMethodName()); |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 23 | assertEquals("j", frames[3].getMethodName()); |
| 24 | assertEquals("k", frames[4].getMethodName()); |
| 25 | assertEquals(null, frames[5].getMethodName()); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 26 | } |