Created attachment 8450052 [details] Example patch We should use DOM promises for the MozLoopAPI functions which are currently based around callbacks. The main functions to swap are currently ensureRegistered and hawkRequest. Switching to use DOM promises isn't too difficult in itself (see example patch), the slightly more complicated bit is integrating into the Mocha & chai tests. There's information on that here: For the records Mocha supports promises; quoting http://visionmedia.github.io/mocha/#asynchronous-code: > Alternately, instead of using the done() callback, you can return a promise. They also use https://github.com/domenic/chai-as-promised/ to extend the Chai expectation API.
(In reply to Mark Banner (:standard8) from comment #0) > They also use https://github.com/domenic/chai-as-promised/ to extend the > Chai expectation API. Additional xref http://chaijs.com/plugins/chai-as-promised
I'm wontfixing this, as we're changing the MozLoopAPI due to e10s to use a message passing mechanism, and this is unlikely to fit with promises.