Bug 30933 - Web Inspector: support for debugging alt-JS files which generate JS
Summary: Web Inspector: support for debugging alt-JS files which generate JS
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-29 15:57 PDT by Patrick Mueller
Modified: 2014-01-12 16:15 PST (History)
12 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Mueller 2009-10-29 15:57:47 PDT
There are quite a few alt-JS language implementations available today - Objective-J (like Objective-C, but for JS), EGL (4GL from IBM), Clamato (Smalltalk), Schemes, Pythons, and Rubys.  It would be nice to be able to support these somehow in Web Inspector.

Here's the thought.  For alt-JS implementations which generate JavaScript code and then eval() it, we can have those implementations make additional debug information available that can map the generated JavaScript code back to the original source.  Information such as a URL to the original alt-JS source file(s), a line number map (from original to generated code), etc.

The additional information, or pointers to it, would be added to the generated JS files, perhaps in the same kind of comment/directive format used for //@sourceURL= that allows naming your evals.

An initial implementation which just supported an alternate source representation and line number map could be used for setting breakpoints and stepping through the code.  Dealing with mapping locals and other variables/properties, as well as stack manipulation, would be a lot more work.  As a point of reference, some alt-JVM languages make use of existing Java bytecode facilities to handle just the source code/line numbers, and the resulting debugger experience is acceptable (eg, Groovy).

Given the alternative source and line number mappings, we can translate requests to/from the the JS engine to render the original source in the debugger views, supporting setting breakpoints, stepping, etc.

Tom Robinson noted that Caja seems to be generating debug info like this: 

   http://code.google.com/p/google-caja/source/browse/trunk/tests/com/google/caja/parser/quasiliteral/testModule.co.js

Should also check with FireBug folks to see if they're doing anything.
Comment 1 Patrick Mueller 2009-11-04 16:29:51 PST
There was some chit-chat on stuff like this today on es-discuss:

https://mail.mozilla.org/pipermail/es-discuss/2009-November/010103.html
Comment 2 Patrick Mueller 2011-07-08 10:26:06 PDT
Suggest we close this bug as a DUP of bug 63940 ; better yet, since there may be more bugs on this subject, we could have an "umbrella" bug and tie them together with Depends on (or however it's done).  I suppose this one could be the umbrella.
Comment 3 BJ Burg 2014-01-12 16:15:01 PST
Inspector supports source maps.