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.

michael@0 1 // |reftest| skip-if(!xulRuntime.shell) slow
michael@0 2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 //-----------------------------------------------------------------------------
michael@0 8 var BUGNUMBER = 319980;
michael@0 9 var summary = 'GC not called during non-fatal out of memory';
michael@0 10 var actual = '';
michael@0 11 var expect = 'Normal Exit';
michael@0 12
michael@0 13 printBugNumber(BUGNUMBER);
michael@0 14 printStatus (summary);
michael@0 15 print ('This test should never fail explicitly. ' +
michael@0 16 'You must view the memory usage during the test. ' +
michael@0 17 'This test fails if memory usage for each subtest grows');
michael@0 18
michael@0 19 var timeOut = 45 * 1000;
michael@0 20 var interval = 0.01 * 1000;
michael@0 21 var testFuncWatcherId;
michael@0 22 var testFuncTimerId;
michael@0 23 var maxTests = 5;
michael@0 24 var currTest = 0;
michael@0 25
michael@0 26 if (typeof setTimeout == 'undefined')
michael@0 27 {
michael@0 28 setTimeout = function() {};
michael@0 29 clearTimeout = function() {};
michael@0 30 actual = 'Normal Exit';
michael@0 31 reportCompare(expect, actual, summary);
michael@0 32 }
michael@0 33 else
michael@0 34 {
michael@0 35 // delay start until after js-test-driver-end runs.
michael@0 36 // delay test driver end
michael@0 37 gDelayTestDriverEnd = true;
michael@0 38
michael@0 39 setTimeout(testFuncWatcher, 1000);
michael@0 40 }
michael@0 41
michael@0 42 function testFuncWatcher()
michael@0 43 {
michael@0 44 a = null;
michael@0 45
michael@0 46 gc();
michael@0 47
michael@0 48 clearTimeout(testFuncTimerId);
michael@0 49 testFuncWatcherId = testFuncTimerId = null;
michael@0 50 if (currTest >= maxTests)
michael@0 51 {
michael@0 52 actual = 'Normal Exit';
michael@0 53 reportCompare(expect, actual, summary);
michael@0 54 printStatus('Test Completed');
michael@0 55 gDelayTestDriverEnd = false;
michael@0 56 jsTestDriverEnd();
michael@0 57 return;
michael@0 58 }
michael@0 59 ++currTest;
michael@0 60
michael@0 61 print('Executing test ' + currTest + '\n');
michael@0 62
michael@0 63 testFuncWatcherId = setTimeout("testFuncWatcher()", timeOut);
michael@0 64 testFuncTimerId = setTimeout(testFunc, interval);
michael@0 65 }
michael@0 66
michael@0 67
michael@0 68 var a;
michael@0 69 function testFunc()
michael@0 70 {
michael@0 71
michael@0 72 var i;
michael@0 73
michael@0 74 switch(currTest)
michael@0 75 {
michael@0 76 case 1:
michael@0 77 a = new Array(100000);
michael@0 78 for (i = 0; i < 100000; i++ )
michael@0 79 {
michael@0 80 a[i] = i;
michael@0 81 }
michael@0 82 break;
michael@0 83
michael@0 84 case 2:
michael@0 85 a = new Array(100000);
michael@0 86 for (i = 0; i < 100000; i++)
michael@0 87 {
michael@0 88 a[i] = new Number();
michael@0 89 a[i] = i;
michael@0 90 }
michael@0 91 break;
michael@0 92
michael@0 93 case 3:
michael@0 94 a = new String() ;
michael@0 95 a = new Array(100000);
michael@0 96 for ( i = 0; i < 100000; i++ )
michael@0 97 {
michael@0 98 a[i] = i;
michael@0 99 }
michael@0 100
michael@0 101 break;
michael@0 102
michael@0 103 case 4:
michael@0 104 a = new Array();
michael@0 105 a[0] = new Array(100000);
michael@0 106 for (i = 0; i < 100000; i++ )
michael@0 107 {
michael@0 108 a[0][i] = i;
michael@0 109 }
michael@0 110 break;
michael@0 111
michael@0 112 case 5:
michael@0 113 a = new Array();
michael@0 114 for (i = 0; i < 100000; i++ )
michael@0 115 {
michael@0 116 a[i] = i;
michael@0 117 }
michael@0 118 break;
michael@0 119 }
michael@0 120
michael@0 121 if (testFuncTimerId)
michael@0 122 {
michael@0 123 testFuncTimerId = setTimeout(testFunc, interval);
michael@0 124 }
michael@0 125 }
michael@0 126
michael@0 127

mercurial