js/src/jit-test/tests/debug/Object-makeDebuggeeValue-01.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Debugger.Object.prototype.makeDebuggeeValue creates only one
michael@0 2 // Debugger.Object instance for each debuggee object.
michael@0 3
michael@0 4 var g = newGlobal();
michael@0 5 var dbg = new Debugger();
michael@0 6 var gw = dbg.addDebuggee(g);
michael@0 7
michael@0 8 g.eval("var x = { 'now playing': 'Joy Division' };");
michael@0 9 g.eval("var y = { 'mood': 'bleak' };");
michael@0 10
michael@0 11 wx = gw.makeDebuggeeValue(g.x);
michael@0 12 assertEq(wx, gw.makeDebuggeeValue(g.x));
michael@0 13 assertEq(wx === g.x, false);
michael@0 14 assertEq("now playing" in wx, false);
michael@0 15 assertEq(wx.getOwnPropertyNames().indexOf("now playing"), 0);
michael@0 16 wx.commentary = "deconstruction";
michael@0 17 assertEq("deconstruction" in g.x, false);
michael@0 18
michael@0 19 wy = gw.makeDebuggeeValue(g.y);
michael@0 20 assertEq(wy === wx, false);
michael@0 21 wy.commentary = "reconstruction";
michael@0 22 assertEq(wx.commentary, "deconstruction");
michael@0 23
michael@0 24 // Separate debuggers get separate Debugger.Object instances, but both
michael@0 25 // instances' referents are the same underlying object.
michael@0 26 var dbg2 = new Debugger();
michael@0 27 var gw2 = dbg2.addDebuggee(g);
michael@0 28 w2x = gw2.makeDebuggeeValue(g.x);
michael@0 29 assertEq(wx === w2x, false);
michael@0 30 w2x.defineProperty("breadcrumb", { value: "pumpernickel" });
michael@0 31 assertEq(wx.getOwnPropertyDescriptor("breadcrumb").value, "pumpernickel");
michael@0 32
michael@0 33 // Non-objects are already debuggee values.
michael@0 34 assertEq(gw.makeDebuggeeValue("foonting turlingdromes"), "foonting turlingdromes");
michael@0 35 assertEq(gw.makeDebuggeeValue(true), true);
michael@0 36 assertEq(gw.makeDebuggeeValue(false), false);
michael@0 37 assertEq(gw.makeDebuggeeValue(null), null);
michael@0 38 assertEq(gw.makeDebuggeeValue(1729), 1729);
michael@0 39 assertEq(gw.makeDebuggeeValue(Math.PI), Math.PI);
michael@0 40 assertEq(gw.makeDebuggeeValue(undefined), undefined);

mercurial