Use responseType 'arraybuffer' for all XHR requests

This PR is still work in progress as it needs some more refactoring.

This branches of PR #693, which we just discovered has still a bug.