do not send request if abort has been called, r=elemoine (closes #2065)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10341 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -168,7 +168,9 @@ OpenLayers.Request = {
|
|||||||
request.send(config.data);
|
request.send(config.data);
|
||||||
} else {
|
} else {
|
||||||
window.setTimeout(function(){
|
window.setTimeout(function(){
|
||||||
|
if (request._aborted !== true) {
|
||||||
request.send(config.data);
|
request.send(config.data);
|
||||||
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
return request;
|
return request;
|
||||||
|
|||||||
@@ -371,6 +371,22 @@
|
|||||||
teardown();
|
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>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
Reference in New Issue
Block a user