js/src/jit-test/tests/debug/Debugger-findScripts-18.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 // In a debuggee with multiple scripts with varying displayURLs (aka //#
     2 // sourceURL), findScripts can filter by displayURL.
     4 var g = newGlobal();
     6 g.eval("function f(){} //# sourceURL=f.js");
     7 g.eval("function g(){} //# sourceURL=g.js");
     8 g.eval("function h(){}");
    10 var dbg = new Debugger();
    11 var gw = dbg.addDebuggee(g);
    12 var fw = gw.makeDebuggeeValue(g.f);
    13 var ggw = gw.makeDebuggeeValue(g.g);
    14 var hw = gw.makeDebuggeeValue(g.h);
    16 var fScripts = dbg.findScripts({ displayURL: "f.js" });
    17 assertEq(fScripts.indexOf(fw.script) != -1, true);
    18 assertEq(fScripts.indexOf(ggw.script), -1);
    19 assertEq(fScripts.indexOf(hw.script), -1);
    21 var gScripts = dbg.findScripts({ displayURL: "g.js" });
    22 assertEq(gScripts.indexOf(ggw.script) != -1, true);
    23 assertEq(gScripts.indexOf(fw.script), -1);
    24 assertEq(gScripts.indexOf(hw.script), -1);
    26 var allScripts = dbg.findScripts();
    27 assertEq(allScripts.indexOf(fw.script) != -1, true);
    28 assertEq(allScripts.indexOf(ggw.script) != -1, true);
    29 assertEq(allScripts.indexOf(hw.script) != -1, true);
    31 try {
    32   dbg.findScripts({ displayURL: 3 });
    33   // Should never get here because the above line should throw
    34   // JSMSG_UNEXPECTED_TYPE.
    35   assertEq(true, false);
    36 } catch(e) {
    37   assertEq(e.name, "TypeError");
    38   assertEq(e.message.contains("displayURL"), true);
    39 }

mercurial