Debian Codegraph @

rhino/testsrc/tests/js1_7/extensions/regress-352885-02.js

raw symbols SCIP
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/. */
5
6 var gTestfile = 'regress-352885-02.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 352885;
9 var summary = 'Do not crash iterating over gen.__proto__';
10 var actual = 'No Crash';
11 var expect = 'No Crash';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 function dotest()
25 {
26 var proto = (function() { yield 3; })().__proto__;
27
28 try {
29 proto.next();
30 throw "generatorProto.next() does not throw StopIteration";
31 } catch (e) {
32 if (!(e instanceof StopIteration))
33 throw "generatorProto.next() throws unexpected exception: "+uneval(e);
34 }
35
36 try {
37 proto.send();
38 throw "generatorProto.send() does not throw StopIteration";
39 } catch (e) {
40 if (!(e instanceof StopIteration))
41 throw "generatorProto.send() throws unexpected exception: "+uneval(e);
42 }
43
44 var obj = {};
45 try {
46 proto.throw(obj);
47 throw "generatorProto.throw(obj) does not throw obj";
48 } catch (e) {
49 if (e !== obj)
50 throw "generatorProto.throw() throws unexpected exception: "+uneval(e);
51 }
52
53 var obj = {};
54 try {
55 proto.close();
56 } catch (e) {
57 throw "generatorProto.throw() throws exception: "+uneval(e);
58 }
59
60 }
61
62 dotest();
63
64 reportCompare(expect, actual, summary);
65
66 exitFunc ('test');
67 }