js/src/jit-test/tests/debug/Frame-evalWithBindings-01.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 // evalWithBindings basics
     3 var g = newGlobal();
     4 var dbg = new Debugger(g);
     5 var hits = 0;
     6 dbg.onDebuggerStatement = function (frame) {
     7     assertEq(frame.evalWithBindings("x", {x: 2}).return, 2);
     8     assertEq(frame.evalWithBindings("x + y", {x: 2}).return, 5);
     9     hits++;
    10 };
    12 // in global code
    13 g.y = 3;
    14 g.eval("debugger;");
    16 // in function code
    17 g.y = "fail";
    18 g.eval("function f(y) { debugger; }");
    19 g.f(3);
    21 // in direct eval code
    22 g.eval("function f() { var y = 3; eval('debugger;'); }");
    23 g.f();
    25 // in strict eval code with var
    26 g.eval("function f() { 'use strict'; eval('var y = 3; debugger;'); }");
    27 g.f();
    29 // in a with block
    30 g.eval("with ({y: 3}) { debugger; }");
    32 // shadowing
    33 g.eval("let (x = 50, y = 3) { debugger; }");
    35 assertEq(hits, 6);

mercurial