Opened 8 years ago
Closed 8 years ago
#15193 closed bug (migrated)
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.
Change History (2)
comment:2 Changed 8 years ago by
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.