js/src/jit-test/tests/debug/gc-03.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 // Storing a property on a Debugger.Object protects it from GC as long as the
     2 // referent is alive.
     4 var g = newGlobal();
     5 var N = g.N = 3;
     6 var dbg = Debugger(g);
     8 var i = 0;
     9 dbg.onDebuggerStatement = function (frame) {
    10     frame.arguments[0].id = i++;
    11 };
    12 g.eval("function f(x) { debugger; }");
    13 g.eval("var arr = [], j; for (j = 0; j < N; j++) arr[j] = {};");
    14 g.eval("for (j = 0; j < N; j++) f(arr[j]);");
    15 assertEq(i, N);
    17 gc(); gc();
    19 i = 0;
    20 dbg.onDebuggerStatement = function (frame) {
    21     assertEq(frame.arguments[0].id, i++)
    22 }
    23 g.eval("for (j = 0; j < N; j++) f(arr[j]);");
    24 assertEq(i, N);

mercurial