types-767589: s/getType/createType/g

Some initial preparation.
types.getType is a misleading name because in many cases (and probably
it should be all cases) we are creating a new object. So we name it
types.createType instead.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
types-767589: Allow object literal type definitions

Previously Types all inherited (eventually) from 'Type' or more directly
from SelectionType or DelegateType. They had to do this because various
parts of the system used 'instanceof' to check what they were.

This makes exposing types hard because all new types must first import
types from GCLI, and must then jump through JS inheritance hoops before
registering a new type.

So this change arms 'addType' with the ability to register a new type
using an object literal that contains a 'parent' property which points
to another type whose properties should be used as a 'manual prototype',
that is to say we'll create a new object copy in the parent properties
then copy in the provided properties.

In future commits we'll avoid using instanceof in GCLI code and upgrade
a couple of types to the new system.

We're continuing to allow old-style types in the short term for 2
reasons:
* It's work to remove them, and external things may still need them
* We have some concerns that it might slow the system down as a result
  of confusing the type inference system in JS engines.

Any existing slowdown is in the order of 0.5ms per keypress [1], however
which sounds low, put it has to be put against the overall average time
to process a keypress of around 5ms.

[1] This isn't very scientific though.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
types-767589: Allow subtype discovery

Most types can be discovered using their name property (for example:
type.name === 'string') however delegate and selection types are
designed to be inherited from, so we add isDelegate and isSelection to
the type definition.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
types-767589: Use new type identification system

Convert use of instanceof to either 'type.name === xxx' or type.isXxx
as detailed in previous 2 commits.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
types-767589: Use object-literal type style

Upgrade the following types to use the new object-literal type style:
connection, setting, settingValue and the test types in mockCommands.

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

Conflicts:
	lib/gcli/cli.js