Debian Codegraph @

rhino/testsrc/tests/e4x/extensions/regress-353165.js

raw symbols SCIP
1 /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 gTestfile = 'regress-353165.js';
8
9 var BUGNUMBER = 353165;
10 var summary = 'Do not crash with xml_getMethod';
11 var actual = 'No Crash';
12 var expect = 'No Crash';
13
14 printBugNumber(BUGNUMBER);
15 START(summary);
16
17 crash1();
18 crash2();
19
20 END();
21
22 function crash1()
23 {
24 try {
25 var set = new XML('<a><b>text</b></a>').children('b');
26 var counter = 0;
27 Object.prototype.unrooter getter = function() {
28 ++counter;
29 if (counter == 5) {
30 set[0] = new XML('<c/>');
31 if (typeof gc == "function") {
32 gc();
33 var tmp = Math.sqrt(2), tmp2;
34 for (i = 0; i != 50000; ++i)
35 tmp2 = tmp / 2;
36 }
37 }
38 return undefined;
39 }
40
41 set.unrooter();
42 }
43 catch(ex) {
44 print('1: ' + ex);
45 }
46 TEST(1, expect, actual);
47
48 }
49
50 function crash2() {
51 try {
52 var expected = "SOME RANDOM TEXT";
53
54 var set = <a><b>{expected}</b></a>.children('b');
55 var counter = 0;
56
57 function unrooter_impl() {
58 return String(this);
59 }
60
61 Object.prototype.unrooter getter = function() {
62 ++counter;
63 if (counter == 7)
64 return unrooter_impl;
65 if (counter == 5) {
66 set[0] = new XML('<c/>');
67 if (typeof gc == "function") {
68 gc();
69 var tmp = 1e500, tmp2;
70 for (i = 0; i != 50000; ++i)
71 tmp2 = tmp / 1.1;
72 }
73 }
74 return undefined;
75 }
76
77 set.unrooter();
78 }
79 catch(ex) {
80 print('2: ' + ex);
81 }
82 TEST(2, expect, actual);
83 }