michael@0: // Debugger.Object.prototype.makeDebuggeeValue creates only one michael@0: // Debugger.Object instance for each debuggee object. michael@0: michael@0: var g = newGlobal(); michael@0: var dbg = new Debugger(); michael@0: var gw = dbg.addDebuggee(g); michael@0: michael@0: g.eval("var x = { 'now playing': 'Joy Division' };"); michael@0: g.eval("var y = { 'mood': 'bleak' };"); michael@0: michael@0: wx = gw.makeDebuggeeValue(g.x); michael@0: assertEq(wx, gw.makeDebuggeeValue(g.x)); michael@0: assertEq(wx === g.x, false); michael@0: assertEq("now playing" in wx, false); michael@0: assertEq(wx.getOwnPropertyNames().indexOf("now playing"), 0); michael@0: wx.commentary = "deconstruction"; michael@0: assertEq("deconstruction" in g.x, false); michael@0: michael@0: wy = gw.makeDebuggeeValue(g.y); michael@0: assertEq(wy === wx, false); michael@0: wy.commentary = "reconstruction"; michael@0: assertEq(wx.commentary, "deconstruction"); michael@0: michael@0: // Separate debuggers get separate Debugger.Object instances, but both michael@0: // instances' referents are the same underlying object. michael@0: var dbg2 = new Debugger(); michael@0: var gw2 = dbg2.addDebuggee(g); michael@0: w2x = gw2.makeDebuggeeValue(g.x); michael@0: assertEq(wx === w2x, false); michael@0: w2x.defineProperty("breadcrumb", { value: "pumpernickel" }); michael@0: assertEq(wx.getOwnPropertyDescriptor("breadcrumb").value, "pumpernickel"); michael@0: michael@0: // Non-objects are already debuggee values. michael@0: assertEq(gw.makeDebuggeeValue("foonting turlingdromes"), "foonting turlingdromes"); michael@0: assertEq(gw.makeDebuggeeValue(true), true); michael@0: assertEq(gw.makeDebuggeeValue(false), false); michael@0: assertEq(gw.makeDebuggeeValue(null), null); michael@0: assertEq(gw.makeDebuggeeValue(1729), 1729); michael@0: assertEq(gw.makeDebuggeeValue(Math.PI), Math.PI); michael@0: assertEq(gw.makeDebuggeeValue(undefined), undefined);