michael@0: // obj.getOwnPropertyDescriptor works when obj is a transparent cross-compartment wrapper. michael@0: michael@0: var g1 = newGlobal(); michael@0: var g2 = newGlobal(); michael@0: g1.next = g2; michael@0: michael@0: // This test is a little hard to follow, especially the !== assertions. michael@0: // michael@0: // Bottom line: the value of a property of g1 can only be an object in g1's michael@0: // compartment, so any Debugger.Objects obtained by calling michael@0: // g1obj.getOwnPropertyDescriptor should all have referents in g1's michael@0: // compartment. michael@0: michael@0: var dbg = new Debugger; michael@0: var g1obj = dbg.addDebuggee(g1); michael@0: var g2obj = dbg.addDebuggee(g2); michael@0: var wobj = g1obj.getOwnPropertyDescriptor("next").value; michael@0: assertEq(wobj instanceof Debugger.Object, true); michael@0: assertEq(wobj !== g2obj, true); // referents are in two different compartments michael@0: michael@0: g2.x = "ok"; michael@0: assertEq(wobj.getOwnPropertyDescriptor("x").value, "ok"); michael@0: michael@0: g1.g2min = g2.min = g2.Math.min; michael@0: g2.eval("Object.defineProperty(this, 'y', {get: min});"); michael@0: assertEq(g2.y, Infinity); michael@0: var wmin = wobj.getOwnPropertyDescriptor("y").get; michael@0: assertEq(wmin !== g2obj.getOwnPropertyDescriptor("min").value, true); // as above michael@0: assertEq(wmin, g1obj.getOwnPropertyDescriptor("g2min").value);