js/src/jit-test/tests/debug/Frame-eval-14.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 // Test the corner case of accessing an unaliased variable of a block
     2 // while the block is not live.
     4 var g = newGlobal();
     5 g.eval("function h() { debugger }");
     6 g.eval("function f() { let (x = 1, y) { (function() { y = 0 })(); h() } }");
     7 g.eval("var surprise = null");
     9 var dbg = new Debugger(g);
    10 dbg.onDebuggerStatement = function(hFrame) {
    11     var fFrame = hFrame.older;
    12     assertEq(fFrame.environment.getVariable('x'), 1);
    13     assertEq(fFrame.environment.getVariable('y'), 0);
    14     fFrame.eval("surprise = function() { return ++x }");
    15     assertEq(g.surprise(), 2);
    16 }
    17 g.f();
    18 assertEq(g.surprise !== null, true);
    20 // Either succeed or throw an error about 'x' not being live
    21 try {
    22     assertEq(g.surprise(), 3);
    23 } catch (e) {
    24     assertEq(e+'', 'Error: x is not live');
    25 }

mercurial