js/src/tests/js1_5/extensions/regress-345967.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
     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 = 345967;
     9 var summary = 'Yet another unrooted atom in jsarray.c';
    10 var actual = '';
    11 var expect = '';
    14 //-----------------------------------------------------------------------------
    15 test();
    16 //-----------------------------------------------------------------------------
    18 function test()
    19 {
    20   enterFunc ('test');
    21   printBugNumber(BUGNUMBER);
    22   printStatus (summary);
    24   expectExitCode(0);
    25   expectExitCode(3);
    27   print('This test will probably run out of memory');
    28   print('This test really should only fail on 64 bit machines');
    30   var JSVAL_INT_MAX = (1 << 30) - 1;
    32   var a = new Array(JSVAL_INT_MAX + 2);
    33   a[JSVAL_INT_MAX] = 0;
    34   a[JSVAL_INT_MAX + 1] = 1;
    36   a.__defineGetter__(JSVAL_INT_MAX, function() { return 0; });
    38   a.__defineSetter__(JSVAL_INT_MAX, function(value) {
    39 		       delete a[JSVAL_INT_MAX + 1];
    40 		       var tmp = [];
    41 		       tmp[JSVAL_INT_MAX + 2] = 2;
    43 		       if (typeof gc == 'function')
    44 			 gc();
    45 		       for (var i = 0; i != 50000; ++i) {
    46 			 var tmp = 1 / 3;
    47 			 tmp /= 10;
    48 		       }
    49 		       for (var i = 0; i != 1000; ++i) {
    50 			 // Make string with 11 characters that would take
    51 			 // (11 + 1) * 2 bytes or sizeof(JSAtom) so eventually
    52 			 // malloc will ovewrite just freed atoms.
    53 			 var tmp2 = Array(12).join(' ');
    54 		       }
    55 		     });
    58   a.shift();
    60   expect = 0;
    61   actual = a[JSVAL_INT_MAX];
    62   if (expect !== actual)
    63     print("BAD");
    65   reportCompare(expect, actual, summary);
    67   exitFunc ('test');
    68 }

mercurial