Bug 20308

Summary: Pretty print minimized/obfuscated JS code for readability and debugging
Product: WebKit Reporter: Andy Clark <aclark>
Component: Web Inspector (Deprecated)Assignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Enhancement Keywords: InRadar
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   

Andy Clark
Reported 2008-08-06 14:55:28 PDT
JavaScript apps are often deployed with the source minimized (or obfuscated). This results in the source being reduced to a single line or multiple lines with multiple statements per line. This makes it very difficult to read when the debugger traps on an error. Also, it is impossible to set meaningful breakpoints because they are set on lines, not statements. The first request for enhancement is to add a setting that will pretty-print the JS source. So even if the code is minimized, it will appear as separate lines, indented appropriately, and with added whitespace between tokens for readability. Even though the process of minimization often renames local variables this would allow the developer to more easily associate the lines of code back to the original source. The second request for enhancement falls out from the first request because once the source code is pretty-printed, each statement appears on a separate line. Then the user should be allowed to set breakpoints on these statements (or "virtual lines" of code). This allows the developer to read and debug the JS source in a deployed environment.
Attachments
Mark Rowe (bdash)
Comment 1 2008-08-06 15:40:32 PDT
Gavin Sherlock
Comment 2 2008-08-24 19:10:51 PDT
This seems to be essentially a duplicate of bug 16397. Also, check out: http://elfz.laacz.lv/beautify/ it's good a prettifying javascript - maybe it could be used (though its sources appear to have no explicit license).
Timothy Hatcher
Comment 3 2008-09-28 12:10:44 PDT
*** This bug has been marked as a duplicate of 14469 ***
Note You need to log in before you can comment on or make changes to this bug.