js/src/tests/ecma_3/extensions/regress-188206-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.

     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 UBound = 0;
     8 var BUGNUMBER = 188206;
     9 var summary = 'Invalid use of regexp quantifiers should generate SyntaxErrors';
    10 var TEST_PASSED = 'SyntaxError';
    11 var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!';
    12 var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
    13 var status = '';
    14 var statusitems = [];
    15 var actual = '';
    16 var actualvalues = [];
    17 var expect= '';
    18 var expectedvalues = [];
    21 /*
    22  * Now do some weird things on the left side of the regexps -
    23  */
    24 status = inSection(7);
    25 testThis(' /*a/ ');
    27 status = inSection(8);
    28 testThis(' /**a/ ');
    31 //-----------------------------------------------------------------------------
    32 test();
    33 //-----------------------------------------------------------------------------
    35 /*
    36  * Invalid syntax should generate a SyntaxError
    37  */
    38 function testThis(sInvalidSyntax)
    39 {
    40   expect = TEST_PASSED;
    41   actual = TEST_FAILED_BADLY;
    43   try
    44   {
    45     eval(sInvalidSyntax);
    46   }
    47   catch(e)
    48   {
    49     if (e instanceof SyntaxError)
    50       actual = TEST_PASSED;
    51     else
    52       actual = TEST_FAILED;
    53   }
    55   statusitems[UBound] = status;
    56   expectedvalues[UBound] = expect;
    57   actualvalues[UBound] = actual;
    58   UBound++;
    59 }
    62 function test()
    63 {
    64   enterFunc('test');
    65   printBugNumber(BUGNUMBER);
    66   printStatus(summary);
    68   for (var i=0; i<UBound; i++)
    69   {
    70     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    71   }
    73   exitFunc ('test');
    74 }

mercurial