Thu, 15 Jan 2015 21:03:48 +0100
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.evalInGlobal throws when asked to evaluate in a CCW of a global. |
michael@0 | 2 | |
michael@0 | 3 | load(libdir + 'asserts.js'); |
michael@0 | 4 | |
michael@0 | 5 | var dbg = new Debugger(); |
michael@0 | 6 | |
michael@0 | 7 | var g1 = newGlobal(); |
michael@0 | 8 | var dg1 = dbg.addDebuggee(g1); |
michael@0 | 9 | |
michael@0 | 10 | var g2 = newGlobal(); |
michael@0 | 11 | var dg2 = dbg.addDebuggee(g2); |
michael@0 | 12 | |
michael@0 | 13 | // Generate a Debugger.Object viewing g2 from g1's compartment. |
michael@0 | 14 | var dg1wg2 = dg1.makeDebuggeeValue(g2); |
michael@0 | 15 | assertEq(dg1wg2.global, dg1); |
michael@0 | 16 | assertEq(dg1wg2.unwrap(), dg2); |
michael@0 | 17 | assertThrowsInstanceOf(function () { dg1wg2.evalInGlobal('1'); }, TypeError); |
michael@0 | 18 | assertThrowsInstanceOf(function () { dg1wg2.evalInGlobalWithBindings('x', { x: 1 }); }, TypeError); |
michael@0 | 19 | |
michael@0 | 20 | // These, however, should not throw. |
michael@0 | 21 | assertEq(dg1wg2.unwrap().evalInGlobal('1729').return, 1729); |
michael@0 | 22 | assertEq(dg1wg2.unwrap().evalInGlobalWithBindings('x', { x: 1729 }).return, 1729); |