js/src/tests/js1_8/genexps/regress-349331.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 BUGNUMBER = 349331;
     8 var summary = 'generator.close without GeneratorExit';
     9 var actual = '';
    10 var expect = '';
    13 //-----------------------------------------------------------------------------
    14 test();
    15 //-----------------------------------------------------------------------------
    17 function test()
    18 {
    19   enterFunc ('test');
    20   printBugNumber(BUGNUMBER);
    21   printStatus (summary);
    23   var catch1, catch2, catch3, finally1, finally2, finally3;
    24   var iter;
    26   function gen()
    27   {
    28     yield 1;
    29     try {
    30       try {
    31         try {
    32           yield 2;
    33         } catch (e) {
    34           catch1 = true;
    35         } finally {
    36           finally1 = true;
    37         }
    38       } catch (e) {
    39         catch2 = true;
    40       } finally {
    41         finally2 = true;
    42       }
    43     } catch (e) {
    44       catch3 = true;
    45     } finally {
    46       finally3 = true;
    47     }
    48   }
    50 // test explicit close call
    51   catch1 = catch2 = catch3 = finally1 = finally2 = finally3 = false;
    52   iter = gen();
    53   iter.next();
    54   iter.next();
    55   iter.close();
    57   var passed = !catch1 && !catch2 && !catch3 && finally1 && finally2 &&
    58     finally3;
    60   if (!passed) {
    61     print("Failed!");
    62     print("catch1=" + catch1 + " catch2=" + catch2 + " catch3=" +
    63 	  catch3);
    64     print("finally1=" + finally1 + " finally2=" + finally2 +
    65 	  " finally3=" + finally3);
    66   }
    68   reportCompare(true, passed, 'test explicit close call');
    70 // test for-in invoked close
    71   catch1 = catch2 = catch3 = finally1 = finally2 = finally3 = false;
    72   iter = gen();
    73   for (var i in iter) {
    74     if (i == 2)
    75       break;
    76   }
    78   var passed = !catch1 && !catch2 && !catch3 && finally1 && finally2 &&
    79     finally3;
    81   if (!passed) {
    82     print("Failed!");
    83     print("catch1=" + catch1 + " catch2=" + catch2 + " catch3=" +
    84 	  catch3);
    85     print("finally1=" + finally1 + " finally2=" + finally2 +
    86 	  " finally3="+finally3);
    87   }
    88   reportCompare(true, passed, 'test GC-invoke close');
    90   reportCompare(expect, actual, summary);
    92   exitFunc ('test');
    93 }

mercurial