RESOLVED FIXED 74088
Web Inspector: auto detect source map url.
https://bugs.webkit.org/show_bug.cgi?id=74088
Summary Web Inspector: auto detect source map url.
Pavel Podivilov
Reported 2011-12-08 07:35:47 PST
Check to see if "X-SourceMap" HTTP response header was sent with script resource. Header value will be used as auto suggestion for source map url in UI.
Attachments
Patch (8.22 KB, patch)
2011-12-08 08:51 PST, Pavel Podivilov
no flags
Patch (9.73 KB, patch)
2011-12-09 06:52 PST, Pavel Podivilov
pfeldman: review+
Pavel Podivilov
Comment 1 2011-12-08 08:51:23 PST
WebKit Review Bot
Comment 2 2011-12-08 09:20:14 PST
Comment on attachment 118399 [details] Patch Attachment 118399 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/10786302 New failing tests: inspector/debugger/raw-source-code.html
Pavel Podivilov
Comment 3 2011-12-09 06:52:01 PST
Pavel Podivilov
Comment 4 2011-12-09 07:03:10 PST
See https://bugs.webkit.org/show_bug.cgi?id=74181 for how it is going to be used.
Pavel Feldman
Comment 5 2011-12-09 07:06:26 PST
Comment on attachment 118571 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=118571&action=review > Source/WebCore/ChangeLog:8 > + Check to see if "X-SourceMap" HTTP response header was sent with script resource. Is there a discussion on the X-SourceMap name? > Source/WebCore/inspector/Inspector.json:1994 > + { "name": "sourceMapURL", "type": "string", "description": "URL of source map associated with script (if any)." }, We should not process sourceMapURL on the backend (node.js won't have it). User should listen to the network and get it from there.
Pavel Podivilov
Comment 6 2011-12-09 07:30:21 PST
(In reply to comment #5) > (From update of attachment 118571 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=118571&action=review > > > Source/WebCore/ChangeLog:8 > > + Check to see if "X-SourceMap" HTTP response header was sent with script resource. > > Is there a discussion on the X-SourceMap name? > > > Source/WebCore/inspector/Inspector.json:1994 > > + { "name": "sourceMapURL", "type": "string", "description": "URL of source map associated with script (if any)." }, > > We should not process sourceMapURL on the backend (node.js won't have it). User should listen to the network and get it from there. We will need to process sourceMapURL on the backend to support //@sourceMapURL comment to avoid loading all the script sources to frontend. X-SourceMap header is sent to frontend only for the very first time. After resource is cached, it would not be sent again.
Pavel Feldman
Comment 7 2011-12-20 01:58:05 PST
Comment on attachment 118571 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=118571&action=review >> Source/WebCore/inspector/Inspector.json:1994 >> + { "name": "sourceMapURL", "type": "string", "description": "URL of source map associated with script (if any)." }, > > We should not process sourceMapURL on the backend (node.js won't have it). User should listen to the network and get it from there. You should at least make this optional.
Pavel Podivilov
Comment 8 2011-12-21 06:08:26 PST
Ilya Tikhonovsky
Comment 9 2011-12-22 00:45:07 PST
Reverted r103405 for reason: it broke WorkerDevToolsSanityTest.InspectSharedWorker Committed r103500: <http://trac.webkit.org/changeset/103500>
Pavel Podivilov
Comment 10 2011-12-22 05:09:10 PST
Nikita Vasilyev
Comment 11 2012-01-03 08:24:56 PST
Is there an example of source map file? Say, for CoffeeScript.
Pavel Feldman
Comment 12 2012-01-04 03:11:49 PST
(In reply to comment #11) > Is there an example of source map file? Say, for CoffeeScript. There is nothing for CoffeeScript as far as I know, but podivilov@ was going to help with generating one. Here is the source map v3 proposal: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?hl=en_US&pli=1&pli=1
Timothy Hatcher
Comment 13 2012-01-04 05:21:01 PST
Who does need/use source maps currently?
Pavel Feldman
Comment 14 2012-01-04 05:54:46 PST
(In reply to comment #13) > Who does need/use source maps currently? SourceMaps are used by: 1) web developers that use compiled languages such as CoffeeScript, Closure Compiler, GWT, etc for their day to day development. The tool is converting sources from compiled JavaScript back to the original source code and allow debugging in term of the original source. 2) web developers for debugging production (minified) code. Developers load private mapping and see the original source code while debugging. Web Inspector is the first source map implementation I know of that is in production. We still need to work on particular use cases with the compiled framework owners. Mozilla is on board with the standard and I think I've seen their working prototype with CoffeeScript SourceMaps somewhere.
Nikita Vasilyev
Comment 15 2012-01-04 06:01:32 PST
Thanks Pavel. Would be nice to have at least one example for minified javascript. I haven't found one in the tests. Mozilla's work on it: https://wiki.mozilla.org/DevTools/Features/SourceMap https://github.com/mozilla/source-map Source map generator
Patrick Mueller
Comment 16 2012-01-04 06:22:43 PST
(In reply to comment #14) > (In reply to comment #13) > > Who does need/use source maps currently? > > SourceMaps are used by: > 1) web developers that use compiled languages such as CoffeeScript, Closure Compiler, GWT, etc for their day to day development. The tool is converting sources from compiled JavaScript back to the original source code and allow debugging in term of the original source. > > 2) web developers for debugging production (minified) code. Developers load private mapping and see the original source code while debugging. Just a note that these are "needs" and not "uses", since I'm not aware of anyone using SourceMaps in the field today. > ... I think I've seen their working prototype with CoffeeScript SourceMaps somewhere. I don't believe there exists a version of CoffeeScript that generates SourceMaps, but there's a bug open for it: https://github.com/jashkenas/coffee-script/issues/558 (In reply to comment #15) > Would be nice to have at least one example for minified javascript. Yes. I'd like to see something that works in a browser available today. Perhaps someone can post a blog entry describing how us mortals can use it? I think the closure compiler generates sourcemaps, so an example minizing a couple of js files together, but debugging them as separate files, would be good enough. In fact, I've been cautioning folks that I don't believe SourceMaps are real until I see them working. Not quite true - I'm sure it'll work in theory, but theory !=practice. Like, do we need an .html wrapper so you can JSONP the sourcemap data (per a previous discussion in a Web Inspector bug)?
Note You need to log in before you can comment on or make changes to this bug.