1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Object-global-01.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,26 @@ 1.4 +// Debugger.Object.prototype.global accessor surfaces. 1.5 + 1.6 +load(libdir + 'asserts.js'); 1.7 + 1.8 +var dbg = new Debugger; 1.9 +var g = newGlobal(); 1.10 +var gw = dbg.addDebuggee(g); 1.11 + 1.12 +assertEq(Object.getOwnPropertyDescriptor(gw, 'global'), undefined); 1.13 +var d = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(gw), 'global'); 1.14 +assertEq(d.enumerable, false); 1.15 +assertEq(d.configurable, true); 1.16 +assertEq(typeof d.get, "function"); 1.17 +assertEq(d.get.length, 0); 1.18 +assertEq(d.set, undefined); 1.19 + 1.20 +// This should not throw. 1.21 +gw.global = ''; 1.22 + 1.23 +// This should throw. 1.24 +assertThrowsInstanceOf(function () { "use strict"; gw.global = {}; }, TypeError); 1.25 +assertEq(gw.global, gw); 1.26 + 1.27 +// You shouldn't be able to apply the accessor to the prototype. 1.28 +assertThrowsInstanceOf(function () { return Debugger.Object.prototype.global; }, 1.29 + TypeError);