badenv-854948: Make environment/document dynamic

The wrong version was being cached in the context. This wasn't a problem
when the context wasn't cached, but when it was, then it was.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Hack modules not the help command

GCLI in node-js uses the standard help command, however because we're
outputting to text there is a different template. Previously in order
to get this to be used we'd alter the help module, however with this
change we just define the template that we want help to require.

Changes to code that goes into Firefox:
- The help module no-longer exports hooks to alter the templates
- A new viewToString converter

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Better errors from converters.js

The fallback converter now outputs to console.error. Plus some minor
tidy-ups.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Tighten up conversion types

Add a number of converters from number, boolean, undefined and null to
dom, which could help with commands like 'pref set' that have no return
value.

Complain if the value that we get in the output object is just 'object'
which means that it wasn't specified anywhere.

Have intro.js output a typed object rather than leaving it to be
guessed by something.

Also remove a redundant check:{} from testCanon.js

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Collect websocket support together

Previously the websocket support was meshed into the 'server start'
command exec function. This is now extracted into a separate collection
of functions and the argument is renamed from --commands to
--websocket.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Output.onChange -> output.promise

Output already had a promise, but it tried to use an onChange function
too in-case of an evolving output. Current thinking is that we should
have long-running commands emit a separate stream object rather than
having Output be both a promise and a stream.

This change removes the onChange event and replaces it with a promise.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
Merge branch 'badenv-854948' into remotegcli-839862

Conflicts:
	lib/gcli/cli.js