1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Object-defineProperty-09.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,24 @@ 1.4 +// defineProperty can't re-define non-configurable properties. 1.5 +// Also: when defineProperty throws, the exception is native to the debugger 1.6 +// compartment, not a wrapper. 1.7 + 1.8 +var g = newGlobal(); 1.9 +var dbg = new Debugger; 1.10 +var gw = dbg.addDebuggee(g); 1.11 +gw.defineProperty("p", {value: 1}); 1.12 +g.p = 4; 1.13 +assertEq(g.p, 1); 1.14 + 1.15 +var threw; 1.16 +try { 1.17 + gw.defineProperty("p", {value: 2}); 1.18 + threw = false; 1.19 +} catch (exc) { 1.20 + threw = true; 1.21 + assertEq(exc instanceof TypeError, true); 1.22 + assertEq(typeof exc.message, "string"); 1.23 + assertEq(typeof exc.stack, "string"); 1.24 +} 1.25 +assertEq(threw, true); 1.26 + 1.27 +assertEq(g.p, 1);