fix(client): Fix CORS requests not being decoded for Fx<21

Fx < 21 has a problem where it returns an emtpy string when calling
xhr.getAllResponseHeaders() for CORS requests. jQuery uses the
'Content-Type' header to do smart decoding of content. Since jQuery
cannot get the correct type, it returns JSON content as text, causing the app
to blowup whenever trying use the returned data as an object.

We also have issues where jQuery does not return Promises/A+ compliant promises
from its XHR functionality. We convert between jQuery deferreds and promises wherever we 
make a request.

Instead of leaving these two problems to be solved on an ad-hoc basis, a simple
xhr wrapper library is created that surfaces the functions we make use of. All
functions return a Promises/A+ compatible promise. The default dataType is set
to JSON for `get` and `post` if not already specified. `ajax` is left alone so we do
not alter default low level functionality.

fixes #1786