js/src/jit-test/tests/debug/Frame-evalWithBindings-09.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.

     1 // evalWithBindings code is debuggee code, so it can trip the debugger. It nests!
     2 var g = newGlobal();
     3 var dbg = new Debugger(g);
     4 var f1;
     5 var hits = 0;
     6 dbg.onDebuggerStatement = function (frame) {
     7     f1 = frame;
     9     // This trips the onExceptionUnwind hook.
    10     var x = frame.evalWithBindings("wrongSpeling", {rightSpelling: 2}).throw;
    12     assertEq(frame.evalWithBindings("exc.name", {exc: x}).return, "ReferenceError");
    13     hits++;
    14 };
    15 dbg.onExceptionUnwind = function (frame, exc) {
    16     assertEq(frame !== f1, true);
    18     // f1's environment does not contain the binding for the first evalWithBindings call.
    19     assertEq(f1.eval("rightSpelling").return, "dependent");
    20     assertEq(f1.evalWithBindings("n + rightSpelling", {n: "in"}).return, "independent");
    22     // frame's environment does contain the binding.
    23     assertEq(frame.eval("rightSpelling").return, 2);
    24     assertEq(frame.evalWithBindings("rightSpelling + three", {three: 3}).return, 5);
    25     hits++;
    26 };
    27 g.eval("(function () { var rightSpelling = 'dependent'; debugger; })();");

mercurial