js/src/tests/js1_5/Regress/regress-140974.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  *
     8  * Date:    04 May 2002
     9  * SUMMARY: |if (false) {var x;} should create the variable x
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=140974
    11  *
    12  */
    13 //-----------------------------------------------------------------------------
    14 var UBound = 0;
    15 var BUGNUMBER = 140974;
    16 var TEST_PASSED = 'variable was created';
    17 var TEST_FAILED = 'variable was NOT created';
    18 var summary = '|if (false) {var x;}| should create the variable x';
    19 var status = '';
    20 var statusitems = [];
    21 var actual = '';
    22 var actualvalues = [];
    23 var expect= '';
    24 var expectedvalues = [];
    27 // --------------  THESE TWO SECTIONS TEST THE VARIABLE X  --------------
    28 status = inSection(1);
    29 actual = TEST_PASSED;
    30 try{ X;} catch(e) {actual = TEST_FAILED}
    31 expect = TEST_PASSED;
    32 addThis();
    34 var X;
    36 status = inSection(2);
    37 actual = TEST_PASSED;
    38 try{ X;} catch(e) {actual = TEST_FAILED}
    39 expect = TEST_PASSED;
    40 addThis();
    44 // --------------  THESE TWO SECTIONS TEST THE VARIABLE Y  --------------
    45 status = inSection(3);
    46 actual = TEST_PASSED;
    47 try{ Y;} catch(e) {actual = TEST_FAILED}
    48 expect = TEST_PASSED;
    49 addThis();
    51 if (false) {var Y;};
    53 status = inSection(4);
    54 actual = TEST_PASSED;
    55 try{ Y;} catch(e) {actual = TEST_FAILED}
    56 expect = TEST_PASSED;
    57 addThis();
    61 // --------------  THESE TWO SECTIONS TEST THE VARIABLE Z  --------------
    62 status = inSection(5);
    63 actual = TEST_PASSED;
    64 try{ Z;} catch(e) {actual = TEST_FAILED}
    65 expect = TEST_PASSED;
    66 addThis();
    68 if (false) { for (var Z; false;){} }
    70 status = inSection(6);
    71 actual = TEST_PASSED;
    72 try{ Z;} catch(e) {actual = TEST_FAILED}
    73 expect = TEST_PASSED;
    74 addThis();
    79 //-----------------------------------------------------------------------------
    80 test();
    81 //-----------------------------------------------------------------------------
    85 function addThis()
    86 {
    87   statusitems[UBound] = status;
    88   actualvalues[UBound] = actual;
    89   expectedvalues[UBound] = expect;
    90   UBound++;
    91 }
    94 function test()
    95 {
    96   enterFunc('test');
    97   printBugNumber(BUGNUMBER);
    98   printStatus(summary);
   100   for (var i=0; i<UBound; i++)
   101   {
   102     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
   103   }
   105   exitFunc ('test');
   106 }

mercurial