File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -148,7 +148,13 @@ if ( jQuery.support.ajax ) {
148
148
if ( xml && xml . documentElement /* #4958 */ ) {
149
149
responses . xml = xml ;
150
150
}
151
- responses . text = xhr . responseText ;
151
+
152
+ // When requesting binary data, IE6-9 will throw an exception
153
+ // on any attempt to access responseText (#11426)
154
+ try {
155
+ responses . text = xhr . responseText ;
156
+ } catch ( _ ) {
157
+ }
152
158
153
159
// Firefox throws an exception when accessing
154
160
// statusText for faulty cross-domain requests
Original file line number Diff line number Diff line change @@ -2322,6 +2322,20 @@ test("jQuery.ajax - abort in prefilter", function() {
2322
2322
2323
2323
} ) ;
2324
2324
2325
+ test ( "jQuery.ajax - loading binary data shouldn't throw an exception in IE (#11426)" , 1 , function ( ) {
2326
+ stop ( ) ;
2327
+ jQuery . ajax ( url ( "data/1x1.jpg" ) , {
2328
+ success : function ( data ) {
2329
+ ok ( data === undefined || / J F I F / . test ( data ) , "success callback reached" ) ;
2330
+ start ( ) ;
2331
+ } ,
2332
+ error : function ( _ , __ , error ) {
2333
+ ok ( false , "exception thrown: '" + error + "'" ) ;
2334
+ start ( ) ;
2335
+ }
2336
+ } ) ;
2337
+ } ) ;
2338
+
2325
2339
test ( "jQuery.ajax - active counter" , function ( ) {
2326
2340
ok ( jQuery . active == 0 , "ajax active counter should be zero: " + jQuery . active ) ;
2327
2341
} ) ;
You can’t perform that action at this time.
0 commit comments