Bug 1165533 - Test that the DOM reflection of signed-integer properties never exposes such values as -0, only as +0. r=Ms2ger

--HG--
extra : rebase_source : 9e4303c00c8259923255528ff4100b583209db82
This commit is contained in:
Jeff Walden 2015-07-02 21:19:05 -07:00
Родитель 04b22e3bcf
Коммит 97c040275e
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -502,8 +502,10 @@ function reflectInt(aParameters)
if (result) {
var resultInt = parseInt(result[1], 10);
if ((nonNegative ? 0 : -0x80000000) <= resultInt && resultInt <= 0x7FFFFFFF) {
// If the value is within allowed value range for signed/unsigned integer, return value
return resultInt;
// If the value is within allowed value range for signed/unsigned
// integer, return it -- but add 0 to it to convert a possible -0 into
// +0, the only zero present in the signed integer range.
return resultInt + 0;
}
}
return defaultValue;