Fix js_LineNumberToPC based on MikeM@RetekSolutions.com's input (313922, r=mrbkap).

This commit is contained in:
brendan%mozilla.org 2007-04-02 18:13:22 +00:00
Родитель 7bc5bb6a89
Коммит 1cc09d0eb3
1 изменённых файлов: 6 добавлений и 2 удалений

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

@ -1632,9 +1632,13 @@ js_LineNumberToPC(JSScript *script, uintN target)
lineno = script->lineno;
bestdiff = SN_LINE_LIMIT;
for (sn = SCRIPT_NOTES(script); !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
if (lineno == target)
/*
* Exact-match only if offset is not in the prolog; otherwise use
* nearest greater-or-equal line number match.
*/
if (lineno == target && script->code + offset >= script->main)
goto out;
if (lineno > target) {
if (lineno >= target) {
diff = lineno - target;
if (diff < bestdiff) {
bestdiff = diff;