js/src/tests/js1_5/GC/regress-383269-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 // |reftest| skip -- unreliable - based on GC timing
     2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 //-----------------------------------------------------------------------------
     8 var BUGNUMBER = 383269;
     9 var summary = 'Leak related to arguments object';
    10 var actual = 'No Leak';
    11 var expect = 'No Leak';
    14 //-----------------------------------------------------------------------------
    15 test();
    16 //-----------------------------------------------------------------------------
    18 function test()
    19 {
    20   enterFunc ('test');
    21   printBugNumber(BUGNUMBER);
    22   printStatus (summary);
    24   function generate_big_object_graph()
    25   {
    26     var root = {};
    27     f(root, 17);
    28     return root;
    29     function f(parent, depth) {
    30       if (depth == 0)
    31         return;
    32       --depth;
    33       f(parent.a = {}, depth);
    34       f(parent.b = {}, depth);
    35     }
    36   }
    38   function outer() {  var x = arguments; return function inner() { return x }; }
    40   function timed_gc()
    41   {
    42     var t1 = Date.now();
    43     gc();
    44     return Date.now() - t1;
    45   }
    47   outer(1);
    48   gc();
    49   var base_time = timed_gc();
    51   var f = outer(generate_big_object_graph());
    52   f = null;
    53   gc();
    54   var time = timed_gc();
    56   if (time > (base_time + 1) * 3)
    57     actual = "generate_big_object_graph() leaked, base_gc_time="+base_time+", last_gc_time="+time;
    59   reportCompare(expect, actual, summary);
    61   exitFunc ('test');
    62 }

mercurial