Skip to content

Commit

Permalink
devtools: fix edge case in SDK.TextSourceMap.findEntry
Browse files Browse the repository at this point in the history
issue #53
  • Loading branch information
darwin committed Feb 1, 2017
1 parent b7198c2 commit 2f1268b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions resources/unpacked/devtools/front_end/sdk/SourceMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,11 @@ SDK.TextSourceMap = class {
}
}
var entry = mappings[first];
if (!first && entry &&
(lineNumber < entry.lineNumber || (lineNumber === entry.lineNumber && columnNumber < entry.columnNumber)))
if (entry && entry.lineNumber === lineNumber && entry.columnNumber <= columnNumber) {

This comment has been minimized.

Copy link
@aslushnikov

aslushnikov Mar 3, 2017

where does this backfire?

This comment has been minimized.

Copy link
@darwin

darwin Mar 3, 2017

Author Member

The original code was probably correct. But I wasn't able to reason about it. Why "!first"?

Turned out the ultimate problem was adba577. But before I discovered it I assumed _findEntry works properly and I desperately did these two commits 2f1268b, e03cb3f.

This comment has been minimized.

Copy link
@aslushnikov

aslushnikov Mar 3, 2017

Ah, I see! Thanks for the fast reply. The "!first" is a cryptic "first === 0", which happens when we iterated through all the mappings trying to find a proper one (and failed).

return entry;
} else {
return null;
return entry;
}
}

/**
Expand Down

0 comments on commit 2f1268b

Please sign in to comment.