js/src/tests/js1_7/geniter/yield-undefined.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 // Note that this syntax isn't in the most recently posted ES4 TG1 wiki export,
     8 // either in the specification parts or in the grammar, so this test might be
     9 // Spidermonkey-specific.
    10 var BUGNUMBER     = "(none)";
    11 var summary = "|yield;| is equivalent to |yield undefined;| ";
    12 var actual, expect;
    14 printBugNumber(BUGNUMBER);
    15 printStatus(summary);
    17 /**************
    18  * BEGIN TEST *
    19  **************/
    21 var failed = false;
    23 function gen()
    24 {
    25   yield 7;
    26   yield;
    27   yield 3;
    28 }
    30 var it = gen();
    32 try
    33 {
    34   if (it.next() != 7)
    35     throw "7 not yielded";
    36   if (it.next() !== undefined)
    37     throw "|yield;| should be equivalent to |yield undefined;|";
    38   if (it.next() != 3)
    39     throw "3 not yielded";
    41   var stopPassed = false;
    42   try
    43   {
    44     it.next();
    45   }
    46   catch (e)
    47   {
    48     if (e === StopIteration)
    49       stopPassed = true;
    50   }
    52   if (!stopPassed)
    53     throw "it: missing or incorrect StopIteration";
    54 }
    55 catch (e)
    56 {
    57   failed = e;
    58 }
    60 expect = false;
    61 actual = failed;
    63 reportCompare(expect, actual, summary);

mercurial