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
|
// send request (optionally with data) and return
|
||||||
request.send(config.data);
|
// 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;
|
return request;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
+24
-13
@@ -20,7 +20,7 @@
|
|||||||
function test_issue(t) {
|
function test_issue(t) {
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
t.plan(22);
|
t.plan(21);
|
||||||
var request, config;
|
var request, config;
|
||||||
var proto = OpenLayers.Request.XMLHttpRequest.prototype;
|
var proto = OpenLayers.Request.XMLHttpRequest.prototype;
|
||||||
var issue = OpenLayers.Function.bind(OpenLayers.Request.issue,
|
var issue = OpenLayers.Function.bind(OpenLayers.Request.issue,
|
||||||
@@ -126,18 +126,6 @@
|
|||||||
request = issue(config);
|
request = issue(config);
|
||||||
request.readyState = 4;
|
request.readyState = 4;
|
||||||
request.onreadystatechange();
|
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
|
// test that optional success callback is only called with 200s and
|
||||||
// failure is only called with non-200s
|
// failure is only called with non-200s
|
||||||
@@ -182,6 +170,29 @@
|
|||||||
teardown();
|
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) {
|
function test_GET(t) {
|
||||||
t.plan(1);
|
t.plan(1);
|
||||||
var _issue = OpenLayers.Request.issue;
|
var _issue = OpenLayers.Request.issue;
|
||||||
|
|||||||
Reference in New Issue
Block a user