js/src/jit-test/tests/debug/Object-evalInGlobal-05.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.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);

mercurial