js/src/tests/ecma_3/RegExp/regress-98306.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  * Date: 04 September 2001
     8  *
     9  * SUMMARY: Regression test for Bugzilla bug 98306
    10  * "JS parser crashes in ParseAtom for script using Regexp()"
    11  *
    12  * See http://bugzilla.mozilla.org/show_bug.cgi?id=98306
    13  */
    14 //-----------------------------------------------------------------------------
    15 var BUGNUMBER = 98306;
    16 var summary = "Testing that we don't crash on this code -";
    17 var cnUBOUND = 10;
    18 var re;
    19 var s;
    22 //-----------------------------------------------------------------------------
    23 test();
    24 //-----------------------------------------------------------------------------
    27 function test()
    28 {
    29   enterFunc ('test');
    30   printBugNumber(BUGNUMBER);
    31   printStatus (summary);
    33   s = '"Hello".match(/[/]/)';
    34   tryThis(s);
    36   s = 're = /[/';
    37   tryThis(s);
    39   s = 're = /[/]/';
    40   tryThis(s);
    42   s = 're = /[//]/';
    43   tryThis(s);
    45   reportCompare('No Crash', 'No Crash', '');
    46   exitFunc ('test');
    47 }
    50 // Try to provoke a crash -
    51 function tryThis(sCode)
    52 {
    53   // sometimes more than one attempt is necessary -
    54   for (var i=0; i<cnUBOUND; i++)
    55   {
    56     try
    57     {
    58       eval(sCode);
    59     }
    60     catch(e)
    61     {
    62       // do nothing; keep going -
    63     }
    64   }
    65 }

mercurial