XMLHttpRequest: no exception is fired when responseType is set the a not supported value - by Real McCoy

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


ID 750888 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 6/26/2012 3:43:02 AM
Access Restriction Public

Description

If (new XMLHttpRequest()).responseType is set to an unsupported value, it should throw an exception.

For example;

In the UA's console run the following code:

(function IsArrayBufferSupported(){ 
    var xhr = new XMLHttpRequest(); 
    xhr.open('GET', '/', true); 
    try{ 
       xhr.responseType = "arraybuffer"; 
       return true; 
    }catch(e){return false;} 
})();

This should return true. Which it does in IE, FF, Opera, Chrome and Safari.

Then run:

(function IsArrayBufferSupported(){ 
    var xhr = new XMLHttpRequest(); 
    xhr.open('GET', '/', true); 
    try{ 
       xhr.responseType = "badValue"; 
       return true; 
    }catch(e){return false;} 
})();

This should return false. Which it does in Chrome (19.0.1...) and Safari (5.1.2) only. All other browsers including IE9 and 10RP return ture.

"e.message" in both Safari and Chrome is:  SYNTAX_ERR: DOM Exception 12

In short, 
xhr.responseType = "badValue"; 
should throw an exception.

Sign in to post a comment.
Posted by Microsoft on 7/23/2012 at 12:16 PM
Thank you for your feedback.

Since this is a feature request, we will resolve the issue as "By Design." However, we have taken your feedback into consideration.

Best regards,

The Internet Explorer Team
Posted by Real McCoy on 7/21/2012 at 12:08 PM
@Microsoft, if the invalid value is passed, wouldn't it make sense to throw an exception like Chrome and Safari been doing?
Posted by Microsoft on 7/19/2012 at 9:58 AM
Thank you for your feedback.

The issue you are reporting is by design. ResponseType is designed to be a string as W3C wants to make it extensible to support more data types in the future

Best regards,

The Internet Explorer Team
Posted by Microsoft on 6/26/2012 at 12:31 PM
Thank you for your feedback. We will be investigating this issue further.

Best regards,

The Internet Explorer Team