Using the IE cache fix from XMLHttpRequest.js allows us to send asynchronous requests without a setTimeout handler. r=bartvde (closes #2065)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10347 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2010-05-20 18:11:30 +00:00
parent 91bceb273b
commit e4085bbdc6
3 changed files with 4 additions and 30 deletions

View File

@@ -161,18 +161,8 @@ OpenLayers.Request = {
}
};
// send request (optionally with data) and return
// call in a timeout for asynchronous requests so the return is
// available before readyState == 4 for cached docs
if(config.async === false) {
request.send(config.data);
} else {
window.setTimeout(function(){
if (request._aborted !== true) {
request.send(config.data);
}
}, 0);
}
request.send(config.data);
return request;
},

View File

@@ -128,7 +128,7 @@
//
fCleanTransport(oRequest);
// Uncomment this block if you need a fix for IE cache
/*
/**/
// BUGFIX: IE - cache issue
if (!oRequest._object.getResponseHeader("Date")) {
// Save object to cache
@@ -192,7 +192,7 @@
// Return now - wait until re-sent request is finished
return;
};
*/
/**/
// BUGFIX: IE - memory leak in interrupted
if (bIE && bAsync)
window.detachEvent("onunload", fOnUnload);

View File

@@ -371,22 +371,6 @@
teardown();
}
function test_abort(t) {
t.plan(0);
var fail = false;
OpenLayers.Request.XMLHttpRequest.onsend = function(args) {
fail = true;
}
t.delay_call(0.5, function() {
if (fail === true) {
t.fail("Send should not be called because request is aborted");
}
OpenLayers.Request.XMLHttpRequest.onsend = null;
});
var protocol = new OpenLayers.Protocol.HTTP();
protocol.abort(protocol.read());
}
</script>
</head>
<body>