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 ) {
148148 if ( xml && xml . documentElement /* #4958 */ ) {
149149 responses . xml = xml ;
150150 }
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+ }
152158
153159 // Firefox throws an exception when accessing
154160 // 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() {
23222322
23232323} ) ;
23242324
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+
23252339test ( "jQuery.ajax - active counter" , function ( ) {
23262340 ok ( jQuery . active == 0 , "ajax active counter should be zero: " + jQuery . active ) ;
23272341} ) ;
You can’t perform that action at this time.
0 commit comments