Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/regress-325269.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-325269.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 325269;
9 var summary = 'GC hazard in js_ConstructObject';
10 var actual = 'No Crash';
11 var expect = 'No Crash';
12
13 printBugNumber(BUGNUMBER);
14 printStatus (summary);
15 // only get exit code 3 if out of memory error occurs which
16 // will not happen on machines with enough memory.
17 // expectExitCode(3);
18
19 var SavedArray = Array;
20
21 function Redirector() { }
22
23 Redirector.prototype = 1;
24 Redirector.__defineGetter__('prototype', function() {
25 // printStatus("REDIRECTOR");
26 gc();
27 return SavedArray.prototype;
28 });
29
30 //Array = Function('printStatus("Constructor")');
31 try {
32 Array = Function('');
33 } catch (e) { }
34
35 if (Array === SavedArray) {
36 // No test of the hazard possible as the array is read-only
37 actual = expect;
38 } else {
39 Array.prototype = 1;
40 Array.__defineGetter__('prototype', function() {
41 // printStatus("**** GETTER ****");
42 Array = Redirector;
43 gc();
44 new Object();
45 new Object();
46 return undefined;
47 });
48
49 new Object();
50
51 try
52 {
53 var y = "test".split('');
54 }
55 catch(ex)
56 {
57 printStatus(ex + '');
58 }
59 }
60
61 reportCompare(expect, actual, summary);