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

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:701ffee468c2
1 // |reftest| skip-if(!xulRuntime.shell)
2
3 // Any copyright is dedicated to the Public Domain.
4 // http://creativecommons.org/licenses/publicdomain/
5
6 //-----------------------------------------------------------------------------
7 var BUGNUMBER = 822041;
8 var summary = "Live generators should not cache SPS state";
9
10 print(BUGNUMBER + ": " + summary);
11
12 function gen() {
13 var x = yield turnoff();
14 yield x;
15 yield 'bye';
16 }
17
18 function turnoff() {
19 print("Turning off profiler\n");
20 disableSPSProfiling();
21 return 'hi';
22 }
23
24 for (var slowAsserts of [ true, false ]) {
25 // The slowAssertions setting is not expected to matter
26 enableSPSProfilingAssertions(slowAsserts);
27
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 }
34
35 // This is really a crashtest
36 reportCompare(0, 0, 'ok');

mercurial