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
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Mark Rowe (bdash)
<rdar://problem/6130992>
Gavin Sherlock
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
*** This bug has been marked as a duplicate of 14469 ***