1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_8_5/extensions/sps-generators.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 +// |reftest| skip-if(!xulRuntime.shell) 1.5 + 1.6 +// Any copyright is dedicated to the Public Domain. 1.7 +// http://creativecommons.org/licenses/publicdomain/ 1.8 + 1.9 +//----------------------------------------------------------------------------- 1.10 +var BUGNUMBER = 822041; 1.11 +var summary = "Live generators should not cache SPS state"; 1.12 + 1.13 +print(BUGNUMBER + ": " + summary); 1.14 + 1.15 +function gen() { 1.16 + var x = yield turnoff(); 1.17 + yield x; 1.18 + yield 'bye'; 1.19 +} 1.20 + 1.21 +function turnoff() { 1.22 + print("Turning off profiler\n"); 1.23 + disableSPSProfiling(); 1.24 + return 'hi'; 1.25 +} 1.26 + 1.27 +for (var slowAsserts of [ true, false ]) { 1.28 + // The slowAssertions setting is not expected to matter 1.29 + enableSPSProfilingAssertions(slowAsserts); 1.30 + 1.31 + g = gen(); 1.32 + assertEq(g.next(), 'hi'); 1.33 + assertEq(g.send('gurgitating...'), 'gurgitating...'); 1.34 + for (var x in g) 1.35 + assertEq(x, 'bye'); 1.36 +} 1.37 + 1.38 +// This is really a crashtest 1.39 +reportCompare(0, 0, 'ok');