inputpos-768744: Use this.document

We need to ensure that we're using the correct document. This is
important both for when gcli is in an iframe, and for when it's embedded
in a xul document.
Merge branch 'inputpos-768744'
nodetest-786658: Remove existsSync hack

It causes noise on stdout, and we don't really need it.
nodetest-786658: Switch on isJsdom not isNode

The test failures are mostly down to jsdom being only a half way decent
dom implementation, not down to node.
nodetest-786658: Various Node fixes

console.debug does not exist in node.
Sometimes there is no document and we need to protect ourselves.
nodetest-786658: Check for the existence of commands

We test the commands only if they exists.
menufix-786317: setAssignment > setConversion

We're generally moving command line mutations to the requisition, and
in this case it fixes a bug where the requisition needs to know about
the extra arguments.
menufix-786317: Delay assignment update

We need to update the args array before the assignment so that things
that read requisition.toString from events from the assignment update
get the correct strings.
menufix-786317: Properly refer to assignment

This fixes the action of UP/DOWN arrows.
newmutate-739947: Remove Assignment.setBlank

Assignment.setBlank() becomes Requisition.setAssignmentBlank(assignment)
and the 2 cases when setBlank was called from a constructor without
access to a Requisition, we move the call to just after the 'new'.
newmutate-739947: setConversion -> setAssignment

Alter setAssignment to take a third parameter which decides if we need
to do the processing to update the args array (which we need to do if
this is not part of an update call).

Also update it to accept either an arg (in which case convert it), or a
conversion (in which case use it directly) or null (in which case use
the blank value).

Also we have 2 versions of the setAssignment function, one external,
which does not expose the skipArgUpdate parameter.

Now all updates to the assignments can go through the setAssignment
function, which means we may be able to control events somewhat more.
nosynctest-787712: Remove examiner.run()

Everything that used run() now uses runSync()
nosyntest-787712: Add checkCalled to examiner

This adds the functionality to the browser side, we still need to add
a similar function to the firefox side.
fuzzy-764856: allow fuzzy matching of commands using Damerau-Levenshtein edit distance

Signed-off-by: Quentin Pradet <quentin.pradet@gmail.com>
newpromise-708984: Use Add-on/Q like promise

Promise is now a copy of toolkit/addon-sdk/promise/core.js, and
Requisition has code to handle both the new way and the old way. Also
pref_list, which depended on the old way, is updated to use defer().

Documentation is updated

Commands that use createPromise() have not been updated in this commit
partly to prove that this system is backwards compatible.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
newpromise-708984: Update commands to new promise

Signed-off-by: Joe Walker <jwalker@mozilla.com>
newpromise-708984: Use central copy of add-on promise

Signed-off-by: Joe Walker <jwalker@mozilla.com>
nosynctest-787712: Add changed() call to Output

This allows changes to be streamed. This is not a feature that we are
making use of right now, however it is important that we remember that
this is something that we would like to enable in the future.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
Merge branch 'newpromise-708984' into nosynctest-787712
Merge branch 'nodetest-786658' into nosynctest-787712