js/src/tests/js1_5/Regress/regress-290575.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 = 290575;
     8 var summary = 'Do not crash calling function with more than 32768 arguments';
     9 var actual = 'No Crash';
    10 var expect = 'No Crash';
    11 printBugNumber(BUGNUMBER);
    12 printStatus (summary);
    14 function crashMe(n) {
    15   var nasty, fn;
    17   nasty = [];
    18   while (n--)
    19     nasty.push("a"+n);   // Function arguments
    20   nasty.push("void 0");  // Function body
    21   fn = Function.apply(null, nasty);
    22   fn.toString();
    23 }
    25 printStatus('crashMe(0x8001)');
    27 crashMe(0x8001);
    29 reportCompare(expect, actual, summary);
    31 function crashMe2(n) {
    32   var nasty = [], fn
    34     while (n--) nasty[n] = "a"+n
    35       fn = Function(nasty.join(), "void 0")
    36       fn.toString()
    37       }
    39 printStatus('crashMe2(0x10000)');
    41 summary = 'Syntax Error Function to string when more than 65536 arguments';
    42 expect = 'Error';
    43 try
    44 {
    45   crashMe2(0x10000);
    46   actual = 'No Error';
    47   reportCompare(expect, actual, summary);
    48 }
    49 catch(e)
    50 {
    51   actual = 'Error';
    52   reportCompare(expect, actual, summary);
    53   expect = 'SyntaxError';
    54   actual = e.name;
    55   reportCompare(expect, actual, summary);
    56 }

mercurial