Make XHR work for file:// urls

The response status will be 0 instead of a HTTP status code for file urls,
so we need to consider a status of 0 as success too.
This commit is contained in:
Andreas Hocevar
2016-07-28 11:45:20 +02:00
parent 3d57ea45cb
commit 7da5a5ae92
4 changed files with 10 additions and 5 deletions
+2 -1
View File
@@ -125,7 +125,8 @@ ol.source.CartoDB.prototype.initializeMap_ = function() {
*/
ol.source.CartoDB.prototype.handleInitResponse_ = function(paramHash, event) {
var client = /** @type {XMLHttpRequest} */ (event.target);
if (client.status >= 200 && client.status < 300) {
// status will be 0 for file:// urls
if (!client.status || client.status >= 200 && client.status < 300) {
var response;
try {
response = /** @type {CartoDBLayerInfo} */(JSON.parse(client.responseText));