js/src/tests/js1_5/GC/regress-324278.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 -- slow, obsoleted by 98409 fix
     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 = 324278;
     9 var summary = 'GC without recursion';
    10 var actual = 'No Crash';
    11 var expect = 'No Crash';
    13 printBugNumber(BUGNUMBER);
    14 printStatus (summary);
    16 // Number to push native stack size beyond 10MB if GC recurses generating
    17 // segfault on Fedora Core / Ubuntu Linuxes where the stack size by default
    18 // is 10MB/8MB.
    19 var N = 100*1000;
    21 function build(N) {
    22   // Exploit the fact that (in ES3), regexp literals are shared between
    23   // function invocations. Thus we build the following chain:
    24   // chainTop: function->regexp->function->regexp....->null
    25   // to check how GC would deal with this chain.
    27   var chainTop = null;
    28   for (var i = 0; i != N; ++i) {
    29     var f = Function('some_arg'+i, ' return /test/;');
    30     var re = f();
    31     re.previous = chainTop;
    32     chainTop = f;
    33   }
    34   return chainTop;
    35 }
    37 function check(chainTop, N) {
    38   for (var i = 0; i != N; ++i) {
    39     var re = chainTop();
    40     chainTop = re.previous;
    41   }
    42   if (chainTop !== null)
    43     throw "Bad chainTop";
    45 }
    47 if (typeof gc != "function") {
    48   gc = function() {
    49     for (var i = 0; i != 50*1000; ++i) {
    50       var tmp = new Object();
    51     }
    52   }
    53 }
    55 var chainTop = build(N);
    56 printStatus("BUILT");
    57 gc();
    58 check(chainTop, N);
    59 printStatus("CHECKED");
    60 chainTop = null;
    61 gc();
    63 reportCompare(expect, actual, summary);

mercurial