Side navigation
#15193 closed bug (migrated)
Opened July 28, 2014 09:53PM UTC
Closed October 21, 2014 12:50AM UTC
Ajax requests with binary data throw errors in Chrome
Reported by: | cbroome | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | ajax | Version: | 2.1.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
This is related to issue #11426.
Code starting at line 8598:
complete( xhrSuccessStatus[ xhr.status ] || xhr.status, xhr.statusText, // Support: IE9 // Accessing binary-data responseText throws an exception // (#11426) typeof xhr.responseText === "string" ? { text: xhr.responseText } : undefined, xhr.getAllResponseHeaders() );
In that ticket, the fix was to throw an exception for IE browsers, however Chrome v36 throws an exception as well when accessing xhr.responseText. I'm not advocating jquery handling binary data, as another ticket left that for the plugins. What I'd like to see is the conditional:
typeof xhr.responseText === "string"
changed to something safer:
(xhr.responseType === "text" && xhr.responseText === "string")
Or something similar, so long as that check doesn't throw an exception. As it is the current state prevents launching the 'complete' callback for any binary data response, even though 'text' is an inessential parameter (defaulted to undefined).
Thanks.
Attachments (0)
Change History (2)
Changed July 28, 2014 09:59PM UTC by comment:1
_comment0: | Actually, thinking on it more, something like: \ {{{ \ ( [ "dataarray", "blob" ].indexOf( xhr.responseType ) < 0 ) && xhr.responseText === "string") \ }}} \ \ would be safer all to existing functionality. → 1406664695721106 |
---|
Changed October 21, 2014 12:50AM UTC by comment:2
resolution: | → migrated |
---|---|
status: | new → closed |
Migrated to https://github.com/jquery/jquery/issues/1782
Actually, thinking on it more, something like:
would be safer all to existing functionality.