See #964 - not only should we cancel ajax requests when we destroy the tile, but also when we initiate a new response. which is to say that when we instruct the tile to run a new request, we can discard the old one(s). that is what this patch does (as well as cleaning up memory in the destroy). Note that I have added this.request.destroy(); call, but commented out. this is a nod to future development/improvement of the OpenLayers.Ajax.Base and OpenLayers.Ajax.Request class to give it its own destroy() method. Just for fun I'll go ahead and open a separate ticket for that: #1277. Thanks elemoine for the reviews and the good dialogue to finishing up this patch.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@5777 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -67,6 +67,8 @@ OpenLayers.Tile.WFS = OpenLayers.Class(OpenLayers.Tile, {
|
||||
this.url = null;
|
||||
if(this.request) {
|
||||
this.request.transport.abort();
|
||||
//this.request.destroy();
|
||||
this.request = null;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -108,6 +110,10 @@ OpenLayers.Tile.WFS = OpenLayers.Class(OpenLayers.Tile, {
|
||||
* failure - {function}
|
||||
*/
|
||||
loadFeaturesForRegion:function(success, failure) {
|
||||
if(this.request) {
|
||||
this.request.transport.abort();
|
||||
//this.request.destroy();
|
||||
}
|
||||
this.request = OpenLayers.loadURL(this.url, null, this, success);
|
||||
},
|
||||
|
||||
@@ -141,6 +147,10 @@ OpenLayers.Tile.WFS = OpenLayers.Class(OpenLayers.Tile, {
|
||||
if (this.events) {
|
||||
this.events.triggerEvent("loadend");
|
||||
}
|
||||
|
||||
//request produced with success, we can delete the request object.
|
||||
//this.request.destroy();
|
||||
this.request = null;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user