Bug 788701 - Decrease the length of the text to match when there is a start position. r=jorendorff

This commit is contained in:
Benjamin Peterson 2012-09-13 14:34:33 -04:00
Родитель 0d248e0821
Коммит 57230defd8
2 изменённых файлов: 7 добавлений и 1 удалений

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

@ -40,3 +40,7 @@ var idx = {valueOf : (function () {
})};
myobj.contains("elephant", idx);
assertEq(gotPos, true);
assertEq("xyzzy".contains("zy\0", 2), false);
var dots = Array(10000).join('.');
assertEq(dots.contains("\x01", 10000), false);
assertEq(dots.contains("\0", 10000), false);

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

@ -1160,7 +1160,9 @@ str_contains(JSContext *cx, unsigned argc, Value *vp)
return false;
// Step 6
text += uint32_t(Min(double(textlen), Max(0.0, posDouble)));
uint32_t delta = uint32_t(Min(double(textlen), Max(0.0, posDouble)));
text += delta;
textlen -= delta;
}
// Step 7