js/src/jit-test/tests/debug/Object-unwrap-02.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 // Debugger.Object.prototype.unwrap unwraps Debugger.Objects referring to
michael@0 2 // cross-compartment wrappers.
michael@0 3
michael@0 4 var dbg = new Debugger();
michael@0 5
michael@0 6 var g1 = newGlobal();
michael@0 7 var dg1 = dbg.addDebuggee(g1);
michael@0 8 assertEq(dg1.unwrap(), dg1);
michael@0 9
michael@0 10 var g2 = newGlobal();
michael@0 11 var dg2 = dbg.addDebuggee(g2);
michael@0 12
michael@0 13 var dg1g2 = dg1.makeDebuggeeValue(g2);
michael@0 14 assertEq(dg1g2.global, dg1);
michael@0 15 assertEq(dg1g2.unwrap(), dg2);
michael@0 16
michael@0 17 // Try an ordinary object, not a global.
michael@0 18 var g2o = g2.Object();
michael@0 19 var dg2o = dg2.makeDebuggeeValue(g2o);
michael@0 20 var dg1g2o = dg1.makeDebuggeeValue(g2o);
michael@0 21 assertEq(dg1g2o.global, dg1);
michael@0 22 assertEq(dg1g2o.unwrap(), dg2o);
michael@0 23 assertEq(dg1g2o.unwrap().unwrap(), dg2o);

mercurial