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

     1 // Debugger.Object.prototype.evalInGlobal throws when asked to evaluate in a CCW of a global.
     3 load(libdir + 'asserts.js');
     5 var dbg = new Debugger();
     7 var g1 = newGlobal();
     8 var dg1 = dbg.addDebuggee(g1);
    10 var g2 = newGlobal();
    11 var dg2 = dbg.addDebuggee(g2);
    13 // Generate a Debugger.Object viewing g2 from g1's compartment.
    14 var dg1wg2 = dg1.makeDebuggeeValue(g2);
    15 assertEq(dg1wg2.global, dg1);
    16 assertEq(dg1wg2.unwrap(), dg2);
    17 assertThrowsInstanceOf(function () { dg1wg2.evalInGlobal('1'); }, TypeError);
    18 assertThrowsInstanceOf(function () { dg1wg2.evalInGlobalWithBindings('x', { x: 1 }); }, TypeError);
    20 // These, however, should not throw.
    21 assertEq(dg1wg2.unwrap().evalInGlobal('1729').return, 1729);
    22 assertEq(dg1wg2.unwrap().evalInGlobalWithBindings('x', { x: 1729 }).return, 1729);

mercurial