fixed a caching issue with asynchronous requests in IE. r=igrcic, tschaub (closes #1896)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@8816 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -150,7 +150,15 @@ 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(){
|
||||
request.send(config.data);
|
||||
}, 0);
|
||||
}
|
||||
return request;
|
||||
},
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
function test_issue(t) {
|
||||
setup();
|
||||
|
||||
t.plan(22);
|
||||
t.plan(21);
|
||||
var request, config;
|
||||
var proto = OpenLayers.Request.XMLHttpRequest.prototype;
|
||||
var issue = OpenLayers.Function.bind(OpenLayers.Request.issue,
|
||||
@@ -127,18 +127,6 @@
|
||||
request.readyState = 4;
|
||||
request.onreadystatechange();
|
||||
|
||||
// test that send is called with data - 1 test
|
||||
var _send = proto.send;
|
||||
config = {
|
||||
method: "PUT",
|
||||
data: "bling"
|
||||
};
|
||||
proto.send = function(data) {
|
||||
t.eq(data, config.data, "send called with correct data");
|
||||
}
|
||||
request = issue(config);
|
||||
proto.send = _send;
|
||||
|
||||
// test that optional success callback is only called with 200s and
|
||||
// failure is only called with non-200s
|
||||
var _send = proto.send;
|
||||
@@ -182,6 +170,29 @@
|
||||
teardown();
|
||||
}
|
||||
|
||||
function test_delayed_send(t) {
|
||||
t.plan(1);
|
||||
var proto = OpenLayers.Request.XMLHttpRequest.prototype;
|
||||
var _send = proto.send;
|
||||
|
||||
// test that send is called with data - 1 test
|
||||
var config = {
|
||||
method: "PUT",
|
||||
data: "bling"
|
||||
};
|
||||
var got = {};
|
||||
proto.send = function(data) {
|
||||
got.data = data;
|
||||
}
|
||||
OpenLayers.Request.issue(config);
|
||||
|
||||
t.delay_call(1, function() {
|
||||
t.eq(got.data, config.data, "proper data sent");
|
||||
proto.send = _send;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function test_GET(t) {
|
||||
t.plan(1);
|
||||
var _issue = OpenLayers.Request.issue;
|
||||
|
||||
Reference in New Issue
Block a user