1// Copyright 2014 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 5function testError(error) { 6 // Reconfigure e.stack to be non-configurable 7 var desc1 = Object.getOwnPropertyDescriptor(error, "stack"); 8 Object.defineProperty(error, "stack", 9 {get: desc1.get, set: desc1.set, configurable: false}); 10 11 var desc2 = Object.getOwnPropertyDescriptor(error, "stack"); 12 assertFalse(desc2.configurable); 13 assertEquals(desc1.get, desc2.get); 14 assertEquals(desc2.get, desc2.get); 15} 16 17function stackOverflow() { 18 function f() { f(); } 19 try { f() } catch (e) { return e; } 20} 21 22function referenceError() { 23 try { g() } catch (e) { return e; } 24} 25 26testError(referenceError()); 27testError(stackOverflow()); 28