js/src/tests/js1_5/GC/regress-319980-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-if(!xulRuntime.shell) slow
     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 = 319980;
     9 var summary = 'GC not called during non-fatal out of memory';
    10 var actual = '';
    11 var expect = 'Normal Exit';
    13 printBugNumber(BUGNUMBER);
    14 printStatus (summary);
    15 print ('This test should never fail explicitly. ' +
    16        'You must view the memory usage during the test. ' +
    17        'This test fails if memory usage for each subtest grows');
    19 var timeOut  = 45 * 1000;
    20 var interval = 0.01  * 1000;
    21 var testFuncWatcherId;
    22 var testFuncTimerId;
    23 var maxTests = 5;
    24 var currTest = 0;
    26 if (typeof setTimeout == 'undefined')
    27 {
    28   setTimeout = function() {};
    29   clearTimeout = function() {};
    30   actual = 'Normal Exit';
    31   reportCompare(expect, actual, summary);
    32 }
    33 else
    34 {
    35   // delay start until after js-test-driver-end runs.
    36   // delay test driver end
    37   gDelayTestDriverEnd = true;
    39   setTimeout(testFuncWatcher, 1000);
    40 }
    42 function testFuncWatcher()
    43 {
    44   a = null;
    46   gc();
    48   clearTimeout(testFuncTimerId);
    49   testFuncWatcherId = testFuncTimerId = null;
    50   if (currTest >= maxTests)
    51   {
    52     actual = 'Normal Exit';
    53     reportCompare(expect, actual, summary);
    54     printStatus('Test Completed');
    55     gDelayTestDriverEnd = false;
    56     jsTestDriverEnd();
    57     return;
    58   }
    59   ++currTest;
    61   print('Executing test ' + currTest + '\n');
    63   testFuncWatcherId = setTimeout("testFuncWatcher()", timeOut);
    64   testFuncTimerId = setTimeout(testFunc, interval);
    65 }
    68 var a;
    69 function testFunc()
    70 {
    72   var i;
    74   switch(currTest)
    75   {
    76   case 1:
    77     a = new Array(100000);
    78     for (i = 0; i < 100000; i++ )
    79     {
    80       a[i] = i;
    81     }
    82     break;
    84   case 2:
    85     a = new Array(100000);
    86     for (i = 0; i < 100000; i++)
    87     {
    88       a[i] = new Number();
    89       a[i] = i;
    90     }
    91     break;
    93   case 3:
    94     a = new String() ;
    95     a = new Array(100000);
    96     for ( i = 0; i < 100000; i++ )
    97     {
    98       a[i] = i;
    99     }
   101     break;
   103   case 4:
   104     a = new Array();
   105     a[0] = new Array(100000);
   106     for (i = 0; i < 100000; i++ )
   107     {
   108       a[0][i] = i;
   109     }
   110     break;
   112   case 5:
   113     a = new Array();
   114     for (i = 0; i < 100000; i++ )
   115     {
   116       a[i] = i;
   117     }
   118     break;
   119   }
   121   if (testFuncTimerId)
   122   {
   123     testFuncTimerId = setTimeout(testFunc, interval);
   124   }
   125 }

mercurial