Ticket #964: wfsAbort.patch
| File wfsAbort.patch, 3.0 kB (added by tschaub, 1 year ago) |
|---|
-
tests/Tile/test_WFS.html
old new 42 42 } 43 43 44 44 function test_99_Tile_WFS_destroy(t) { 45 t.plan( 6);45 t.plan(8); 46 46 47 47 var layer = {}; // bogus layer 48 48 var position = new OpenLayers.Pixel(10,20); … … 56 56 }; 57 57 58 58 59 var _gAbort = false; 60 tile.request = { 61 transport: { 62 abort: function() { 63 _gAbort = true; 64 } 65 } 66 } 67 68 59 69 tile.destroy(); 60 70 61 71 t.ok(tile.layer == null, "tile.layer set to null"); 62 72 t.ok(tile.bounds == null, "tile.bounds set to null"); 63 73 t.ok(tile.size == null, "tile.size set to null"); 64 74 t.ok(tile.position == null, "tile.position set to null"); 75 t.ok(_gAbort, "request transport is aborted"); 65 76 66 77 t.ok(tile.events == null, "tile.events set to null"); 78 79 tile.requestSuccess({'requestText': '<xml><foo /></xml>'}); 80 t.ok(true, "Didn't fail after calling requestSuccess on destroyed tile."); 67 81 } 68 82 69 83 </script> -
lib/OpenLayers/Tile/WFS.js
old new 28 28 */ 29 29 url: null, 30 30 31 /** 32 * Property: request 33 * {OpenLayers.Ajax.Request} 34 */ 35 request: null, 36 31 37 /** TBD 3.0 - reorder the parameters to the init function to put URL 32 38 * as last, so we can continue to call tile.initialize() 33 39 * without changing the arguments. … … 57 63 this.destroyAllFeatures(); 58 64 this.features = null; 59 65 this.url = null; 66 if(this.request) { 67 this.request.transport.abort(); 68 } 60 69 }, 61 70 62 71 /** … … 97 106 * failure - {function} 98 107 */ 99 108 loadFeaturesForRegion:function(success, failure) { 100 OpenLayers.loadURL(this.url, null, this, success);109 this.request = OpenLayers.loadURL(this.url, null, this, success); 101 110 }, 102 111 103 112 /** -
lib/OpenLayers/Ajax.js
old new 64 64 : OpenLayers.nullHandler; 65 65 66 66 // from prototype.js 67 new OpenLayers.Ajax.Request(uri, 68 { method: 'get', 69 parameters: params, 70 onComplete: success, 71 onFailure: failure 72 } 73 ); 67 return new OpenLayers.Ajax.Request( 68 uri, 69 { 70 method: 'get', 71 parameters: params, 72 onComplete: success, 73 onFailure: failure 74 } 75 ); 74 76 }; 75 77 76 78 /**
