js/src/jit-test/tests/debug/Frame-onPop-throw-error.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 // |jit-test| error: TestComplete
     2 // onPop can change a throw into 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         };
    22         dbg.onEnterFrame = function handleSecondFrame(f) {
    23             log += 'e';
    24             assertEq(f.type, 'eval');
    26             dbg.onEnterFrame = function handleThirdFrame(f) {
    27                 log += '(';
    28                 assertEq(f.type, type);
    30                 dbg.onEnterFrame = function handleExtraFrames(f) {
    31                     // This should never be called.
    32                     assertEq(false, true);
    33                 };
    35                 f.onPop = function handlePop(c) {
    36                     log += ')';
    37                     assertEq(c.throw, 'mud');
    38                     return null;
    39                 };
    40             };
    41         };
    43         assertEq(f.eval(provocation), null);
    44     };
    46     log = '';
    47     // This causes handleFirstFrame to be called.
    48     assertEq(typeof g.eval('eval'), 'function');
    49     assertEq(log, 'fe(d)');
    51     print();
    52 }
    54 g.eval('function f() { debugger; throw \'mud\'; }');
    55 test('call', 'f();');
    56 test('call', 'new f;');
    57 test('eval', 'eval(\'debugger; throw \\\'mud\\\';\');');
    58 test('global', 'evaluate(\'debugger; throw \\\'mud\\\';\');');
    59 throw 'TestComplete';

mercurial