js/src/jit-test/tests/debug/Script-gc-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 // |jit-test| debug
     2 // Debugger.Script instances with live referents stay alive.
     4 var N = 4;
     5 var g = newGlobal();
     6 var dbg = new Debugger(g);
     7 var i;
     8 dbg.onDebuggerStatement = function (frame) {
     9     assertEq(frame.script instanceof Debugger.Script, true);
    10     frame.script.id = i;
    11 };
    13 g.eval('var arr = [];')
    14 for (i = 0; i < N; i++)  // loop to defeat conservative GC
    15     g.eval("arr.push(function () { debugger }); arr[arr.length - 1]();");
    17 gc();
    19 var hits;
    20 dbg.onDebuggerStatement = function (frame) {
    21     hits++;
    22     assertEq(frame.script.id, i);
    23 };
    24 hits = 0;
    25 for (i = 0; i < N; i++)
    26     g.arr[i]();
    27 assertEq(hits, N);

mercurial