зеркало из https://github.com/mozilla/gecko-dev.git
JavaScript Test - fix Script object detection, bug 368585
This commit is contained in:
Родитель
95573c3544
Коммит
6d8f8110d7
|
@ -43,33 +43,40 @@ var expect = '';
|
|||
printBugNumber (bug);
|
||||
printStatus (summary);
|
||||
|
||||
var str = " 2;".substring(1);
|
||||
"1".substring(2);
|
||||
var expected = Script.prototype.compile(str).toSource();
|
||||
|
||||
var likeString = {
|
||||
toString: function() {
|
||||
var tmp = str;
|
||||
str = null;
|
||||
return tmp;
|
||||
}
|
||||
};
|
||||
|
||||
TWO = 2.0;
|
||||
|
||||
var likeObject = {
|
||||
valueOf: function() {
|
||||
if (typeof gc == "function")
|
||||
gc();
|
||||
for (var i = 0; i != 40000; ++i) {
|
||||
var tmp = 1e100 * TWO;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
if (typeof Script == 'undefined')
|
||||
{
|
||||
print('Test skipped. Script not defined.');
|
||||
}
|
||||
else
|
||||
{
|
||||
var str = " 2;".substring(1);
|
||||
"1".substring(2);
|
||||
var expected = Script.prototype.compile(str).toSource();
|
||||
|
||||
var s = Script.prototype.compile(likeString, likeObject);
|
||||
var actual = s.toSource();
|
||||
printStatus(expected === actual);
|
||||
var likeString = {
|
||||
toString: function() {
|
||||
var tmp = str;
|
||||
str = null;
|
||||
return tmp;
|
||||
}
|
||||
};
|
||||
|
||||
reportCompare(expected, actual, summary);
|
||||
TWO = 2.0;
|
||||
|
||||
var likeObject = {
|
||||
valueOf: function() {
|
||||
if (typeof gc == "function")
|
||||
gc();
|
||||
for (var i = 0; i != 40000; ++i) {
|
||||
var tmp = 1e100 * TWO;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
var s = Script.prototype.compile(likeString, likeObject);
|
||||
var actual = s.toSource();
|
||||
printStatus(expected === actual);
|
||||
|
||||
reportCompare(expected, actual, summary);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче