contents.js wrapper for contents service

This is PR #6671, rebased because it's a blocker for the text editor components, and @fperez asked me to make that high priority. So far, I've just rebased, I intend to test it and fix things I see.
Nothing prevent from using both, advantages of promise is that you can bind the callback after calling the function.
Callback also push to more nesting of anonymous function IMHO, but that's just a detail.

I'm just saying that here, it would be convenient to have `return $.ajax` to at least get a handle on this promise if we want to use it.