js/src/tests/js1_8/regress/regress-366941.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 /*
     3  * Any copyright is dedicated to the Public Domain.
     4  * http://creativecommons.org/licenses/publicdomain/
     5  * Contributor: Robert Sayre
     6  */
     9 //-----------------------------------------------------------------------------
    10 var BUGNUMBER = 366941;
    11 var summary = 'Destructuring enumerations, iterations';
    12 var actual = '';
    13 var expect = '';
    16 //-----------------------------------------------------------------------------
    17 test();
    18 //-----------------------------------------------------------------------------
    20 function test()
    21 {
    22   enterFunc ('test');
    23   printBugNumber(BUGNUMBER);
    24   printStatus (summary);
    26   var list1 = [[1,2],[3,4],[5,6]];
    27   var list2 = [[1,2,3],[4,5,6],[7,8,9]];
    29   expect = '1,2;3,4;5,6;';
    30   actual = '';
    32   for each (var [foo, bar] in list1) {
    33     actual += foo + "," + bar + ";";
    34   }
    36   reportCompare(expect, actual, summary + ': 1');
    38   expect = '1,2,3;4,5,6;7,8,9;';
    39   actual = '';
    40   for each (var [foo, bar, baz] in list2) {
    41     actual += foo + "," + bar + "," + baz + ";";
    42   }
    44   reportCompare(expect, actual, summary + ': 2');
    46   function gen(list) {
    47     for each (var test in list) {
    48       yield test;
    49     }
    50   }
    52   var iter1 = gen(list1);
    54   expect = '1,2;3,4;5,6;';
    55   actual = '';
    57   for (var [foo, bar] in iter1) {
    58     actual += foo + "," + bar + ";";
    59   }
    61   reportCompare(expect, actual, summary + ': 3');
    63   var iter2 = gen(list2);
    64   expect = '1,2,3;4,5,6;7,8,9;';
    65   actual = '';
    67   for (var [foo, bar, baz] in iter2) {
    68     actual += foo + "," + bar + "," + baz + ";";
    69   }
    71   reportCompare(expect, actual, summary + ': 4');
    73   exitFunc ('test');
    74 }

mercurial