| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-313938.js'; |
| 7 |
|
| 8 |
var BUGNUMBER = 313938; |
| 9 |
var summary = 'Root access in jsscript.c'; |
| 10 |
var actual = ''; |
| 11 |
var expect = ''; |
| 12 |
|
| 13 |
printBugNumber(BUGNUMBER); |
| 14 |
printStatus (summary); |
| 15 |
|
| 16 |
if (typeof Script == 'undefined') |
| 17 |
{ |
| 18 |
print('Test skipped. Script not defined.'); |
| 19 |
reportCompare("Script not defined, Test skipped.", |
| 20 |
"Script not defined, Test skipped.", |
| 21 |
summary); |
| 22 |
} |
| 23 |
else |
| 24 |
{ |
| 25 |
var str = " 2;".substring(1); |
| 26 |
"1".substring(2); |
| 27 |
expect = Script.prototype.compile(str).toSource(); |
| 28 |
|
| 29 |
var likeString = { |
| 30 |
toString: function() { |
| 31 |
var tmp = str; |
| 32 |
str = null; |
| 33 |
return tmp; |
| 34 |
} |
| 35 |
}; |
| 36 |
|
| 37 |
TWO = 2.0; |
| 38 |
|
| 39 |
var likeObject = { |
| 40 |
valueOf: function() { |
| 41 |
if (typeof gc == "function") |
| 42 |
gc(); |
| 43 |
for (var i = 0; i != 40000; ++i) { |
| 44 |
var tmp = 1e100 * TWO; |
| 45 |
} |
| 46 |
return this; |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
var s = Script.prototype.compile(likeString, likeObject); |
| 51 |
var actual = s.toSource(); |
| 52 |
printStatus(expect === actual); |
| 53 |
|
| 54 |
reportCompare(expect, actual, summary); |
| 55 |
} |