js/src/tests/js1_5/extensions/regress-341956-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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 //-----------------------------------------------------------------------------
     7 var BUGNUMBER = 341956;
     8 var summary = 'GC Hazards in jsarray.c - pop';
     9 var actual = '';
    10 var expect = 'GETTER RESULT';
    12 //-----------------------------------------------------------------------------
    13 test();
    14 //-----------------------------------------------------------------------------
    16 function test()
    17 {
    18   enterFunc ('test');
    19   printBugNumber(BUGNUMBER);
    20   printStatus (summary);
    22   var N = 0xFFFFFFFF;
    23   var a = []; 
    24   a[N - 1] = 0;
    26   var expected = "GETTER RESULT";
    28   a.__defineGetter__(N - 1, function() {
    29 		       delete a[N - 1];
    30 		       var tmp = [];
    31 		       tmp[N - 2] = 1;
    33 		       if (typeof gc == 'function')
    34 			 gc();
    35 		       for (var i = 0; i != 50000; ++i) {
    36 			 var tmp = 1 / 3;
    37 			 tmp /= 10;
    38 		       }
    39 		       for (var i = 0; i != 1000; ++i) {
    40 			 // Make string with 11 characters that would take
    41 			 // (11 + 1) * 2 bytes or sizeof(JSAtom) so eventually
    42 			 // malloc will ovewrite just freed atoms.
    43 			 var tmp2 = Array(12).join(' ');
    44 		       }
    45 		       return expected;
    46 		     });
    48   actual = a.pop();
    50   reportCompare(expect, actual, summary);
    52   print('Done');
    54   exitFunc ('test');
    55 }

mercurial