Debian Codegraph @

rhino/testsrc/tests/js1_8/extensions/regress-422269.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-422269.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 422269;
9 var summary = 'Compile-time let block should not capture runtime references';
10 var actual = 'No leak';
11 var expect = 'No leak';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 function f()
25 {
26 let m = {sin: Math.sin};
27 (function() { m.sin(1); })();
28 return m;
29 }
30
31 if (typeof countHeap == 'undefined')
32 {
33 expect = actual = 'Test skipped';
34 print('Test skipped. Requires countHeap function.');
35 }
36 else
37 {
38 var x = f();
39 gc();
40 var n = countHeap();
41 x = null;
42 gc();
43
44 var n2 = countHeap();
45 if (n2 >= n)
46 actual = "leak is detected, something roots the result of f";
47 }
48 reportCompare(expect, actual, summary);
49
50 exitFunc ('test');
51 }