Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception when setting XHR responseType parameter #66

Conversation

robertknight
Copy link

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 and results
in an exception.

Work around this issue by setting the xhr.responseType attribute only
after opening the request.

Also if the caller explicitly specifies a desired response type, report
an error instead of silently returning an unexpected data type if the
xhr.responseType assignment fails.

Fixes #65

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 and results
in an exception.

Work around this issue by setting the xhr.responseType attribute only
after opening the request.

Also if the caller explicitly specifies a desired response type, report
an error instead of silently returning an unexpected data type if the
xhr.responseType assignment fails.

Fixes browserify#65
This verifies that the responseType is set, but not that it is a legal
value or one which the browser will understand.
@robertknight
Copy link
Author

Ah, I've just realized that this is essentially the same change as in https://github.com/substack/http-browserify/pull/61/commits

@cardoni
Copy link

cardoni commented Apr 23, 2015

👍

@anandthakker
Copy link

Thanks for this fix, @robertknight.

@robertknight
Copy link
Author

This issue was fixed a year ago upstream in Firefox, so I'm going to close this for now unless anyone else wants to revive it.

@robertknight robertknight deleted the i45-firefox_xhr_responsetype branch December 3, 2016 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting XHR response type fails due to xhr.responseType being modified before XHR is opened
3 participants