Issue 2710 wsapi ver lock

Not ready for merge!

I am submitting this PR to get feedback from @ozten and @lloyd.

Large portions of @ozten's original code in f2adc7aad1c3321f398dd83e9349610ba8514897 as well as an updated version of @lloyd's PR #2284 to turn version() into an asynchronous function are used.

The asynchronous version() was used because generate_code_version was using the randomly generated SHA because git had not yet fetched the version.

Instead of placing the SHA into the wsapi URL, it is placed into the X-BrowserID-Version HTTP header.

Outstanding concern:
Both compress and run_locally.js call the generate_code_version.js script. generate_code_version relies on version being asynchronous, so it itself is now asynchronous. When calling generate_code_version asynchronously from compress or run_locally, the callback is never called and I am unsure why. For the moment I am calling generate_code_version without using a callback, but this could fail due to timing problems. The only reason things work now is because generate_code_version writes out /build/code_version.js before it is needed.