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.
When you finis function by these `$.ajax`  call, you can just return it and let success and error as undefined as since jQuery 1.5 (we ship 2.0.3) they return a promise. Though it is not clear wether or not call back or promise are preferred from documentation. The promise seem to be much more recent, and no example use the callbacks.