js/src/jit-test/tests/debug/Frame-onPop-error-error.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 // |jit-test| error: TestComplete
     2 // onPop can request a termination when stopped for a termination
     4 var g = newGlobal();
     5 var dbg = new Debugger(g);
     7 // We use Debugger.Frame.prototype.eval and ignore the outer 'eval' frame so we 
     8 // can catch the termination.
    10 function test(type, provocation) {
    11     // Help people figure out which 'test' call failed.
    12     print("type:        " + uneval(type));
    13     print("provocation: " + uneval(provocation));
    15     var log;
    16     dbg.onEnterFrame = function handleFirstFrame(f) {
    17         log += 'f';
    18         dbg.onDebuggerStatement = function handleDebugger(f) {
    19             log += 'd';
    20             return null;
    21         };
    23         dbg.onEnterFrame = function handleSecondFrame(f) {
    24             log += 'e';
    25             assertEq(f.type, 'eval');
    27             dbg.onEnterFrame = function handleThirdFrame(f) {
    28                 log += '(';
    29                 assertEq(f.type, type);
    31                 dbg.onEnterFrame = function handleExtraFrames(f) {
    32                     // This should never be called.
    33                     assertEq(false, true);
    34                 };
    36                 f.onPop = function handlePop(c) {
    37                     log += ')';
    38                     assertEq(c, null);
    39                     return null;
    40                 };
    41             };
    42         };
    44         assertEq(f.eval(provocation), null);
    45     };
    47     log = '';
    48     // This causes handleFirstFrame to be called.
    49     assertEq(typeof g.eval('eval'), 'function');
    50     assertEq(log, 'fe(d)');
    52     print();
    53 }
    55 g.eval('function f() { debugger; return \'termination fail\'; }');
    56 test('call', 'f();');
    57 test('call', 'new f;');
    58 test('eval', 'eval(\'debugger; \\\'termination fail\\\';\');');
    59 test('global', 'evaluate(\'debugger; \\\'termination fail\\\';\');');
    60 throw 'TestComplete';

mercurial