js/src/jit-test/tests/debug/makeGlobalObjectReference-01.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/debug/makeGlobalObjectReference-01.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,26 @@
     1.4 +// Debugger.prototype.makeGlobalObjectReference returns a D.O for a global
     1.5 +// without adding it as a debuggee.
     1.6 +
     1.7 +let g1 = newGlobal();
     1.8 +let dbg = new Debugger;
     1.9 +assertEq(dbg.hasDebuggee(g1), false);
    1.10 +
    1.11 +let g1w = dbg.makeGlobalObjectReference(g1);
    1.12 +assertEq(dbg.hasDebuggee(g1), false);
    1.13 +assertEq(g1w.unsafeDereference(), g1);
    1.14 +assertEq(g1w, g1w.makeDebuggeeValue(g1));
    1.15 +
    1.16 +assertEq(dbg.addDebuggee(g1w), g1w);
    1.17 +assertEq(dbg.hasDebuggee(g1), true);
    1.18 +assertEq(dbg.hasDebuggee(g1w), true);
    1.19 +assertEq(g1w.unsafeDereference(), g1);
    1.20 +assertEq(g1w, g1w.makeDebuggeeValue(g1));
    1.21 +
    1.22 +// makeGlobalObjectReference dereferences CCWs.
    1.23 +let g2 = newGlobal();
    1.24 +g2.g1 = g1;
    1.25 +let g2w = dbg.addDebuggee(g2);
    1.26 +let g2g1w = g2w.getOwnPropertyDescriptor('g1').value;
    1.27 +assertEq(g2g1w !== g1w, true);
    1.28 +assertEq(g2g1w.unwrap(), g1w);
    1.29 +assertEq(dbg.makeGlobalObjectReference(g2g1w), g1w);

mercurial