Ticket #2518 (closed defect: fixed)
xdomain doesn't parse io.bind result if content-type contains additional attributes
| Reported by: | stenduncan | Owned by: | jburke |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.1 |
| Component: | IO | Version: | 0.4.1 |
| Severity: | normal | Keywords: | XhrIframeProxy, xdomain, response |
| Cc: | stenduncan@… |
Description
Using XhrIframeProxy? to do cross-domain server calls. The server response has a header that looks like:
Content-Type: text/xml;charset=UTF-8
This works just fine in a non-xdomain situation. But using the XhrIframeProxy? I get an error. The problem is in the method
receive: function(/*String*/stateId, /*String*/urlEncodedData)
...
//Fix responseXML. var contentType = facade.getResponseHeader("Content-Type");
if(contentType && (contentType == "application/xml"
contentType == "text/xml")){ facade.responseXML = dojo.dom.createDocumentFromText(response.responseText, contentType);
}
====
Notice that there is an exact query for content-type which won't match my content-type header.
I have written a brain-dead workaround that I call in my own javascript to repair the problem before I process the result in my handler method (passing in evt from the handler call which has "type, data, evt"):
fixResponseXML: function(response) {
// anything to fix? if (response.responseXML != null) {
return;
};
var bIsXML = false; var contentType = response.getResponseHeader("Content-Type"); var ct = ""; var ctValues = contentType.split(";"); for (var i=0; i<ctValues.length;i++) {
if (ctValues[i] == "application/xml"
ctValues[i] == "text/xml" ) { ct = ctValues[i]; bIsXML = true; break;
};
};
if (bIsXML == false) {
return;
};
if(response.responseText){
//Fix responseXML. response.responseXML = dojo.dom.createDocumentFromText(response.responseText, ct);
};
}
But it seems to me that the XhrIframeProxy? should be doing this check itself and returning the correct xml in the evt.responseXML object.
Change History
Note: See TracTickets for help on using tickets.Download in other formats: