Merged changes from emscripten.
Updated connection protocols to handle changes in Firefox implementation, resulting in reduced code required to support Firefox and Chrome.
All of the logic is now shared.