make Request rely on standard XMLHttpRequest interfaces, p=jorix, r=me (References #2913)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10966 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2010-12-15 07:52:00 +00:00
parent 8084f63cb0
commit 4c3d4c77c0
2 changed files with 16 additions and 1 deletions

View File

@@ -169,7 +169,7 @@ OpenLayers.Request = {
request.send(config.data); request.send(config.data);
} else { } else {
window.setTimeout(function(){ window.setTimeout(function(){
if (request._aborted !== true) { if (request.readyState !== 0) { // W3C: 0-UNSENT
request.send(config.data); request.send(config.data);
} }
}, 0); }, 0);

View File

@@ -409,6 +409,21 @@
}); });
} }
function test_abort2(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 req = OpenLayers.Request.GET();
req.abort();
}
</script> </script>
</head> </head>
<body> <body>