Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/regress-312278.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-312278.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 312278;
9 var summary = 'Do no access GC-ed object in Error.prototype.toSource';
10 var actual = 'No Crash';
11 var expect = 'No Crash';
12
13 printBugNumber(BUGNUMBER);
14 printStatus (summary);
15
16 function wrapInsideWith(obj)
17 {
18 var f;
19 with (obj) {
20 f = function() { }
21 }
22 return f.__parent__;
23 }
24
25 function customToSource()
26 {
27 return "customToSource "+this;
28 }
29
30 Error.prototype.__defineGetter__('message', function() {
31 var obj = {
32 toSource: "something"
33 }
34 obj.__defineGetter__('toSource', function() {
35 gc();
36 return customToSource;
37 });
38 return wrapInsideWith(obj);
39 });
40
41 printStatus(Error.prototype.toSource());
42
43 reportCompare(expect, actual, summary);