browserify / http-browserify

node's http module, but for the browser
MIT License
245 stars 110 forks source link

Setting XHR response type fails due to xhr.responseType being modified before XHR is opened #65

Open robertknight opened 10 years ago

robertknight commented 10 years ago

http-browserify accepts a 'responseType' parameter to set the XHR response type. However, in Firefox 31 at least, the logic to set the response type always fails because it is set before xhr.open() is called.

The call to set 'xhr.responseType = params.responseType' fails with 'An attempt was made to use an object that is not, or is no longer, usable' ala. http://stackoverflow.com/questions/13216903/get-binary-data-with-xmlhttprequest-in-a-firefox-extension

robertknight commented 10 years ago

According to the XHR spec (http://xhr.spec.whatwg.org/#the-responsetype-attribute) and https://bugzilla.mozilla.org/show_bug.cgi?id=707484 it is legal to set the responseType attribute before opening the request. However, this doesn't work with current versions of Firefox.