exec-729514: convert() should always return a promise

converters.convert() was supposed to always return a promise, but if
there was no conversion to be done, then we just returned the original
object rather than a promise of it.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
exec-729514: Factor out a 'serve' command

This commit does not need Mozilla review as it doesn't change files in
mozilla-central.

Extract a 'serve' command and a startup sequence which will help us
integrate socket.io better.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
exec-729514: Create 'server start|stop' commands

This commit does not need Mozilla review as it doesn't change files in
mozilla-central.

Split the 'serve' command into 2: 'server start' and 'server stop'.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
exec-729514: Add "--commands" option to "server start"

Allow remote command execution (turned off by default) using websockets
to asynchronously pass data between client and server.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
exec-729514: Add "connect" command (to go with prev)

Add the client side counterpart to the "server start --commands"
addition in the previous commit.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
exec-729514: Split help data and help formatting

Now we have converters working, we split out the formatting of help data
which also helps with remoting since the formatting can happen on the
client.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
exec-729514: Split "pref list" data and formatting

Now we have converters working, we split out the formatting of pref data
which also helps with remoting since the formatting can happen on the
client.

Also use context.updateExec in place of context.exec because the
'command' way we're using it is deprecated.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
exec-729514: Apply band-aid to "pref list"

It would be good to show this command some love, however it's undergone
some bit-rot, or maybe it was never loved properly. Anyway this comments
out the "Filter" and the edit buttons until we can make them work
properly.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
exec-729514: Swap param order to typedData

The original order was wrong for 2 reasons:
* 'data' is more likely to be multi-line. 'type' never
* the ordering is hinted at in the name 'typedData'
The original thinking was that 'data' is more important than 'type' so
it should come first, but that doesn't feel like a strong enough case

Signed-off-by: Joe Walker <jwalker@mozilla.com>
exec-729514: Split execution/conversion contexts

Previously there was a single 'context' object that essentially provided
a wrapper for a Requisition to allow us to evolve a Requisition and
hope to have a degree of backwards compatibility and safety. With
remoting and splitting execution from formatting there could be 2
different requisitions, so we split the execution functions from the
conversion functions.

To allow backwards compatibility we have a 'legacy' switch to make the
execution context act as it did previously.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
exec-729514: Make "context" command use default document.

From the source:
"The ability to add functionality by adding a new script tag is specific
to a browser, so this code is not going to work in NodeJS/Firefox etc.
We export the document that we are using so multi-frame environments can
update the default document"

Signed-off-by: Joe Walker <jwalker@mozilla.com>
exec-729514: Move createExecutionContext into Requisition

Now that we're caching the context objects, there is no need to have a
separate exported function to create them, so we make executionContext
and conversionContext property getters.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
updatedom-856002: util.updateCommand -> requisition.update

util.updateCommand was in demand but:
* awkward to use and discover since it was in an unpredictable place
* GCLI specific, and exposed in a utility module
So we deleted it and moved the functionality into cli.js

Signed-off-by: Joe Walker <jwalker@mozilla.com>
exec-729514: Split "intro" data and formatting

Now we have converters working, we split out the formatting the "intro"
command. Also rename context->converstionContext to be clearer and don't
assume that this context is a strict subset of requisition.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
exec-729514: Have audit clear up after self

Previously the "test" command tidied up the command line when the tests
were done, but that fell foul of the context split, and while we could
hack it, it seemed better to have tests clean up after themselves, which
we can do by asking 'helpers' to do it.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
exec-729514: Remove examiner setups/shutdowns

As part of the previous change I noticed that there was a whole setup /
shutdown system in examiner that wasn't being used. Removed.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
Outstanding work: WARNING WILL REBASE

This branch will be rebased before it is done. You have been warned.