js/src/tests/js1_7/geniter/message-value-passing.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     = 326466;
     8 var summary = "Generator value/exception passing";
     9 var actual, expect;
    11 printBugNumber(BUGNUMBER);
    12 printStatus(summary);
    14 /**************
    15  * BEGIN TEST *
    16  **************/
    18 function gen()
    19 {
    20   var rv, rv2, rv3, rv4;
    21   rv = yield 1;
    23   if (rv)
    24     rv2 = yield rv;
    25   else
    26     rv3 = yield 2;
    28   try
    29   {
    30     if (rv2)
    31       yield rv2;
    32     else
    33       rv3 = yield 3;
    34   }
    35   catch (e)
    36   {
    37     if (e == 289)
    38       yield "exception caught";
    39   }
    41   yield 5;
    42 }
    44 var failed = false;
    45 var it = gen();
    47 try
    48 {
    49   if (it.next() != 1)
    50     throw "failed on 1";
    52   if (it.send(17) != 17)
    53     throw "failed on 17";
    55   if (it.next() != 3)
    56     throw "failed on 3";
    58   if (it.throw(289) != "exception caught")
    59     throw "it.throw(289) failed";
    61   if (it.next() != 5)
    62     throw "failed on 5";
    64   var stopPassed = false;
    65   try
    66   {
    67     it.next();
    68   }
    69   catch (e)
    70   {
    71     if (e === StopIteration)
    72       stopPassed = true;
    73   }
    75   if (!stopPassed)
    76     throw "missing or incorrect StopIteration";
    77 }
    78 catch (e)
    79 {
    80   failed = e;
    81 }
    85 expect = false;
    86 actual = failed;
    88 reportCompare(expect, actual, summary);

mercurial