| Summary: | [firefox] [IE] xhr throws IllegalStateError when responseType is 'blob' | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Mark Macdonald <mamacdon> |
| Component: | Client | Assignee: | Mark Macdonald <mamacdon> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 2.0 | ||
| Target Milestone: | 3.0 M1 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
Found a reference [1]. This apparently happens because the 'async' parameter in XMLHttpRequest must be true to allow the responseType to be changed. But until open() is called, 'async' is not set. The XHR2 spec doesn't mention this anywhere that I could see. IE10 throws similar errors in the same situation (plus more). No error in Chrome. Anyway, fixed and added regression testcase http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=94c051c8d1bafcddc7d48e74 [1] http://forums.udacity.com/questions/100022122/cross-browser-xmlhttprequestresponsetype |
1. Use Firefox 2. Write some code that uses orion/xhr to do this: xhr('GET', '/anything', {responseType: 'blob'}); 3. You get > InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable. at xhr.js:100 > xhr.responseType = options.responseType; Due to Firefox's expert quality implementation of XMLHttpRequest, apparently you need to set the responseType after calling open() but before calling send(). Otherwise it barfs. Very cool