Bug 734045 (script0): Use getLookup not getPredictions

The results of getPredictions are filtered through the matcher which
prevents the return of more than 10 results, so it's silly doing maths on
the lengths expecting it to work. Instead we should be using getLookup
directly which isn't filtered, and so the length maths will work.
Bug 760791 (tiltopen): Protect against null inputs

This is the minimum part of the fix for this bug. A similar bug affects
other types, and there are tests to check, both of which are part of
Bug 706793 (nodenull)
Bug 760793 (nodenull): Protect against null inputs

As for Bug 760791 (tiltopen) for boolean, array and selection types.
It is unlikely that these fixes will be required in the real world because
the blank values for boolean and array are not null (they are false and
empty array respectively) and selection types are commonly 1 from n.
However it's worth being general in our fixes.
Bug 760793 (nodenull): Don't check typeSpec length

Most importantly these checks have the potential to break backwards
compatibility. However specifically right now, these checks make writing
tests harder. since it prevents us from creating a type using
types.getType({ name:... });
Bug 760793 (nodenull): Strengthen type tests

Extract code to loop over all tests to forEachType() function and create
a new testNullDefault case.
Bug 720972 (optmenu): Refactor template data generation

Previously we used the completer instance as the data for the template,
however this didn't make much sense since the set of things that were
important to templates and the set of things important to being a completer
were disjoint sets, and using properties (the old way) meant either
inefficient code that re-calculated properties, or cached values (what we
did) which caused subtle sequencing issues. Now we just have a simple
(if a little large) function to generate the template data.
Bug 720972 (optmenu): Tidy assignment constructor

Assigning to prototype like that is asking for confusion, and the point
(so that tools had something to document) hasn't happened.
So we move the docs into the constructor.
Bug 720972 (optmenu): Allow valueArg to be null

Requisition uses it with null when there is only one part of a named
argument, so we this code should accept that.
Also tidy up the over-reaching docs.
Bug 720972 (optmenu): Add _toSummaryJson

_toSummaryJson alows us to see at a glance what the state of the command
line it. This is useful partly in debugging because it saves digging down
and could be useful in testing to check the state of a large number of
things at the same time, however we will need to ensure that it's stable
before using it in testing too much.
This patch also changes a demo command that we use for debugging. This
change does not reach Firefox.

REBASE: make summaryJson a property

tweak command
Bug 720972 (optmenu): Swap isBlank() for .type and BlankArgument

This gives us a bit more information about how the command line got to be
in the state that it is, it's also more consistent with how Argument works
in general. Also it means consumers of Argument do not need to import all the
subtypes in order to get type information (and it's not going to break in a
cross frame situation)
Bug 720972 (optmenu): Various minor changes

Fix minor number parsing bug: '-' is an incomplete number, not an error
We need to make it a special case because otherwise we try to parseInt it
which errors.
Remove inconsistent documentation, add thoughts on future Argument refactoring
Bug 720972 (optmenu): Support incomplete named args

Previously we supported named arguments, but we didn't cope well with
them being incorrect while they were being typed, which is clearly needed
for a menu to help.
This makes _unassigned to be an array to which we add dynamically created
instances of UnassignedAssignment rather than merging them which was always a
bit of a hack.
Bug 720972 (optmenu): Basic menu support

Create a ParamType. This also fixes a bug where an extra space was inserted in
the empty parameters, which was caused by us mutating an argument rather than
creating a new one.
Bug 720972 (optmenu): Fix bad comparison logic

Act if we've got something to act on, not if we haven't
Bug 720972 (optmenu): Extract out setAssignment

Extract out Requisition.setAssignment, so we can do the args checks properly.
We were just adding the args if they were missing, now we're also replacing
them if that needs doing too.
Bug 720972 (optmenu): Add checks for defaultValue

Optional parameters must have a defaultValue (unless they are boolean), which
is a check that we didn't make explicit before.
Bug 720972 (optmenu): Add unit tests

These test allow us to test the type of arguments, and allow testing of
different ways to get the command line into any given position.
Merge branch 'master' into optmenu-7200972