js/src/tests/js1_5/GC/regress-383269-02.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 f(obj) {
    39     with (obj)
    40       return arguments;
    41   }
    43   function timed_gc()
    44   {
    45     var t1 = Date.now();
    46     gc();
    47     return Date.now() - t1;
    48   }
    50   var x = f({});
    51   x = null;
    52   gc();
    53   var base_time = timed_gc();
    55   x = f(generate_big_object_graph());
    56   x = null;
    57   gc();
    58   var time = timed_gc();
    60   if (time > (base_time + 10) * 3)
    61     actual = "generate_big_object_graph() leaked, base_gc_time="+base_time+", last_gc_time="+time;
    63   reportCompare(expect, actual, summary);
    65   exitFunc ('test');
    66 }

mercurial