[Commits] r1369 - in core/trunk/geoext: lib/GeoExt/data tests/lib/GeoExt/data
commits at geoext.org
commits at geoext.org
Tue Sep 29 15:53:35 CEST 2009
Author: fredj
Date: 2009-09-29 15:53:35 +0200 (Tue, 29 Sep 2009)
New Revision: 1369
Modified:
core/trunk/geoext/lib/GeoExt/data/ProtocolProxy.js
core/trunk/geoext/tests/lib/GeoExt/data/ProtocolProxy.html
Log:
Call protocol.abort (defined in OpenLayers >= 2.8) r=elemoine (closes #149)
Modified: core/trunk/geoext/lib/GeoExt/data/ProtocolProxy.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/data/ProtocolProxy.js 2009-09-29 13:25:12 UTC (rev 1368)
+++ core/trunk/geoext/lib/GeoExt/data/ProtocolProxy.js 2009-09-29 13:53:35 UTC (rev 1369)
@@ -89,16 +89,9 @@
* Called to abort any ongoing request.
*/
abortRequest: function() {
- // FIXME really we should rely on the protocol itself to
- // cancel the request, the Protocol class in OpenLayers
- // 2.7 does not expose a cancel() method
if (this.response) {
- var response = this.response;
- if (response.priv &&
- typeof response.priv.abort == "function") {
- response.priv.abort();
- this.response = null;
- }
+ this.protocol.abort(this.response);
+ this.response = null;
}
},
Modified: core/trunk/geoext/tests/lib/GeoExt/data/ProtocolProxy.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/data/ProtocolProxy.html 2009-09-29 13:25:12 UTC (rev 1368)
+++ core/trunk/geoext/tests/lib/GeoExt/data/ProtocolProxy.html 2009-09-29 13:53:35 UTC (rev 1369)
@@ -7,7 +7,7 @@
<script type="text/javascript" src="../../../../../openlayers/lib/OpenLayers.js"></script>
<script type="text/javascript" src="../../../../lib/GeoExt.js"></script>
- <script type="text/javascript"><!--
+ <script type="text/javascript">
function test_constructor(t) {
t.plan(1);
// setup
@@ -20,6 +20,7 @@
t.ok(proxy.protocol == protocol,
"ctor sets protocol in protocol property");
}
+
function test_load(t) {
t.plan(8);
// setup
@@ -67,8 +68,30 @@
// 8 tests
proxy.load(params, reader, callback, scope, arg);
}
- --></script>
+
+ function test_abort(t) {
+ t.plan(1);
+ var protocol = new OpenLayers.Protocol({
+ read: function(o) {
+ return new OpenLayers.Protocol.Response();
+ },
+ abort: function(response) {
+ t.ok("protocol.abort called");
+ }
+ });
+ var proxy = new GeoExt.data.ProtocolProxy({
+ protocol: protocol
+ });
+
+ proxy.load(); // abort not called because proxy.response is null
+ proxy.load(); // abort called
+ proxy.abortPrevious = false;
+ proxy.load(); // abort not called because proxy.abortPrevious is false
+ }
+
+ </script>
+
<body>
<div id="map"></div>
</body>
More information about the Commits
mailing list