Bug 20308 - Pretty print minimized/obfuscated JS code for readability and debugging
Summary: Pretty print minimized/obfuscated JS code for readability and debugging
Status: RESOLVED DUPLICATE of bug 14469
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2008-08-06 14:55 PDT by Andy Clark
Modified: 2008-09-28 12:10 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Clark 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.
Comment 1 Mark Rowe (bdash) 2008-08-06 15:40:32 PDT
<rdar://problem/6130992>
Comment 2 Gavin Sherlock 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).
Comment 3 Timothy Hatcher 2008-09-28 12:10:44 PDT

*** This bug has been marked as a duplicate of 14469 ***