js/src/tests/js1_5/Scope/regress-192226.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:    07 February 2003
     9  * SUMMARY: Testing a nested function call under |with| or |catch|
    10  *
    11  * See http://bugzilla.mozilla.org/show_bug.cgi?id=192226
    12  *
    13  */
    14 //-----------------------------------------------------------------------------
    15 var UBound = 0;
    16 var BUGNUMBER = 192226;
    17 var summary = 'Testing a nested function call under |with| or |catch|';
    18 var status = '';
    19 var statusitems = [];
    20 var actual = '';
    21 var actualvalues = [];
    22 var expect= '';
    23 var expectedvalues = [];
    24 var counter = 0;
    27 function f()
    28 {
    29   try
    30   {
    31     with (Math)
    32     {
    33       test0();
    34       test1(sin);
    35     }
    36     throw 1;
    37   }
    38   catch (e)
    39   {
    40     test0();
    41     test1(e);
    42   }
    43 }
    45 function test0()
    46 {
    47   ++counter;
    48 }
    50 function test1(arg)
    51 {
    52   ++counter;
    53 }
    56 status = inSection(1);
    57 f(); // sets |counter|
    58 actual = counter;
    59 expect = 4;
    60 addThis();
    64 //-----------------------------------------------------------------------------
    65 test();
    66 //-----------------------------------------------------------------------------
    70 function addThis()
    71 {
    72   statusitems[UBound] = status;
    73   actualvalues[UBound] = actual;
    74   expectedvalues[UBound] = expect;
    75   UBound++;
    76 }
    79 function test()
    80 {
    81   enterFunc('test');
    82   printBugNumber(BUGNUMBER);
    83   printStatus(summary);
    85   for (var i=0; i<UBound; i++)
    86   {
    87     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    88   }
    90   exitFunc ('test');
    91 }

mercurial