js/src/tests/js1_5/Scope/regress-220362.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:    27 Sep 2003
     9  * SUMMARY: Calling a local function from global scope
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=220362
    11  *
    12  */
    13 //-----------------------------------------------------------------------------
    14 var UBound = 0;
    15 var BUGNUMBER = 220362;
    16 var summary = 'Calling a local function from global scope';
    17 var status = '';
    18 var statusitems = [];
    19 var actual = '';
    20 var actualvalues = [];
    21 var expect= '';
    22 var expectedvalues = [];
    25 // creates a local function and calls it immediately
    26 function a()
    27 {
    28   var x = 'A';
    29   var f = function() {return x;};
    30   return f();
    31 }
    33 // creates and returns a local function
    34 function b()
    35 {
    36   var x = 'B';
    37   var f = function() {return x;};
    38   return f;
    39 }
    42 status = inSection(1);
    43 actual = a();
    44 expect = 'A';
    45 addThis();
    47 status = inSection(2);
    48 var f = b();
    49 actual = f();
    50 expect = 'B';
    51 addThis();
    55 //-----------------------------------------------------------------------------
    56 test();
    57 //-----------------------------------------------------------------------------
    61 function addThis()
    62 {
    63   statusitems[UBound] = status;
    64   actualvalues[UBound] = actual;
    65   expectedvalues[UBound] = expect;
    66   UBound++;
    67 }
    70 function test()
    71 {
    72   enterFunc('test');
    73   printBugNumber(BUGNUMBER);
    74   printStatus(summary);
    76   for (var i=0; i<UBound; i++)
    77   {
    78     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    79   }
    81   exitFunc ('test');
    82 }

mercurial