Bug 683511 (cookie): Tidy-up - remove unused require
Bug 683511 (cookie): Add basic DateType implementation

Work outstanding:
- Define valid input formats. Should probably include the format that
  cookies are defined in, along with a simple basic alternative and a few
  shortcuts, e.g.: 'now', 'tomorrow', 'yesterday'
- Implement parse function based on the above
- Think about step values for increment/decrement
- Complete tests
Merge branch 'master' into cookie-683511
Merge branch 'master' into cookie-683511
Merge branch 'master' into cookie-683511
Merge branch 'master' into cookie-683511
date-773271: Change branch name

Branch name changed to date-773271 because the cookie command shipped
without the date type.
Merge branch 'master' into date-773271
Merge branch 'master' into date-773271
Merge branch 'master' into date-773271
asynctypes-685526: constrainPredictionIndex can promise

If getPredictions() is able to return a promise then we first need
constrainPredictionIndex() to be able to work with promises.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
asynctypes-685526: Separate sync/async template data

completer._getCompleterTemplateData returns 6 bits of information, 3 are
not affected by predictions becoming asynchronous, 3 are. This separates
them by pushing the sync data (i.e. statusMarkup, unclosedJs and
scratchLink) into separate functions. The rest will become promises
which the template engine will lap up beautifully.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
asynctypes-685526: Make getCompleterTemplateData async

The changes to completer.js look more significant than they really are
we just introduce three new promisedXXX variables, and do all the
calculations in Q.resolve(prediction) passing the promises of the 3
promises in the return data.

getCompleterTemplateData is used in 2 places, completer.update and
the test helpers. completer.update does not need to change at all
because domtemplate is awesome.

The test helpers are affected in 3 places, the hints function which
has to resolve the 3 promised values, the debug outputted which remains
synchronous by inserting the string "<promise>" when it gets an
unresolved value, and the asserts themselves which use test.checkCalled
to defer the test and automagically include the results in the correct
test.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
asynctypes-685526: Fix ',' and ';'

Trying out WebStorm which told me about a bunch of semi-syntax errors.
I'm not sure if I care particularly, but it's easy to fix, so I did.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
asynctypes-685526: Make Requisition.complete async

The changes to testKeyboard mostly involve the indent caused by adding
Q.resolve.

Inputter gains a _completed promise that tracks if there are any
outstanding completions. This is something of an experiment.

There are some unknown consequences of this change with slow to finish
asynchronous types. It is likely that there will be some problems that
we need to work around in the future.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
asynctypes-685526: Use promised() after all

I raised bug 790973 to cover the issue with promised() unrolling arrays
and it was fixed in a few hours, so here is a (hopefully short term)
import of promised until it lands in core.js, and a revert to the
implementation of hints() that we originally wanted to use.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
Merge branch 'master' into date-773271
asynctypes-685526: Make getPredictions() async

Given all the previous changes to make things that depend on
getPredictions asynchronous, this is fairly simple.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
asynctypes-685526: Minor tidy-ups

Fix a spelling mistake, add some blank lines, update some test error reporting
strings, and wrap to 80 column lines

Signed-off-by: Joe Walker <jwalker@mozilla.com>
asynctypes-685526: Add unit tests

These unit tests are incomplete, but are useful in guiding what work is
still required in this patch.

Signed-off-by: Joe Walker <jwalker@mozilla.com>