Closed
Bug 987536
Opened 10 years ago
Closed 10 years ago
Script.getAllColumnOffsets() provides wrong offsets
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 984696
People
(Reporter: Honza, Unassigned)
Details
(Whiteboard: [firebug-p1])
I am facing a problem with how Debugger.Script.getAllColumnOffsets is implemented. Here are two scripts (the same code, just different layout) and corresponding column offsets it provides: (the offset format below is: [line, column, offset]) 1) One liner: function add2(a, b) { var test = 'hello'; console.log(test); var c = a + b; console.log(c); return c; } [1:0:0], [1:42:10], [1:76:42], [1:92:62] 2) Prettified: function add1(a, b) { var test = 'hello'; console.log(test); var c = a + b; console.log(c); return c; } [2:0:0], [3:4:10], [4:0:30], [5:4:42], [6:4:62] The prettified script has an offset for “var c = a + b” while the one-liner doesn’t. Looks like a bug. Also the offsets start at column 0 for lines 2 and 4. Shouldn’t all lines start at column 4? --- This makes harder to compute executable lines for pretty printed scripts since the line “var c = a + b” looks like not executable, since there is no byte code for it in the one-liner script an so, it can’t be mapped (using Nick’s source maps in the source actor) to the prettified script. Honza
Reporter | ||
Updated•10 years ago
|
Whiteboard: [firebug-p1]
Reporter | ||
Updated•10 years ago
|
Summary: Script.getAllColumnOffsets() provides wrong offesets → Script.getAllColumnOffsets() provides wrong offsets
Comment 1•10 years ago
|
||
What is the status of this bug? It's long that we are blocked on this bug to integrate the source map with Firebug and waiting to hear any news of it. Could you let us know the status of this bug? Farshid
Comment 2•10 years ago
|
||
(In reply to Farshid Beheshti from comment #1) > What is the status of this bug? > It's long that we are blocked on this bug to integrate the source map with > Firebug and waiting to hear any news of it. Could you let us know the status > of this bug? > > Farshid I believe Nick recently landed a patch that should improve the accuracy of getAllColumnOffsets in some of the more common (though not all) cases. Nick, can you provide more information?
Flags: needinfo?(nfitzgerald)
Comment 3•10 years ago
|
||
Yeah in bug 984696 I added more detailed source notes which makes pretty printing properly debuggable on the test cases I tried. Marking this as a dupe of that bug, if you find specific syntax forms that still need source notes, we can probably add them for that specific form. We can't just add it for every single expression type because it would slow down parsing and create too much memory overhead. But specific forms (like function calls, for example) are do-able. I have a bug open for function calls and new: bug 1000967.
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(nfitzgerald)
Resolution: --- → DUPLICATE
Comment 4•10 years ago
|
||
Thanks for the reply, good news! Farshid
You need to log in
before you can comment on or make changes to this bug.
Description
•