michael@0: // Debugger.Object.prototype.global accessor surfaces. michael@0: michael@0: load(libdir + 'asserts.js'); michael@0: michael@0: var dbg = new Debugger; michael@0: var g = newGlobal(); michael@0: var gw = dbg.addDebuggee(g); michael@0: michael@0: assertEq(Object.getOwnPropertyDescriptor(gw, 'global'), undefined); michael@0: var d = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(gw), 'global'); michael@0: assertEq(d.enumerable, false); michael@0: assertEq(d.configurable, true); michael@0: assertEq(typeof d.get, "function"); michael@0: assertEq(d.get.length, 0); michael@0: assertEq(d.set, undefined); michael@0: michael@0: // This should not throw. michael@0: gw.global = ''; michael@0: michael@0: // This should throw. michael@0: assertThrowsInstanceOf(function () { "use strict"; gw.global = {}; }, TypeError); michael@0: assertEq(gw.global, gw); michael@0: michael@0: // You shouldn't be able to apply the accessor to the prototype. michael@0: assertThrowsInstanceOf(function () { return Debugger.Object.prototype.global; }, michael@0: TypeError);