Bug 846543: Generalize async operations, use that in the BMM API; r=mcote

This also adds support for asynchronous HTTP requests, and uses those
from the request machine.