js/src/tests/js1_8_5/extensions/sps-generators.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 // |reftest| skip-if(!xulRuntime.shell)
     3 // Any copyright is dedicated to the Public Domain.
     4 // http://creativecommons.org/licenses/publicdomain/
     6 //-----------------------------------------------------------------------------
     7 var BUGNUMBER = 822041;
     8 var summary = "Live generators should not cache SPS state";
    10 print(BUGNUMBER + ": " + summary);
    12 function gen() {
    13   var x = yield turnoff();
    14   yield x;
    15   yield 'bye';
    16 }
    18 function turnoff() {
    19   print("Turning off profiler\n");
    20   disableSPSProfiling();
    21   return 'hi';
    22 }
    24 for (var slowAsserts of [ true, false ]) {
    25   // The slowAssertions setting is not expected to matter
    26   enableSPSProfilingAssertions(slowAsserts);
    28   g = gen();
    29   assertEq(g.next(), 'hi');
    30   assertEq(g.send('gurgitating...'), 'gurgitating...');
    31   for (var x in g)
    32     assertEq(x, 'bye');
    33 }
    35 // This is really a crashtest
    36 reportCompare(0, 0, 'ok');

mercurial