Bug 865328: debug protocol client: capture a 'self' variable, instead of doing lots of 'bind' calls. r=msucan

This lets us use ordinary function declarations, which can appear in the
order the code will run, for legibility.
Bug 865328: Close console clients by building a chain of continuations. r=msucan