Closed
Bug 618650
Opened 14 years ago
Closed 9 years ago
map JS source coordinates to source language that was translated to JS
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: brendan, Assigned: jimb)
References
(Blocks 1 open bug)
Details
We added
//@line n "f"
as a magic comment which, when JSOPTION_ATLINE is set, should cause the next line to be taken as line n of the file named "f". This seems to have been regressed by recent scanner changes, but I'll file that separately.
The idea here is to relieve the source-to-JS translator from having to spew such comments all over the place in generated JS. Instead, the generated JS would set an ideally more concise mapping up using, e.g., JSON.
This was proposed by Jeremy Ashkenas at http://intertwingly.net/blog/2010/11/25/Hobgoblin-of-Little-Minds#c1292138238.
/be
Reporter | ||
Comment 1•14 years ago
|
||
See bug 618652 for an @line bug with patch and test (I hope it can be a Firefox 4 ride-along, since it is not a blocker).
/be
Reporter | ||
Comment 2•14 years ago
|
||
In case my @line ref might mislead, source coordinates must be finer grained than lines in our minified world. Line and column, as jimb has planned already.
/be
Assignee | ||
Updated•14 years ago
|
Assignee: general → jimb
Reporter | ||
Comment 3•14 years ago
|
||
Mark Miller cited
http://blog.csdn.net/dollyn/archive/2009/09/01/4506156.aspx#sourcemapfile
just now. Syntax aside, the idea lines up with this bug.
/be
Comment 4•13 years ago
|
||
So, SourceMap Format-ish, in terms of the data model, but in say JSON format?
Guess someone can start hacking away at a document describing that.
Thoughts on how to link the SMAP file/data to the final generated source?
- comment at the bottom of the generated source points to a URL of the SMAP file
- SMAP data included literally as a comment in the generated file
- debugger loads the file using a path-math operation of the JS file URL (remove trailing ".js" if there, append ".smap")
Comment 5•13 years ago
|
||
(In reply to comment #4)
> - SMAP data included literally as a comment in the generated file
I'm not a fan of inlining the mapping data because this same source mapping protocol is going to be used to debug minified code as well as "transpiled" sources. Because of that, it makes sense to have the mapping data be located in a separate file, to keep the js file sizes as small as possible.
I think either of the other two options would be feasible, and don't have a strong opinion either way at this time.
Comment 6•13 years ago
|
||
Can anyone point to any other SMAP-like stories for debug? I'm hesitant to even look at the JSR 45 stuff; the link Brendan pointed to in comment #3 appears to be a copy of the JSR 45 specification. The "original" JSR 45 spec requires a click-through agreement to read, from the jcp site itself. Would prefer to look at something "cleaner".
Comment 7•13 years ago
|
||
(In reply to comment #6)
> Can anyone point to any other SMAP-like stories for debug?
You could look at the way that Closure Compiler generates source maps. See the src/com/google/debugging/sourcemap directory in the source code.
Reporter | ||
Comment 8•13 years ago
|
||
Comment 9•13 years ago
|
||
Chrome 18 has sourcemap support - http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/
Comment 10•12 years ago
|
||
GWT 2.5 plugin-free debugger Super Dev Mode relies on Source Maps:
https://developers.google.com/web-toolkit/articles/superdevmode
Comment 11•10 years ago
|
||
Is this bug still valid?
Comment 13•9 years ago
|
||
Yeah, we've been done here for years. For specific bugs related to source mapping, file bugs that block https://bugzilla.mozilla.org/show_bug.cgi?id=dbg-sourcemap.
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: needinfo?(nfitzgerald)
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•