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.

2

1 Answer 1

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.

2
  • 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. Commented Mar 28, 2013 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
    Commented Mar 28, 2013 at 11:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.