| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 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); |