0

I need to modify WebDriverJS for my purposes. The compiled source is giving me a hard time debugging, though. Describing function names and comments would help me out big time! So I was wondering whether it is possible to compile WebDriverJS without minimizing it's content.

The build.desc for the JavaScript compilation is using js_binary which is using Google Closure Compiler. Anyone of you know how to compile it and preserve functionnames and comments? This would rather be a merge of all sources then a compilation.

Senči
  • 911
  • 2
  • 10
  • 25
  • 1
    possible duplicate of [Potential differences between compiled and uncompiled Javascript](http://stackoverflow.com/questions/14147479/potential-differences-between-compiled-and-uncompiled-javascript) – Chad Killingsworth Mar 28 '13 at 02:43
  • thanks... it's not really a complete Answer to my question but it brought me to the flags... can't belive I forgot to check those... --compilation_level=WHITESPACE_ONLY helps a lot, too. ;) – Senči Mar 28 '13 at 09:35

1 Answers1

0

Thanks to Chads Post in "Potential differences between compiled and uncompiled Javascript" I've taken a deeper look at the flags of closure compiler.

  • --compilation_level=WHITESPACE_ONLY preserves function and variable names
  • --formatting=PRETTY_PRINT doesn't remove linebreaks
  • --formatting=PRINT_INPUT_DELIMETER gives me a better overview in which file to search for the source

Unfortunately I still couldn't figure out how to save the comments, but thats just a small problem since I can look them up in the source code.

Update: Seems like the compilation_level doesn't remove the goog.required-calls. I've got to remove them somehow, because the script doesn't work with them.

Update 2: I've removed all goog.require($mod) and goog.provide($mod) calls and defined Objects where needed (typically to find right after the // Input $int comments). It's working now.

Community
  • 1
  • 1
Senči
  • 911
  • 2
  • 10
  • 25
  • Typically, you'd use the same optimization level you would on your live version. Using the `--debug` flags mangles the names in such a way that it's pretty easy to match up to the original source. – Chad Killingsworth Mar 28 '13 at 11:29
  • thank you! I tried that but I didn't like it, I've already made it work ;) I will edit the source files anyways when I figured out what is missing. – Senči Mar 28 '13 at 11:46