js/src/tests/js1_5/extensions/regress-341956-02.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:a0a113a87ae7
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 //-----------------------------------------------------------------------------
7 var BUGNUMBER = 341956;
8 var summary = 'GC Hazards in jsarray.c - pop';
9 var actual = '';
10 var expect = 'GETTER RESULT';
11
12 //-----------------------------------------------------------------------------
13 test();
14 //-----------------------------------------------------------------------------
15
16 function test()
17 {
18 enterFunc ('test');
19 printBugNumber(BUGNUMBER);
20 printStatus (summary);
21
22 var N = 0xFFFFFFFF;
23 var a = [];
24 a[N - 1] = 0;
25
26 var expected = "GETTER RESULT";
27
28 a.__defineGetter__(N - 1, function() {
29 delete a[N - 1];
30 var tmp = [];
31 tmp[N - 2] = 1;
32
33 if (typeof gc == 'function')
34 gc();
35 for (var i = 0; i != 50000; ++i) {
36 var tmp = 1 / 3;
37 tmp /= 10;
38 }
39 for (var i = 0; i != 1000; ++i) {
40 // Make string with 11 characters that would take
41 // (11 + 1) * 2 bytes or sizeof(JSAtom) so eventually
42 // malloc will ovewrite just freed atoms.
43 var tmp2 = Array(12).join(' ');
44 }
45 return expected;
46 });
47
48 actual = a.pop();
49
50 reportCompare(expect, actual, summary);
51
52 print('Done');
53
54 exitFunc ('test');
55 }

mercurial